added iptables logging guide
This commit is contained in:
32
admin/iptables_logging
Normal file
32
admin/iptables_logging
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#log all dropped packages to separate file
|
||||||
|
|
||||||
|
#backup
|
||||||
|
sudo iptables-save > backup.save
|
||||||
|
|
||||||
|
#safety flush cronjob every xx:45h
|
||||||
|
sudo crontab -e
|
||||||
|
45 * * * * /sbin/iptables -F
|
||||||
|
|
||||||
|
#begin
|
||||||
|
sudo iptables -N DROP_AND_LOG
|
||||||
|
sudo iptables -A DROP_AND_LOG -m limit --limit 1/min -j LOG --log-prefix "[IPTABLES-DROP]: "
|
||||||
|
sudo iptables -A DROP_AND_LOG -j DROP
|
||||||
|
|
||||||
|
#if old rules exist, save now upated rules
|
||||||
|
sudo iptables-save > modded.save
|
||||||
|
|
||||||
|
#replace DROP with DROP_AND_LOG chain
|
||||||
|
sed -e 's:-j DROP:-j DROP_AND_LOG:g' modded.save > replaced.save
|
||||||
|
|
||||||
|
#fix last "-j DROP" to original...
|
||||||
|
vim replaced.save
|
||||||
|
|
||||||
|
#create custom syslog output log
|
||||||
|
vim /etc/rsyslog.d/custom_iptables.conf
|
||||||
|
> :msg,contains,"IPTABLES-DROP" /var/log/iptables.log
|
||||||
|
|
||||||
|
#flush iptables and restore our modded rules
|
||||||
|
sudo iptables -F
|
||||||
|
sudo iptables-restore < replaced.save
|
||||||
|
|
||||||
|
#see the magic happen... (and dont forget to remove cronjob...)
|
||||||
5
packages.sh
Normal file
5
packages.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Baseline Packages i need (Debian specific...)
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
1
shell/.config/fish/config.fish
Normal file
1
shell/.config/fish/config.fish
Normal file
@ -0,0 +1 @@
|
|||||||
|
set -g -x fish_greeting 'Welcome to FiSH'
|
||||||
6
shell/.vimrc
Normal file
6
shell/.vimrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
:set mouse=r
|
||||||
|
:color desert
|
||||||
|
:syntax on
|
||||||
|
:set nu
|
||||||
|
:set list
|
||||||
|
:set listchars=tab:>-
|
||||||
Reference in New Issue
Block a user