Difference between revisions of "OPS345 Lab 7"

From CDOT Wiki
Jump to: navigation, search
Line 2: Line 2:
 
* webmail
 
* webmail
  
* dovecot installed in previous lab
+
* can't use the same keys generated in www lab, they're for the wrong FQDN
* use the same keys generated in www lab:
+
<source>
* scp -P 2212 -i keys/ssh/ops345-all-aws-machines.pem keys/asmith15.ops345.ca.* andrew@34.202.103.43:~
+
andrew@p51:~/prog/seneca/ops345/new$ sudo su -
* [root@email andrew]# cp asmith15.ops345.ca.cert.pem /etc/pki/tls/certs/
+
root@p51:~# certonly --manual --preferred-challenges dns
* [root@email andrew]# cp asmith15.ops345.ca.key.pem /etc/pki/tls/private/
+
certonly: command not found
 +
root@p51:~# certbot certonly --manual --preferred-challenges dns
 +
Saving debug log to /var/log/letsencrypt/letsencrypt.log
 +
Plugins selected: Authenticator manual, Installer None
 +
Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c'
 +
to cancel): email.asmith15.ops345.ca
 +
Obtaining a new certificate
 +
Performing the following challenges:
 +
dns-01 challenge for email.asmith15.ops345.ca
 +
 
 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 +
NOTE: The IP of this machine will be publicly logged as having requested this
 +
certificate. If you're running certbot in manual mode on a machine that is not
 +
your server, please ensure you're okay with that.
 +
 
 +
Are you OK with your IP being logged?
 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 +
(Y)es/(N)o: y
 +
 
 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 +
Please deploy a DNS TXT record under the name
 +
_acme-challenge.email.asmith15.ops345.ca with the following value:
 +
 
 +
PdK1vlZnYMdBO7untofSCkfXH2ejk3EE019R7A90x7Q
 +
 
 +
Before continuing, verify the record is deployed.
 +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 +
Press Enter to Continue
 +
Waiting for verification...
 +
Cleaning up challenges
 +
 
 +
IMPORTANT NOTES:
 +
- Congratulations! Your certificate and chain have been saved at:
 +
  /etc/letsencrypt/live/email.asmith15.ops345.ca/fullchain.pem
 +
  Your key file has been saved at:
 +
  /etc/letsencrypt/live/email.asmith15.ops345.ca/privkey.pem
 +
  Your cert will expire on 2022-02-28. To obtain a new or tweaked
 +
  version of this certificate in the future, simply run certbot
 +
  again. To non-interactively renew *all* of your certificates, run
 +
  "certbot renew"
 +
- If you like Certbot, please consider supporting our work by:
 +
 
 +
  Donating to ISRG / Let's Encrypt:  https://letsencrypt.org/donate
 +
  Donating to EFF:                   https://eff.org/donate-le
 +
 
 +
root@p51:~# cp /etc/letsencrypt/live/email.asmith15.ops345.ca/cert.pem ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.cert.pem
 +
root@p51:~# cp /etc/letsencrypt/live/email.asmith15.ops345.ca/privkey.pem ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.key.pem
 +
root@p51:~# chown andrew ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.*
 +
</source>
 
* configure postfix to enable encrypted connections from client software. add this to the bottom of main.cf:
 
* configure postfix to enable encrypted connections from client software. add this to the bottom of main.cf:
 
<source># Settings to enable secure SMTP via STARTTLS using my key and certificate:
 
<source># Settings to enable secure SMTP via STARTTLS using my key and certificate:
Line 18: Line 66:
 
smtpd_tls_loglevel = 1</source>
 
smtpd_tls_loglevel = 1</source>
 
* test with telnet/EHLO: should say 250-STARTTLS
 
* test with telnet/EHLO: should say 250-STARTTLS
*
+
* dovecot installed in previous lab, it needs very little configuration for our simple setup
 +
* /etc/dovecot/dovecot.conf:
 +
* Modify the protocols option so that Dovecot will work with IMAP connections, no POP3 or LMTP.
 +
* 10-ssl.conf:
 +
** ssl_cert = </etc/pki/tls/certs/asmith15.ops345.ca.cert.pem
 +
** ssl_key = </etc/pki/tls/private/asmith15.ops345.ca.key.pem
 +
* ss should show port 993, no 995 or 110
 +
* there's no iptables running on email, so just open port 993 in ops345sgemail
 +
* configure thunderbird:
 +
** IMAP: email.asmith15.ops345.ca, SSL 993, normal password
 +
** SMTP: email.asmith15.ops345.ca, STARTTLS 25, normal password

Revision as of 04:18, 30 November 2021

  • dovecot with imaps
  • webmail
  • can't use the same keys generated in www lab, they're for the wrong FQDN
andrew@p51:~/prog/seneca/ops345/new$ sudo su -
root@p51:~# certonly --manual --preferred-challenges dns
certonly: command not found
root@p51:~# certbot certonly --manual --preferred-challenges dns
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c'
to cancel): email.asmith15.ops345.ca
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for email.asmith15.ops345.ca

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.email.asmith15.ops345.ca with the following value:

PdK1vlZnYMdBO7untofSCkfXH2ejk3EE019R7A90x7Q

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/email.asmith15.ops345.ca/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/email.asmith15.ops345.ca/privkey.pem
   Your cert will expire on 2022-02-28. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

root@p51:~# cp /etc/letsencrypt/live/email.asmith15.ops345.ca/cert.pem ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.cert.pem
root@p51:~# cp /etc/letsencrypt/live/email.asmith15.ops345.ca/privkey.pem ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.key.pem
root@p51:~# chown andrew ~andrew/prog/seneca/ops345/new/keys/email.asmith15.ops345.ca.*
  • configure postfix to enable encrypted connections from client software. add this to the bottom of main.cf:
# Settings to enable secure SMTP via STARTTLS using my key and certificate:
smtpd_tls_auth_only = no
smtpd_use_tls = yes
smtp_use_tls = yes
smtpd_tls_key_file = /etc/ssl/private/vm2.andrewsmith.ops.key
smtpd_tls_cert_file = /etc/ssl/certs/vm2.andrewsmith.ops.crt
smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem
tls_random_source = dev:/dev/urandom
smtpd_tls_loglevel = 1
  • test with telnet/EHLO: should say 250-STARTTLS
  • dovecot installed in previous lab, it needs very little configuration for our simple setup
  • /etc/dovecot/dovecot.conf:
  • Modify the protocols option so that Dovecot will work with IMAP connections, no POP3 or LMTP.
  • 10-ssl.conf:
    • ssl_cert = </etc/pki/tls/certs/asmith15.ops345.ca.cert.pem
    • ssl_key = </etc/pki/tls/private/asmith15.ops345.ca.key.pem
  • ss should show port 993, no 995 or 110
  • there's no iptables running on email, so just open port 993 in ops345sgemail
  • configure thunderbird:
    • IMAP: email.asmith15.ops345.ca, SSL 993, normal password
    • SMTP: email.asmith15.ops345.ca, STARTTLS 25, normal password