Skip to content

Commit

Permalink
Report new certificate fingerprint
Browse files Browse the repository at this point in the history
  • Loading branch information
3nprob authored and 3nprob committed May 5, 2022
1 parent f812f95 commit 3524aae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bridge/AdminRoomHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,9 @@ export class AdminRoomHandler {
new MatrixUser(userId), server.domain
);
}
let c: crypto.X509Certificate;
try {
const c = new crypto.X509Certificate(cert);
c = new crypto.X509Certificate(cert);
const pk = config.getSASLKey();
if (pk) {
if (!c.checkPrivateKey(crypto.createPrivateKey(pk))) {
Expand All @@ -689,10 +690,13 @@ export class AdminRoomHandler {
catch (err) {
throw new Error(`Invalid certificate: ${err.message})`);
}
const fingerprint512 = crypto.createHash('sha512').update(c.raw).digest('hex')
.replace(/:/g, '').toLowerCase();
config.setSASLCert(cert);
await this.ircBridge.getStore().storeIrcClientConfig(config);
notice = new MatrixAction(
"notice", `Successfully stored SASL cert for ${domain}. Use !reconnect to reauthenticate.`
"notice", `Successfully stored SASL cert for ${domain} with fingerprint ${fingerprint512}.\n' +
'Use !reconnect to reauthenticate.`
);
}
}
Expand Down

0 comments on commit 3524aae

Please sign in to comment.