X-Git-Url: https://plomlompom.com/repos/test.html?a=blobdiff_plain;f=buster%2Fother_files%2Fplomlombot_daemon.sh;h=7847d25ce3e3af59f04da98572fc483b76b53346;hb=5f5aad4d7e9f84bed45b8fcf9f9c7d7223d09dcb;hp=8cf58a10d38b2734fe731d5a5c155f48dfbbc3dc;hpb=b631588a45593882e718395ba87701d07de64249;p=config
diff --git a/buster/other_files/plomlombot_daemon.sh b/buster/other_files/plomlombot_daemon.sh
index 8cf58a1..7847d25 100755
--- a/buster/other_files/plomlombot_daemon.sh
+++ b/buster/other_files/plomlombot_daemon.sh
@@ -6,6 +6,7 @@ path=~/.plomlombot
db_dir="${HOME}/plomlombot_db"
irclogs_dir=/var/www/html/irclogs
irclogs_pw_dir=/var/www/irclogs_pw
+hostname_mod_epoch=$(stat -c%Y /etc/hostname)
while true; do
if [ -f "${path}" ]; then
cat "${path}" | while read line; do
@@ -41,12 +42,17 @@ while true; do
ln -sfn "${logs_dir}" "${irclogs_dir}/${shortened_channel_name}"
echo "${login_user}":'{PLAIN}'"${login_pw}" > "${irclogs_pw_dir}/${shortened_channel_name}"
- # If "gpg" line, encrypt old raw logs to that GPG key.
+ # If "gpg_key" line, encrypt old raw logs to that GPG key.
elif [ "${first_word}" = "gpg_key" ]; then
key=$(echo -n "${line}" | cut -d' ' -f2)
mkdir -p ~/plomlombot_db
cd ~/plomlombot_db
- find . -path '*/*/raw_logs/*.txt' -mtime +1 -type f -exec gpg --recipient "${key}" --trust-model always --encrypt {} \; -exec rm {} \;
+ # Dirty hack: To avoid trouble with GPG key expiration, fake
+ # system to something reasonbly old (younger than key creation,
+ # older than expiration) by taking the mod datetime of
+ # /etc/hostname, which should have last be changed when the
+ # system was set up.
+ find . -path '*/*/raw_logs/*.txt' -mtime +1 -type f -exec gpg --recipient "${key}" --trust-model always --faked-system-time="${hostname_mod_epoch}" --encrypt {} \; -exec rm {} \;
fi
done