shell: make require take a tag

This commit is contained in:
Girish Ramakrishnan
2024-10-14 19:10:31 +02:00
parent 02823c4158
commit a9e1d7641d
27 changed files with 162 additions and 156 deletions

View File

@@ -44,7 +44,7 @@ const assert = require('assert'),
safe = require('safetydance'),
services = require('./services.js'),
settings = require('./settings.js'),
shell = require('./shell.js'),
shell = require('./shell.js')('mailserver'),
tasks = require('./tasks.js'),
users = require('./users.js');
@@ -53,8 +53,8 @@ async function generateDkimKey() {
const privateKeyFilePath = path.join(os.tmpdir(), `dkim-${crypto.randomBytes(4).readUInt32LE(0)}.private`);
// https://www.unlocktheinbox.com/dkim-key-length-statistics/ and https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-authentication-dkim-easy.html for key size
await shell.exec('generateDkimKey', `openssl genrsa -out ${privateKeyFilePath} 1024`, {});
await shell.exec('generateDkimKey', `openssl rsa -in ${privateKeyFilePath} -out ${publicKeyFilePath} -pubout -outform PEM`, {});
await shell.exec(`openssl genrsa -out ${privateKeyFilePath} 1024`, {});
await shell.exec(`openssl rsa -in ${privateKeyFilePath} -out ${publicKeyFilePath} -pubout -outform PEM`, {});
const publicKey = safe.fs.readFileSync(publicKeyFilePath, 'utf8');
if (!publicKey) throw new BoxError(BoxError.FS_ERROR, safe.error.message);
@@ -194,7 +194,7 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
${readOnly} -v /run -v /tmp ${image} ${cmd}`;
debug('configureMail: starting mail container');
await shell.exec('configureMail', runCmd, { shell: '/bin/bash' });
await shell.exec(runCmd, { shell: '/bin/bash' });
}
async function restart() {