Welcome to Binary Revolution Forums
![]() |
|
| Guest Message © 2012 DevFuse | |
Linux System Security. Stopping malicious activity.
#1
Posted 04 January 2007 - 03:33 PM
Since some of us know how to get in, I'm sure some of us know how to stop others from getting in. :)
Alk3
#2
Posted 05 January 2007 - 12:12 AM
I'm just assuming, from your short description, you've basically got a box accessible from the net, and that it's not too complex-
SSH: If it's public (IE- accessible to the Interweb), disable root logins, and look into running DenyHosts or something similar to parse the /var/log/secure (auth on Debian? I forget) for failed SSH logins and add offending hosts to /etc/hosts.deny. There's an iptables rule to do the same thing, although I forget what it is, and I think it counts on connections within a timeframe, not actual password/username failures. You undoubtably will see Brute Force attempts if it's public, though generally as a large list of common accounts (test, apache, root, bin, etc), each hitting for only one or two passwords.
Telnet: Don't do it, it's horribly insecure, and SSH does the same thing and install just as easy on modern distros.
FTP: For the love of Pete, chroot it, especially if you've set it up for anon access. You really shouldn't use regular user accounts to upload/download files from it. If you do want to use actual user accounts, just go ahead and use SFTP which is built into SSH.
Firewall: Meh, why not, even if you only have a few ports open. Just some simple rules in IP tables to block all ports in but the ones you need public, and allow everything out, usually does the trick. Alternatively, you could use the /etc/hosts.allow and /etc/hosts.deny files for incoming, as I think most daemons respect their settings.
Updating: Like anything, you need to patch things (Kernel, service, or otherwise) when there's a major security flaw found. I've run distros such as Debian and Fedora Core at full patch level all the time, and I don't have any problems with an updated binary breaking something... upgrading from version A to version B is a much different story, however...
HTTP: I trust Apache, again, if you keep up on its critical updates. What I would worry about are canned web applications (Drupal, phpBB, etc) you serve out. Don't forget, these sorts of things can be exploited too. I don't do web service monitoring enough to know what (if anything) is out there to monitor apache logs from a security standpoint.
SMB: Shouldn't be public, period. Same goes with NFS.
SMTP: No matter what you use (Postfix or Sendmail typically) set it to only relay for domains/networks you specify. Under no circumstances should it be allowed to accept connections from anyone that wants to connect to it. If you don't plan on using the box to send/recieve mail for your own little domain, firewall it off. I don't think most domains will recieve mail from a host they can't verify the DNS entries recursively for, so keep that in mind if you do want to send/recieve mail.
Username/Passwords: I won't repeat the lecture, you know it by now- root/root is a terrible combination.
For a single (and simple) box that's not firewalled from incomming traffic on the net, that should do. NIDS shouldn't really be necessary, but you could give it a shot- learning to config it and watch its logs could prove educational. You might also want to look into Bastille linux, which to my knoweldge is a set of scripts to harden Linux installs, but this again may not be absolutely necessary.
#3
Posted 05 January 2007 - 01:02 AM
I use Firestarter firewall to manage my connections, since essentially it is a GUI front-end to iptables. I use Firestarter because it lets me share internet connections, and allows for point and click firewall rules. What I really want to learn is how to use iptables by itself, eliminating that extra space taken up by the GUI. Does anyone have any really good tutorials for iptables? All the tutorials I have found are /very/ technical and hard to understand, for me at least.
I do use Bastille. It is an essential tool for securing the finer points of a live box. I disabled root login and FTP (and all other plain text protocols). Is there another tool out there that is better than Bastille?
Rootkit detection? How does this work? I usually only run desktop installs of Linux and the whole security issue isn't as prominent for my purposes. I understand what it is but what is the benefit? Are viruses an issue with Linux?
What Dirk Chestnut said about web service monitoring is really what I am trying to learn and apply ASAP. I have a laptop that is available for use as a logging server, necessary? I would like to find an application that allows for server log management and monitoring, any ideas?
The host OS I am running is Debian GNU/Linux 4.0. I am sufficient in administering and keeping it patched. (even thought it hasnt been live yet) With MySQL, I know there are database administrative interfaces available. Which is best?
Anyway, input for this topic will be /very/ helpful.
Alk3
#4
Posted 05 January 2007 - 11:24 AM
For MySQL administration I know webmin has a plugin for it, and there's phpmyadmin, I don't use either enough to tell you what works best, but that should be a nudge in the right direction.
In general, http://www.aboutdebian.com has some other walkthroughs that may be of interest to you. Debian is well documented, especially from the command-line, for most anything.
This post has been edited by Dirk Chestnut: 10 January 2007 - 11:36 PM
#5
Posted 05 January 2007 - 04:23 PM
While on the subject of parsing logs I should also suggest using a intrusion detection system such as Snort. I have even seem some people(not sure how well it worked for them) set up TCPSpy and configure it just to log 'suppicious' activity.
Hope that helps a tad.
#6
Posted 05 January 2007 - 08:31 PM
Dirk Chestnut, on Jan 5 2007, 12:12 AM, said:
The thing to remember about preventing unauthorized access to your server is that you can't. You can limit your exposure by reducing the number of services and closing uneeded ports. But beyond that you just need to know when your system has been accessed and hopefully as soon as possible.
There will always be some time between a successful compromise and a fully rooted system. That is the time that I have the system start sending me continuous emails which contain bash_history and the system logs. You are root so bash_history shouldn't be changing unless you are logged in.
#7
Posted 07 January 2007 - 03:10 AM
L0gicB0mb, on Jan 5 2007, 03:23 PM, said:
While on the subject of parsing logs I should also suggest using a intrusion detection system such as Snort. I have even seem some people(not sure how well it worked for them) set up TCPSpy and configure it just to log 'suppicious' activity.
Hope that helps a tad.
Yeah, those O'Reilly books are king. They have texts on just about anything you can think of.
nullkraft, on Jan 5 2007, 07:31 PM, said:
How would I go about setting this up? I have the mail server set up. Would I just have the recipient be username@hostname.com?
Also, what are other things to be aware of to know if your system is rooted? Finding out if your system has been compromised can be hard to know to a less aware admin. I know some, but what tells you your system is compromised?
Anyone else have any ideas?
Alk3
#9
Posted 10 January 2007 - 05:46 AM
Oh, and Squid. In my experience Squid is definitely worthwhile, it can be rather time consuming to get up and running properly, but the benefits in speed/security far outweigh the time required to set it up. Squid is probably my best tool for protecting my users from their own stupidity, and protecting my anonymity. All while being probably the most effective ad blocker I've ever had. :P
#10
Posted 10 January 2007 - 07:05 PM
#11
Posted 19 January 2007 - 05:48 PM
ALk3
#12
Posted 22 January 2007 - 02:28 PM
#13
Posted 10 February 2007 - 03:09 AM
If you go to http://www.cisecurity.org/ you can download a "scoring utility" for various OSes. This scoring utility will present you with a list of recomended changes to make to your system to enhance security.
Basically when you run the application you are given a log of what the scoring utility found, alongside a number. This number corresponds to a section of the included .pdf file. In each section of the .pdf you will find small shell scripts that will actually fix the problem. Some of the stuff the scanner checks is not really required, like warning banners, but all-in-all it's a nice little utility.
If you don't feel like running the scoring utility, the included .pdf is a very good information resource. I haven't looked at the newer releases yet, but the .pdf used to include actual information about why the scoring utility is asking you to change certain things. It's actually a good read :)
#14
Posted 13 February 2007 - 05:11 PM
mecca_, on Feb 10 2007, 02:09 AM, said:
If you go to http://www.cisecurity.org/ you can download a "scoring utility" for various OSes. This scoring utility will present you with a list of recomended changes to make to your system to enhance security.
Basically when you run the application you are given a log of what the scoring utility found, alongside a number. This number corresponds to a section of the included .pdf file. In each section of the .pdf you will find small shell scripts that will actually fix the problem. Some of the stuff the scanner checks is not really required, like warning banners, but all-in-all it's a nice little utility.
If you don't feel like running the scoring utility, the included .pdf is a very good information resource. I haven't looked at the newer releases yet, but the .pdf used to include actual information about why the scoring utility is asking you to change certain things. It's actually a good read :)
Great info! Is there anything like this available in source code? I'd like to compile my own package for later use. Or is there something like this for .deb base Linux distribuitions?
#15
Posted 05 March 2007 - 07:01 PM
Alk3, on Feb 13 2007, 05:11 PM, said:
To be quite honest I haven't used this utility much since they switched over to their "Next Generation" :wacko: version of the utility, but the previous one was just a fairly simple shell script. You could see everything that the script was checking for and them compare that to the small script suggestions given in the .pdf.
Alot of the things that this script checks for are version inspecific. The reason they offer different distributions is because of the differences in SUID\GUID files and such. At least, thats how it was before the new version. I think there may be some OS version checks in the shell script, but I have successfully run this on non-supported OSes simply by commenting out the section that makes the shell script die if it can't determine the version. The only thing you miss are the SUID checks and the other minor version specific things. It would be very simple to make, add to, and modify the shell script and deploy it across the Linux distro of your choice.
#16
Posted 14 April 2007 - 09:41 PM
APF, which is a policy based firewall using iptables. You can find it here: http://rfxnetworks.com/apf.php
BFD, which is brute force detection. You can set it to email you when people are trying to brute force your user accounts. http://rfxnetworks.com/bfd.php
R-Fx Networks has some really cool stuff, http://rfxnetworks.com/proj.php
Also, I would install http://www.chkrootkit.org/ for checking for rootkits.
If those two tools you don't like, check out CSF here http://configserver.com/cp/csf.html
I hear people say they like that one better, I'll probably be testing it out later this week.
#17
Posted 14 April 2007 - 10:14 PM
And how is APF any different than Iptables? Once you get the hang of it, iptables is actually easy. Remember, it's easy if you know how. :P
The BFD is a knew thing. However, the most important thing is choosing complicated long passwords.
Some of my passwords are over 15 chars. Upper case lower case and numbers.
Why risk being compromised because you're lazy? Also, never use the same password more than twice for ANYTHING.
That CSF thing is pretty cool. Like Bastille.
#18
Posted 14 April 2007 - 10:21 PM
Quote
Its not, it uses iptables. I found APF easier to work with than writing the iptables stuff because I never knew how to do it.
Easier in the sense that if I want to ban an IP address from connecting, I just do: apf -d IPADDR
I don't know how to do using iptables off hand.
#19
Posted 09 May 2007 - 12:20 AM
riscphree, on Apr 14 2007, 09:41 PM, said:
APF, which is a policy based firewall using iptables. You can find it here: http://rfxnetworks.com/apf.php
BFD, which is brute force detection. You can set it to email you when people are trying to brute force your user accounts. http://rfxnetworks.com/bfd.php
R-Fx Networks has some really cool stuff, http://rfxnetworks.com/proj.php
Also, I would install http://www.chkrootkit.org/ for checking for rootkits.
If those two tools you don't like, check out CSF here http://configserver.com/cp/csf.html
I hear people say they like that one better, I'll probably be testing it out later this week.
How did it go?

Sign In »
Register Now!
Help























