Generate auth token

Summary: Generate auth token on whenever we load the secure server config,  and add more logs.

Reviewed By: antonk52

Differential Revision: D49272857

fbshipit-source-id: 1e549a8bfd7926e9a44b9480432e92ee3c0162b2
This commit is contained in:
Lorenzo Blasa
2023-09-14 07:04:59 -07:00
committed by Facebook GitHub Bot
parent 1cf7160b2c
commit 8062e2c9e5
2 changed files with 17 additions and 15 deletions

View File

@@ -82,6 +82,7 @@ export const loadSecureServerConfig = async (): Promise<SecureServerConfig> => {
await ensureOpenSSLIsAvailable();
await certificateSetup();
await generateAuthToken();
const [key, cert, ca] = await Promise.all([
fs.readFile(serverKey),
@@ -171,6 +172,7 @@ const ensureServerCertExists = async (): Promise<void> => {
await checkCertIsValid(serverCert);
console.info('Checking certificate was issued by current CA');
await verifyServerCertWasIssuedByCA();
console.info('Current certificates are valid');
} catch (e) {
console.warn('Not all certificates are valid, generating new ones', e);
await generateServerCertificate();