LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-15-2018, 08:58 AM   #1
gondola
LQ Newbie
 
Registered: Aug 2018
Posts: 3

Rep: Reputation: Disabled
Iptables rules for connection to a openvpn server


Hello,

I am having trouble connecting to my openvpn server from my desktop. I am not proficient in iptables at all but i have managed to set up a simple iptables ruleset. The default policy is drop and the rules included are:

sudo iptables -A INPUT -i enp2s0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i enp2s0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i enp2s0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i enp2s0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
sudo iptables -A INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -p udp -i enp2s0 --sport 53 -j ACCEPT
sudo iptables -A INPUT -p udp -i enp2s0 --sport 53 -j ACCEPT

sudo iptables -A OUTPUT -o enp2s0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -o enp2s0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -o enp2s0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -o enp2s0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
sudo iptables -A OUTPUT -o lo -j ACCEPT
sudo iptables -A OUTPUT -p udp -o enp2s0 --dport 53 -j ACCEPT
sudo iptables -A OUTPUT -p udp -o enp2s0 --dport 53 -j ACCEPT

Can someone please help me getting my openvpn connection through my firewall.

Thanks in advance
 
Old 08-16-2018, 12:42 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by gondola View Post
Hello,

I am having trouble connecting to my openvpn server from my desktop.
Welcome to LQ!
"Server" where? Is it "remote" from your current computer/host/current_desktop/
Not on the same machine is it?

Any research you have done? What does the openvpn documentation indicate the next action is?

Do you understand the client-server model?
 
Old 08-17-2018, 12:26 PM   #3
smaclennan
Member
 
Registered: May 2010
Location: Ottawa, Canada
Distribution: slackware
Posts: 37
Blog Entries: 2

Rep: Reputation: 13
Those rules seem to have nothing to do with openvpn. By default, openvpn uses port 1194 and is usually udp.

Where did you get the firewall rules from?
 
Old 08-18-2018, 06:42 AM   #4
gondola
LQ Newbie
 
Registered: Aug 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
It seems i have not explained myself very well in my opening post. So let's try it again. I am trying to connect from my desktop (client) to a vpn provider (protonvpn). The rules listed above are my iptables rules. Because my default policy is DROP, i can not connect to my vpn provider. I am looking for a set of rulkes that let's my computer connect to my vpn provider. As of now iptables blocks this (as i have not yet added rules to allow this). But as i stated above, i am not very proficient in iptabes so i am looking for some help. I have looked extensively but i can not find it. So can someone help me put a set of rules together that will allow my firewall to connect to my vpn provider?
 
Old 08-18-2018, 02:02 PM   #5
smaclennan
Member
 
Registered: May 2010
Location: Ottawa, Canada
Distribution: slackware
Posts: 37
Blog Entries: 2

Rep: Reputation: 13
I am going to assume they are using port 1194 and that you chose udp....

sudo iptables -A INPUT -i enp2s0 -p udp --sport 1194 -m state --state ESTABLISHED -j ACCEPT

sudo iptables -A OUTPUT -o enp2s0 -p udp --dport 1194 -m state --state NEW,ESTABLISHED -j ACCEPT
 
Old 08-18-2018, 03:36 PM   #6
smaclennan
Member
 
Registered: May 2010
Location: Ottawa, Canada
Distribution: slackware
Posts: 37
Blog Entries: 2

Rep: Reputation: 13
I am still interested in where the original rules came from. What distro are you using? Did the rules come with the distro?
 
Old 08-21-2018, 05:53 AM   #7
gondola
LQ Newbie
 
Registered: Aug 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
I am currently using debian as my default distro. I got the rules from the internet and from a course i am taking on cybersecurity. It introduced me to iptables, but i am not really proficient in it yet.
 
Old 08-22-2018, 08:36 PM   #8
smaclennan
Member
 
Registered: May 2010
Location: Ottawa, Canada
Distribution: slackware
Posts: 37
Blog Entries: 2

Rep: Reputation: 13
Quote:
Originally Posted by gondola View Post
I am currently using debian as my default distro. I got the rules from the internet and from a course i am taking on cybersecurity. It introduced me to iptables, but i am not really proficient in it yet.
Fair enough. IMHO, the rules seem very inefficient. Generally, I would just allow all established connections. Simple and efficient. I also don't understand a default drop policy on output for normal computers. Generally, you trust yourself

But I am not a security expert... I no longer even play one in real life.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Minimum iptables rules for OPENVPN client and server linuxgurusa Linux - Software 1 11-27-2014 04:06 AM
[SOLVED] [iptables] Linux (not gateway) + OpenVpn, need forwarding rules. laser_xf Linux - Networking 7 10-25-2014 06:02 AM
set rules for OpenVPN in iptables trieu1929 Linux - Security 1 07-03-2014 11:48 PM
iptables forward rules for OpenVPN & PPTP crspy Linux - Networking 2 04-18-2013 02:12 AM
configuring openvpn with iptables rules (internet connection freezes when tun0 is up) BlackHawk Linux - Networking 11 06-22-2011 12:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration