Posts

Nmap on Linux

Nmap is a very powerful tool with lots of options and features to visualize your network. Check which services are running on various hosts and find suspicious malicious programs running in your network. Even though Nmap is the swiss-army knife for network scanning, most of its benefits can be gained by the average Network Administrator without diving deep in to its complications. Chances are, most of the time you will find yourself using common switches even if you know all of them. The basic syntax for Nmap is: nmap 192.168.0.1 the above command scans the given host with defaults - standard TCP connect method (-sT option) and known ports (those specified in the /etc/services file. You may need to scan a whole subnet, in which case you can use: nmap 192.168.0.1/24 nmap 192.168.0.* both the command would do the same here. One of the simplest scan methods that I come up with almost every day is the Ping Scan: nmap -sP 192.168.0.1 Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2...

Setting Mail Server with Qmail on Fedora 3 part6

26. Installing Qqtrap # cd /home/vpopmail # mkdir -p qtrap/logs # cd qtrap # cp /downloads/qmailrocks/scripts/qtrap/qtrap-2.0.0 ./qtrap.sh # vi qtrap.sh whitelist_check () { case $WHITELIST in address@somewhere.com|address@somewhereelse.com|*entiredomain.com) echo $SENDER found in whitelist on `date "+%D %H:%M:%S"` >> /home/vpopmail/qtrap/logs/qtrap.log exit 0;; *) ;; esac } checkall () { case $BANNED_WORDS in porn|PORN|Sex|SEX) printout $BANNED_WORDS echo MESSAGE DROPPED from $SENDER because of $BANNED_WORDS on `date "+%D %H:%M:%S"` >> /home/vpopmail/qtrap/logs/qtrap.log exit 99;; *) ;; esac } # touch /home/vpopmail/qtrap/logs/qtrap.log # chown -R vpopmail:vchkpw /home/vpopmail/qtrap # chmod -R 755 /home/vpopmail/qtrap # cd /home/vpopmail/domains/yourdomain.com # vi .qmail-default | /home/vpopmail/qtrap/qtrap.sh | /home/vpopmail/bin/vdelivermail '' delete 27. Maintaining your qmail server Starting Courier-imap on boot - make sure the following 2...

Setting Mail Server with Qmail on Fedora 3 part5

21. Installing Squirrelmail # tar zxvf squirrelmail-1.4.4.tar.gz # mv squirrelmail-1.4.4 /var/www/html/webmail # mkdir /var/sqattachements # chown -R apache:apache /var/sqattachements # cd /var/www/html/webmail # chown -R apache:apache data # cd config # ./conf.pl General ------- 1. Domain : 1.2.3.4 (Enter the IP of your server here. Don't be an idiot and actually use 1.2.3.4) 2. Invert Time : false 3. Sendmail or SMTP : SMTP IMAP Settings -------------- 4. IMAP Server : localhost 5. IMAP Port : 143 6. Authentication type : login 7. Secure IMAP (TLS) : false 8. Server software : other 9. Delimiter : detect SMTP Settings ------------- 4. SMTP Server : localhost 5. SMTP Port : 25 6. POP before SMTP : false 7. SMTP Authentication : login 8. Secure SMTP (TLS) : false try to open in your browser http://www.yourdomain.com/webmail Username: postmaster@smiert.org Password: your_password # cd /var/www/html/webmail/plugins # tar zxvf change_pass-2.7-1.4.x.tar.gz # cd /var/www/html/webmail//c...

Setting Mail Server with Qmail on Fedora 3 part4

16. Starting Qmail # /downloads/qmailrocks/scripts/util/qmr_inst_check # qmailctl stop # qmailctl start # qmailctl stat You should see an output like this: /service/qmail-send: up (pid 29956) 2 seconds /service/qmail-send/log: up (pid 29960) 2 seconds /service/qmail-smtpd: up (pid 29963) 2 seconds /service/qmail-smtpd/log: up (pid 29968) 2 seconds /service/qmail-pop3d: up (pid 29971) 2 seconds /service/qmail-pop3d/log: up (pid 29972) 2 seconds messages in queue: 0 messages in queue but not yet preprocessed: 0 Congratulations, Qmail is now officially up and running and you should be able to send and receive mail on the server. Let's test your new server's POP3 service... telnet localhost 110 you should see something like this: Trying 192.168.1.10... Connected to 192.168.1.10. Escape character is '^]'. +OK user postmaster@smiert.org +OK pass your_password +OK list +OK 1 323 (there's your message!) . quit +OK Connection closed by foreign host. And now let's test yo...

Setting Mail Server with Qmail on Fedora 3 part3

11. Installing Vqadmin Vqadmin is simply a nice web based interface that will let us manage Vpopmail. Through the interface we can create new domains, new users, net quotas, enable services and much more. # cd /downloads/qmailrocks # tar zxvf vqadmin-2.3.6.tar.gz # cd vqadmin-2.3.6 # ./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html # make && make install-strip Vqadmin should install itself in the cgi-bin directory of your default website. Now you will need to add the following to your server's Apache configuration file (httpd.conf) # vi /etc/httpd/conf/httpd.conf deny from all Options ExecCGI AllowOverride AuthConfig Order deny,allow Within the Apache master config file you have to set the "AllowOveride" option to "All". Example: AllowOverride All # cd /var/www/cgi-bin/vqadmin Now you will want to create a .htaccess file to password protect the Vqadmin interface. # vi .htaccess AuthType Basic AuthUserFile /var/www/cgi-bin/.h...

Setting Mail Server with Qmail on Fedora 3 part2

6. Building the daemontools # cd /package/admin/daemontools-0.76 You will need to patch daemontools with an additional errno patch: # cd /package/admin/daemontools-0.76/src # patch # cd /package/admin/daemontools-0.76 # package/install 7. Checking qmail itself installation # ps ax you should see the daemon "svscanboot" running. If you see "svscanboot" running, you're in good shape. 8. Installing ezmlm as mailing list add-on to Qmail # cd /downloads/qmailrocks/ # tar zxvf ezmlm-0.53-idx-0.41.tar.gz # cd ezmlm-0.53-idx-0.41 # make && make setup 9. Setting up autorespond for mailboxes. # cd /downloads/qmailrocks # tar zxvf autorespond-2.0.5.tar.gz # cd autorespond-2.0.5 # make && make install 10. Installing vpopmail Vpopmail allows us to do virtual domain mail hosting. When used with mysql, all domain information (domain name, email users, passwords etc.) are all stored in a handy mysql database. The actual mail messages are NOT stored in the databa...

Setting Mail Server with Qmail on Fedora 3 part1

1. Getting the package and setting up environtment for installation Make a work directory # mkdir /downloads Change directory to working directory # cd /downloads Copy qmailrocks package to working directory # cp {dir package source}/qmailrocks.tar.gz . Extract this package # tar zxvf qmailrocks.tar.gz 2. Executing additional script Executing script for pre-installation # /downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script Executing script for patching qmail # /downloads/qmailrocks/scripts/util/qmail_big_patches.script 3. Building Qmail # cd /usr/src/qmail/qmail-1.03 # make man && make setup check # ./config-fast mail.smiert.org 4. Setting up secure certificate Generate a secure certificate that will be used to encrypt your server's TLS encrypted SMTP sessions... # make cert Here's a sample of my cert configs. Country Name (2 letter code) [GB]:ID State or Province Name (full name) [Berkshire]:West Java Locality Name (eg, city) [Newbury]:Bandung Organizatio...