dns: fqdn only needs domain string

This is from the caas days, when we had hyphenated subdomains flag
This commit is contained in:
Girish Ramakrishnan
2022-11-28 21:23:06 +01:00
parent cab7409d85
commit b70572a6e9
23 changed files with 75 additions and 87 deletions

View File

@@ -13,22 +13,15 @@ const common = require('./common.js'),
reverseProxy = require('../reverseproxy.js');
describe('Reverse Proxy', function () {
const { setup, cleanup, domain, auditSource, app, admin } = common;
const { setup, cleanup, domain, auditSource, app } = common;
const domainCopy = Object.assign({}, domain);
before(setup);
after(cleanup);
describe('validateCertificate', function () {
let foobarDomain = {
domain: 'foobar.com',
config: {}
};
let amazingDomain = {
domain: 'amazing.com',
config: {}
};
let foobarDomain = 'foobar.com';
let amazingDomain = 'amazing.com';
/*
Generate these with:
openssl genrsa -out server.key 512
@@ -82,7 +75,7 @@ describe('Reverse Proxy', function () {
});
it('does not allow cert without matching domain', function () {
expect(reverseProxy.validateCertificate('', { domain: 'cloudron.io' }, { cert: validCert0, key: validKey0 })).to.be.an(Error);
expect(reverseProxy.validateCertificate('', 'cloudron.io', { cert: validCert0, key: validKey0 })).to.be.an(Error);
expect(reverseProxy.validateCertificate('cloudron.io', foobarDomain, { cert: validCert0, key: validKey0 })).to.be.an(Error);
});
@@ -122,20 +115,17 @@ describe('Reverse Proxy', function () {
});
describe('generateFallbackCertificate', function () {
let domainObject = {
domain: 'cool.com',
config: {}
};
const domain = 'cool.com';
let result;
it('can generate fallback certs', async function () {
result = await reverseProxy.generateFallbackCertificate(domainObject.domain);
result = await reverseProxy.generateFallbackCertificate(domain);
expect(result).to.be.ok();
});
it('can validate the certs', function () {
expect(reverseProxy.validateCertificate('foo', domainObject, result)).to.be(null);
expect(reverseProxy.validateCertificate('', domainObject, result)).to.be(null);
expect(reverseProxy.validateCertificate('foo', domain, result)).to.be(null);
expect(reverseProxy.validateCertificate('', domain, result)).to.be(null);
});
});