Have fun with RC aircrafts


Are Your Servers Secure?

In a word, No. No machine connected to the
internet is 100% secure. This doesn't meansteps. These are the steps which I used to
that you are helpless. You can take measuresdo and will be handy in most of the
to avoid hacks, but you cannot avoid themsituations.10.1 Check your box to see if your
completely. This is like a house - when theperformance  has  degraded  or
windows and doors are open then the
probability of a thief coming in is high, butif your machine is being over used.For that,
if the doors and windows are closed anduse the commandsvmstat - Displays information
locked the probability of being robbed isabout memory, cpu and disk.Ex: bash# vmstat 1
less, but still not nil.1 What is Information4  (where  1  is
Security?For our purposes, Information
Security  means  the  methods  we  usedelay and 4 is count)mpstat - Displays
statistics about cpu utilization. This will
to protect sensitive data from unauthorizedhelp us to see if your cpu is over worked or
users.2 Why do we need Information Sec?Thenot.Ex:  bash#  mpstat  1  4  (where  1  is
entire world is rapidly becoming IT enabled.
Wherever you look, computer technology hasdelay and 4 is count)iostat - This command
revolutionized the way things operate. Somedisplays statistics about the disk
examplessystem.Useful options:-d - Gives the device
utilization report.-k - Display statistics in
are airports, seaports, telecommunicationkilobytes  per
industries,  and  TV
second.Ex:  bash# iostat -dk 1 4 (where 1 is
broadcasting, all of which are thriving as a
result  of  the  use  ofdelay and 4 is count)sar - Displays overall
system performance.10.2 Check to see if your
IT. "IT is everywhere."A lot of sensitiveserver  has  any  hidden  processes
information passes through the Internet, such
running.ps - Displays the status of all
as credit card data, mission critical serverknown processes.lsof - List all open files.
passwords,  andIn Linux everything is considered a file, so
you will be able to see almost all of the
important files. There is always a chance ofactivity on your system with this
some  one  viewingcommand.10.3  Use  Intrusion  Detection Tools
and/or modifying the data while it is inrkHunter  ( )chkrootkit  (
transmission.  There  are
10.4 Check your machine's uptime.If the
countless horror stories of what happensuptime is less than it should be, this can
when  an  outsider  getsmean that your machine's resources are being
used by someone. Linux doesn't crash or
someone's credit card or financialreboot under normal conditions because it is
information.  He  or  she  can  usesuch  a  stable  OS.
it in any way they like and could evenIf your machine has been rebooted try to
destroy  you  and  yourfind  out  the  actual  reason
business by taking or destroying all yourbehind it.10.5 Determine what your unknown
assets.  As  we  all  knowprocesses  are  and  what  they  are
"An ounce of prevention beats a pound ofdoing.10.5.1 Use commands like the following
cure,"  so  to  avoid  suchto  take  apart  unknown
critical situations, it is advisable to haveprogramsreadelfThis command will display
a good security policy and securitywhat  the  executable's  program  is
implementation.3 Security FrameworkThe
following illustrates the framework needed toperforming.ldd - This command will show the
implement  adetails of libraries used by a
executable.string - This command will display
functioning security implementation:[ Riskthe strings in the binary.strace - This
Analysis ] [ Business Requirements ]|[command will display the system calls a
Security Policy ]|[ Security Service,program makes as it runs.11 Hardening
Mechanisms, and Objects ]|[ SecurityMethodology
Management, Monitoring, Detection and
Response ]This framework shows the basicRead all security related sites and keep up
steps  in  the  life  cycle  ofto  date.  This  is
securing a system. "Risk Analysis" dealsone of the main things a security
with  the  risk  associatedadministrator  or  server  owner
with the data in the server to be secured.should do. Server owners should be made
"Business  Requirements"aware  of  security  and  its
is the study which deals with the actualimportance. Security training is an
requirements  forimportant  part  of  an  overall
conducting business. These two componentssecurity package.Create a good security
cover  the  businesspolicy.  Conduct  security  audits  on  the
aspects of the security implementation.Thebasis of this policy.Keep your OS updated by
"Security Policy" covers 8 specific areas ofapplying all patches.Install a custom kernel
the  securitywith all unwanted services removed and
patched with either grsecurity or
implementation, and is discussed in moreopenwall.Disable all unwanted services and
detail in section 4below. "Security Service,harden the services you leave running; Change
Mechanisms  and  Objects"  is  actually  thefile and directory permissions so that
security is tightened.Install a firewall and
implementation part of security. "Securitycreate good rule sets.Test and audit the
Management, Monitoring, Detection andserver on regular basisInstall an intrusion
Response" is the operational face ofdetection  system,  log  monitor,  all of the
security, where we cover the specifics of how
we find a security breach, and how we reactApache security modules, bfd, faf and tmp
if a breach is found.4 Security PolicyThemonitor.  Make  your
Security Policy is a document which addresses
the  followingpartitions secure.Run a good backup system
to  recover  data  in  case  of  an
areas:
intrusion, crash, or other destructive
Authentication: This section deals with whatincident.Install a log analyzer and check
methods  are  usedyour  logs  for  any  suspicious
to determine if a user is real or not, whichentries.Install scripts to send out mail or
users  can  or  cannotenable notifications when a security breach
occurs.After a security breach try to find
access the system, the minimum length ofout  how,  when  and  through
password  allowed,  how  long
what the breach occurred. When you find a
can a user be idle before he is logged out,fix for it, document the details for future
etc.Authorization: This area deals withreference.12 SummaryNow lets conclude by
classifying  user  levels  andcovering  the  main  steps  by  which  a
what each level is allowed to do on thehosting server can be secured.12.1 Determine
system,  which  users  canthe  business  requirements  and risk factors
become root, etc.Data Protection: Datawhich are applicable to this system12.2
protection  deals  with  the  details  likeDevise a security policy with the above data
in  mind.
what data should be protected and who can
access  which  levels  ofGet management's approval and signoff on
this  security
data on the system.Internet Access: This
area  deals  with  the  details  of the userspolicy.12.3 On approval of the policy, do a
security  audit  on  any
having access to the internet and what they
can do there.Internet Services: This sectionexisting systems to determine the current
deals  with  what  services  on  thevulnerabilities  and
server are accessible from the internet andsubmit a report regarding this to the
which are not.Security Audit: This areamanagement.The report should also cover the
addresses  how  audit  and  review  ofmethods  needed to improve existing security.
security related areas and processes will beA  quick  checklist:
done.Incident Handling: This area addresses
the  steps  and  measuresSoftware Vulnerabilities.Kernel Upgrades and
vulnerabilities.Check for any Trojans.Run
to be taken if there is a breach ofchkrootkit.Check ports.Check for any hidden
security.  This  also  covers  theprocesses.Use audittools to check
system.Check logs.Check binaries and
steps to find out the actual culprit and theRPMS.Check for open email relays.Check for
methods  to  preventmalicious cron entries.Check /dev /tmp /var
directories.Check whether backups are
future incidents.Responsibilities: This partmaintained.Check for unwanted users, groups,
covers  who  will  be  contacted  at  anyetc. on the system.Check for and disable any
unneeded services.Locate malicious
given stage of an incident and thescripts.Querylog in DNS.Check for the suid
responsibilities  of  thescripts and nouser scripts.Check valid
scripts in /tmp.Use intrusion detection
administrator(s) during and after thetools.Check the system performance.Check
incident.  This  is  a  verymemory performance (run memtest).12.4
Implement the security policy12.4.1 Correct
important area, since the operation of theall known existing software vulnerabilities
incident  handlingeither by applying patches or by upgrading
the  software.12.4.2  Implement host security
mechanism  is  dependent  on  it.
Protect your systems with passwordsCheck the
5 Types of Information SecurityThere are 2file  systems and set correct permissions and
types of security. (1) Physical security /
Hostownerships on all directories and fileschmod
-R 700 /etc/rc.d/init.d/*Use rpm -Va to find
Security and (2) Network security. Each ofout  if  an  rpm  is
these  sections  has  3
modified
parts:
Apply security patches to vulnerable
Protection: Slow down or stop intrusions orsoftware  (ie.  patch
damageDetection: Alert someone if a breach
(or  attempted  breach)  of-p1 < patch file)Remove all unneeded ttys
and  console  logins  by  removing  the
security occurs, and quantify and qualify
what  sort  of  damageentry from /etc/securettyCheck system logs
(eg:  /var/log/messages,  /var/log/secure,
occurred or would have occurred.Recovery:
Re-secure the system or data after the breachetc.)Set a password on the boot loader (lilo
orand  grub  both  support
damage and where possible, undo whateverthis)Monitor the system (nagios or big
damage  occurredbrother)
5.1 Host Security / Physical SecurityHost12.4.3  Implement  Network  security
Security / Physical Security means securing
the  server  fromRemove all unwanted users and groups.Use
custom security scripts which will send out
unauthorized access. For that we cannotification
password protect the box with such steps as
setting up a bios password, placing thewhen sshing as root or while creating a user
computer box in a locked room where onlywith  uid  of  0,
authorized users have access, applying OS
security patches, and checking logs onetc.Require passwords with 16 characters
regular basis for any intrusion and attacks.(can  be  done  by  making
In Host security we check and correct the
permissions on all OS related files.5.2changes in login.def).Disable unwanted
Network securityNetwork security is one ofservices  using tcpwrapper (unwanted services
the  most  important  aspects  of  overall
can also be disabled through xinet.d or
security. As I mentioned earlier, no machinexinetd.Conf).Set up an idle timeout, so that
connected  to  theidle  users  will  be  logged  out
internet is completely secure, so securityafter a certain amount of time.Disable all
administrators and server owners need to beconsole  program  access  (eg:  rm  -rf
alert, and make sure that they are informed
of all new bugs and exploits that are/etc/security/console.app/.)Enable nospoof
discovered. Failure to keep up with these mayoption in /etc/host.conf.Specify the order in
leave you at the mercy of some scriptwhich  domain  names  should be resolved (eg:
kiddy.5.3 Which operating system is the most
secure?Every OS has its own pros and cons.order bind hosts).Lock the /etc/services
There are ways to make Windows more secure,file so that no one can modify it.Restrict
but the implementation is quite costly. Linuxdirect root login (comment out the
is stable and reasonably secure, but manyPermitRootLogin
companies perceive it as having little vendor
support. My vote for the best OS for securitylogin option in sshd_config).Restrict su, so
purposes goes to FreeBSD, another freethat only wheel group members are able to su.
Unix-like OS, but not many people are aware
of its existence.6 Is a firewall the final(can use pam or disable the permission of
solution to the Network Security problem?No,other  for  the  su
a firewall is just a part of the security
implementation.binary).Limit users resources (using pam,
specify  the  limits  for  each
Again, we will use the example of a house.
In  a  house  all  theuser in /etc/security/limit.conf).Secure
tmp (mount /tmp with
windows and doors can be closed but if thenoexec,nodev,nosuid).Hide the server details.
lock  on  the  front  doorRemove  /etc/issues  and
of the house is so bad that someone can put/etc/issues.net.Disable unwanted suid and
just any key-like thing in and open it, thensgid  files  (eg:  find  -type  -perm
what is the use of the house being all closed
up? Similarly, if we have a strong firewall-04000  -o  perm  02000.)
policy, it will restrict unauthorized access,
but if the software running on the box isExamples  of  these:  gpasswd,  wall,
outdated or full of bugs then crackers can
use it to intrude into the server and gainand  traceroute
root access. This shows that a firewall is
not the final solution. A planned securityUsing iptables, allow only pings from a
implementation is the only real qualityspecific  locations  (for
solution to this issue.7 Security is a
continuous processContinuing security is amonitoring systems to work).Take preventive
on-going  process.  Securitymeasures against DOS, "ping of death"
attacks, etc.Install a firewall (eg: apf and
administrators can only conduct their workiptables) and only allow ports to operate
on  the  basis  of  thewhich the box needs for its normal functions;
block  all  other  ports to prevent mischief.
alerts and bugfixes released up to the date
of  securing,  so  inLinks: and
order to accommodate all of the fixes forInstall intrusion detection (eg: install
the latest bugs, security work has to be donetripwire  or
on a regular basis.8 Does Security
implementation  create overhead and/or reduceaide).
performance?Yes, Security implementationLinks:
creates  a  small  amount  of  overhead,
and
but it need not reduce overall performance
drastically. In order to take care of such
things, a well done security implementation
has an optimization section where theInstall sxid to keep an eye on suid and sgid
security administration gives priority toscripts.
both performance and security. While securing
any software, we should secure it in such aLink: ssh to specific IP addresses and
way  that  it  providesspecific  users  (I
maximum performance.9 Security Audits - Whatsuggest key authentication using
Should be CheckedA security audit is a partpassphrase).Install logcheck to check the
of  security  implementation  where  welogs.Install tmpwatch to delete the unused
files  from  /tmp
try to find out the vulnerabilities of the
system and suggest actions to improve thedirectory.Install and setup portsentry and
security. In a normal audit, the points belowconfigure  it  to  use  iptables
should be checked, and a report with the
results  of  that  audit  should  be created.to block IPs.Install mod_security and
mod_dosevasive  to  safe  guard
Check intrusion detection. Use chkrootkit or
rkhunter  for  thisapache.Delete files with nouser and
nogroup.Deleted unwanted files/folders in
purpose.Check for known bugs in the softwarehtdocs,  disable  directory
installed  on  the  server  -
indexing.Check for unwanted scripts in
the kernel, openssl, openssh, etc.Scan allroot,  /usr/local,
network ports and find out which ports are
open./var/spool/mbox.Install BFD and FAF for
additional security.Disable open email
Report the ports that should not be open andrelaying.Submit a status report to management
what  program  isdetailing  all  discovered
listening on them.Check whether /tmp isvulnerabilities  and  fixes.
secured.Check for hidden processes.Check for
bad disk blocks in all partitions. (This is12.5 Testing phaseUse tools like nessus,
just  tonikto,  and  nmap  to  do  a penetration test
make sure that the system is reasonablyand see how well your server is secured.
healthy.)Check for unsafe fileAlso do a stress test.Security is of utmost
permissions.Check whether the kernel has aimportance  to  a  server,  compromising
ptrace vulnerability.Check the memory
(Another system health check.)Check if thesecurity is compromising the server itself.
server is an open e-mail relay.Check if theHence, an understanding of the same is a
partitions have enough free space.Check theprerequisite to server ownership and
size of the log files. It's better that theadministration.Blessen works as Executive
log  size remains  in  megabytes.team member in He is an Engineer in Computer
Science from the College of Engineering,
10 How to know if you are being hacked?ToChengannur. He is passionate about Linux
find out if your box is compromised or not,security and looks forward to grow in that
follow  thesefield.



1 A B C D 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 106 107 108 109 110 111 112 113 114