|
mail server testing notes |
| Note:we now only create home directories on the mail server
for new accounts for "department members" - aka - those who will be
included on the everyone@phas email list. Here's a code snippet from addusr:
# Set up files on mail server (for "everyone" only)
This therefore WILL NOT include the following categories of users: Ugrad, Visitor, System, Misc If a Ugrad or Visitor needs/want to have an email account you just need to log onto the mail server and run the following command: /opt/sysadmin/passwd/make_mailhome <username>
Assuming that the username has already been propagated to the mail server /etc/passwd file. |
Testing SendmailUsing telnet
|
To make sure your sendmail binary is compiled with Milter support just run :You can display class w entries with the following command: echo '$=w' | sendmail -bt -d0.4By default, class w contains localhost, the IP address 127.0.0.1, and the system's IP address(es), fully qualified domain names, and short hostnames. Entries placed in /etc/mail/local-host-names or /etc/mail/sendmail.cw are added to these default values. |
Testing SMTP AUTH connectionshttp://qmail.jms1.net/test-auth.shtml When setting up a mail server, one of the things you should do before you "go live" is to test it- not only to make sure things which should work, do work, but to make sure things which shouldn't work, don't. One of the things to test is whether or not your server correctly supports the AUTH command. This command is used when a remote client wishes to identify themself as an "authenticated" user, normally so that they can use your server as an outbound mail relay. This is very handy for companies with employees who travel, or for ISPs with clients who travel. Find your authentication informationIn order to use the AUTH command, you need to know the base64-encoded version of the userid and password you will be using to authenticate to the server. Normally this would be the same as the userid and password you would use to check your mail using IMAP or POP3. This perl command (which requires the MIME::Base64 module) will do the encoding for you:
% perl -MMIME::Base64 -e 'print
encode_base64("\000jms1\@jms1.net\000not.my.real.password")'
Note: Make sure to use
\0 both as the first character of what you're
encoding, and as the separator between the userid and the password.
There was an error with the original version of these directions- I had
forgotten about needing a \0 at the beginning.
Sorry
all!
Another reader pointed out that perl silently interprets the "@" sign in the middle of a string and replaces it with the contents of an array with that name, if one exists... or with nothing, if not. I just did a full two-way test with my real password, and it turns out if you don't put a backslash in front of the "@" sign it won't work. Good call. And JT Justman pointed out that if you use \0
as the
separator, and the userid or password happens to start with a digit,
perl will try to find and use a three-digit octal character code
instead
of a one-digit null byte with two normal digits behind it. Using
\000 instead of just \0
prevents
this from happening.
Connecting to the serverDepending on how the server is configured, you may need to use SSL or TLS before you are able to use the AUTH command. In fact, if you are able to use the AUTH command without using either SSL or TLS, you are in fact sending your userid and password over the internet in clear text. Anybody with a packet sniffer in the right spot will be able to read the base64-encoded string you send to authenticate, and it's really easy to decode that stuff- in fact the same command above will work if you change "encode_base64" to "decode_base64" (and put the encoded string between the double quotes, obviously.)
Make sure the server supports AUTHWhen you first connect to an SSL or TLS server, you will see the key-exchange information fly by on the screen, and the last line you see when it stops scrolling text will be the server's "banner" message, which tells the client that the server is ready to accept commands. For a non-secured connection, the first thing you see will be the banner. When the banner is received, a normal SMTP client would send an EHLO command to the server in order to identify the client machine, as well as ask for a list of the capabilities supported by the server. If you are using an openssl command to connect to an SSL or TLS server, make sure to enter your SMTP commands in lowercase as shown here. The openssl "s_client" command watches what you type- if you send a line of text starting with a capital "R", it will re-key the SSL layer instead of sending your command to the server... and if you send a line of text which starts with a capital "Q", it will terminate the SSL connection and exit.
220 a.mx.jms1.net NO UCE ESMTP Look at the response from your EHLO command, make sure AUTH is on the list, and that PLAIN is one of the options it supports. If it's not listed, the server will not let you send an AUTH command. This may be because the connection is not secured and the server is protecting you from sending your authentication information across the net in plain text... Sending the AUTH commandAssuming the server supports AUTH, we will send the actual AUTH command to try and authenticate.
AUTH PLAIN AGptczFAam1zMS5uZXQAbm90Lm15LnJlYWwucGFzc3dvcmQ= If you see this message, you are authenticated. If you see this one instead...
AUTH PLAIN AGptczFAam1zMS5uZXQAbm90Lm15LnJlYWwucGFzc3dvcmQ= ... then obviously it means you are not authenticated. If you were not able to authenticate, you can try another AUTH PLAIN command- although if the server is logging the traffic or running an intrusion detection system, having multiple AUTH commands in a single SMTP session is enough to raise a red flag. Be careful not to ban your test client's IP address. Sending the messageOnce you are authenticated, you may continue with a normal SMTP conversation and the server should accept any message from you, whether you are relaying to an outside domain or not. Even if you don't authenticate, the server will still accept messages from you- it just won't relay (it will act the same as if you had never entered an AUTH command at all.)
mail from: <nospam@jms1.net> |
| Testing IMAPD |
IMAPD Testing
[root@mail root]# telnet localhost 143 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] localhost.localdomain IMAP4rev1 2003.338rh at Thu, 27 Sep 2007 14:34:47 -0700 (PDT) A01 CAPABILITY * CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS BINARY UNSELECT SCAN SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND LOGIN-REFERRALS STARTTLS AUTH=LOGIN A01 OK CAPABILITY completed A02 LOGOUT * BYE mail.phas.ubc.ca IMAP4rev1 server terminating connection A02 OK LOGOUT completed Connection closed by foreign host. |
| Testing pop |
[root@mail ~]# telnet localhost pop3 +OK dovecot ready. user johndoe +OK pass password +OK Logged in. list +OK 1 messages: 1 622 . retr 1 +OK 622 octets Return-Path: |
| Testing TLS - 17-06-09, rdp |
rap@ada:~$ openssl s_client -starttls smtp -crlf -connect smtp.phas.ubc.ca:587
CONNECTED(00000003)
depth=3 C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority
verify return:1
depth=2 C = US, ST = Arizona, L = Scottsdale, O = "GoDaddy.com, Inc.", CN = Go Daddy Root Certificate Authority - G2
verify return:1
depth=1 C = US, ST = Arizona, L = Scottsdale, O = "GoDaddy.com, Inc.", OU = http://certs.godaddy.com/repository/, CN = Go Daddy Secure Certificate Authority - G2
verify return:1
depth=0 OU = Domain Control Validated, CN = *.phas.ubc.ca
verify return:1
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=*.phas.ubc.ca
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
1 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
2 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
3 s:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFIzCCBAugAwIBAgIHKzArIl0lbDANBgkqhkiG9w0BAQsFADCBtDELMAkGA1UE
BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMS0wKwYDVQQLEyRodHRwOi8vY2VydHMu
Z29kYWRkeS5jb20vcmVwb3NpdG9yeS8xMzAxBgNVBAMTKkdvIERhZGR5IFNlY3Vy
ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjAeFw0xNDA0MTQyMjQwMDVaFw0x
ODA4MTIxNzMxMTdaMDsxITAfBgNVBAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRl
ZDEWMBQGA1UEAwwNKi5waGFzLnViYy5jYTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBAK+T9PRn9qAtaKB1DjS7uw6xzUIhJX5YD6zsEog9M2PB7s6t7TqW
LqT2l/aJAIZKLZnalmJMoR2b0u8Cl8hjAhMaWW1dLeQsLp4N8LQat6xPUTICS8I1
3IYrAj8cqW2vTfZC8HORa4mMnh/yqD9AiXJc9Zu7/XCYE4yYaqhhpLXHUDM8HeDI
ek4I2SslSkoYW1P396PUSZPZ7veHMhVZpaZpCJ60P4Ci04Rg0U1FqpxCb3/RPRXC
uChcOYRolYOnbOj6fZ/kkDQMR0T5g1Vp0m+PEyLpOOfXWC/ZP45sUU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US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
---
Acceptable client certificate CA names
/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certs.godaddy.com/repository//CN=Go Daddy Secure Certificate Authority - G2
/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./CN=Go Daddy Root Certificate Authority - G2
/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
Client Certificate Types: RSA fixed DH, DSS fixed DH, RSA sign, DSA sign, ECDSA sign
Requested Signature Algorithms: RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA224:DSA+SHA224:ECDSA+SHA224:RSA+SHA1:DSA+SHA1:ECDSA+SHA1
Shared Requested Signature Algorithms: RSA+SHA512:DSA+SHA512:ECDSA+SHA512:RSA+SHA384:DSA+SHA384:ECDSA+SHA384:RSA+SHA256:DSA+SHA256:ECDSA+SHA256:RSA+SHA224:DSA+SHA224:ECDSA+SHA224:RSA+SHA1:DSA+SHA1:ECDSA+SHA1
Peer signing digest: SHA512
Server Temp Key: DH, 2048 bits
---
SSL handshake has read 6652 bytes and written 566 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : DHE-RSA-AES256-GCM-SHA384
Session-ID: 9718FC75BD24A59CA9AB5F1EA7CC2582FA6E2A489AB06E8C36E81064DA2906AF
Session-ID-ctx:
Master-Key: E7FF56EA1089736F70A6C87DDF16314AA3E531CA52DE71BE57F7CBD3841ADDCD32D79163067C568DED2111CED9A971AB
Key-Arg : None
Krb5 Principal: None
PSK identity: None
PSK identity hint: None
TLS session ticket lifetime hint: 1 (seconds)
TLS session ticket:
0000 - 29 05 8b 3c fd cc 73 a9-98 a0 9d f2 9f ad 94 5b )..<..s........[
0010 - ab 6f f8 70 9b 16 44 e5-50 53 d2 64 fe 28 37 6f .o.p..D.PS.d.(7o
0020 - 87 88 bc 28 de b7 ca c0-ad b4 a5 c8 19 c1 3a 91 ...(..........:.
0030 - 17 61 8f dc ad 17 6f 73-e3 1e 48 0a 4f 94 ea 07 .a....os..H.O...
0040 - 7c 35 10 c7 91 5e 45 42-df 67 2e 72 a2 03 17 99 |5...^EB.g.r....
0050 - 0d 42 57 f6 f3 fd 2e 16-e0 9a a7 8e 1c bf 6a 1b .BW...........j.
0060 - b8 8d 39 b7 25 e1 01 96-b8 4a a5 7d cf 32 ad 99 ..9.%....J.}.2..
0070 - 25 33 a2 a7 e5 e4 df 34-30 96 ed 02 57 c9 d8 9d %3.....40...W...
0080 - 46 58 78 d1 e4 ad ad a8-46 dd 27 04 5f 12 05 51 FXx.....F.._..Q
0090 - eb 72 3c ac f9 d2 be 4c-9a 7c 24 7b 89 73 be 91 .r<....L.|${.s..
Start Time: 1497046301
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
250 HELP
ehlo localhost
250-mail.phas.ubc.ca Hello ada.phas.ubc.ca [142.103.235.80], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-AUTH DIGEST-MD5 CRAM-MD5 LOGIN PLAIN
250-DELIVERBY
250 HELP
QUIT
DONE
|
| Testing POP3 TLS/SSL |
|
This is a followup to Juliet Kemp's excellent
Troubleshooting Linux Servers with telnet article.
This is adapted from the aging but still-excellent
Linux Cookbook. Telnet does not support any encryption. If you are protecting your POP3 sessions with TLS/SSL then you need s_client, which is part of OpenSSL. You can query both local and remote mail servers, using your own server names of course. Commands that you type are in bold:
$ openssl s_client -connect localhost.com:995 You'll see a whole lot of lines about certificates and protocols, and eventually something like this:
---
Now we know we're talking to a Dovecot server. Dovecot supports both secure POP3 and secure IMAP. Now I can give Dovecot my login. Note that if you enter an invalid username it won't tell you, but will still say +OK:
Let's see if I have any messages: list
Yay, two messages for me! Use the retr command to read them:
retr 1
Hello Little Carla,
We're having a little get-together this weekend and hope you can come.
Bring your fabulous chicken skewers.
Love,
To read the second message type retr 2. To delete messages type dele followed by the message number, for example dele 1. Messages are not really deleted until you type quit, so you can change your mind and un-delete with the rset command, which un-deletes all messages marked for deletion.
You may need to use the domain name on a remote server to log in, for example
user carla@example.com. RFC 1939 contains a complete listing of POP3 commands.
|
| Testing IMAP TLS/SSL |
| This is how to talk to an IMAP server over TLS/SSL. Again, commands that you type are in bold, and remember to use your own server name and login:
$ openssl s_client -connect localhost.com:993 login carla password
Hurrah, we're in! Now let's list mailboxes: a002 list "" "*"
And let's see what's in the Inbox:
a003 examine inbox
There are ten messages; let's read the body of the fourth one without the headers: a004 4 rfc822.text
I hear there is going to be food this weekend-- may I come?
Thanks!
a005 OK Fetch completed.
I'm bored with reading email this way, so it's time to go:
a005 logout
There are many different commands for listing messages, and reading headers and selected headers. Read all about them in RFC 3501.
|
| HBA |
ID |
LUN |
Vendor |
Product |
| 0 |
7 |
0 |
LSI |
LSI 1030 [ 402] 1000E00 |
| 0 |
8 |
0 |
IBM |
32P0032a S320 1 1 |
| 1 |
7 |
0 |
LSI |
LSI 1030 [ 402] 1000E00 |
DISASTER RECOVERY
|
[root@mail root]# df -h |
Installation Notes
|
[root@mail root]# df -h |
For more assistance contact
Ron Parachoniak, rap@phas.ubc.ca ( Sysadmin )
| webmaster@phas.ubc.ca | [Dept. Home Page] | last
updated: June 28, 2005 |