Archive for the tag 'server'

How to use a custom mirror for Parallels Updates Server

If you already have your Parallels Updates Server mirror setup.

Then on the hardware node, edit the file defining the repository URL.

The file for editing is /vz/template/[os]/[os-version]/[platform]/config/app/[app-template-name]/default/repositories.

For example:

/vz/template/[os]/[os-version]/[platform]/config/app/plesk10.0/default/repositories

Replace the Parallels Updates server URLs with the corresponding ones of your mirror and save the file.

Clean or re-fetch the packages metadata.

For Example

vzpkg clean

How to find open sockets on your Linux server

Here we will look into lsof - list open file, and Nmap (“Network Mapper”)

Nmap is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts.

There are a number of methods that you can use to show open sockets at least:

lsof -U will list open sockets

nmap -sT -sU localhost will scan your local machine for open TCP or UDP ports

$ sudo nmap -sT -sU localhost

Starting Nmap 4.68 ( http://nmap.org ) at 2010-11-15 06:54 IST
Interesting ports on localhost (127.0.0.1):
Not shown: 3201 closed ports
PORT STATE SERVICE
123/udp open|filtered ntp
5353/udp open|filtered zeroconf

Nmap done: 1 IP address (1 host up) scanned in 4.003 seconds

netstat -a | grep LISTEN will show all listening sockets.

Nmap has lots of options, so we are going to focus on only some of them.

sudo nmap -sS -O 127.0.0.1

-sS
TCP SYN scan
-O
Enable Operating System detection

SBDavid

Check the most IP connect to server

Check the most IP connect to server

netstat -an | grep :80 | awk ‘{print $5}’ | sed -e s/’:.*’/”/g | sort | uniq -c

or

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

or

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

Block an IP from access to your server with IPtable

Use the command netstat -n command to see the IP addresses connected to your server. Once you have found the IP address you want to block you can use the following below command to block them from accessing your server using iptables.

-I INPUT 1 means to insert the rule at the top of the INPUT table (which means it will get looked at first)

-s IP-ADDRESSS is the source address of the packets we want to deal with

-j DROP means dump the packets into the void, and forget they ever happened.

iptables -I INPUT 1 -s IP-ADDRESSS -j DROP

Installing PostgreSQL on Your cPanel/WHM Server

cPanel requires PostgreSQL 7.3.x or later.

First step is to update cpanel using /scripts/upcp from command line while logged in as root. If you have PostgreSQL 7.2.x installed, back up your databases using pg_dumpall.

Move your existing PostgreSQL data directory somewhere else by, for example, typing the following command:

mv /var/lib/pgsql /var/lib/pgsql.old

Type the following command:

/scripts/installpostgres

From WHM now select Postgres Config in the SQL Services section of WHM. Type a new PostgreSQL password in the text box and click Change Password.

« Prev - Next »