feat: 实现账号设备分组与命令日志

This commit is contained in:
Nixevol
2026-10-12 06:58:05 +08:00
parent ac68d4fe90
commit 775599174b
29 changed files with 3149 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
FROM git.asio.asia/nixevol/nixmsg:0.1.1 AS nixmsg
FROM alpine:3.21
COPY --from=nixmsg /nixmsg /usr/local/bin/nixmsg
COPY deploy/init-nixmsg.sh /init-nixmsg.sh
RUN chmod 755 /init-nixmsg.sh /usr/local/bin/nixmsg
ENTRYPOINT ["/init-nixmsg.sh"]
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu
mkdir -p /data
chown -R 65532:65532 /data
exec su-exec 65532:65532 /usr/local/bin/tapremly
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
set -eu
umask 077
mkdir -p /data /secrets
secret=/secrets/nixmsg-admin-password
if [ ! -s "$secret" ]; then
set +e
out=$(/usr/local/bin/nixmsg admin init 2>&1)
code=$?
set -e
if [ "$code" -ne 0 ]; then
printf '%s\n' "$out" >&2
if printf '%s\n' "$out" | grep -q "already initialized"; then
echo "nixmsg admin already initialized but the password file is missing" >&2
exit 1
fi
exit "$code"
fi
pw=$(printf '%s\n' "$out" | sed -n 's/^admin password: //p' | head -n 1)
if [ -z "$pw" ]; then
echo "admin init did not print a password" >&2
exit 1
fi
printf '%s' "$pw" > "$secret"
echo "nixmsg admin initialized"
else
echo "nixmsg admin password file present"
fi
chown -R 65532:65532 /data /secrets
chmod 700 /secrets
chmod 600 "$secret"
+9
View File
@@ -0,0 +1,9 @@
listen: ":7443"
admin_listen: ""
tls:
cert_file: ""
key_file: ""
allow_plaintext: false
data_dir: /data
log:
level: info