shell: no need to promise scoping
This commit is contained in:
@@ -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.promises.exec('generateDkimKey', `openssl genrsa -out ${privateKeyFilePath} 1024`, {});
|
||||
await shell.promises.exec('generateDkimKey', `openssl rsa -in ${privateKeyFilePath} -out ${publicKeyFilePath} -pubout -outform PEM`, {});
|
||||
await shell.exec('generateDkimKey', `openssl genrsa -out ${privateKeyFilePath} 1024`, {});
|
||||
await shell.exec('generateDkimKey', `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);
|
||||
@@ -153,7 +153,7 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
|
||||
const mailCertFilePath = `${paths.MAIL_CONFIG_DIR}/tls_cert.pem`;
|
||||
const mailKeyFilePath = `${paths.MAIL_CONFIG_DIR}/tls_key.pem`;
|
||||
|
||||
const [copyError] = await safe(shell.promises.exec('configureMail', `cp ${paths.DHPARAMS_FILE} ${dhparamsFilePath}`, {}));
|
||||
const [copyError] = await safe(shell.exec('configureMail', `cp ${paths.DHPARAMS_FILE} ${dhparamsFilePath}`, {}));
|
||||
if (copyError) throw new BoxError(BoxError.FS_ERROR, `Could not copy dhparams: ${copyError.message}`);
|
||||
if (!safe.fs.writeFileSync(mailCertFilePath, certificate.cert)) throw new BoxError(BoxError.FS_ERROR, `Could not create cert file: ${safe.error.message}`);
|
||||
if (!safe.fs.writeFileSync(mailKeyFilePath, certificate.key)) throw new BoxError(BoxError.FS_ERROR, `Could not create key file: ${safe.error.message}`);
|
||||
@@ -161,8 +161,8 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
|
||||
// if the 'yellowtent' user of OS and the 'cloudron' user of mail container don't match, the keys become inaccessible by mail code
|
||||
if (!safe.fs.chmodSync(mailKeyFilePath, 0o644)) throw new BoxError(BoxError.FS_ERROR, `Could not chmod key file: ${safe.error.message}`);
|
||||
|
||||
await safe(shell.promises.exec('stopMail', 'docker stop mail', {})); // ignore error
|
||||
await safe(shell.promises.exec('removeMail', 'docker rm -f mail', {})); // ignore error
|
||||
await safe(shell.exec('stopMail', 'docker stop mail', {})); // ignore error
|
||||
await safe(shell.exec('removeMail', 'docker rm -f mail', {})); // ignore error
|
||||
|
||||
const allowInbound = await createMailConfig(mailFqdn);
|
||||
|
||||
@@ -191,7 +191,7 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
|
||||
--label isCloudronManaged=true \
|
||||
${readOnly} -v /run -v /tmp ${image} ${cmd}`;
|
||||
|
||||
await shell.promises.exec('startMail', runCmd, {});
|
||||
await shell.exec('startMail', runCmd, {});
|
||||
}
|
||||
|
||||
async function restart() {
|
||||
|
||||
Reference in New Issue
Block a user