From 38fca7692e900589338eade8b5667a483575f5af Mon Sep 17 00:00:00 2001 From: steering7253 Date: Tue, 28 Apr 2026 23:28:25 +0000 Subject: add logging --- authorized_keys.sh | 2 ++ install.sh | 4 ++++ log_autopeer_shell.sh | 3 +++ sshd_config | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 log_autopeer_shell.sh diff --git a/authorized_keys.sh b/authorized_keys.sh index d16588f..b8a016c 100755 --- a/authorized_keys.sh +++ b/authorized_keys.sh @@ -19,6 +19,8 @@ if [ "$1" = "new" ]; then echo "[autopeer $(hostname)] New user being created: $user from $key $connection" | socat stdio "$NOTIFY_TO" /usr/sbin/adduser --disabled-password --quiet --comment "created at $(date +%s) by $key ${connection//:/_}" --ingroup autopeer "$user" /usr/sbin/adduser "$user" bird + ( umask 0077; touch "/var/log/autopeer/$user".{tim,io}; ) + chown "$user" "/var/log/autopeer/$user".{tim,io} fi fi else # not new user diff --git a/install.sh b/install.sh index bd0ea5a..5836d31 100755 --- a/install.sh +++ b/install.sh @@ -27,3 +27,7 @@ umask 0022 wg pubkey /etc/wireguard/pubkey chmod 711 /etc/wireguard + +mkdir /var/log/autopeer +chmod 1770 /var/log/autopeer +chown root:autopeer /var/log/autopeer diff --git a/log_autopeer_shell.sh b/log_autopeer_shell.sh new file mode 100755 index 0000000..29253c9 --- /dev/null +++ b/log_autopeer_shell.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +SHELL=/opt/autopeer/autopeer_shell.py script -q -a --log-timing "/var/log/autopeer/$USER.tim" --log-io "/var/log/autopeer/$USER.io" diff --git a/sshd_config b/sshd_config index 3b5e925..1afda01 100644 --- a/sshd_config +++ b/sshd_config @@ -22,4 +22,4 @@ Match group autopeer PermitOpen none PermitTunnel no PermitUserRC no - ForceCommand /opt/autopeer/autopeer_shell.py + ForceCommand /opt/autopeer/log_autopeer_shell.sh -- cgit v1.3.1-10-gc9f91