sendmail: add requiresValidCertificate
some apps really want a valid certificate to send mail and upstream authors won't add support to skip self-signed certs or skip host name check in cert. In our case, the issue is that we use 'mail' as the server name despite having valid certs. this flag will set the server name to the full mail server fqdn and also reconfigure the app as needed when the mail server name changes. we also set up the mail server name to resolve to internal IP because no mail port is exposed when we are not receiving emails!
This commit is contained in:
@@ -42,6 +42,7 @@ const apps = require('./apps.js'),
|
||||
debug = require('debug')('box:docker'),
|
||||
Docker = require('dockerode'),
|
||||
fs = require('fs'),
|
||||
mailServer = require('./mailserver.js'),
|
||||
os = require('os'),
|
||||
paths = require('./paths.js'),
|
||||
promiseRetry = require('./promise-retry.js'),
|
||||
@@ -413,7 +414,8 @@ async function createSubcontainer(app, name, cmd, options) {
|
||||
SecurityOpt: [ 'apparmor=docker-cloudron-app' ],
|
||||
CapAdd: [],
|
||||
CapDrop: [],
|
||||
Sysctls: {}
|
||||
Sysctls: {},
|
||||
ExtraHosts: []
|
||||
}
|
||||
};
|
||||
|
||||
@@ -428,7 +430,12 @@ async function createSubcontainer(app, name, cmd, options) {
|
||||
containerOptions.HostConfig.NetworkMode = 'cloudron'; // user defined bridge network
|
||||
|
||||
// Do not inject for AdGuard. It ends up resolving the dashboard domain as the docker bridge IP
|
||||
if (manifest.id !== 'com.adguard.home.cloudronapp') containerOptions.HostConfig.ExtraHosts = [ `${dashboardFqdn}:172.18.0.1` ];
|
||||
if (manifest.id !== 'com.adguard.home.cloudronapp') containerOptions.HostConfig.ExtraHosts.push(`${dashboardFqdn}:172.18.0.1`);
|
||||
|
||||
if (manifest.addons?.sendmail?.requiresValidCertificate) {
|
||||
const { fqdn:mailFqdn } = await mailServer.getLocation();
|
||||
containerOptions.HostConfig.ExtraHosts.push(`${mailFqdn}:${constants.MAIL_SERVICE_IPv4}`);
|
||||
}
|
||||
|
||||
containerOptions.NetworkingConfig = {
|
||||
EndpointsConfig: {
|
||||
|
||||
Reference in New Issue
Block a user