Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hello,
i am currently working for a company and a task has been assigned to me to create a monitoring server on a linux machine (Centos 5.2) using splunkd, now i have created the monitoring server and its working fine,the issue is that i just want my server to be accessed only through my 3 IP-Addresses at port 8000, for this i am using iptables but unable to figure out how i will do this, can anybody help me, the current config of my iptables file is
------------------------------------------------
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 514 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 514 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
------------------------------------------------------------------------------------------
accessing server address is 172.16.100.187:8000, and the ip-adresses which i want to allow are 10.10.1.21, 10.10.1.22, 10.10.1.23 (only these 3 addresses can only access the server at http port 8000)...........the rest all the traffic should be blocked ......can anybody tell me exact configuration of iptables for this scenario.
Accept the source address which you want to allow access and then drop all others
iptables -A INPUT -s 10.10.1.21/255.255.255.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -I INPUT 11 -s 10.10.1.20/255.255.252.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
This command will cause only 10.10.1.20-23 access your server
if you want more strict input fellow
iptables -I INPUT 11 -s 10.10.1.20/255.255.254.0 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -I INPUT 11 -s 10.10.1.22 -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT
iptables -D RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8000 -j ACCEPT
I come from china ,my enlish is so bad, if something wrong sorry
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.