aboutsummaryrefslogtreecommitdiff
path: root/pw-update-fingerprint
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-03 20:12:49 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-03 20:12:49 +0200
commit5b9ff2c334a3a85c25b11bc17009f211eec51575 (patch)
treeff8d82f8a952e6f3006aec99a758f10a5592e74a /pw-update-fingerprint
parentf0b527f61e251a879a179ff4fef16baaa486c047 (diff)
downloadscripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.tar.gz
scripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.tar.bz2
scripts-5b9ff2c334a3a85c25b11bc17009f211eec51575.zip
update
Diffstat (limited to 'pw-update-fingerprint')
-rwxr-xr-xpw-update-fingerprint16
1 files changed, 16 insertions, 0 deletions
diff --git a/pw-update-fingerprint b/pw-update-fingerprint
new file mode 100755
index 0000000..e25a0b4
--- /dev/null
+++ b/pw-update-fingerprint
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# update tls_fingerprint entry in ~/.msmtprc
+
+MAILSERVER="mail.server.com"
+PORT="587"
+
+cd $HOME
+
+# get the server fingerprint
+KEY=$(msmtp --serverinfo --tls --tls-certcheck=off --host="$MAILSERVER" --port="$PORT" | grep -E -o "([0-9A-Za-z]{2}:){31}[0-9A-Za-z]{2}")
+
+# replace tls_fingerprint line in .msmtprc
+sed -i "s/^tls_fingerprint.*/tls_fingerprint $KEY/g" .msmtprc
+
+echo ".msmtprc has been updated with the latest $MAILSERVER fingerprint."