
Via: Medical Billing And Coding
This blog is all about life of being a systems administrator, it highlights the achievements and hurdles of managing small to large systems running on Unix/Linux platforms.

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm # yum install mod_security # vi /etc/httpd/modsecurity.d/modsecurity_crs_10_config.confSecRuleEngine On
5. Turn on other required options and policies as per your requirements. Finally, restart httpd:
# service httpd restart# tail -f /var/log/httpd/error_logThis tutorial is not limited to CentOS only distributions for Debian systems you can use apt-get to intall mod_security or check the site documentation for procedures.
svnadmin lstxns /path/to/repositoryservice ntop start is ran. Starting ntop: Processing file /etc/ntop.conf for parameters...
Mon Aug 3 19:49:38 2009 NOTE: Interface merge enabled by default
Mon Aug 3 19:49:38 2009 Initializing gdbm databases
FATAL ERROR: Unrecognized/unprocessed ntop options...
--user=ntop, --db-file-path=/var/ntop, --use-syslog=local3, --daemon,
run ntop --help for usage information
Common problems:
-B "filter expressions" (quotes are required)
--use-syslog=facilty (the = is required)
FAILED]
Here is the fix for it:/etc/init.d/ntopstart () { echo -n $"Starting $prog: " # daemon $prog -d -L @/etc/ntop.conf daemon $prog @/etc/ntop.conf -d -L -M In addition to this, /etc/ntop.conf needs to be edited and any spaces in the options should be replaced with =.### Sets the user that ntop runs as. ### NOTE: This should not be root unless you really understand the security risks. --user=ntop ### Sets the directory that ntop runs from. --db-file-path=/var/ntop [root@Neptune ~]# service ntop start Starting ntop: Processing file /etc/ntop.conf for parameters... Fri Dec 10 11:09:11 2010 NOTE: Interface merge enabled by default
Fri Dec 10 11:09:11 2010 Initializing gdbm databases [ OK ] Note: There is a pesky error (**ERROR** RRD: Disabled - unable to create directory (err 13, /var/ntop/rrd/graphics), when trying to view network load page. To fix this problem you have to do the following:id:5:initdefault:All other items that were previously handled by /etc/inittab are now in individual files in the /etc/init directory (not to be confused with /etc/init.d, which contains the service scripts). Below you can find a short list of the scripts that are used:/etc/init/rcS.conf | handles system initialization by starting the most fundamental services |
/etc/init/rc.conf | handles starting the individual runlevels |
/etc/init/control-alt-delete.conf | defines what should happen when “control-alt-delete” is pressed |
/etc/init/tty.conf | specify how terminals are to be handled |
AUTOSWAP=noACTIVE_CONSOLES=/dev/tty[1-6]SINGLE=/sbin/sushell/sbin/sushell (the default) which drops you in a root shell after starting single-user mode, or /sbin/sulogin, which launches a login prompt where you have to enter the root password before single user mode can be started.$ cd /tmp
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.1.tar.bz2# tar -xjvf linux-2.6.36.1.tar.bz2 -C /usr/src
# cd /usr/src# apt-get install gcc $ make menuconfigYou have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.$ make$ make modules $ su -
# make modules_install
# make install # cd /boot
# mkinitrd -o initrd.img-2.6.36.1 2.6.36.1* In my case I used mkinitramfs -o initrd.img-2.6.25 (which ever version number of kernel you downloaded)# vi /boot/grub/menu.lsttitle Debian GNU/Linux, kernel 2.6.36.1 Default root (hd0,0) kernel /boot/vmlinuz-2.6.36.1 root=/dev/hdb1 ro initrd /boot/initrd.img-2.6.36.1
savedefault boot
Remember to setup correct root=/dev/hdXX device. Save and close the file. If you think editing and writing all lines by hand is too much for you, try out update-grub command to update the lines for each kernel in /boot/grub/menu.lst file. Just type the command:
# update-grub ... Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.36.1
Found kernel: /vmlinuz-2.6.26-2-686
Updating /boot/grub/menu.lst ... done
# reboot# chkconfig sshd off
# yum erase openssh-server
# apt-get remove openssh-server# service iptables restart
# service ip6tables restart
Protocol 2
AllowUsers root vivek jerry
DenyUsers saroj anjali foo
ClientAliveInterval 300ClientAliveCountMax 0
IgnoreRhosts yes
HostbasedAuthentication no
PermitRootLogin no
Saying "don't login as root" is h******t. It stems from the days when people sniffed the first packets of sessions so logging in as yourself and su-ing decreased the chance an attacker would see the root pw, and decreast the chance you got spoofed as to your telnet host target, You'd get your password spoofed but not root's pw. Gimme a break. this is 2005 - We have ssh, used properly it's secure. used improperly none of this 1989 will make a damn bit of difference. -Bob
Banner /etc/issue
----------------------------------------------------------------------------------------------You are accessing a XYZ Government (XYZG) Information System (IS) that is provided for authorized use only.By using this IS (which includes any device attached to this IS), you consent to the following conditions:ed to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enfo+ The XYZG routinely intercepts and monitors communications on this IS for purposes including, but not limi trcement (LE), and counterintelligence (CI) investigations. + At any time, the XYZG may inspect and seize data stored on this IS.may be disclosed or used for any XYZG authorized purpose. + This IS includes security measures (e.g.,+ Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and authentication and access controls) to protect XYZG interests--not for your personal benefit or privacy. + Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searchingoduct are private and confidential. See User Agreement for details. ------------------------------------------or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work pr----------------------------------------------------
-A RH-Firewall-1-INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 22 -j ACCEPT-A RH-Firewall-1-INPUT -s 202.54.1.5/29 -m state --state NEW -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -s ipv6network::/ipv6mask -m tcp -p tcp --dport 22 -j ACCEPT
pass in on $ext_if inet proto tcp from {192.168.1.0/24, 202.54.1.5/29} to $ssh_server_ip port ssh flags S/SA synproxy state
Port 300ListenAddress 192.168.1.5ListenAddress 202.54.1.5
genpasswd() {local l=$1[ "$l" == "" ] && l=20tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs}
genpasswd 16uw8CnDVMwC6vOKgW
sshd : 192.168.1.2 172.16.23.12
PermitEmptyPasswords no
#!/bin/bashinet_if=eth1ssh_port=22$IPT -I INPUT -p tcp --dport ${ssh_port} -i ${inet_if} -m state --state NEW -m recent --set$IPT -I INPUT -p tcp --dport ${ssh_port} -i ${inet_if} -m state --state NEW -m recent --update --seconds 60 --hitcount 5 -j DROP
$IPT -A INPUT -i ${inet_if} -p tcp --dport ${ssh_port} -m state --state NEW -m limit --limit 3/min --limit-burst 3 -j ACCEPT$IPT -A INPUT -i ${inet_if} -p tcp --dport ${ssh_port} -m state --state ESTABLISHED -j ACCEPT$IPT -A OUTPUT -o ${inet_if} -p tcp --sport ${ssh_port} -m state --state ESTABLISHED -j ACCEPT# another one line example# $IPT -A INPUT -i ${inet_if} -m state --state NEW,ESTABLISHED,RELATED -p tcp --dport 22 -m limit --limit 5/minute --limit-burst 5-j ACCEPT
sshd_server_ip="202.54.1.5"tablepersist block in quick from pass in on $ext_if proto tcp to $sshd_server_ip port ssh flags S/SA keep state (max-src-conn 20, max-src-conn-rate 15/5, overloadflush)
$IPT -N stage1$IPT -A stage1 -m recent --remove --name knock$IPT -A stage1 -p tcp --dport 3456 -m recent --set --name knock2$IPT -N stage2$IPT -A stage2 -m recent --remove --name knock2$IPT -A stage2 -p tcp --dport 2345 -m recent --set --name heaven$IPT -N door$IPT -A door -m recent --rcheck --seconds 5 --name knock2 -j stage2$IPT -A door -m recent --rcheck --seconds 5 --name knock -j stage1$IPT -A door -p tcp --dport 1234 -m recent --set --name knock$IPT -A INPUT -m --state ESTABLISHED,RELATED -j ACCEPT$IPT -A INPUT -p tcp --dport 22 -m recent --rcheck --seconds 5 --name heaven -j ACCEPT$IPT -A INPUT -p tcp --syn -j doo
LogLevel INFO
# Turn on privilege separationUsePrivilegeSeparation yesre home directory and key file permissions StrictModes yes # Turn on# Prevent the use of insec u reverse name checking VerifyReverseMapping yes # Do you need port forwarding?ion is allowed. TheAllowTcpForwarding no X11Forwarding no # Specifies whether password authentica tdefault is yes.ation noPasswordAuthenti c
# /usr/sbin/sshd -t