View previous topic :: View next topic |
Author |
Message |
deboeck Tux's lil' helper
Joined: 13 Jan 2004 Posts: 92
|
Posted: Mon Jan 16, 2006 4:20 pm Post subject: OpenVPN and iptables firewall rules [SOLVED] |
|
|
Hi,
I'm running an OpenVPN server to which different clients connect. When starting the OpenVPN service on the server, I use the 'up' parameter in the openvpn config file to add some rules to my firewall. The rules do the following:
1) Open the VPN port (1194) on my external interface.
2) Define which traffic is allowed through the created TUN interface.
This works fine. However, when shutting down the OpenVPN service, I'd like these rules to be removed. I tried doing this using the 'down' parameter, but it doesn't work because OpenVPN is running as user nobody. The results is that the rules are still present. When starting OpenVPN again, they are added a second time.
I thought of the following solutions to solve this problem:
1) Run OpenVPN as root. Last resort really, seems like a bad idea.
2) Create a new user openvpn, let OpenVPN run as that user and use sudo so the user can execute my firewall script as root. Anyone using this approach ?
3) Modify the /etc/init.d/openvpn script to add and remove the firewall rules.
Anyone else having this problem ? Suggestions are very welcome
Steven
Last edited by deboeck on Tue Jan 17, 2006 4:56 pm; edited 1 time in total |
|
Back to top |
|
|
tuxmin l33t
Joined: 24 Apr 2004 Posts: 838 Location: Heidelberg
|
Posted: Mon Jan 16, 2006 7:11 pm Post subject: |
|
|
As you resumed: #1 is a bad idea
I'd go for #3. One suggestion though: you could create a chain for your openvpn rules, then, upon startup simply flush/delete that chain first and insert your rules again. This would prevent the rules from multiplying.
Hth, Alex!!! _________________ ALT-F4 |
|
Back to top |
|
|
deboeck Tux's lil' helper
Joined: 13 Jan 2004 Posts: 92
|
Posted: Tue Jan 17, 2006 4:54 pm Post subject: @Alex |
|
|
Thanks for the answer. I've already gone for solution 2 Seems to be working. Putting the VPN rules in a chain is a good idea though, thanks for that one.
Steven |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|