Server-Config UI (aktiv/passiv) und Port-Forwarding Tipps in README

- FTP-Tab: Server Configuration mit Active/Passive Radio-Buttons
- Passive Mode: Port-Range konfigurierbar (Default 30000-31000)
- Apply-Button startet Pure-FTPd automatisch neu
- Helper-Script: serverconfig show/active/passive Kommandos
- sudoers: systemctl restart, tee und rm für Pure-FTPd Config
- README: Port-Forwarding Anleitung für Windows (netsh) und Linux (socat/iptables)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 19:39:24 +02:00
parent 32d95bb334
commit 2c2c5c7821
6 changed files with 383 additions and 7 deletions
+55 -7
View File
@@ -92,6 +92,10 @@ ${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/mount --bind *
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/mount -o remount?ro?bind *
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/umount ${REAL_FTP_ROOT}/*
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/pure-pw *
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/tee /etc/pure-ftpd/conf/*
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/rm -f /etc/pure-ftpd/conf/PassivePortRange
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/sed -i *pureftpd.passwd*
${REAL_USER} ALL=(root) NOPASSWD: /usr/bin/systemctl restart pure-ftpd
EOF
sudo chmod 440 /etc/sudoers.d/dolphin-ftp-share
@@ -225,15 +229,56 @@ cmd_passwd() {
rebuild_db
}
cmd_serverconfig() {
local action="$1"
case "$action" in
show)
# Output current mode and ports
if [ -f /etc/pure-ftpd/conf/PassivePortRange ]; then
local range
range=$(cat /etc/pure-ftpd/conf/PassivePortRange)
echo "mode=passive"
echo "passive_start=${range%% *}"
echo "passive_end=${range##* }"
else
echo "mode=active"
fi
;;
active)
# Remove passive port range → only active mode
sudo rm -f /etc/pure-ftpd/conf/PassivePortRange
sudo systemctl restart pure-ftpd
echo "Server set to active mode"
;;
passive)
local start_port="$2"
local end_port="$3"
if [ -z "$start_port" ] || [ -z "$end_port" ]; then
echo "Error: start and end port required" >&2
exit 1
fi
echo "${start_port} ${end_port}" | sudo tee /etc/pure-ftpd/conf/PassivePortRange >/dev/null
sudo systemctl restart pure-ftpd
echo "Server set to passive mode (ports ${start_port}-${end_port})"
;;
*)
echo "Usage: dolphin-ftp-share serverconfig {show|active|passive <start> <end>}" >&2
exit 1
;;
esac
}
case "${1:-}" in
setup) cmd_setup ;;
info) cmd_info ;;
add) cmd_add "$2" "$3" "${4:-}" ;;
delete) cmd_delete "$2" ;;
userexists) cmd_userexists "$2" ;;
passwd) cmd_passwd "$2" "$3" ;;
setup) cmd_setup ;;
info) cmd_info ;;
add) cmd_add "$2" "$3" "${4:-}" ;;
delete) cmd_delete "$2" ;;
userexists) cmd_userexists "$2" ;;
passwd) cmd_passwd "$2" "$3" ;;
serverconfig) cmd_serverconfig "$2" "$3" "$4" ;;
*)
echo "Usage: dolphin-ftp-share {setup|info|add|delete|userexists|passwd}" >&2
echo "Usage: dolphin-ftp-share {setup|info|add|delete|userexists|passwd|serverconfig}" >&2
echo "" >&2
echo "Commands:" >&2
echo " setup Initial Pure-FTPd setup" >&2
@@ -242,6 +287,9 @@ case "${1:-}" in
echo " delete <name> Remove a share" >&2
echo " userexists <username> Check if FTP user exists" >&2
echo " passwd <username> <password> Set/create FTP password" >&2
echo " serverconfig show Show current server config" >&2
echo " serverconfig active Set active mode" >&2
echo " serverconfig passive <start> <end> Set passive mode with port range" >&2
exit 1
;;
esac