Програмка stunnel, из описания:
stunnel - это SSL врапер между клиентом и локальным демоном.
Програмка предназначена для добавления SSL функциональности таким службам как
POP3, SMTP, IMAP, WEB
Установка
Код: Выделить всё
# cd /usr/ports/security/stunnel/
# make && make install && make cert && make clean
сразу в момент установки, "средствами данного порта"
Опции при сборке я оставлял по умолчанию
Код: Выделить всё
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Options for stunnel 4.21_1 +
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +
+ + [ ] FORK use the fork(3) threading model + +
+ + [X] PTHREAD use the pthread(3) threading model (default) + +
+ + [ ] UCONTEXT use the ucontext(3) threading model + +
+ + [ ] IPV6 enable IPv6 support + +
+ + + +
+ + + +
+ + + +
+ + + +
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +
+ [ OK ] Cancel +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
отвечаем на вопросы, домен нада указать тот который будет
обслуживать данный сертефикат. Иначе в бровзере например будет не соответствие
сертификата и домена.
Код: Выделить всё
Country Name (2 letter code) [PL]:UA
State or Province Name (full name) [Some-State]:Ukraine
Locality Name (eg, city) []:Kiev
Organization Name (eg, company) [Stunnel Developers Ltd]:
Organizational Unit Name (eg, section) []:IT
Common Name (FQDN of your server) [localhost]:mail.domain.com
subject= /C=UA/ST=Ukraine/L=Kiev/O=Stunnel Developers Ltd/OU=IT/CN=mail.domain.com
notBefore=Jan 14 11:11:09 2008 GMT
notAfter=Jan 13 11:11:09 2009 GMT
MD5 Fingerprint=9C:AF:06:54:00:91:D2:2A:70:59:16:21:E9:90:6B:66
/usr/bin/install -c -o root -g wheel -d -m 1770 /usr/local/var/lib/stunnel
chgrp nogroup /usr/local/var/lib/stunnel
if uname | grep SunOS; then /usr/bin/install -c -o root -g wheel -d -m 755 /usr/local/var/lib/stunnel/dev; mknod
/usr/local/var/lib/stunnel/dev/zero c 13 12; chmod 666 /usr/local/var/lib/stunnel/dev/zero; fi
===> Cleaning for stunnel-4.21_1
в rc.conf
Код: Выделить всё
stunnel_enable="YES"
Код: Выделить всё
cd /usr/local/etc/stunnel
cp stunnel.conf-sample stunnel.conf
Код: Выделить всё
mkdit /var/tmp/stunnel
touch /var/tmp/stunnel/stunnel.pid
chown -R stunnel:nogroup /var/tmp/stunnel
Код: Выделить всё
/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)
; я здесь практически ничего не менял, только путь на фaйл сертификат
; и порты с которыми работает программа можно указывать петлю явно , можно не указывать
; работает и так и так
; Certificate/key is needed in server mode and optional in client mode
cert = /usr/local/etc/stunnel/stunnel.pem
;key = /usr/local/etc/stunnel/mail.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 = nogroup
; 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
; Use it for client mode
;client = yes
; Service-level configuration
[pop3s]
accept = 995
connect = 110
; здесь можно писать connect = 127.0.0.1:110
; хотя и так работает
[imaps]
accept = 993
connect = 143
[ssmtp]
accept = 465
connect = 25
[https]
accept = 443
connect = 80
TIMEOUTclose = 0
; vim:ft=dosini
Код: Выделить всё
/usr/local/etc/rc.d/stunnel start
Код: Выделить всё
ps -ax | grep stunnel
64038 ?? Is 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64033 p2 I 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64034 p2 I 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64035 p2 I 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64036 p2 I 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64037 p2 I 0:00,00 /usr/local/bin/stunnel /usr/local/etc/stunnel/stunnel.conf
64076 p2 RV+ 0:00,00 grep stunnel (csh)
програмка с тредами
Код: Выделить всё
sockstat -4 | grep stunnel
stunnel stunnel 64038 11 tcp4 *:995 *:*
stunnel stunnel 64038 12 tcp4 *:993 *:*
stunnel stunnel 64038 13 tcp4 *:465 *:*
stunnel stunnel 64038 14 tcp4 *:443 *:*
юзерский вэб интерфейс можно включить SSL. Что тут и сделано.
--------
Если что-то не полностью описал, плз поправьте