SPKIFP support
parent
dc858917a7
commit
966bdd2af1
9
index.js
9
index.js
|
@ -1,3 +1,4 @@
|
||||||
|
const crypto = require("crypto")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const tls = require("tls")
|
const tls = require("tls")
|
||||||
const IRC = require("irc-framework")
|
const IRC = require("irc-framework")
|
||||||
|
@ -125,7 +126,7 @@ bot.on("privmsg", msg => {
|
||||||
msg.reply(" help: Get this message")
|
msg.reply(" help: Get this message")
|
||||||
msg.reply(" refreshnet: Refresh network state")
|
msg.reply(" refreshnet: Refresh network state")
|
||||||
msg.reply(" refresh <server>: Refresh a server")
|
msg.reply(" refresh <server>: Refresh a server")
|
||||||
msg.reply(" check <server>: Check a server")
|
msg.reply(" check <server> [--spkifp]: Check a server")
|
||||||
msg.reply(" refreshall: Refresh all servers")
|
msg.reply(" refreshall: Refresh all servers")
|
||||||
msg.reply(" info: Show information about the bot, and statistics")
|
msg.reply(" info: Show information about the bot, and statistics")
|
||||||
msg.reply(" expired: Show expired certificates")
|
msg.reply(" expired: Show expired certificates")
|
||||||
|
@ -235,6 +236,9 @@ bot.on("privmsg", msg => {
|
||||||
} else {
|
} else {
|
||||||
msg.reply(` ${addr}: Expired ${((Date.now() - check.expiryTS) / 86400000).toFixed(2)}d ago (${check.expiry})`)
|
msg.reply(` ${addr}: Expired ${((Date.now() - check.expiryTS) / 86400000).toFixed(2)}d ago (${check.expiry})`)
|
||||||
}
|
}
|
||||||
|
if (args[1] === "--spkifp" && check.type === "s2s") {
|
||||||
|
msg.reply(` ${Array(addr.length + 1).fill(" ").join("")} ${check.spkifp}`)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case "timeout": {
|
case "timeout": {
|
||||||
|
@ -360,10 +364,11 @@ setInterval(() => {
|
||||||
res.expiry = cert.validTo
|
res.expiry = cert.validTo
|
||||||
res.expiryTS = +new Date(cert.validTo)
|
res.expiryTS = +new Date(cert.validTo)
|
||||||
res.valid = conn.authorized
|
res.valid = conn.authorized
|
||||||
|
res.spkifp = crypto.createHash("sha256").update(cert.publicKey.export({type: "spki", format: "der"})).digest("base64")
|
||||||
jobEnded()
|
jobEnded()
|
||||||
conn.end()
|
conn.end()
|
||||||
})
|
})
|
||||||
conn.on("error", () => {
|
conn.on("error", (e) => {
|
||||||
if (hasFinished) return
|
if (hasFinished) return
|
||||||
res.status = "error"
|
res.status = "error"
|
||||||
jobEnded()
|
jobEnded()
|
||||||
|
|
Loading…
Reference in New Issue