last day (16 days later) » 

22:28
2
A: Block all internet connections unless connected to OpenVPN server

tachomiAllow first your local connection and your RELATED, ESTABLISHED connections protocols. $ sudo iptables -A INPUT -p tcp -s 127.0.0.1 -j ACCEPT $ sudo iptables -A INPUT -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT $ sudo iptables -A INPUT -p udp -m state --state RELATED,ESTABLISHED -j ACC...

I tried to write this into a script, which doesn't seem to work as for now pastebin.com/NqpK4LDT . iptables states "Try `iptables -h' or 'iptables --help' for more information. iptables v1.6.0: unknown protocol "input" specified"
@boolean.is.null I updated, give a try
thank you @tachomi, but it still states iptables v1.6.0: unknown protocol "input" specified
@boolean.is.null can you execute line by line on the command line?
@boolean.is.null Ok I realised what was, change to uppercase the p in the chain default pilicies
cheers! seems to be working now! But shouldn't I also add a -o udp? Can I disable all the rules with iptables -F again?
22:28
@boolean.is.null The chain policies won't restore with -F option, you must execute iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT, the other will be removed. Of course you can put -p udp to specify upd traffic
The iptables commands work now without errors, but when my connection is completely cut off. Here are the commands/the script pastebin.com/fdDCXfRL
@boolean.is.null You must consider that the iptables -P INPUT DROP will deny all access from all to everything, so you must know what things you must have to enable after executing that line... e.g. iptables -A INPUT -p tcp --dport 22 -s <YOUR IP> -j ACCEPT. Are you local connected? What kind of connection is completely close?
I'm working on my local system, I have no internet connection when the rules are set.
@boolean.is.null Just allow the internet, I updated.
I don't think that's how it should be done. Any other connection will go trough the VPN, so the IP I allowed..
22:28
@boolean.is.null I didn't get that last comment. Which other connection will go through the VPN? You specifying the outbound TO the VPN address. The IP you allowed was the VPN. So when you try to go to the internet, you will go to X.X.X.X through port 80. If you call a website of your VPN server, you are reaching the VPN address, so the connection will go through it even though your reaching port 80
there seems to be a bigger problem. I can't even ping the IP of the VPN provider, when the rules are set.
@boolean.is.null Ok let's make something, allow all your OUTPUT traffic, take out from your script the iptables -P OUTPUT DROP line, give a try
@boolean.is.null I don't get why you're not allowed to ping the VPN server while you're allowing all the OUTBOUND to that specific IP
I still have the same issue, it is also very weird that sudo iptables --list takes forever to list the rules.. something is very odd..
@boolean.is.null Have you tried with iptables-save? Can you display the output as an update to your question please?
OP updated, thank you
22:28
@boolean.is.null Hi, I made some tests. Please execute iptables -F and execute the lines in the answer. That must help
Hi @tachomi! Thanks for your effort but it still doesn't work. I CAN connect to the VPN, but everything else (ping, dig, browsing, ..) fails.
@boolean.is.null If you execute $ sudo iptables -P OUTPUT ACCEPT stills failing?

  last day (16 days later) »