For OpenVPN server users, how do you delete logs? 04-24-2018, 08:51 AM
#1
Hello,
how do you connect your open vpn server anonymously to manage it and how do you delete its logs so no one who got access to the server files be able to fiscover IP from which you connected the server?
So far this is what i am using:
cd /var/log;rm -rf audit;rm -f messages- cron- maillog- secure- ~/.viminfo /var/log/http/log;>/var/log/messages;>/var/log/maillog;>/var/log/cron;>/var/log/secure;history -c;echo >~/.bash_history;echo >/var/log/wtmp; echo > /var/log/btmp;>/var/log/lastlog;>/var/log/syslog;>/var/log/lynis.log;>/var/log/fail2ban.log;>~/.bash_history;history -c;find /var/log -size 0 -delete
It can be run as a cronjob (crontab -e) by prefixing it by "* * * * * " to run it every minute.
Disable OpenVPN server logging (if/after have openvpn server installed):
sed -i '/openvpn-status.log/d' /etc/openvpn/server.conf;sed -i '/verb /d' /etc/openvpn/server.conf;echo -e "log /dev/null\nstatus /dev/null\nverb 0" >> /etc/openvpn/server.conf;service openvpn restart || systemctl restart openvpn@server
How You would improve my commands or what is your way to delete logs on Linux server?
how do you connect your open vpn server anonymously to manage it and how do you delete its logs so no one who got access to the server files be able to fiscover IP from which you connected the server?
So far this is what i am using:
cd /var/log;rm -rf audit;rm -f messages- cron- maillog- secure- ~/.viminfo /var/log/http/log;>/var/log/messages;>/var/log/maillog;>/var/log/cron;>/var/log/secure;history -c;echo >~/.bash_history;echo >/var/log/wtmp; echo > /var/log/btmp;>/var/log/lastlog;>/var/log/syslog;>/var/log/lynis.log;>/var/log/fail2ban.log;>~/.bash_history;history -c;find /var/log -size 0 -delete
It can be run as a cronjob (crontab -e) by prefixing it by "* * * * * " to run it every minute.
Disable OpenVPN server logging (if/after have openvpn server installed):
sed -i '/openvpn-status.log/d' /etc/openvpn/server.conf;sed -i '/verb /d' /etc/openvpn/server.conf;echo -e "log /dev/null\nstatus /dev/null\nverb 0" >> /etc/openvpn/server.conf;service openvpn restart || systemctl restart openvpn@server
How You would improve my commands or what is your way to delete logs on Linux server?
(This post was last modified: 04-24-2018, 08:52 AM by wdc.)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)