LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-30-2011, 01:18 PM   #1
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Rep: Reputation: Disabled
Question Putting a public IP on my Debian squeeze server....firewall rules.


What I am wanting to do is give some one access to the server without them having to login to my VPN.

Configure the server 192.168.x.x to have a DMZ allowing only access on port 443 and only from their IP range (67.218.x.x)

How can this be done within the server itself? I dont really want to change the setup of my VPN as it sits now.
 
Old 11-30-2011, 01:34 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Are you going through a router? If so, you can forward port 443 to your server, and then edit iptables to reflect what you need done, as such:
Code:
-A INPUT -p tcp --destination-port 443 -m iprange --src-range 67.218.1.100-67.218.1.200 -j ACCEPT
Of course, you would need to make changes to that in order to reflect what you need.

Cheers,

Josh
 
Old 11-30-2011, 01:39 PM   #3
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by corp769 View Post
Are you going through a router? If so, you can forward port 443 to your server, and then edit iptables to reflect what you need done, as such:
Code:
-A INPUT -p tcp --destination-port 443 -m iprange --src-range 67.218.1.100-67.218.1.200 -j ACCEPT
Of course, you would need to make changes to that in order to reflect what you need.

Cheers,

Josh
The only thing between the VPN and the server is the switch it is all connected to.
 
Old 11-30-2011, 01:41 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Oh ok, I see what you mean. You will have to turn on IP forwarding, and forward that range to port 443 of your server, then use what I posted on your server to allow access to port 443.
 
Old 11-30-2011, 01:54 PM   #5
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
ok so I have turned on IP forwarding I used

vi /etc/sysctl.conf:
net.ipv4.ip_forward =1 (I uncommented this line and set from "0" to "1")

Then ran...to make the changes take effect
sysctl -p /etc/sysctl.conf


Is there anything in rc.local that need to be changed as well to make this work?
 
Old 11-30-2011, 01:59 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Read here - http://serverfault.com/questions/140...-with-iptables
Not being lazy, but it does a good job of explaining what needs to be done.
 
Old 11-30-2011, 02:01 PM   #7
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
thanks
 
Old 11-30-2011, 02:02 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Not a problem at all, man. Report back once you get everything up and running, and let me know if you need any more assistance.

Over and out,

Josh
 
Old 11-30-2011, 02:19 PM   #9
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
OK so after setting up IP forwarding I created three rules within the firewall.

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j DNAT --to 192.168.x.x:443
iptables -A INPUT -p tcp -m state --state NEW --dport 443 -i eth0 -j ACCEPT

I then added..
iptables -A PREROUTING -t nat -i eth0 -p tcp --source 67.218.x.x/24 --dport 443 -j DNAT --to 192.168.x.x:443

I have no fully tested these just yet but I am fairly confident they should work as described. Unless I missed something....which is quite possible :-)
 
Old 12-01-2011, 08:29 AM   #10
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
The above lines were accept when I added the three rules...BUT this is what I get what I try iptables -L. Is this correct? Just dont look right to me....


# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
 
Old 12-02-2011, 06:56 PM   #11
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
After you added the rules, did you fully restart your iptables service?

Last edited by corp769; 12-02-2011 at 07:12 PM.
 
Old 12-02-2011, 07:04 PM   #12
tango0202
LQ Newbie
 
Registered: Nov 2011
Distribution: RHEL, CentOS, Debian, Gentoo, Ubuntu
Posts: 19

Original Poster
Rep: Reputation: Disabled
yes I restarted the entire network. Will I need to bounce the entire server for this to take effect?

/etc/init.d/procps restart
 
Old 12-02-2011, 07:13 PM   #13
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
How exactly are you configuring iptables in the first place? Are you using the configuration located in /etc/sysconfig?
 
Old 12-02-2011, 07:21 PM   #14
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
Quote:
procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill.
I am not familiar with procps, but a quick look at the website indicates to me, it doesn't have anything to do with iptables.

Code:
/etc/init.d/iptables restart
will restart the firewall. but in doing so, will reload the default rules, contained (centos/rhel at least), in /etc/sysconfig/iptables

so once your rules are configured, and working, you would probably want to do something to the effect of:
Code:
cp /etc/sysconfig/iptables /etc/sysconfig/iptables.backup
iptables-save > /etc/sysconfig/iptables
to save the currently implemented rules. This will also make the rules persistent across reboots as they are loaded from that file via the init scipts.
 
  


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
LXer: How to add Debian Squeeze to your Debian Lenny FAI install server LXer Syndicated Linux News 0 09-08-2011 07:21 PM
Various segmentation faults Debian Squeeze Virtualbox running on Debian Squeeze host fordwrench Debian 1 07-21-2011 03:55 AM
LXer: The Perfect Server - Debian Squeeze (Debian 6.0) ISPConfig 2 LXer Syndicated Linux News 0 02-14-2011 08:00 AM
server firewall rules qwertyjjj Linux - Newbie 12 08-03-2009 07:45 PM
how to check whether my public IP server has firewall cofigured gotoabhishek Linux - Security 6 06-17-2008 01:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08: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