Test SMTP communication with OpenSSL

We can use the openssl command to have the verification of SMTP sever connectivity over TLS

$ openssl s_client -connect smtpserver.mailprovider.com:25 -starttls smtp

 
CONNECTED(00000004)
depth=3 C = SE, O = AddTrust AB, OU = AddTrust External TTP Network, CN = AddTrust External CA Root
verify error:num=19:self signed certificate in certificate chain
---
Certificate chain
 0 s:/C=US/postalCode=160030/ST=Chandigarh/L=Chandigarh/street=Chandigarh/O=OrgName, Inc./OU=Messaging/OU=Hosted by OrgName/OU=Multi-Domain SSL/CN=securemail.mailprovider.com
   i:/C=GB/ST=Greater Chandigarh/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Organization Validation Secure Server CA
 1 s:/C=GB/ST=Greater Chandigarh/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
 2 s:/C=GB/ST=Greater Chandigarh/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Organization Validation Secure Server CA
   i:/C=GB/ST=Greater Chandigarh/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Certification Authority
 3 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
---
Server certificate
-----BEGIN CERTIFICATE-----
Wj/FMdFEvIbYGHUVUtPswhcJR5jvJQuiP9h/lFgCYcKG/Fa1QZ9/53Cp0tUrZoTd
UrwYlpZA+2CnAgMBAAGjggRZMIIEVTAfBgNVHSMEGDAWgBSa8yvaz61Pti+7KkhI
KhK3G0LBJDAdBgNVHQ4EFgQUutI6MN0OGTTOt77BXbWvuWY2sZcwDgYDVR0PAQH/
MH0wVQYIKwYBBQUHMAKGSWh0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NPTU9ET1JT
QU9yZ2FuaXphdGlvblZhbGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcnQwJAYIKwYB
BQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTCCARQGA1UdEQSCAQswggEH
cm92aWRlci5jb22CF214NC5tZXNzYWdlcHJvdmlkZXIuY29tghdteDUubWVzc2Fn
ZXByb3ZpZGVyLmNvbYIXbXg2Lm1lc3NhZ2Vwcm92aWRlci5jb22CF214Ny5tZXNz
-----END CERTIFICATE-----
subject=/C=US/postalCode=160030/ST=Chandigarh/L=Chandigarh/street=Chandigarh/O=OrgName, Inc./OU=Messaging/OU=Hosted by OrgName/OU=Multi-Domain SSL/CN=securemail.mailprovider.com
issuer=/C=GB/ST=Greater Chandigarh/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Organization Validation Secure Server CA
---
No client certificate CA names sent
---
SSL handshake has read 6842 bytes and written 558 bytes
---
New, TLSv1/SSLv3, Cipher is AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : AES256-SHA
    Session-ID: 87077B0F0737A1FF5FF042D484800DD0C70DD24125E88812C5A4EC37BA8DE607
    Session-ID-ctx:
    Master-Key: 4D538CD6FA48143912C634BE3EE36ADFC8D6CBEECAB3D43A2C45E5F31B7B43422A21C5CDA1DE12B0A9DA33C541B6D530
    Key-Arg   : None
    SRP username: None
    TLS session ticket lifetime hint: 300 (seconds)
    TLS session ticket:
    0000 - 33 d7 ad 86 5d b1 a7 0a-97 36 72 43 cc aa e8 0c   3...]....6rC....
    0010 - f0 3b 17 39 e4 c7 81 1d-f7 36 f4 ff 04 19 f7 9e   .;.9.....6......
    0020 - a6 16 6b 21 33 b7 eb d3-54 50 b8 3a 2f 72 cb bf   ..k!3...TP.:/r..
    0030 - 31 44 7d 53 73 86 df a0-72 a9 90 5c 73 c9 0c 46   1D}Ss...r..\s..F
    0040 - c8 4b 79 be 86 a7 ae a0-23 1c 43 e5 fd ef a0 cc   .Ky.....#.C.....
    0050 - 49 e3 df e8 0f 2b fa 7d-9d 8b 7c de 20 a4 fc 6f   I....+.}..|. ..o
    0060 - 95 7e 37 e0 15 f9 a6 e6-34 3d da 7a 40 5f ba f7   .~7.....4=.z@_..
    0070 - 92 2d 03 89 5d 17 f5 28-85 fa 02 e0 50 cc 01 83   .-..]..(....P...
    0080 - 3d 77 2c 1f ef e8 2c 9b-31 68 d5 6d 9a ff e0 dd   =w,...,.1h.m....
    0090 - cf 43 86 fa 02 07 e0 d8-c8 d7 d3 e0 db 6d f8 ce   .C...........m..

    Start Time: 1545224851
    Timeout   : 300 (sec)
    Verify return code: 19 (self signed certificate in certificate chain)
---
250 STARTTLS

500 5.5.1 Command unrecognized: ""
quit
221 2.0.0 mx4.mailprovider.com Closing connection
closed
Advertisements

What is the purpose of sudo in Linux?

sudo is an abbreviation of “super user do” and is a Linux command that allows programs to be executed as a super user (aka root user) or another user. It’s basically the Linux/Mac equivalent of the runas command in Windows.

Chmod Permissions Explained

There are four OCTAL (0..7) digits, which control the file permissions. But often, only three are used. If you use 600 it equals 0600. The missing digit is appended at the beginning of the number. Each of three digits described permissions. Position in the number defines to which group permissions do apply!

Permissions:
1 – can execute
2 – can write
4 – can read

The octal number is the sum of those free permissions, i.e.
3 (1+2) – can execute and write
6 (2+4) – can write and read

Position of the digit in value:
1 – what owner can
2 – what users in the file group(class) can
3 – what users not in the file group(class) can

Examples:
chmod 600 file – owner can read and write
chmod 700 file – owner can read, write and execute
chmod 666 file – all can read and write
chmod 777 file – all can read, write and execute

Reference: http://en.wikipedia.org/wiki/Filesystem_permissions