check A records
This commit is contained in:
parent
fd78e7b590
commit
e0926d1f92
12
cloudron.js
12
cloudron.js
@ -255,6 +255,18 @@ Cloudron.prototype.reboot = function () {
|
|||||||
this.waitForBox();
|
this.waitForBox();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Cloudron.prototype.checkA = function (callback) {
|
||||||
|
var that = this;
|
||||||
|
dns.resolve4(this._box.domain, function (error, records) {
|
||||||
|
if (error) return callback(error);
|
||||||
|
if (records.length !== 1) return callback(new Error('Got ' + JSON.stringify(records) + ' A records. Expecting 1 length array'));
|
||||||
|
|
||||||
|
if (records[0][0] !== that._box.ip) return callback(new Error('Bad A record. ' + records[0][0]));
|
||||||
|
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Cloudron.prototype.checkSPF = function (callback) {
|
Cloudron.prototype.checkSPF = function (callback) {
|
||||||
var that = this;
|
var that = this;
|
||||||
dns.resolveTxt(this._box.domain, function (error, records) {
|
dns.resolveTxt(this._box.domain, function (error, records) {
|
||||||
|
@ -62,6 +62,7 @@ describe('Appstore new user flow', function () {
|
|||||||
|
|
||||||
it('has setup DNS records correctly', function (done) {
|
it('has setup DNS records correctly', function (done) {
|
||||||
async.series([
|
async.series([
|
||||||
|
cloudron.checkA.bind(cloudron),
|
||||||
cloudron.checkSPF.bind(cloudron),
|
cloudron.checkSPF.bind(cloudron),
|
||||||
cloudron.checkDKIM.bind(cloudron),
|
cloudron.checkDKIM.bind(cloudron),
|
||||||
cloudron.checkDMARC.bind(cloudron)
|
cloudron.checkDMARC.bind(cloudron)
|
||||||
@ -106,6 +107,7 @@ describe('Appstore new user flow', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async.series([
|
async.series([
|
||||||
|
expectError(cloudron.checkA.bind(cloudron)),
|
||||||
expectError(cloudron.checkSPF.bind(cloudron)),
|
expectError(cloudron.checkSPF.bind(cloudron)),
|
||||||
expectError(cloudron.checkDKIM.bind(cloudron)),
|
expectError(cloudron.checkDKIM.bind(cloudron)),
|
||||||
expectError(cloudron.checkDMARC.bind(cloudron))
|
expectError(cloudron.checkDMARC.bind(cloudron))
|
||||||
|
Loading…
Reference in New Issue
Block a user