--- /dev/null
+weechat
+screen
--- /dev/null
+[Unit]
+Description=Attempt encryption of old chat logs
+[Service]
+Type=oneshot
+User=plom
+ExecStart=/bin/sh -c '~/encrypter.sh'
--- /dev/null
+[Unit]
+Description=Attempt encryption of old chatlogs once every minute.
+
+[Timer]
+OnCalendar=*-*-* *:*:00
+
+[Install]
+WantedBy=timers.target
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+
+# Enforce ~/.weechatrc as sole persistent weechat config file.
+rm -rf ~/.weechat/
+WEECHATCONF=`tr '\n' ';' < ~/.weechatrc`
+weechat -r "$WEECHATCONF"
+rm -rf ~/.weechat/
--- /dev/null
+#!/bin/sh
+# Encrypt dated weechatlog files older than one day to GPG target defined in
+# ~/.encrypt_target
+set -e
+
+gpg_key=$(cat ~/.encrypt_target)
+cd ~/weechatlogs/irc/
+
+# 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.
+hostname_mod_epoch=$(stat -c%Y /etc/hostname)
+find . -regextype posix-egrep -regex '^.*/.*/.*\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.weechatlog$' -type f -mtime +1 -exec gpg --recipient "${gpg_key}" --trust-model always --faked-system-time="${hostname_mod_epoch}" --encrypt {} \; -exec rm {} \;
+
--- /dev/null
+/set logger.file.path ~/weechatlogs
+/set logger.file.flush_delay 0
+/set logger.mask.irc "irc/$server/$channel.%Y-%m-%d.weechatlog"
+/set weechat.bar.status.items "[time],[buffer_last_number],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+buffer_filter,[lag],[hotlist],completion,scroll,[otr]"
+/set weechat.color.chat_nick_colors "lightcyan"
+/server add freenode irc.freenode.net -nicks=plimlompom,plimlomp0m,pliml0mp0m -realname="foo bar" -autojoin=#plomlompomtest
+/connect freenode
# Get old mail data, shutdown old postfix server.
if [ "${old_server}" != "" ]; then
cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
- #chown plom:plom /home/plom/prepare_to_meet_server.sh
su -lc "./prepare_to_meet_server.sh ${old_server}" plom
read -p'Hit Enter when you are done.' ignore
rm /home/plom/prepare_to_meet_server.sh
su -lc "scp plom@${old_server}:.fetchmailrc ~" plom
su -lc "scp plom@${old_server}:.pingmailrc ~" plom
su -lc "ssh -t plom@${old_server} \"su -lc 'service postfix stop'\"" plom
+ su -lc "ssh plom@${old_server} \"su -lc 'systemctl disable fetchmail_old_account.timer'\"" plom
su -lc "ssh plom@${old_server} \"su -lc 'service fetchmail_old_account stop'\"" plom
#su -lc "ssh -t plom@${old_server} \"su -lc 'service fetchmail stop'\"" plom
cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
--- /dev/null
+#!/bin/sh
+set -e
+set -x
+
+if [ "$#" -lt 1 ]; then
+ echo "Need public key ID and optionally old server IP."
+ fi
+fi
+gpg_key="$1"
+old_server="$2"
+
+config_tree_prefix="${HOME}/config/buster"
+./install_for_target.sh play
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" play
+cp "${config_tree_prefix}/other_files/weechatrc" /home/plom/.weechatrc
+cp "${config_tree_prefix}/other_files/weechat-wrapper.sh" /home/plom/
+cp "${config_tree_prefix}/other_files/weechatlogs-encrypter.sh" /home/plom/
+chown plom:plom /home/plom/*weechat*
+echo "${gpg_key}" /home/plom/.encrypt_target
+chown plom:plom /home/plom/.encrypt_target
+
+# TODO refactor with setup_website.sh
+# Add encryption key.
+keyservers='sks-keyservers.net/ keys.gnupg.net'
+set +e
+while true; do
+ do_break=0
+ for keyserver in $(echo "${keyservers}"); do
+ su plom -c "gpg --no-tty --keyserver $keyserver --recv-key ${gpg_key}"
+ if [ $? -eq "0" ]; then
+ do_break=1
+ break
+ fi
+ echo "Attempt with keyserver ${keyserver} unsuccessful, trying other."
+ done
+ if [ "${do_break}" -eq "1" ]; then
+ break
+ fi
+done
+set -e
+
+if [ "${old_server}" != "" ]; then
+ cp "${config_tree_prefix}/setup_scripts/prepare_to_meet_server.sh" /home/plom/
+ su -lc "./prepare_to_meet_server.sh ${old_server}" plom
+ read -p'Hit Enter when you are done.' ignore
+ rm /home/plom/prepare_to_meet_server.sh
+ su -lc "scp plom@${old_server}:.weechatrc ~" plom
+ cp "${config_tree_prefix}/setup_scripts/mirror_dir.sh" /home/plom/
+ su -lc "./mirror_dir.sh ${old_server} /home/plom/weechatlogs" plom
+ rm /home/plom/mirror_dir.sh
+fi
+
+systemctl enable --now encrypt_chatlogs.timer