Very restrictive access?
I am running CentOS 3.1 and I turned off and uninsulated most unneeded services, but spammers were relaying their "Products" through it.
Is there a simple IPTables command that could block ALL from accessing my server except my subnet? I am asking this in case it is all figured out and I dont screw up and block my own SSH access to the server and have to start from scratch.
thanks,
5 Replies
thanks!
I guess you are using plain iptables rules? I use Firehol. I find I actually UNDERSTAND Firehol, even if it gives me fits every once in a while! (All badly written rules on my part, but from what I understand, a miswritten IPtables rule is just as bad (if not much worse) than a miswritten Firehol rule (as Firehol tries to failsafe badly written rules) )
If you use Firehol to make your firewall rules, you should be able to modify your interface statement thusly:
interface eth0 linode src "xxx.yyy.zzz.0/24 1.2.3.4"
What this rule SHOULD do (I haven't used it, the docs are here: http://firehol.sourceforge.net/commands.html#parameters
Is that what you were looking for?
I don't think there is any single iptables command that will work for you with any existing configuration. A new iptables rule needs to work with the other rules that are already in place. It may be easiest for you to use firewall software and configure that to do what you want rather than deal with iptables directly.
If you dump and post your current iptables state, with 'iptables -n -L -v' it's possible that some iptables guru would be able to tell you a magic incantation to do what you want. Of course, it's also possible some lowlife will use it to discover a vulnerability.
Roy
If spammers are using your server to send email, then remove your smtp server. If it's your web proxy they are using, then use the ACLs it (hopefully) provides to restrict it to yourself only. Better yet, make it require authentication (a username/password) to use.
If you must, then use iptables to firewall out all incoming new connections except from your own subnet (which probably also includes a bunch of other people as well). However, you will probably find that some other things that will end up not working and lots of inconveniences.