wiki/server/core/auth.js
/**
   * Generate New Authentication Public / Private Key Certificates
   */
Generate New Authentication Public / Private Key Certificates
Generate New Authentication Public / Private Key Certificates
async regenerateCertificates () {
    WIKI.logger.info('Regenerating certificates...')
    _.set(WIKI.config, 'sessionSecret', (await crypto.randomBytesAsync(32)).toString('hex'))
    const certs = crypto.generateKeyPairSync('rsa', {
      modulusLength: 2048,
      publicKeyEncoding: {
        type: 'pkcs1',
        format: 'pem'
      },
      privateKeyEncoding: {
        type: 'pkcs1',
        format: 'pem',
        cipher: 'aes-256-cbc',
        passphrase: WIKI.config.sessionSecret
      }
    })
    _.set(WIKI.config, 'certs', {
      jwk: pem2jwk(certs.publicKey),
      public: certs.publicKey,
      private: certs.privateKey
    })
    await WIKI.configSvc.saveToDb([
      'certs',
      'sessionSecret'
    ])
    await WIKI.auth.activateStrategies()
    WIKI.events.outbound.emit('reloadAuthStrategies')
    WIKI.logger.info('Regenerated certificates: [ COMPLETED ]')
  }
async regenerateCertificates ( ) { WIKI . logger . info ( 'Regenerating certificates...' ) _ . set ( WIKI . config , 'sessionSecret' , ( await crypto . randomBytesAsync ( 32 ) ) . toString ( 'hex' ) ) const certs = crypto . generateKeyPairSync ( 'rsa' , { modulusLength : 2048 , publicKeyEncoding : { type : 'pkcs1' , format : 'pem' } , privateKeyEncoding : { type : 'pkcs1' , format : 'pem' , cipher : 'aes-256-cbc' , passphrase : WIKI . config . sessionSecret } } ) _ . set ( WIKI . config , 'certs' , { jwk : pem2jwk ( certs . publicKey ) , public : certs . publicKey , private : certs . privateKey } ) await WIKI . configSvc . saveToDb ( [ 'certs' , 'sessionSecret' ] ) await WIKI . auth . activateStrategies ( ) WIKI . events . outbound . emit ( 'reloadAuthStrategies' ) WIKI . logger . info ( 'Regenerated certificates: [ COMPLETED ]' ) }
Generate New Authentication Public / Private Key Certificates
Generate New Authentication Public / Private Key Certificates