Archive for the ‘Linux Security’ Category
March 24, 2008
Filed Under (Linux Security) by admin on 24-03-2008
The purpose of syctl hardening is to help prevent spoofing and dos attacks. This short guide will show what I have found to be a good configuration for the sysctl.conf configuration file. The most important of the variables listed below is the enabling of syn cookie protection. Only place the bottom two if you do not want your server to respond to ICMP echo, commonly referred to as ICMP ping or just ping requests. Backup sysctl.conf : # mv /etc/sysctl.conf /etc/sysctl.conf.bak Open to edit the file: # nano -w /etc/sysctl.conf Now paste the following into the file, you can overwrite the current information. #Kernel sysctl configuration file for Red Hat Linux # Disables packet forwarding # Disables IP source routing # Enable IP spoofing protection, turn on source route verification # Disable ICMP Redirect Acceptance # Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets # Disables IP source routing # Enable IP spoofing protection, turn on source route verification # Disable ICMP Redirect Acceptance # Disables the magic-sysrq key # Decrease the time default value for tcp_fin_timeout connection # Decrease the time default value for tcp_keepalive_time connection # Turn off the tcp_window_scaling # Turn off the tcp_sack # Turn off the tcp_timestamps # Enable TCP SYN Cookie Protection # Enable ignoring broadcasts request # Enable bad error message Protection # Log Spoofed Packets, Source Routed Packets, Redirect Packets # Increases the size of the socket queue (effectively, q0). # Increase the tcp-time-wait buckets pool size # Allowed local port range After you make the changes to the file you need to run the commands below to enable the changes without a reboot: # /sbin/sysctl -p # sysctl -w net.ipv4.route.flush=1 Tags: hardening, syctlRelated posts
March 23, 2008
Filed Under (Linux Security) by admin on 23-03-2008
MySQL is one of the most important programs on a server, unfortunately it is also pretty resource intensive. On a server it is not uncommon for a single user or even a query to take up the bulk of the servers CPU cycles. Mytop is a very useful program to see what queries a server is currently processing as well as which user is executing them. Think of mytop as top for mysql. If you see a lot from a user that means they are probably the hog. Mytop can also be useful for figuring out exactly which queries are causing the problem in the case of a self-designed website. The following is how to install mytop on the server and run it. We are going to install 2 perl modules in addition to mytop to ensure that it will work. Install TermReadKey: # cd /usr/local/src Now install DBI: # wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz # wget http://jeremy.zawodny.com/mysql/mytop/mytop-1.4.tar.gz Now simply run “mytop” and your done! Tags: mytopRelated posts
March 23, 2008
Filed Under (Linux Security) by admin on 23-03-2008
Secure and harden your System Configuration File host.conf to prevent DNS lookup poisoning and also provide protection against spoofs. #nano /etc/host.conf Lookup names via DNS first then fall back to /etc/hosts order hosts, bind We don’t have machines with multiple IP addresses on the same card (like Virtual Servers, IP Aliasing) multi off Check for IP address spoofing nospoof on Now type Ctrl+X then hit Y and enter Tags: harden, host.conf, secureRelated posts
March 21, 2008
Filed Under (Linux Security) by admin on 21-03-2008
BFD is a modular shell script for parsing applicable logs and checking for authentication failures. There is not much complexity or detail to BFD yet and likewise it is very straight-forward in its installation, configuration and usage. The reason behind BFD is very simple; the fact there is little to no authentication and brute force auditing programs in the linux community that work in conjunction with a firewall or real-time facility to place bans. BFD is available at: http://www.rfxnetworks.com/bfd.php Note: You must have APF installed first before proceeding to install BFD. # cd /root/downloads or another temporary folder where you store your files. # wget http://www.rfxnetworks.com/downloads/bfd-current.tar.gz # tar -xvzf bfd-current.tar.gz # cd bfd-0.9 Run the install file: ./install.sh You will receive a message saying it has been installed: .: BFD installed Lets edit the configuration file: Enable brute force hack attempt alerts: Find: ALERT_USR=”0″ CHANGE TO: ALERT_USR=”1″ Find: EMAIL_USR=”root” CHANGE TO: EMAIL_USR=”your@yourdomain.com” Save the changes: Ctrl+X then Y Prevent locking yourself out! nano -w /usr/local/bfd/ignore.hosts and add your own trusted IPs Save the changes: Ctrl+X then Y ++++++ BFD uses APF’ cli insert feature and as such will override any allow_hosts.rules entries users have in-place. So be sure to add your trusted ip addresses to the ignore file to prevent Run the program! # /usr/local/sbin/bfd -s Customize your applicatoins brute force configuration. Check out the rules directory in your /usr/local/bfd Tags: bfd, brute force detection, installRelated posts
March 21, 2008
Filed Under (Linux Security) by admin on 21-03-2008
APF is a policy based iptables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteran Linux user and the novice alike. Packaged in tar.gz format and RPM formats, make APF ideal for deployment in many server environments based on Linux. APF is developed and maintained by R-fx Networks: http://www.rfxnetworks.com/apf.php Login to your server through SSH and su to the root user. # cd /root/downloads or another temporary folder where you store your files. # wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz # tar -xvzf apf-current.tar.gz # cd apf-0.9.5-1/ or whatever the latest version is. Run the install file: # ./install.sh You will receive a message saying it has been installed: Installing APF 0.9.5-1: Completed. Installation Details: Other Details: Listening TCP ports: 1,21,22,25,53,80,110,111,143,443,465,993,995,2082,2083,2086,2087,2095,2096,3306 Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options. Lets configure the firewall: We will go over the general configuration to get your firewall running. This isn’t a complete detailed guide of every feature the firewall has. Look through the README and the configuration for an explanation of each feature. We like to use DShield.org’s “block” list of top networks that have exhibited FIND: USE_DS=”0″ Configuring Firewall Ports: Common ingress (inbound) ports #Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD IG_TCP_CPORTS=”21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,3000_3500″ # Common ingress (inbound) UDP ports EG_UDP_CPORTS=”53″ Common egress (outbound) ports # Egress filtering [0 = Disabled / 1 = Enabled] EGF=”1″ # Common egress (outbound) TCP ports EG_TCP_CPORTS=”21,25,80,443,43,2089″ # Common egress (outbound) UDP ports EG_UDP_CPORTS=”20,21,53″ Starting the firewall /usr/local/sbin/apf -s Tags: advanced policy firewall, apf, firewall, securityRelated posts
March 21, 2008
Filed Under (Linux Security) by admin on 21-03-2008
Rootkit scanner is scanning tool to ensure you for about 99.9%* you’re clean of nasty tools. This tool scans for rootkits, backdoors and local exploits by running tests like: - MD5 hash compare ++++++ # wget http://downloads.rootkit.nl/rkhunter-1.2.7.tar.gz # tar -zxvf rkhunter-1.2.7.tar.gz # cd rkhunter # ./installer.sh ++++++ Run a test scan with the following command: /usr/local/bin/rkhunter -c ++++++ Setup a daily scan report? nano /etc/cron.daily/rkhunter.sh Add the following replacing your email address: #!/bin/bash Then give it permissions to run: # chmod +x /etc/cron.daily/rkhunter.sh ++++++ Updating RKhunter: Get the latest database updates from their central server and matches your OS better to prevent false positives. # rkhunter –update Tags: installation, rkhunter, securityRelated posts
March 21, 2008
Filed Under (Linux Security) by admin on 21-03-2008
First off by default Logwatch comes installed on CentOS. It might not be the latest version. This program parses through your server’s logs and reports to you via e-mail on a daily basis with tabulated information. Initial Install: # wget ftp://ftp.kaybee.org/pub/redhat/RPMS/noarch/logwatch-7.3.6-1.noarch.rpm # rpm logwatch-7.3.6-1.noarch.rpm # nano /etc/logwatch/conf/logwatch.conf Insert: MailTo = yourname@yourdomain.com ++++++ To Upgrade: # wget ftp://ftp.kaybee.org/pub/redhat/RPMS/noarch/logwatch-7.3.6-1.noarch.rpm # rpm -Uvh logwatch-7.3.6-1.noarch.rpm ++++++ To complete the process you need to create a cron to run daily: # crontab -e # 0 4 * * * /usr/share/logwatch/scripts/logwatch.pl Tags: 7.3.6, cron, install, logwatch, upgradeRelated posts
March 21, 2008
Filed Under (Linux Security) by admin on 21-03-2008
Changing SSH port to a different port number from the default gives you more security and preventing brute force attacks and potential hackers from hitting directly to the default port. On your linux box login via ssh: # nano /etc/ssh/sshd_config
Now press Ctrl+X then hit Y and enter Now restart ssh by typing: # /etc/init.d/ssh restart Note: Don’t forget to add the port to your firewall. That’s it! Tags: 22, change, Linux HOW TOs, port, sshRelated posts |
|