iptables config
Author
Discussion

tinman0

Original Poster:

18,231 posts

271 months

Friday 27th July 2007
quotequote all
Never used iptables before, but what do i type in to block IRC on the box (Fedora Core 5)?


tuffer

9,024 posts

298 months

Friday 27th July 2007
quotequote all
This is from Smoothwall but should give you an idea:

http://martybugs.net/smoothwall/iptables.cgi

You may want to run some packet capture software to ascertain what ports are being used prior to blocking.

tinman0

Original Poster:

18,231 posts

271 months

Friday 27th July 2007
quotequote all
I'm now showing this extra line in iptables --help, so I'm assuming thats whats needed.

DROP tcp -- anywhere anywhere tcp dpt:ircd

Essentially, someone has got onto the box and installed an irc server, and whilst i locate how they are getting in, i want to stop the irc server from running. The irc server changes name though quite regulary so i can't just cron a kill on the process easily.

ThePassenger

6,962 posts

266 months

Friday 27th July 2007
quotequote all
I'd have a blanket DENY policy and open only the SSH port (22) and nothing else until the machine is rebuilt.

Even something old like the quicktables script can generate that for you.

And yes, rebuilt.

LivinLaVidaLotus

1,626 posts

232 months

Friday 27th July 2007
quotequote all
Shouldn't really run Fedora on a production server (an unstable, short life OS has no place on a live server). I'd follow the advice of deny everything apart from SSH to the server (preferably locked down to your IP) and then have it formatted with a decent OS (CentOS) and restore the data from backup.

tinman0

Original Poster:

18,231 posts

271 months

Friday 27th July 2007
quotequote all
LivinLaVidaLotus said:
Shouldn't really run Fedora on a production server (an unstable, short life OS has no place on a live server). I'd follow the advice of deny everything apart from SSH to the server (preferably locked down to your IP) and then have it formatted with a decent OS (CentOS) and restore the data from backup.
never had a problem with fedora to be honest.

strange thing is, never had a security problem either with these machines until the latest rebuild. someone has accidently let something onto this machine but once i get 6667-6669 filtered, i can spend more time finding where they got in.

ThePassenger

6,962 posts

266 months

Friday 27th July 2007
quotequote all
tinman0 said:
LivinLaVidaLotus said:
Shouldn't really run Fedora on a production server (an unstable, short life OS has no place on a live server). I'd follow the advice of deny everything apart from SSH to the server (preferably locked down to your IP) and then have it formatted with a decent OS (CentOS) and restore the data from backup.
never had a problem with fedora to be honest.

strange thing is, never had a security problem either with these machines until the latest rebuild. someone has accidently let something onto this machine but once i get 6667-6669 filtered, i can spend more time finding where they got in.
The fact they got in through unknown means, is the problem. Was it a PHP vulnerability? Apache? mySQL? Did they brute force a password and just SSH in? The fact you haven't spotted an extra user running the IRCd program suggests they were able to privileged escalate themselves to root. At the moment you don't know, so

I'm also assuming that you are unable to simply go to the racks and bring the machine to your desk, drop a monitor & keyboard to it and run without network for diagnostics.

That being the case, down all remote services, throw up a 'I'm not here any more, piss off' firewall, give all users bar yourself /dev/null as their login shell and set your password to be something long winded. Then you can start piecing together what actually happened and what has been done to the machine, because if it is an external entity at work (and not just some gimp in the farm wondering what IRCd is) a) You have no idea what else has happened (£10 says the IRC server is the tip of the iceberg) b) you don't know how they've got it, thus blocking the ports won't stop them comming back and shutting your firewall down.

tinman0

Original Poster:

18,231 posts

271 months

Friday 27th July 2007
quotequote all
ThePassenger said:
The fact they got in through unknown means, is the problem. Was it a PHP vulnerability? Apache? mySQL? Did they brute force a password and just SSH in? The fact you haven't spotted an extra user running the IRCd program suggests they were able to privileged escalate themselves to root. At the moment you don't know, so

I'm also assuming that you are unable to simply go to the racks and bring the machine to your desk, drop a monitor & keyboard to it and run without network for diagnostics.

That being the case, down all remote services, throw up a 'I'm not here any more, piss off' firewall, give all users bar yourself /dev/null as their login shell and set your password to be something long winded. Then you can start piecing together what actually happened and what has been done to the machine, because if it is an external entity at work (and not just some gimp in the farm wondering what IRCd is) a) You have no idea what else has happened (£10 says the IRC server is the tip of the iceberg) b) you don't know how they've got it, thus blocking the ports won't stop them comming back and shutting your firewall down.
its a php script somewhere. i just need to figure out which one.

i may go get one of the cores this evening to start blocking traffic to the machine anyway whilst i figure out where they got in.

LivinLaVidaLotus

1,626 posts

232 months

Friday 27th July 2007
quotequote all
Thing with Fedora, is that it's only supported for 3 months, then you're on to a new version, which you may or may not be able to upgrade to - it's not unknown for you to not be able to go between versions without a lot of hard work and potentially screwing the server up. CentOS on the other hand is based on Redhat Enterprise and has a 5 year supported cycle from the X.0 release.