Commit c476d907 authored by nextime's avatar nextime

Add proper log rotation support to Debian packages

- Created logrotate configuration files for both wssshd and wssshc
- wssshd.logrotate: Rotates /var/log/wssshd/watchdog.log weekly
- wssshc.logrotate: Rotates /var/log/wssshc/watchdog.log weekly
- Both configs include postrotate scripts to HUP watchdog processes
- Install logrotate configs to /etc/logrotate.d/ in both packages
- Added /etc/logrotate.d directory creation to debian/rules
- Log rotation settings: weekly, 52 rotations, compress, proper permissions
- Ensures logs don't grow indefinitely and consume disk space
- Follows Debian packaging standards for log management
- Automatic log rotation prevents production system issues
parent 19a0ac29
...@@ -112,6 +112,7 @@ override_dh_auto_install: ...@@ -112,6 +112,7 @@ override_dh_auto_install:
mkdir -p debian/wsssh-server/var/log/wssshd mkdir -p debian/wsssh-server/var/log/wssshd
mkdir -p debian/wsssh-server/etc/wssshd mkdir -p debian/wsssh-server/etc/wssshd
mkdir -p debian/wsssh-server/usr/sbin mkdir -p debian/wsssh-server/usr/sbin
mkdir -p debian/wsssh-server/etc/logrotate.d
# Install PyInstaller binary # Install PyInstaller binary
install -m 755 dist/wssshd debian/wsssh-server/usr/bin/ install -m 755 dist/wssshd debian/wsssh-server/usr/bin/
...@@ -129,6 +130,9 @@ override_dh_auto_install: ...@@ -129,6 +130,9 @@ override_dh_auto_install:
# Install man page # Install man page
install -m 644 debian/wssshd.1 debian/wsssh-server/usr/share/man/man1/ install -m 644 debian/wssshd.1 debian/wsssh-server/usr/share/man/man1/
# Install logrotate configuration
install -m 644 debian/wssshd.logrotate debian/wsssh-server/etc/logrotate.d/wssshd
# Install web templates and static files # Install web templates and static files
cp -r ../templates/* debian/wsssh-server/usr/share/wsssh/templates/ cp -r ../templates/* debian/wsssh-server/usr/share/wsssh/templates/
cp -r ../logos/* debian/wsssh-server/usr/share/wsssh/logos/ cp -r ../logos/* debian/wsssh-server/usr/share/wsssh/logos/
......
/var/log/wssshd/watchdog.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 644 wssshd wssshd
postrotate
if [ -f /var/run/wssshd-watchdog.pid ]; then
kill -HUP $(cat /var/run/wssshd-watchdog.pid) 2>/dev/null || true
fi
endscript
}
\ No newline at end of file
...@@ -32,6 +32,7 @@ override_dh_auto_install: ...@@ -32,6 +32,7 @@ override_dh_auto_install:
mkdir -p debian/wsssh-tools/etc/default mkdir -p debian/wsssh-tools/etc/default
mkdir -p debian/wsssh-tools/usr/bin mkdir -p debian/wsssh-tools/usr/bin
mkdir -p debian/wsssh-tools/usr/sbin mkdir -p debian/wsssh-tools/usr/sbin
mkdir -p debian/wsssh-tools/etc/logrotate.d
# Install wssshc init script # Install wssshc init script
install -m 755 ../wssshc.init debian/wsssh-tools/etc/init.d/wssshc install -m 755 ../wssshc.init debian/wsssh-tools/etc/init.d/wssshc
...@@ -43,6 +44,9 @@ override_dh_auto_install: ...@@ -43,6 +44,9 @@ override_dh_auto_install:
install -m 644 ../wssshc.conf.example debian/wsssh-tools/usr/share/wsssh/ install -m 644 ../wssshc.conf.example debian/wsssh-tools/usr/share/wsssh/
install -m 644 debian/wssshc.default debian/wsssh-tools/etc/default/wssshc install -m 644 debian/wssshc.default debian/wsssh-tools/etc/default/wssshc
# Install logrotate configuration
install -m 644 debian/wssshc.logrotate debian/wsssh-tools/etc/logrotate.d/wssshc
# Install Python scripts # Install Python scripts
install -m 755 ../wssshc.py debian/wsssh-tools/usr/bin/ install -m 755 ../wssshc.py debian/wsssh-tools/usr/bin/
install -m 755 ../wssshd.py debian/wsssh-tools/usr/bin/ install -m 755 ../wssshd.py debian/wsssh-tools/usr/bin/
......
/var/log/wssshc/watchdog.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 644 wssshc wssshc
postrotate
if [ -f /var/run/wssshc-watchdog.pid ]; then
kill -HUP $(cat /var/run/wssshc-watchdog.pid) 2>/dev/null || true
fi
endscript
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment