aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar steering72532026-04-28 23:28:25 +0000
committerGravatar steering72532026-04-28 23:28:25 +0000
commit38fca7692e900589338eade8b5667a483575f5af (patch)
treef5b1e3e8eb4e9fa98e21f10fa0e54776c191e01e
parentupdate cronjob installation (diff)
add logging
-rwxr-xr-xauthorized_keys.sh2
-rwxr-xr-xinstall.sh4
-rwxr-xr-xlog_autopeer_shell.sh3
-rw-r--r--sshd_config2
4 files changed, 10 insertions, 1 deletions
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/privkey >/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