August 1, 2008 by devenix
DESC:
When I send a message now to a user on my server from an outside account.
I am getting this from qmail.
OBSERVATION:
You are probably forwarding mail to yourself.
SOLUTION:
Check your /var/qmail/control/smtproutes file to make sure you are not
sending mail to a relay which is sending back to you, and also look at
your forwarding files, .qmail, .qmail-default etc.
Tags: qmail
Posted in mail servers | 1 Comment »
July 14, 2008 by devenix
Resolution
Remove the trailing character from the recipient’s email address in the Address Book or in the To field.
example :
if ur sending to abc@example.com , you may be mistakenly using email address as abc@example.com. , a trailing dot can make this error to happen.
Tags: dns error
Posted in dns | 1 Comment »
July 9, 2008 by devenix
Allow incoming DNS request at port 53
Use following rules only if you are protecting dedicated DNS server.
SERVER_IP is IP address where BIND(named) is listing on port 53 for incoming DNS queries.
Please note that here I’m not allowing TCP protocol as I don’t have secondary DNS server to do zone transfer.
SERVER_IP=”123.108.230.184″
iptables -A INPUT -p udp -s 0/0 –sport 1024:65535 -d $SERVER_IP –dport 53 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -s $SERVER_IP –sport 53 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -s 0/0 –sport 53 -d $SERVER_IP –dport 53 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -s $SERVER_IP –sport 53 -d 0/0 –dport 53 -m state –state ESTABLISHED -j ACCEPT
Hope it is easy to write iptables rule for a dns server
Tags: dns, iptables
Posted in dns | Leave a Comment »
July 1, 2008 by devenix
Hi ,
M back,
while installing the cpan modules for perl , i was getting the above error.
so following below solution worked out for it.
Use the cpan command-line tool. This can also be invoked via the command
perl -MCPAN -e shell
In the shell, type
install <packagename>
where <packagename> is something like Time::HiRes or Tk.
If it hangs for ages whilst trying to download files over FTP, or get errors like
LWP failed with code[400] message[FTP return code 150]
then try setting the FTP_PASSIVE environment variable before running cpan:
export FTP_PASSIVE=1
Tags: cpan, Perl
Posted in Perl | 3 Comments »
June 26, 2008 by devenix
Just try this.
To use it:
- Create a file named /etc/init.d/firewall
- Copy and paste the script into it and save
- Edit the ALLOWED variable with port numbers you want to allow, default is ports 22 (SSH) and 80 (HTTP)
- Execute:
touch /usr/local/etc/whitelist.txt && touch /usr/local/etc/blacklist.txt
- Edit the whitelist/blacklist files if you want
- Execute:
chmod 755 /etc/init.d/firewall
- Execute:
chkconfig --add firewall && chkconfig firewall on
The script:
#!/bin/bash
# chkconfig: 345 30 99
# description: Starts and stops iptables based firewall
## List Locations
#
WHITELIST=/usr/local/etc/whitelist.txt
BLACKLIST=/usr/local/etc/blacklist.txt
#
## Specify ports you wish to use.
#
ALLOWED="22 80 25"
#
## Specify where IP Tables is located
#
IPTABLES=/sbin/iptables
##
#DO NOT EDIT BELOW THIS LINE
###
RETVAL=0
# To start the firewall
start() {
echo "Setting up firewall rules..."
echo 'Allowing Localhost'
#Allow localhost.
$IPTABLES -A INPUT -t filter -s 127.0.0.1 -j ACCEPT
#
## Whitelist
#
for x in `grep -v ^# $WHITELIST | awk '{print $1}'`; do
echo "Permitting $x..."
$IPTABLES -A INPUT -t filter -s $x -j ACCEPT
done
#
## Blacklist
#
for x in `grep -v ^# $BLACKLIST | awk '{print $1}'`; do
echo "Denying $x..."
$IPTABLES -A INPUT -t filter -s $x -j DROP
done
#
## Permitted Ports
#
for port in $ALLOWED; do
echo "Accepting port TCP $port..."
$IPTABLES -A INPUT -t filter -p tcp --dport $port -j ACCEPT
done
for port in $ALLOWED; do
echo "Accepting port UDP $port..."
$IPTABLES -A INPUT -t filter -p udp --dport $port -j ACCEPT
done
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A INPUT -p udp -j DROP
$IPTABLES -A INPUT -p tcp --syn -j DROP
RETVAL=0
}
# To stop the firewall
stop() {
echo "Removing all iptables rules..."
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
RETVAL=0
}
case $1 in
start)
stop
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
/sbin/iptables -L
/sbin/iptables -t nat -L
RETVAL=0
;;
*)
echo "Usage: firewall {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
Tags: centos firewall, firewall, iptables
Posted in Linux | Leave a Comment »
June 19, 2008 by devenix
If you have ever typed something into a command prompt that you wished you hadn’t – you may find it useful to know that you can delete it from ~/.bash_history very easily.
The command:
- history -d offset
will delete the history entry at position offset.
# history
1 cd
2 history
3 ls -alhF
4 history
5 wget username:password@private.ftp.com/secret/file.tar.gz
6 history
so to delete the wget command (which contains a password) – just use:
history -d 5
# history -d 5
# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history
But suppose you KNOW you’re about to enter a command you don’t want to go into history. It’d be nice if you could just tack a little “hideme” modifer onto the front or tail of your command and be done with it. Unfortunately from what I’ve been able to google there is no such feature built into history or bash.
Naturally I made one.
TMP=$(history | tail -1 | awk ‘{print $1}’) && history -d $TMP && \
paste_in_shell_and_replace_this_with_whatever_you_want_to_hide
Rather than holding down backspace, you may find it useful to know that in bash Ctrl-W will delete from the cursor to the beginning of the previous word. Or if you think you’re going to use it A LOT you may try to put a little function/alias into your .bashrc:
func_hide ()
{
TMP=$(history | tail -1 | awk ‘{print $1}’) && history -d $TMP
}
alias hideme=’func_hide’
Dig the sneaky:
# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history
8 vi .bashrc
9 history
# hideme && mysecretcommand
# history
1 cd
2 history
3 ls -alhF
4 history
5 history
6 history -d 5
7 history
8 vi .bashrc
9 history
10 history
Tags: Bash
Posted in Linux | 3 Comments »
June 18, 2008 by devenix
If you forgot root password for your MySQL server, you can follow the steps below to reset it.
1. Login to the server as root and stop MySQL service.
# /etc/init.d/mysqld stop
2. Start mysqld_safe service.
# mysqld_safe –skip-grant-tables &
3. Login to MySQL server now. It won’t ask you for a password.
# mysql -u root
4. Set up a new MySQL root user password:
mysql> use mysql;
mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD”) where User=’root‘;
mysql> flush privileges;
mysql> quit
5. Restart your MySQL service.
# /etc/init.d/mysqld restart
6. Try to login using new password. It should work fine.
# mysql -u root -p
That’s it !!!
Tags: Mysql
Posted in Mysql | Leave a Comment »
June 18, 2008 by devenix
If you want to redirect a domain to some other url, you can use the PHP script below.
index.php
—————————————-
<?php
header(”Location: http://destination-domain.com/where-you-want-to-redirect/index.html”);
exit();
?>
—————————————-
So, when you take http://your-domain.com or http://your-domain.com/index.php it will be redirected to “http://destination-domain.com/where-you-want-to-redirect/index.html”.
Tags: PHP Programming
Posted in scripts | Leave a Comment »
June 18, 2008 by devenix
Steps to configure OutLook Email client
+++++++++++++++++++++++++++++
1. Click “Tools” -> “Email Accounts” on the menu bar.
2. Select “Add a new e-mail account” and click “Next”.
3. Select “POP3″ and click “Next”.
4. Enter your name and email address under “User Information”.
5. Under “Logon Information”, enter the username and password you use to login to the mail server. MAKE SURE to put the domain at the end of the username — e.g. “user@domain.com” and not just “user”.
6. Check “Remember password” if desired.
7. Under “Server Information”, enter the mailserver in both the POP3 and SMTP fields.
8. Click “More Settings…”.
9. Open the tab “Outgoing Server”. Check the box that says “My outgoing server (SMTP) requires authentication”, and make sure that “Use same settings as my incoming mail server” is selected beneath that.
10. Click “OK”, then “Next”, and then “Finish”.
Tags: OutLook email client
Posted in mail servers | Leave a Comment »
June 18, 2008 by devenix
Steps to configure configure Outlook Express.
+++++++++++++++++++++++++++++++++
1) Launch Outlook Express
2) Click Tools>>Accounts.
3) In the “Internet Accounts Windows” click Add >> Mail.
4) Fill in your username and Click Next.
5) Fill in your email address and Click Next.
6) On the “Email Servers Name” page, fill in the server information.
“My incoming mail server is a POP3 server.”
“Incoming Mail server”: –> Fill in with your mail server name.
“Outgoing mail server”: –> Fill in with your mail server name.
Now, Click Next.
7) In the account name field enter your e-mail address (name@domain.com) and the password below. Click Next.
8)Click Finish.
Now,
9) Take Tools >> Accounts >> Properties >> Servers
Enable the “My server requires authentication” option and click Apply
10) Click the Advanced tab,
Enable the “Leave a copy of messages on the server” option and click Apply.
Now Outlook Express must be configured for you to send and receive mails.
Posted in mail servers | Leave a Comment »