A quick and usefull command for checking if a server is
under ddos is:
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Linux System Admin Blog….
A quick and usefull command for checking if a server is
under ddos is:
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
cPHulk Brute Force Protection prevents malicious forces from trying to access your server’s services by guessing the login password for that service. BUT sometimes it becomes troublesome when you are accessing the cPanel with incorrect password and cPanel assuming you as attacker blocks you with below message :
—————————————————————————————
This account is currently locked out because a brute force attempt was detected. Please wait 10 minutes and try again. Attempting to login again will only increase this delay. If you frequently experience this problem, we recommend having your username changed to something less generic.
—————————————————————————————
To get out of such situation you can disable cphulkd protection :
login via ssh and disable cphulkd using the command below.
# /usr/local/cpanel/bin/cphulk_pam_ctl –disable
This should allow you to login to WHM and double check your cphulk settings.
You can view IP addresses that have been blocked via the WHM interface: WHM -> Security -> Security Center -> cPHulk Brute Force Protection in the Brutes table. On that screen, you can also customize brute force protection settings.
Flush DB will remove all blocked IPs:
WHM >> Security Center >> cPHulk Brute Force Protection >> Click on Flush DB
Well the other way to this is to remove the IP’s blocked by cPHulk from its database .
ssh to the server login as root and type the following at the prompt
[root@server:] mysql
mysql> use cphulkd;
mysql>BACKUP TABLE brutes TO ‘/path/to/backup/directory’;
mysql> SELECT * FROM brutes WHERE `IP`=’xxx.xxx.xxx.xxx’;
mysql> DELETE FROM brutes WHERE `IP`=’xxx.xxx.xxx.xxx’;
mysql>quit
🙂
First, boot the system with the first Linux CD, when you see boot prompt, type linux rescue to switch to rescue mode. Here, you will be asked if similar steps should be followed, which need to be followed in the installation.
At the prompt, type the next command:
# chmod /mnt/sysImage
# locate grub.conf
# nano /path/to/grub.conf (Edit the grub.conf file and remove the passwd line from the file)
This usually happens when you are trying to change a password while the root filesystem (or wherever /etc is) is mounted read-only, for example when you booted up using the init trick, or in some maintenance mode (runlevel, usually).
You can mount a filesystem read-write using:
APPLIES TO:
Plesk Database can be accessed by following steps below depending on the database provider are configured in current Plesk installation.
For MSSQL provider:
Database can be accessed using the following CLI command:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn\osql –E
Or Microsoft SQL Server Management Studio Express utility can be used.
For MySQL DB provider:
Execute the following commands in command prompt:
cd %plesk_dir%\Databases\MySQL\bin
mysql -P8306 -uadmin -p psa
For MS Access DB provider (JET):
You can find and use any utility for viewing MS Access(.mdb) database files:
E.g.
http://www.alexnolan.net/software/mdb_viewer_plus.htm
http://www.softpedia.com/get/Internet/Servers/Database-Utils/MDB-View.shtml
Plesk Database file is located in %plesk_dir%\admin\db\psa.mdb
When trying to restart named process after making modifications may end up in a corrupt rndc.key key and the error will show like this:
Sep 12 03:30:54 server named[23683]: loading configuration: bad base64 encoding
Sep 12 03:30:54 server named[23683]: exiting (due to fatal error)
A simple explanation to this is that the key got modified somehow might me some bug.
What to do about this? Well it is simple just check the /etc/rndc.conf file and copy the key from there(you will see the key in the first lines of the file) and replace the key that it is in /etc/rndc.key file and restart named process.
# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
The Linux kernel, since version 2.0, has included the capabilities to act as a firewall. In those days, the kernel module was called ipfwadm and was very simple. With the 2.2 kernel, the firewall module became called ipchains and had greater capabilities than its predecessor. Today, we have IPTables, the firewall module in the kernel since the 2.4 days. IPTables was built to take over ipchains, and includes improvements that now allow it to compete against some of the best commercial products available in the market. This guide will give you some background on IPTables and how to use it to secure your network.
Getting to know some important terminology
IPTables can be used in three main jobs: NAT, Packet Filtering, and Routing.
A word on tables
There are three table types: filter, NAT, and mangle.
The importance of chains…
There are three built-in chains that are part of IPTables.
Every chain in IPTables is either user-defined or built-in and will have a default policy, which can be either ACCEPT or DROP. ACCEPT and DROP will be discussed in the next section.
Packet targets
IPTables has targets which denotes what happens to all packets. There are four built-in targets:
For the most part I will be using ACCEPT and DROP targets for the sake of simplicity. These two targets are also more than enough to create your firewall rules. Please note that while there are predefined chains, they can also be a user-defined.
NAT, one IP for them all
NAT is one of the best tricks for networking; it allows one IP address to be used by many computers so they can all access the internet. NAT on your network would work through the rewriting the packet by changing the source IP address to read your internet IP address as it passes out of your network. When a packet needs to return to the source, the packet’s destination IP address is changed back to the computer’s IP address inside your network. For example, if your computer with an IP address of 192.168.1.2 needed to get to Google, whose IP address is 216.239.57.99, the NAT firewall would change 192.168.1.2 to something like 64.199.1.83 and would then be passed throught the internet to Google. When Google sends a response, the IP address is changed from 64.199.1.83 to 192.168.1.2 and is received at your computer inside the network.
To write IPTables rules you will need to open a command prompt, but there are some graphical apps to help you out. One application that makes writing IPTables rules simple is Firestarter for GNOME. KDE users can benefit from an application like knetfilter.
Some notes on IPTables syntax
IPTables chain syntax can be confusing, particularly for beginners, but once you have the basics down, anyone can learn to write their own firewall rules; be patient, it just takes time. It took me about 3 months to figure out how to write a rule to block ICMP packets which are used to ping computers. IPTables syntax looks like this: iptables -t filter -A INPUT -p icmp -i eth0 -j DROP.
The next two rules are going to do the work of blocking connections not originating from inside your network.
iptables -A FORWARD -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -m state –state ESTABLISHED,RELATED -j ACCEPT
The -m state –state ESTABLISHED,RELATED was used to match the state of the packet coming in via eth0 (your ethernet device) and if the packet matches, then the packet is accepted. The -m is used to match on a specific option. Some possible options are -m limit –limit which looks for a limited rate, -m tos –tos used to match the TOS IP header field on a packet, -m unclean which is used to match packets that look “suspicious”.
The next rule is going to do source NAT, which will allow your network to connect using one IP address.
iptables -t nat -A POSTROUTING -o eth0
Depending on if you have a Static IP or Dynamic IP you would type: -j SNAT –to-source 1.2.3.4 for Static IP, and -j MASQUERADE for Dynamic IP at the end of the above code. As a bonus, i’ll tell you how to do destination NAT, which will allow you to put a server behind the firewall at the expense of security.
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport www -j DNAT –to-dest 192.168.1.2
The –dport www denotes that the destination port is port 80. You can use text like www (port 80) or ftp (port 21) or simply use port numbers. The -j DNAT part of the rule is the target, similar to -j DROP or -j ACCEPT in previous examples. –to-dest 192.168.1.2 tells IPTables where you want the packet to go. –sport 8080 is just like –dport www.
For three years i have writen my own firewall rules. IPTables saved my computer from MyDoom and Sasser worms/viruses. Hopefully, now you too can write your own firewall rules. IPTables is a usefull tool in the Linux user’s tool belt, for protecting Linux and Windows computers.
Make program default editor for a file type
Shift-right-click on a file of a type; this forces the ‘open with’. Click ‘Choose program’, find it, and select the checkbox that tells windows to always open files of this type.
Change IE ‘view source’ program
Folder:
has a default key that is the path to a program, e.g.
Add to context menu for all files
Run regedit. Create the key:
…if it doesn’t exist. Choose a name that doesn’t exist under it, e.g. Notepad2, and create that as key, and a key under it called ‘command’:
HKEY_CLASSES_ROOT\*\shell\Notepad2\command
Make the default value under the first what you want to appear in the menu and the second what you want it to run, e.g.
and
“C:\Program Files\Notepad2\Notepad2.exe” “%1”
…respectively.
Q. How do I verify that my ISP or my own recursive resolvers are free from DNS cache poisoning bug that is promised full disclosure of the flaw by Dan on August 7 at the Black Hat conference? How do I test my dns server for DNS cache pollution or DNS Cache Poisoning bug?
A. DNS cache poisoning (also known as DNS cache pollution) is a maliciously created or unintended situation that provides data to a Domain Name Server that did not originate from authoritative DNS sources. It occur if DNS “spoofing attack” has been encountered. An attacker will send malicious data / non-secure data in response to a DNS query. For example dns query for www.linuxbabu.net can be redirected to www.redhat.com.
Visit Dan Kaminsky java script page to check your DNS
You can also use following command dig command, enter:$ dig +short @{name-server-ip} porttest.dns-oarc.net txt
Sample output:
$ dig +short @ns1.example.com porttest.dns-oarc.net txt
$ dig +short @208.67.222.222 porttest.dns-oarc.net txt
z.y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a.pt.dns-oarc.net.
"208.67.222.222 is GOOD: 26 queries in 0.1 seconds from 26 ports with std dev 17746.18"
Another test,$ dig +short @125.22.47.125 porttest.dns-oarc.net txt
Output:
z.y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a.pt.dns-oarc.net.
"125.22.47.139 is POOR: 42 queries in 8.4 seconds from 1 ports with std dev 0.00"
FIX :
Run yum updateyum update
Open named.conf file and comment out following two lines:query-source port 53;
Make sure recursion is limited to your LAN only. Set ACL. Restart bind to take effect:
query-source-v6 port 53;rndc reload
service named restart
set the system time from the hardware clock
============================================
root@s1 [~]# /sbin/hwclock –hctosys
root@s1 [~]#
set the hardware clock to the current system time
============================================
root@s1 [~]# /sbin/hwclock –systohc
root@s1 [~]#
root@s1 [~]# /sbin/hwclock –help
hwclock – query and set the hardware clock (RTC)
Usage: hwclock [function] [options…]
Functions:
–help show this help
–show read hardware clock and print result
–set set the rtc to the time given with –date
–hctosys set the system time from the hardware clock
–systohc set the hardware clock to the current system time
–adjust adjust the rtc to account for systematic drift since
the clock was last set or adjusted
–getepoch print out the kernel’s hardware clock epoch value
–setepoch set the kernel’s hardware clock epoch value to the
value given with –epoch
–version print out the version of hwclock to stdout
Options:
–utc the hardware clock is kept in coordinated universal time
–localtime the hardware clock is kept in local time
–directisa access the ISA bus directly instead of /dev/rtc
–badyear ignore rtc’s year because the bios is broken
–date specifies the time to which to set the hardware clock
–epoch=year specifies the year which is the beginning of the
hardware clock’s epoch value
–noadjfile do not access /etc/adjtime. Requires the use of
either –utc or –localtime