Are Your Servers Secure?

In a word, No. No machine connected to the internet iswhether the kernel has a ptrace vulnerability.Check the
100% secure. This doesn't mean that you are helpless.memory (Another system health check.)Check if the
You can take measures to avoid hacks, but youserver is an open e-mail relay.Check if the partitions
cannot avoid them completely. This is like a house -have enough free space.Check the size of the log
when the windows and doors are open then thefiles. It's better that the log size remains in megabytes.
probability of a thief coming in is high, but if the doors10 How to know if you are being hacked?To find out
and windows are closed and locked the probability ofif your box is compromised or not, follow these
being robbed is less, but still not nil.1 What is Informationsteps. These are the steps which I used to do and will
Security?For our purposes, Information Security meansbe handy in most of the situations.10.1 Check your box
the methods we useto see if your performance has degraded or
to protect sensitive data from unauthorized users.2if your machine is being over used.For that, use the
Why do we need Information Sec?The entire world iscommandsvmstat - Displays information about
rapidly becoming IT enabled. Wherever you look,memory, cpu and disk.Ex: bash# vmstat 1 4 (where 1 is
computer technology has revolutionized the way thingsdelay and 4 is count)mpstat - Displays statistics about
operate. Some examplescpu utilization. This will help us to see if your cpu is over
are airports, seaports, telecommunication industries,worked or not.Ex: bash# mpstat 1 4 (where 1 is
and TVdelay and 4 is count)iostat - This command displays
broadcasting, all of which are thriving as a result ofstatistics about the disk system.Useful options:-d -
the use ofGives the device utilization report.-k - Display statistics
IT. "IT is everywhere."A lot of sensitive informationin kilobytes per
passes through the Internet, suchsecond.Ex: bash# iostat -dk 1 4 (where 1 is
as credit card data, mission critical server passwords,delay and 4 is count)sar - Displays overall system
andperformance.10.2 Check to see if your server has any
important files. There is always a chance of somehidden processes
one viewingrunning.ps - Displays the status of all known
and/or modifying the data while it is in transmission.processes.lsof - List all open files. In Linux everything is
There areconsidered a file, so you will be able to see almost all
countless horror stories of what happens when anof the activity on your system with this command.10.3
outsider getsUse Intrusion Detection Tools
someone's credit card or financial information. He orrkHunter ( )chkrootkit (
she can use10.4 Check your machine's uptime.If the uptime is less
it in any way they like and could even destroy youthan it should be, this can mean that your machine's
and yourresources are being used by someone. Linux doesn't
business by taking or destroying all your assets. Ascrash or reboot under normal conditions because it is
we all knowsuch a stable OS.
"An ounce of prevention beats a pound of cure," soIf your machine has been rebooted try to find out the
to avoid suchactual reason
critical situations, it is advisable to have a goodbehind it.10.5 Determine what your unknown
security policy and security implementation.3 Securityprocesses are and what they are
FrameworkThe following illustrates the frameworkdoing.10.5.1 Use commands like the following to take
needed to implement aapart unknown
functioning security implementation:[ Risk Analysis ] [programsreadelfThis command will display what the
Business Requirements ]|[ Security Policy ]|[ Securityexecutable's program is
Service, Mechanisms, and Objects ]|[ Securityperforming.ldd - This command will show the details of
Management, Monitoring, Detection and Responselibraries used by a executable.string - This command
]This framework shows the basic steps in the lifewill display the strings in the binary.strace - This
cycle ofcommand will display the system calls a program
securing a system. "Risk Analysis" deals with the riskmakes as it runs.11 Hardening Methodology
associatedRead all security related sites and keep up to date.
with the data in the server to be secured. "BusinessThis is
Requirements"one of the main things a security administrator or
is the study which deals with the actual requirementsserver owner
forshould do. Server owners should be made aware of
conducting business. These two components coversecurity and its
the businessimportance. Security training is an important part of an
aspects of the security implementation.The "Securityoverall
Policy" covers 8 specific areas of the securitysecurity package.Create a good security policy.
implementation, and is discussed in more detail inConduct security audits on the
section 4below. "Security Service, Mechanisms andbasis of this policy.Keep your OS updated by applying
Objects" is actually theall patches.Install a custom kernel with all unwanted
implementation part of security. "Securityservices removed and patched with either grsecurity
Management, Monitoring, Detection and Response" isor openwall.Disable all unwanted services and harden
the operational face of security, where we cover thethe services you leave running; Change file and
specifics of how we find a security breach, and howdirectory permissions so that security is tightened.Install
we react if a breach is found.4 Security PolicyThea firewall and create good rule sets.Test and audit the
Security Policy is a document which addresses theserver on regular basisInstall an intrusion detection
followingsystem, log monitor, all of the
areas:Apache security modules, bfd, faf and tmp monitor.
Authentication: This section deals with what methodsMake your
are usedpartitions secure.Run a good backup system to
to determine if a user is real or not, which users canrecover data in case of an
or cannotintrusion, crash, or other destructive incident.Install a log
access the system, the minimum length of passwordanalyzer and check your logs for any suspicious
allowed, how longentries.Install scripts to send out mail or enable
can a user be idle before he is logged out,notifications when a security breach occurs.After a
etc.Authorization: This area deals with classifying usersecurity breach try to find out how, when and through
levels andwhat the breach occurred. When you find a fix for it,
what each level is allowed to do on the system, whichdocument the details for future reference.12
users canSummaryNow lets conclude by covering the main
become root, etc.Data Protection: Data protectionsteps by which a
deals with the details likehosting server can be secured.12.1 Determine the
what data should be protected and who can accessbusiness requirements and risk factors
which levels ofwhich are applicable to this system12.2 Devise a
data on the system.Internet Access: This area dealssecurity policy with the above data in mind.
with the details of the usersGet management's approval and signoff on this
having access to the internet and what they can dosecurity
there.Internet Services: This section deals with whatpolicy.12.3 On approval of the policy, do a security
services on theaudit on any
server are accessible from the internet and which areexisting systems to determine the current
not.Security Audit: This area addresses how audit andvulnerabilities and
review ofsubmit a report regarding this to the management.The
security related areas and processes will bereport should also cover the methods needed to
done.Incident Handling: This area addresses the stepsimprove existing security.
and measuresA quick checklist:
to be taken if there is a breach of security. This alsoSoftware Vulnerabilities.Kernel Upgrades and
covers thevulnerabilities.Check for any Trojans.Run
steps to find out the actual culprit and the methods tochkrootkit.Check ports.Check for any hidden
preventprocesses.Use audittools to check system.Check
future incidents.Responsibilities: This part covers whologs.Check binaries and RPMS.Check for open email
will be contacted at anyrelays.Check for malicious cron entries.Check /dev
given stage of an incident and the responsibilities oftmp /var directories.Check whether backups are
themaintained.Check for unwanted users, groups, etc. on
administrator(s) during and after the incident. This is athe system.Check for and disable any unneeded
veryservices.Locate malicious scripts.Querylog in
important area, since the operation of the incidentDNS.Check for the suid scripts and nouser
handlingscripts.Check valid scripts in /tmp.Use intrusion
mechanism is dependent on it.detection tools.Check the system performance.Check
5 Types of Information SecurityThere are 2 types ofmemory performance (run memtest).12.4 Implement
security. (1) Physical security / Hostthe security policy12.4.1 Correct all known existing
Security and (2) Network security. Each of thesesoftware vulnerabilities either by applying patches or
sections has 3by upgrading the software.12.4.2 Implement host
parts:security
Protection: Slow down or stop intrusions orProtect your systems with passwordsCheck the file
damageDetection: Alert someone if a breach (orsystems and set correct permissions and
attempted breach) ofownerships on all directories and fileschmod -R 700
security occurs, and quantify and qualify what sort ofetc/rc.d/init.d/*Use rpm -Va to find out if an rpm is
damagemodified
occurred or would have occurred.Recovery:Apply security patches to vulnerable software (ie.
Re-secure the system or data after the breach orpatch
damage and where possible, undo whatever damage-p1 < patch file)Remove all unneeded ttys and console
occurredlogins by removing the
5.1 Host Security / Physical SecurityHost Security /entry from /etc/securettyCheck system logs (eg: /var
Physical Security means securing the server fromlog/messages, /var/log/secure,
unauthorized access. For that we can passwordetc.)Set a password on the boot loader (lilo and grub
protect the box with such steps as setting up a biosboth support
password, placing the computer box in a locked roomthis)Monitor the system (nagios or big brother)
where only authorized users have access, applying12.4.3 Implement Network security
OS security patches, and checking logs on regularRemove all unwanted users and groups.Use custom
basis for any intrusion and attacks. In Host security wesecurity scripts which will send out notification
check and correct the permissions on all OS relatedwhen sshing as root or while creating a user with uid
files.5.2 Network securityNetwork security is one ofof 0,
the most important aspects of overalletc.Require passwords with 16 characters (can be
security. As I mentioned earlier, no machine connecteddone by making
to thechanges in login.def).Disable unwanted services using
internet is completely secure, so securitytcpwrapper (unwanted services
administrators and server owners need to be alert,can also be disabled through xinet.d or
and make sure that they are informed of all new bugsxinetd.Conf).Set up an idle timeout, so that idle users will
and exploits that are discovered. Failure to keep upbe logged out
with these may leave you at the mercy of someafter a certain amount of time.Disable all console
script kiddy.5.3 Which operating system is the mostprogram access (eg: rm -rf
secure?Every OS has its own pros and cons. There/etc/security/console.app/.)Enable nospoof option in
are ways to make Windows more secure, but theetc/host.conf.Specify the order in which domain names
implementation is quite costly. Linux is stable andshould be resolved (eg:
reasonably secure, but many companies perceive it asorder bind hosts).Lock the /etc/services file so that no
having little vendor support. My vote for the best OSone can modify it.Restrict direct root login (comment
for security purposes goes to FreeBSD, another freeout the PermitRootLogin
Unix-like OS, but not many people are aware of itslogin option in sshd_config).Restrict su, so that only
existence.6 Is a firewall the final solution to thewheel group members are able to su.
Network Security problem?No, a firewall is just a part(can use pam or disable the permission of other for
of the security implementation.the su
Again, we will use the example of a house. In a housebinary).Limit users resources (using pam, specify the
all thelimits for each
windows and doors can be closed but if the lock onuser in /etc/security/limit.conf).Secure /tmp (mount
the front doortmp with noexec,nodev,nosuid).Hide the server details.
of the house is so bad that someone can put just anyRemove /etc/issues and
key-like thing in and open it, then what is the use of the/etc/issues.net.Disable unwanted suid and sgid files
house being all closed up? Similarly, if we have a(eg: find -type -perm
strong firewall policy, it will restrict unauthorized access,-04000 -o perm 02000.)
but if the software running on the box is outdated orExamples of these: gpasswd, wall,
full of bugs then crackers can use it to intrude into theand traceroute
server and gain root access. This shows that aUsing iptables, allow only pings from a specific
firewall is not the final solution. A planned securitylocations (for
implementation is the only real quality solution to thismonitoring systems to work).Take preventive
issue.7 Security is a continuous processContinuingmeasures against DOS, "ping of death" attacks,
security is a on-going process. Securityetc.Install a firewall (eg: apf and iptables) and only allow
administrators can only conduct their work on theports to operate which the box needs for its normal
basis of thefunctions; block all other ports to prevent mischief.
alerts and bugfixes released up to the date ofLinks: and
securing, so inInstall intrusion detection (eg: install tripwire or
order to accommodate all of the fixes for the latestaide).
bugs, security work has to be done on a regularLinks:
basis.8 Does Security implementation create overheadand
and/or reduce
performance?Yes, Security implementation creates aInstall sxid to keep an eye on suid and sgid scripts.
small amount of overhead,Link: ssh to specific IP addresses and specific users (I
but it need not reduce overall performance drastically.suggest key authentication using passphrase).Install
In order to take care of such things, a well donelogcheck to check the logs.Install tmpwatch to delete
security implementation has an optimization sectionthe unused files from /tmp
where the security administration gives priority to bothdirectory.Install and setup portsentry and configure it to
performance and security. While securing anyuse iptables
software, we should secure it in such a way that itto block IPs.Install mod_security and mod_dosevasive
providesto safe guard
maximum performance.9 Security Audits - Whatapache.Delete files with nouser and nogroup.Deleted
Should be CheckedA security audit is a part ofunwanted files/folders in htdocs, disable directory
security implementation where weindexing.Check for unwanted scripts in /root, /usr/local,
try to find out the vulnerabilities of the system and/var/spool/mbox.Install BFD and FAF for additional
suggest actions to improve the security. In a normalsecurity.Disable open email relaying.Submit a status
audit, the points below should be checked, and a reportreport to management detailing all discovered
with the results of that audit should be created.vulnerabilities and fixes.
Check intrusion detection. Use chkrootkit or rkhunter12.5 Testing phaseUse tools like nessus, nikto, and
for thisnmap to do a penetration test
purpose.Check for known bugs in the softwareand see how well your server is secured. Also do a
installed on the server -stress test.Security is of utmost importance to a
the kernel, openssl, openssh, etc.Scan all networkserver, compromising
ports and find out which ports are open.security is compromising the server itself. Hence, an
Report the ports that should not be open and whatunderstanding of the same is a prerequisite to server
program isownership and administration.Blessen works as
listening on them.Check whether /tmp isExecutive team member in He is an Engineer in
secured.Check for hidden processes.Check for badComputer Science from the College of Engineering,
disk blocks in all partitions. (This is just toChengannur. He is passionate about Linux security and
make sure that the system is reasonablylooks forward to grow in that field.
healthy.)Check for unsafe file permissions.Check