Hoping someone much more versed in Linux can help me adapt the travelin man script for Ubuntu to Debian Jessie.
When I locate iptables files on my Debian Jessie system, these are the location and files with iptables name in it...
I was hoping to run these parts of the Ubuntu script:
and
When I locate iptables files on my Debian Jessie system, these are the location and files with iptables name in it...
Code:
# locate iptables
/etc/fail2ban/action.d/iptables-allports.conf
/etc/fail2ban/action.d/iptables-blocktype.conf
/etc/fail2ban/action.d/iptables.conf
/etc/fail2ban/action.d/iptables-ipset-proto4.conf
/etc/fail2ban/action.d/iptables-ipset-proto6-allports.conf
/etc/fail2ban/action.d/iptables-ipset-proto6.conf
/etc/fail2ban/action.d/iptables-multiport.conf
/etc/fail2ban/action.d/iptables-multiport-log.conf
/etc/fail2ban/action.d/iptables-new.conf
/etc/fail2ban/action.d/iptables-xt_recent-echo.conf
/sbin/iptables
/sbin/iptables-restore
/sbin/iptables-save
/usr/bin/iptables-xml
/usr/sbin/iptables-apply
/usr/share/doc/iptables
/usr/share/doc/iptables/changelog.Debian.amd64.gz
/usr/share/doc/iptables/changelog.Debian.gz
/usr/share/doc/iptables/changelog.gz
/usr/share/doc/iptables/copyright
/usr/share/doc/iptables/INCOMPATIBILITIES
/usr/share/doc/iptables/README.Debian
/usr/share/iptables
/usr/share/iptables/iptables.xslt
/usr/share/lintian/overrides/iptables
I was hoping to run these parts of the Ubuntu script:
Code:
# Configuring IPtables
# Rules are saved in /etc/iptables#
# /etc/init.d/iptables-persistent restart
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
apt-get install -y iptables-persistent
# add TM3 rules here
sed -i 's|INPUT ACCEPT|INPUT DROP|' /etc/iptables/rules.v6
sed -i '/OUTPUT ACCEPT/a -A INPUT -s ::1 -j ACCEPT' /etc/iptables/rules.v6
#/-server IP address is?
serverip=`ifconfig | grep "inet addr" | head -1 | cut -f 2 -d ":" | cut -f 1 -d " "`
# user IP address while logged into SSH is?
userip=`echo $SSH_CONNECTION | cut -f 1 -d " "`
# public IP address in case we're on private LAN
publicip=`curl -s -S --user-agent "Mozilla/4.0" http://myip.pbxinaflash.com | awk 'NR==2'`
# WhiteList all of them by replacing 8.8.4.4 and 8.8.8.8 and 74.86.213.25 entries
cp /etc/iptables/rules.v4 /etc/iptables/rules.v4.orig
cd /etc/iptables
wget http://pbxinaflash.com/iptables4-ubuntu14.tar.gz
tar zxvf iptables4-ubuntu14.tar.gz
rm iptables4-ubuntu14.tar.gz
cp rules.v4.ubuntu14 rules.v4
sed -i 's|8.8.4.4|'$serverip'|' /etc/iptables/rules.v4
sed -i 's|8.8.8.8|'$userip'|' /etc/iptables/rules.v4
sed -i 's|74.86.213.25|'$publicip'|' /etc/iptables/rules.v4
badline=`grep -n "\-s \-p" /etc/iptables/rules.v4 | cut -f1 -d: | tail -1`
while [[ "$badline" != "" ]]; do
sed -i "${badline}d" /etc/iptables/rules.v4
badline=`grep -n "\-s \-p" /etc/iptables/rules.v4 | cut -f1 -d: | tail -1`
done
/etc/init.d/iptables-persistent restart
ln -s /etc/init.d/iptables-persistent /etc/init.d/iptables
Code:
# updating TM3 pieces for Ubuntu and IPtables
cd /root
wget http://incrediblepbx.com/iptables-ubuntu.tar.gz
tar zxvf iptables-ubuntu.tar.gz
rm -f iptables-ubuntu.tar.gz
mv iptables-restart /usr/local/sbin
sed -i 's|exit 0|/usr/local/sbin/iptables-restart\nexit 0|' /etc/rc.local
sed -i 's|exit 0"|#exit 0"|' /etc/rc.local
echo "*/10 5-22 * * * root /root/ipchecker > /dev/null 2>&1" >> /etc/crontab