получаем почту с gmail.com посредством fetchmail с поддержкой ssl

[cce lang=bash]
cd /etc/ssl/certs
wget -O Equifax_Secure_Certificate_Authority.pem \ https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Certificate_Authority.cer –no-check-certificat

root@mx1/etc/ssl/certs> ls -l
total 8
lrwxrwxrwx 1 root wheel 11 Jan 27 2011 40e371fd.0 -> dovecot.pem
-rw-r–r– 1 root wheel 1143 May 21 2011 Equifax_Secure_Certificate_Authority.pem
-rw-r–r– 1 root wheel 1216 Jul 24 2009 dovecot.pem

openssl x509 -in Equifax_Secure_Certificate_Authority.pem -fingerprint -subject -issuer -serial -hash -noout

SHA1 Fingerprint=D2:32:09:AD:23:D3:14:23:21:74:E4:0D:7F:9D:62:13:97:86:63:3A
subject= /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
issuer= /C=US/O=Equifax/OU=Equifax Secure Certificate Authority
serial=35DEF4CF
594f1775

c_rehash .

file 578d5c04.*
578d5c04.0: symbolic link to `Equifax_Secure_Certificate_Authority.pem’
root@mx1/etc/ssl/certs> ls -l
total 8
lrwxr-xr-x 1 root wheel 11 Jan 20 10:49 40e371fd.0 -> dovecot.pem
lrwxr-xr-x 1 root wheel 40 Jan 20 10:49 578d5c04.0 -> Equifax_Secure_Certificate_Authority.pem
-rw-r–r– 1 root wheel 1143 May 21 2011 Equifax_Secure_Certificate_Authority.pem
-rw-r–r– 1 root wheel 1216 Jul 24 2009 dovecot.pem
root@mx1/etc/ssl/certs>

[/cce]

c сертификатом закончили. теперь настраиваем для нужного пользователя .fetchmailrc

[cce lang=bash]

vvs@mx1~> ls -l .fetchmailrc
-rwx—— 1 vvs vvs 1426 Jan 20 10:54 .fetchmailrc
vvs@mx1~>

vvs@mx1~> cat .fetchmailrc
poll imap.gmail.com protocol IMAP
user “xxxx@gmail.com” is vvs@vs.kiev.ua here
password ‘XXXX’
options keep ssl sslfingerprint ’93:2E:0F:BA:58:EA:CD:CB:04:33:97:9D:23:2A:0A:77′ sslcertck sslcertpath /etc/ssl/certs
folder ‘Inbox’
fetchlimit 1
keep
ssl

[/cce]

проверяем

[cce lang = bash]

$fetchmail -v

vvs@mx1~> fetchmail -v
fetchmail: 6.3.20 querying imap.gmail.com (protocol IMAP) at Fri, 20 Jan 2012 11:01:27 +0200 (EET): poll started
Trying to connect to 173.194.66.108/993…connected.
fetchmail: Server certificate:
fetchmail: Issuer Organization: Google Inc
fetchmail: Issuer CommonName: Google Internet Authority
fetchmail: Subject CommonName: imap.gmail.com
fetchmail: imap.gmail.com key fingerprint: 93:2E:0F:BA:58:EA:CD:CB:04:33:97:9D:23:2A:0A:77
fetchmail: imap.gmail.com fingerprints match.
fetchmail: IMAP< * OK Gimap ready for requests from 188.40.73.210 g72if1216268wen.91
fetchmail: IMAP> A0001 CAPABILITY

[/cce]

ну и так делаее. сертификат прошел.

добавляем в crontab

[cce lang=bash]
#crontab -e -u vvs

*/3 * * * * /usr/local/bin/fetchmail -s
[/cce]

 

Оставить комментарий