Решил таки вернуться к stunnel. Удобно тем что в почтовую прогу влазить не придеться а зашифровать передачу данных можно и это просто.
Может кому- то пригодиться.
И так коротенько ...
-----------------
Обновляем порты
Ставим stunnel
Код: Выделить всё
cd /usr/ports/security/stunnel
make && make install && make cert && make clean
галочки оставляем поумолчанию - только PTHREAD
make cert - необходим для того чтобы сразу создать сертефикаты,
хотя можно интсалить и так
правим конфиги, права на папки, файлы а потом make clean
В последнем случае напишет следующее:
Код: Выделить всё
To create and install a new certificate, type "make cert"
And don't forget to check out the FAQ at http://www.stunnel.org/
что мы и делаем
в результате получаем сертификат
Код: Выделить всё
**************************************************************************
The new certificate will be saved into /usr/local/etc/stunnel/stunnel.pem
**************************************************************************
который находиться по указанному пути.
Далее правим сам конфиг, у меня он получился такой
cat /usr/local/etc/stunnel/stunnel.conf
Код: Выделить всё
; Sample stunnel configuration file by Michal Trojnara 2002-2006
; Some options used here may not be adequate for your particular configuration
; Please make sure you understand them (especially the effect of chroot jail)
; Certificate/key is needed in server mode and optional in client mode
;cert = /usr/local/etc/stunnel/stunnel.cert
key = /usr/local/etc/stunnel/stunnel.pem
; Protocol version (all, SSLv2, SSLv3, TLSv1)
sslVersion = SSLv3
; Some security enhancements for UNIX systems - comment them out on Win32
chroot = /var/tmp/stunnel
setuid = stunnel
setgid = stunnel
; PID is created inside chroot jail
pid = /stunnel.pid
; Some performance tunings
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
;compression = rle
; Workaround for Eudora bug
;options = DONT_INSERT_EMPTY_FRAGMENTS
; Authentication stuff
;verify = 2
; Don't forget to c_rehash CApath
; CApath is located inside chroot jail
;CApath = /certs
; It's often easier to use CAfile
;CAfile = /usr/local/etc/stunnel/certs.pem
; Don't forget to c_rehash CRLpath
; CRLpath is located inside chroot jail
;CRLpath = /crls
; Alternatively you can use CRLfile
;CRLfile = /usr/local/etc/stunnel/crls.pem
; Some debugging stuff useful for troubleshooting
;debug = 7
;output = stunnel.log
; --------- ------- вот эта секция(debug) может оказаться полезнойб т.к. у меня не сразу получилось запустить
; Use it for client mode
;client = yes
; Service-level configuration
[pop3s]
accept = 995
connect = 127.0.0.1:110
[imaps]
accept = 993
connect = 127.0.0.1:143
[ssmtp]
accept = 465
connect = 127.0.0.1:25
;[https]
;accept = 443
;connect = 80
;TIMEOUTclose = 0
; vim:ft=dosini
заупскаем
в случае включенного дебага в конфиге выведется нечто подобное
Код: Выделить всё
Starting stunnel.
2008.01.13 16:42:19 LOG7[89512:134651904]: Snagged 64 random bytes from /root/.rnd
2008.01.13 16:42:19 LOG7[89512:134651904]: Wrote 1024 new random bytes to /root/.rnd
2008.01.13 16:42:19 LOG7[89512:134651904]: RAND_status claims sufficient entropy for the PRNG
2008.01.13 16:42:19 LOG7[89512:134651904]: PRNG seeded successfully
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: Key file: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Private key loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: SSL context initialized for service pop3s
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: Key file: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Private key loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: SSL context initialized for service imaps
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Certificate loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: Key file: /usr/local/etc/stunnel/stunnel.pem
2008.01.13 16:42:19 LOG7[89512:134651904]: Private key loaded
2008.01.13 16:42:19 LOG7[89512:134651904]: SSL context initialized for service ssmtp
еще раз смотрим
Код: Выделить всё
ps -ax | grep stunnel
92048 ?? Ss 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
92043 p0 S 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
92044 p0 S 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
92045 p0 S 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
92046 p0 S 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
92047 p0 S 0:00.00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
столько якобы процессов думаю потому как с тредами
Код: Выделить всё
sockstat -4 | grep stunnel
stunnel stunnel 92048 11 tcp4 *:995 *:*
stunnel stunnel 92048 12 tcp4 *:993 *:*
stunnel stunnel 92048 13 tcp4 *:465 *:*
Код: Выделить всё
$ pkg_info -Ix stunnel
stunnel-4.21_1 SSL encryption wrapper for standard network daemons
$
Вроде всё, в итоге имеем шифрованные POP3, SMTP, IMAP. Кому надо может юзать шифрованную передачу данных, остальные висят на обычном.
Проверял пока только Kmail'ом мне просто нравиться там кнопочки - определить возможности сервера.Вот у него на POP3 параметры
шифрование - SSL
способ авторизации - открытый текст
на СМТП
шифрование - SSL
авторизация - CRAM-MD5