How to test a POP server by using telnet
What you need
The host name of the POP server (for use in the telnet command)
The POP user name (for use in the USER command)
The user’s POP password (for use in the PASS command)
Encryption
For added security, you can encrypt your POP connection. This requires that your server supports SSL or TLS and that you have access to an SSL/TLS client program, for example OpenSSL, to use instead of telnet.
As the port number normally is 995, an example OpenSSL command would be openssl s_client -connect pop.example.com:995 -quiet. (If you would like to see the public key of the server, as well as some other encryption-related information, omit -quiet.) The server should then start a POP session, displaying a greeting such as the +OK InterMail POP3 server ready example below.
What to do
The DELE command flags messages for deletion. Use it only if you want to delete mail.
The initial telnet: > symbolises your shell prompt.
telnet: > telnet pop.example.com pop3
telnet: Trying 192.0.2.2...
telnet: Connected to pop.example.com.
telnet: Escape character is '^]'.
server: +OK InterMail POP3 server ready.
client: USER MyUsername
server: +OK please send PASS command
client: PASS MyPassword
server: +OK MyUsername is welcome here
client: LIST
server: +OK 1 messages
server: 1 1801
server: .
client: RETR 1
server: +OK 1801 octets
server: Return-Path: sender@example.com
server: Received: from client.example.com ([192.0.2.1])
server: by mx1.example.com with ESMTP
server: id <20040120203404.CCCC18555.mx1.example.com@client.example.com>
server: for <recipient@example.com>; Tue, 20 Jan 2004 22:34:24 +0200
server: From: sender@example.com
server: Subject: Test message
server: To: recipient@example.com
server: Message-Id: <20040120203404.CCCC18555.mx1.example.com@client.example.com>
server:
server: This is a test message.
server: .
client: DELE 1
server: +OK
client: quit
server: +OK MyUsername InterMail POP3 server signing off.
[ 發表回應 ] ( 8預覽 ) | 常註連結 | ( 2.9 / 990 )
Ref: Grig Gheorghiu(2012), http://agiletesting.blogspot.hk/2012/03 ... e-and.html
I first saw nsupdate mentioned on the devops-toolchain mailing list as a tool for dynamically updating DNS zone files from the command line. Since this definitely beats manual editing of zone files, I'd thought I'd give it a try. My setup is BIND 9 on Ubuntu 10.04. I won't go into the details of setting up BIND 9 on Ubuntu -- see a good article about this here. More...
[ 發表回應 ] ( 36預覽 ) | 常註連結 | ( 2.9 / 1590 )
crontab -e
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/bin/php /opt/mailscanner_sql_blockip.php
#!/usr/local/bin/php
<?php
$linkptr = mysql_pconnect ("192.168.50.172","mailwatch","");
mysql_select_db("mailscanner",$linkptr);
$accessfile = "/etc/mail/access";
$sql = "SELECT clientip FROM `maillog` WHERE `sascore` >=10 and `timestamp` > DATE_ADD(now() ,INTERVAL -5 MINUTE) group by clientip ORDER BY INET_ATON(clientip)";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$sql = "SELECT `ipaddress` FROM`ac_blockip` WHERE `ipaddress`= '".$row['clientip']."'";
$resulttemp = mysql_query($sql);
list($r_ipaddress) = mysql_fetch_row($resulttemp);
mysql_free_result($resulttemp);
if ($r_ipaddress == $row['clientip']) {
$sql = "UPDATE ac_blockip SET score=(score + 1),`timeout`=DATE_ADD( now() ,INTERVAL (score*24) HOUR),`status`='B' where ipaddress='".$row['clientip']."'";
mysql_query($sql,$linkptr);
} else {
$sql = "INSERT INTO `ac_blockip`(`ipaddress`, `score`, `timeout`, `status`) VALUES ('".$row['clientip']."',1,DATE_ADD( now() ,INTERVAL 24 HOUR),'B')";
mysql_query($sql,$linkptr);
}
}
mysql_free_result($result);
$sql = "UPDATE `ac_blockip` SET `timeout`=0,`status`='R' where `status` = 'B' and `timeout` < now()";
mysql_query($sql,$linkptr);
$sql = "SELECT `ipaddress` FROM `ac_blockip` where status = 'B'";
$result = mysql_query($sql);
$temp = "";
$fh = fopen($accessfile, 'w') or die("can't open file");
while ($row = mysql_fetch_assoc($result)) {
$temp1 = $row['ipaddress']."\t550 Address invalid\n";
fwrite($fh, $temp1);
}
fclose($fh);
mysql_free_result($result);
system('/usr/sbin/makemap dbm /etc/mail/access < /etc/mail/access');
?>
[ 發表回應 ] ( 77預覽 ) | 常註連結 | ( 3 / 1973 )
#!/usr/local/bin/php
<?php
$host = "localhost";
$user = "mailwatch";
$pass = "";
$db = "mailscanner";
$linkptr = mysql_pconnect ($host,$user,$pass);
mysql_select_db($db,$linkptr);
$DATENOW="-3 MONTH";
$QUERY_DELETE="DELETE FROM maillog WHERE timestamp <= DATE_ADD(DATE_FORMAT(NOW(),'%Y-%m-%d'),INTERVAL $DATENOW);";
$QUERY_REPAIR="REPAIR TABLE maillog ";
mysql_query($QUERY_DELETE,$linkptr);
mysql_query($QUERY_REPAIR,$linkptr);
?>
[ 發表回應 ] ( 18預覽 ) | 常註連結 | ( 3 / 1974 )
# svcadm disable smtp:sendmail
# cd /lib/svc/method
# cp smtp-sendmail smtp-sendmail.orig
# {Editor} smtp-sendmail <- use your Editor Program.
----------------
Find
----------------
$SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
----------------
Modify
----------------
OPTIONS="-OPrivacyOptions=noetrn -ODeliveryMode=queueonly -OQueueDirectory=/var/spool/mqueue.in"
$SENDMAIL $MODE -q$QUEUEOPTION$QUEUEINTERVAL $OPTIONS &
----------------
Save
----------------
# svcadm enable smtp:sendmail
[ 發表回應 ] ( 60預覽 ) | 常註連結 | ( 2.9 / 2090 )