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.
#### Accept SSH ####
## From all ##
iptables -A INPUT -p tcp -i $INET_IFACE --sport 22 -j ACCEPT
iptables -A OUTPUT -p tcp -o $INET_IFACE --dport 22 -j ACCEPT
## Or from an IP ##
#iptables -A INPUT -i $INET_IFACE -p tcp --sport 22 -m account --aaddr 192.168.0.100 -m state NEW -j ACCEPT
#iptables -A OUTPUT -o $INET_IFACE -p tcp --dport 22 -m account --aaddr 192.168.0.100 -m state NEW -j ACCEPT
#### Traffic IN ####
# DNS
iptables -A INPUT -i $INET_IFACE -p udp -s 0/0 -d 0/0 --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT
# WEB
iptables -A INPUT -i $INET_IFACE -p tcp -s 0/0 -d 0/0 --sport 80 -m state --state ESTABLISHED,RELATED -j ACCEPT
After looking at your firewall script I think I'm noticed a mistake. I will admit though that I'm not an IPTables expert so I could be wrong. In your script you have this
Code:
#### Accept SSH ####
## From all ##
iptables -A INPUT -p tcp -i $INET_IFACE --sport 22 -j ACCEPT
iptables -A OUTPUT -p tcp -o $INET_IFACE --dport 22 -j ACCEPT
The first line says "accept input to eth0 if tcp protocol and the source port is 22."
I believe it should say "accept input to eth0 if tcp protocol and the destination port is 22." In coding IPTables it means this
Other than that the only thing I can think of would be to check your sshd configuration to make sure everything is configured correctly. Good luck and hope this helps.
For your ssh rules, first remove '-m account --addr' and replace with '-s'. Also I believe that you have --sport and --dport reversed. Are you trying to allow connections to this machine or allow outbound connections from this machine to other systems running sshd?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.