|
@@ -5655,28 +5655,74 @@ function configure_imap {
|
5655
|
5655
|
sed -i 's/auth_mechanisms =.*/auth_mechanisms = plain login/g' /etc/dovecot/conf.d/10-auth.conf
|
5656
|
5656
|
sed -i 's|mail_location =.*|mail_location = maildir:~/Maildir:LAYOUT=fs|g' /etc/dovecot/conf.d/10-mail.conf
|
5657
|
5657
|
|
5658
|
|
- # enable login via client certs
|
5659
|
|
- # http://strange.systems/certificate-based-auth-with-dovecot-sendmail/
|
5660
|
|
- #sed -i 's|#auth_ssl_require_client_cert =.*|auth_ssl_require_client_cert = yes|g' /etc/dovecot/conf.d/10-auth.conf
|
5661
|
|
- #sed -i 's|#auth_ssl_username_from_cert =.*|auth_ssl_username_from_cert = yes|g' /etc/dovecot/conf.d/10-auth.conf
|
5662
|
|
- #sed -i 's|#ssl_ca =.*|ssl_ca = /etc/ssl/certs/dovecot-ca.pem|g' /etc/dovecot/conf.d/10-ssl.conf
|
5663
|
|
- #sed -i 's|#ssl_cert_username_field =.*|ssl_cert_username_field = commonName|g' /etc/dovecot/conf.d/10-ssl.conf
|
5664
|
|
- #if ! grep -q "passdb {" /etc/dovecot/conf.d/10-auth.conf; then
|
5665
|
|
- #echo '' >> /etc/dovecot/conf.d/10-auth.conf
|
5666
|
|
- #echo 'passdb {' >> /etc/dovecot/conf.d/10-auth.conf
|
5667
|
|
- #echo ' driver = passwd-file' >> /etc/dovecot/conf.d/10-auth.conf
|
5668
|
|
- #echo ' args = /etc/dovecot/passwd-file' >> /etc/dovecot/conf.d/10-auth.conf
|
5669
|
|
- #echo ' deny = no' >> /etc/dovecot/conf.d/10-auth.conf
|
5670
|
|
- #echo ' master = no' >> /etc/dovecot/conf.d/10-auth.conf
|
5671
|
|
- #echo ' pass = no' >> /etc/dovecot/conf.d/10-auth.conf
|
5672
|
|
- #echo '}' >> /etc/dovecot/conf.d/10-auth.conf
|
5673
|
|
- #fi
|
5674
|
|
- #echo "$MY_USERNAME:{plain}::::::nopassword" > /etc/dovecot/passwd-file
|
5675
|
|
- #freedombone-addcert -h dovecot-ca --ca
|
5676
|
5658
|
service dovecot restart
|
5677
|
5659
|
echo 'configure_imap' >> $COMPLETION_FILE
|
5678
|
5660
|
}
|
5679
|
5661
|
|
|
5662
|
+function configure_imap_client_certs {
|
|
5663
|
+ if grep -Fxq "configure_imap_client_certs" $COMPLETION_FILE; then
|
|
5664
|
+ return
|
|
5665
|
+ fi
|
|
5666
|
+ # http://strange.systems/certificate-based-auth-with-dovecot-sendmail/
|
|
5667
|
+ sed -i 's|#auth_ssl_require_client_cert =.*|auth_ssl_require_client_cert = yes|g' /etc/dovecot/conf.d/10-auth.conf
|
|
5668
|
+ sed -i 's|#auth_ssl_username_from_cert =.*|auth_ssl_username_from_cert = yes|g' /etc/dovecot/conf.d/10-auth.conf
|
|
5669
|
+ sed -i 's|#ssl_ca =.*|ssl_ca = /etc/ssl/certs/dovecot-ca.crt|g' /etc/dovecot/conf.d/10-ssl.conf
|
|
5670
|
+ sed -i 's|#ssl_cert_username_field =.*|ssl_cert_username_field = commonName|g' /etc/dovecot/conf.d/10-ssl.conf
|
|
5671
|
+ if ! grep -q "passdb {" /etc/dovecot/conf.d/10-auth.conf; then
|
|
5672
|
+ echo '' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5673
|
+ echo 'passdb {' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5674
|
+ echo ' driver = passwd-file' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5675
|
+ echo ' args = /etc/dovecot/passwd-file' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5676
|
+ echo ' deny = no' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5677
|
+ echo ' master = no' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5678
|
+ echo ' pass = no' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5679
|
+ echo '}' >> /etc/dovecot/conf.d/10-auth.conf
|
|
5680
|
+ fi
|
|
5681
|
+ # make a CA cert
|
|
5682
|
+ if [ ! -f /etc/ssl/private/dovecot-ca.key ]; then
|
|
5683
|
+ freedombone-addcert -h dovecot-ca --ca
|
|
5684
|
+ fi
|
|
5685
|
+ # CA configuration
|
|
5686
|
+ echo '[ ca ]' > /etc/ssl/dovecot-ca.cnf
|
|
5687
|
+ echo 'default_ca = dovecot-ca' >> /etc/ssl/dovecot-ca.cnf
|
|
5688
|
+ echo '' >> /etc/ssl/dovecot-ca.cnf
|
|
5689
|
+ echo '[ crl_ext ]' >> /etc/ssl/dovecot-ca.cnf
|
|
5690
|
+ echo 'authorityKeyIdentifier=keyid:always' >> /etc/ssl/dovecot-ca.cnf
|
|
5691
|
+ echo '' >> /etc/ssl/dovecot-ca.cnf
|
|
5692
|
+ echo '[ dovecot-ca ]' >> /etc/ssl/dovecot-ca.cnf
|
|
5693
|
+ echo 'new_certs_dir = .' >> /etc/ssl/dovecot-ca.cnf
|
|
5694
|
+ echo 'unique_subject = no' >> /etc/ssl/dovecot-ca.cnf
|
|
5695
|
+ echo 'certificate = /etc/ssl/certs/dovecot-ca.crt' >> /etc/ssl/dovecot-ca.cnf
|
|
5696
|
+ echo 'database = ssldb' >> /etc/ssl/dovecot-ca.cnf
|
|
5697
|
+ echo 'private_key = /etc/ssl/private/dovecot-ca.key' >> /etc/ssl/dovecot-ca.cnf
|
|
5698
|
+ echo 'serial = sslserial' >> /etc/ssl/dovecot-ca.cnf
|
|
5699
|
+ echo 'default_days = 3650' >> /etc/ssl/dovecot-ca.cnf
|
|
5700
|
+ echo 'default_md = sha256' >> /etc/ssl/dovecot-ca.cnf
|
|
5701
|
+ echo 'default_bits = 2048' >> /etc/ssl/dovecot-ca.cnf
|
|
5702
|
+ echo 'policy = dovecot-ca_policy' >> /etc/ssl/dovecot-ca.cnf
|
|
5703
|
+ echo 'x509_extensions = dovecot-ca_extensions' >> /etc/ssl/dovecot-ca.cnf
|
|
5704
|
+ echo '' >> /etc/ssl/dovecot-ca.cnf
|
|
5705
|
+ echo '[ dovecot-ca_policy ]' >> /etc/ssl/dovecot-ca.cnf
|
|
5706
|
+ echo 'commonName = supplied' >> /etc/ssl/dovecot-ca.cnf
|
|
5707
|
+ echo 'stateOrProvinceName = supplied' >> /etc/ssl/dovecot-ca.cnf
|
|
5708
|
+ echo 'countryName = supplied' >> /etc/ssl/dovecot-ca.cnf
|
|
5709
|
+ echo 'emailAddress = optional' >> /etc/ssl/dovecot-ca.cnf
|
|
5710
|
+ echo 'organizationName = supplied' >> /etc/ssl/dovecot-ca.cnf
|
|
5711
|
+ echo 'organizationalUnitName = optional' >> /etc/ssl/dovecot-ca.cnf
|
|
5712
|
+ echo '' >> /etc/ssl/dovecot-ca.cnf
|
|
5713
|
+ echo '[ dovecot-ca_extensions ]' >> /etc/ssl/dovecot-ca.cnf
|
|
5714
|
+ echo 'basicConstraints = CA:false' >> /etc/ssl/dovecot-ca.cnf
|
|
5715
|
+ echo 'subjectKeyIdentifier = hash' >> /etc/ssl/dovecot-ca.cnf
|
|
5716
|
+ echo 'authorityKeyIdentifier = keyid:always' >> /etc/ssl/dovecot-ca.cnf
|
|
5717
|
+ echo 'keyUsage = digitalSignature,keyEncipherment' >> /etc/ssl/dovecot-ca.cnf
|
|
5718
|
+ echo 'extendedKeyUsage = clientAuth' >> /etc/ssl/dovecot-ca.cnf
|
|
5719
|
+ touch /etc/ssl/ssldb
|
|
5720
|
+ echo 0001 > /etc/ssl/sslserial
|
|
5721
|
+ freedombone-clientcert -u $MY_USERNAME
|
|
5722
|
+ service dovecot restart
|
|
5723
|
+ echo 'configure_imap_client_certs' >> $COMPLETION_FILE
|
|
5724
|
+}
|
|
5725
|
+
|
5680
|
5726
|
function configure_gpg {
|
5681
|
5727
|
if grep -Fxq "configure_gpg" $COMPLETION_FILE; then
|
5682
|
5728
|
return
|
|
@@ -9153,6 +9199,7 @@ configure_email
|
9153
|
9199
|
create_procmail
|
9154
|
9200
|
spam_filtering
|
9155
|
9201
|
configure_imap
|
|
9202
|
+configure_imap_client_certs
|
9156
|
9203
|
configure_gpg
|
9157
|
9204
|
encrypt_incoming_email
|
9158
|
9205
|
encrypt_outgoing_email
|