!pm dkim reset; switch DKIM algo to RSA

This commit is contained in:
Aine
2022-09-08 09:31:09 +03:00
parent 31a1399736
commit a608fffea8
5 changed files with 16 additions and 10 deletions

View File

@@ -170,7 +170,7 @@ func (b *Bot) handleCommand(ctx context.Context, evt *event.Event, commandSlice
case commandSend:
b.runSend(ctx)
case commandDKIM:
b.runDKIM(ctx)
b.runDKIM(ctx, commandSlice)
case commandUsers:
b.runUsers(ctx, commandSlice)
case commandDelete:

View File

@@ -132,9 +132,14 @@ func (b *Bot) runUsers(ctx context.Context, commandSlice []string) {
b.SendNotice(ctx, evt.RoomID, "allowed users updated")
}
func (b *Bot) runDKIM(ctx context.Context) {
func (b *Bot) runDKIM(ctx context.Context, commandSlice []string) {
evt := eventFromContext(ctx)
cfg := b.getBotSettings()
if len(commandSlice) > 1 && commandSlice[1] == "reset" {
cfg.Set(botOptionDKIMPrivateKey, "")
cfg.Set(botOptionDKIMSignature, "")
}
signature := cfg.DKIMSignature()
if signature == "" {
var private string
@@ -157,6 +162,7 @@ func (b *Bot) runDKIM(ctx context.Context) {
"DKIM signature is: `%s`.\n"+
"You need to add it to your DNS records (if not already):\n"+
"Add new DNS record with type = `TXT`, key (subdomain/from): `postmoogle._domainkey` and value (to):\n ```\n%s\n```\n"+
"Without that record other email servers may reject your emails as spam, kupo.",
signature, signature))
"Without that record other email servers may reject your emails as spam, kupo.\n"+
"To reset the signature, send `%s dkim reset`",
signature, signature, b.prefix))
}