Stunnel: Basics: Difference between revisions

Jump to navigation Jump to search
no edit summary
(New page: <span id="top"></span> <div style="padding:0;margin:0; border-bottom:3px inset #000000"> {| | MPG UniCenter || Stunnel: Home | [[Stunne...)
 
No edit summary
Line 1: Line 1:
<span id="top"></span>
=[http://etizupo.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
<div style="padding:0;margin:0; border-bottom:3px inset #000000">
&lt;span id=&quot;top&quot;&gt;&lt;/span&gt;
&lt;div style=&quot;padding:0;margin:0; border-bottom:3px inset #000000&quot;&gt;
{|  
{|  
| [[Image:uc_small_logo.gif | MPG UniCenter]] ||
| [[Image:uc_small_logo.gif | MPG UniCenter]] ||
Line 14: Line 15:
[[Stunnel: Original | Original]]   
[[Stunnel: Original | Original]]   
|}
|}
</div>
&lt;/div&gt;
{| cellpadding="2"
{| cellpadding=&quot;2&quot;
|
|
__TOC__
__TOC__
Line 40: Line 41:
To generate the certificate and public key you can use the command prompt and enter parameters manually. This is open to errors hence I created a batch file to ease the task.
To generate the certificate and public key you can use the command prompt and enter parameters manually. This is open to errors hence I created a batch file to ease the task.


This batch file is named '''mpg_create.bat''' and located in folder '''<nowiki>*\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin</nowiki>'''
This batch file is named '''mpg_create.bat''' and located in folder '''&lt;nowiki&gt;*\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin&lt;/nowiki&gt;'''


{|style="border:1px solid #aaaaaa"
{|style=&quot;border:1px solid #aaaaaa&quot;
|-
|-
!style="background:#cccccc"|
!style=&quot;background:#cccccc&quot;|
mpg_create.bat
mpg_create.bat
|-
|-
|style="background:#f8f8f8"|
|style=&quot;background:#f8f8f8&quot;|
&nbsp;<nowiki>:</nowiki> File Name : mpg_create.bat<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; File Name : mpg_create.bat&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Created By: UniCenter - MPG<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Created By: UniCenter - MPG&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Create Stunnel pem certificate and public key file stunnel.pem<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Create Stunnel pem certificate and public key file stunnel.pem&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Increased days to give 10year MPG 22/8/07 3.5-Apollo<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Increased days to give 10year MPG 22/8/07 3.5-Apollo&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Updated to Stunnel 4.24 MPG 31/5/08<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Updated to Stunnel 4.24 MPG 31/5/08&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Upgraded OpenSSL to openssl-0.9.8g MPG 31/5/08<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Upgraded OpenSSL to openssl-0.9.8g MPG 31/5/08&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Updated for 3.5-Apollo  MPG 18/8/07<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Updated for 3.5-Apollo  MPG 18/8/07&lt;br&gt;
&nbsp;<nowiki>:</nowiki> Version 1.1 18/8/07<br>
&amp;nbsp;&lt;nowiki&gt;:&lt;/nowiki&gt; Version 1.1 18/8/07&lt;br&gt;
&nbsp;<nowiki>:===============================================================</nowiki>
&amp;nbsp;&lt;nowiki&gt;:===============================================================&lt;/nowiki&gt;


&nbsp;openssl req -new -x509 -days 3650 -nodes -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem
&amp;nbsp;openssl req -new -x509 -days 3650 -nodes -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem


&nbsp;pause
&amp;nbsp;pause
|}
|}


Line 69: Line 70:
Openssl is extremely flexible because of this flexibility requires a configuration file you can use any name so long as it ends with the file extension '''cnf''' Stunnel uses the file '''stunnel.cnf''' in this file you specify the type of certificate (in this case a server) encryption strength and other certificate details.
Openssl is extremely flexible because of this flexibility requires a configuration file you can use any name so long as it ends with the file extension '''cnf''' Stunnel uses the file '''stunnel.cnf''' in this file you specify the type of certificate (in this case a server) encryption strength and other certificate details.


The file stunnel.cnf is located in folder '''<nowiki>*\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin</nowiki>'''
The file stunnel.cnf is located in folder '''&lt;nowiki&gt;*\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin&lt;/nowiki&gt;'''


{|style="border:1px solid #aaaaaa"
{|style=&quot;border:1px solid #aaaaaa&quot;
|-
|-
!style="background:#cccccc"|
!style=&quot;background:#cccccc&quot;|
stunnel.cnf
stunnel.cnf
|-
|-
|style="background:#f8f8f8"|
|style=&quot;background:#f8f8f8&quot;|
&nbsp;<nowiki>#</nowiki> create RSA certs - Server
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; create RSA certs - Server


&nbsp;RANDFILE = stunnel.rnd
&amp;nbsp;RANDFILE = stunnel.rnd


&nbsp;[ req ]<br>
&amp;nbsp;[ req ]&lt;br&gt;
&nbsp;default_bits = 1024<br>
&amp;nbsp;default_bits = 1024&lt;br&gt;
&nbsp;encrypt_key = yes<br>
&amp;nbsp;encrypt_key = yes&lt;br&gt;
&nbsp;distinguished_name = req_dn<br>
&amp;nbsp;distinguished_name = req_dn&lt;br&gt;
&nbsp;x509_extensions = cert_type
&amp;nbsp;x509_extensions = cert_type


&nbsp;[ req_dn ]<br>
&amp;nbsp;[ req_dn ]&lt;br&gt;
&nbsp;'''countryName = Country Name (2 letter code''')<br>
&amp;nbsp;'''countryName = Country Name (2 letter code''')&lt;br&gt;
&nbsp;countryName_default = PL<br>
&amp;nbsp;countryName_default = PL&lt;br&gt;
&nbsp;countryName_min = 2<br>
&amp;nbsp;countryName_min = 2&lt;br&gt;
&nbsp;countryName_max = 2
&amp;nbsp;countryName_max = 2


&nbsp;'''stateOrProvinceName = State or Province Name (full name)'''<br>
&amp;nbsp;'''stateOrProvinceName = State or Province Name (full name)'''&lt;br&gt;
&nbsp;stateOrProvinceName_default = Some-State
&amp;nbsp;stateOrProvinceName_default = Some-State


&nbsp;'''localityName = Locality Name (eg, city)'''
&amp;nbsp;'''localityName = Locality Name (eg, city)'''


&nbsp;'''0.organizationName = Organization Name (eg, company)'''<br>
&amp;nbsp;'''0.organizationName = Organization Name (eg, company)'''&lt;br&gt;
&nbsp;0.organizationName_default = Stunnel Developers Ltd
&amp;nbsp;0.organizationName_default = Stunnel Developers Ltd


&nbsp;organizationalUnitName = Organizational Unit Name (eg, section)<br>
&amp;nbsp;organizationalUnitName = Organizational Unit Name (eg, section)&lt;br&gt;
&nbsp;<nowiki>#</nowiki>organizationalUnitName_default =
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt;organizationalUnitName_default =


&nbsp;'''0.commonName = Common Name (FQDN of your server)'''<br>
&amp;nbsp;'''0.commonName = Common Name (FQDN of your server)'''&lt;br&gt;
&nbsp;0.commonName_default = localhost
&amp;nbsp;0.commonName_default = localhost


&nbsp;<nowiki>#</nowiki> To create a certificate for more than one name uncomment:<br>
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; To create a certificate for more than one name uncomment:&lt;br&gt;
&nbsp;<nowiki>#</nowiki> 1.commonName = DNS alias of your server<br>
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; 1.commonName = DNS alias of your server&lt;br&gt;
&nbsp;<nowiki>#</nowiki> 2.commonName = DNS alias of your server<br>
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; 2.commonName = DNS alias of your server&lt;br&gt;
&nbsp;<nowiki>#</nowiki> ...<br>
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; ...&lt;br&gt;
&nbsp;<nowiki>#</nowiki> See <nowiki>http://home.netscape.com/eng/security/ssl_2.0_certificate.html</nowiki><br>
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; See &lt;nowiki&gt;http://home.netscape.com/eng/security/ssl_2.0_certificate.html&lt;/nowiki&gt;&lt;br&gt;
&nbsp;<nowiki>#</nowiki> to see how Netscape understands commonName.
&amp;nbsp;&lt;nowiki&gt;#&lt;/nowiki&gt; to see how Netscape understands commonName.


&nbsp;[ cert_type ]<br>
&amp;nbsp;[ cert_type ]&lt;br&gt;
&nbsp;nsCertType = server
&amp;nbsp;nsCertType = server
|}
|}


Line 122: Line 123:
'''''Note 1''''': All lines highlighted ('''bold''') are questions presented to you during certificate generation. If you press enter as a response the default value will be used otherwise the value you enter is used.
'''''Note 1''''': All lines highlighted ('''bold''') are questions presented to you during certificate generation. If you press enter as a response the default value will be used otherwise the value you enter is used.


When you reach the line fully qualified domain name (FQDN) enter your server's full name (the name you type in a browser to access your site without the <nowiki>http://</nowiki> bit) or IP address of your server.
When you reach the line fully qualified domain name (FQDN) enter your server's full name (the name you type in a browser to access your site without the &lt;nowiki&gt;http://&lt;/nowiki&gt; bit) or IP address of your server.


'''''Note 2''''': FQDN example, given a device with a hostname of "fred" and a domain name of "example.com", the fully qualified domain name is "'''fred.example.com'''" Like an IP address it is unique and removes any ambiguity.
'''''Note 2''''': FQDN example, given a device with a hostname of &quot;fred&quot; and a domain name of &quot;example.com&quot;, the fully qualified domain name is &quot;'''fred.example.com'''&quot; Like an IP address it is unique and removes any ambiguity.


Note: Windows does not display the file extention ('''cnf''') hence file '''stunnel.cnf''' will display as s'''tunnel''' (the icon is a speed dial)
Note: Windows does not display the file extention ('''cnf''') hence file '''stunnel.cnf''' will display as s'''tunnel''' (the icon is a speed dial)
Line 133: Line 134:
The batch file allows you to create both the private key and public key in one go. You can generate each file individually and then manually combine them into a single file in the PEM format. However using a batch file makes it just that little bit easier and less error prone.
The batch file allows you to create both the private key and public key in one go. You can generate each file individually and then manually combine them into a single file in the PEM format. However using a batch file makes it just that little bit easier and less error prone.


The file is located in folder: '''<nowiki>*</nowiki>\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin'''
The file is located in folder: '''&lt;nowiki&gt;*&lt;/nowiki&gt;\Uniform Server\udrive\home\admin\www\plugins\stunnel_424\bin'''


# If running shut down your servers.
# If running shut down your servers.
# To start the process double click on the batch file '''mpg_create.bat'''.
# To start the process double click on the batch file '''mpg_create.bat'''.
# First the private key is automatically created and requires no input from you.
# First the private key is automatically created and requires no input from you.
# The next phase is a Certificate Signing Request (CSR).<br>During this generation process you will be prompted for several pieces of information. These are the X.509 attributes of the certificate.
# The next phase is a Certificate Signing Request (CSR).&lt;br&gt;During this generation process you will be prompted for several pieces of information. These are the X.509 attributes of the certificate.
# I have highlighted in bold the type of information you enter.
# I have highlighted in bold the type of information you enter.




{|cellpadding="4"
{|cellpadding=&quot;4&quot;
|width="20"|
|width=&quot;20&quot;|
|style="background:#f8f8f8;border:1px solid #cccccc"|
|style=&quot;background:#f8f8f8;border:1px solid #cccccc&quot;|
Country Name (2 letter code) [PL]:'''UK'''<br>
Country Name (2 letter code) [PL]:'''UK'''&lt;br&gt;
State or Province Name (full name) [Some-State]:'''Cambridgeshire'''<br>
State or Province Name (full name) [Some-State]:'''Cambridgeshire'''&lt;br&gt;
Locality Name (eg, city) []:Cambridge<br>
Locality Name (eg, city) []:Cambridge&lt;br&gt;
Organization Name (eg, company) [Stunnel Developers Ltd]:'''Mike Gleaves UniCenter'''<br>
Organization Name (eg, company) [Stunnel Developers Ltd]:'''Mike Gleaves UniCenter'''&lt;br&gt;
Organizational Unit Name (eg, section) []:'''Uniform Server 3.5-Apollo example'''<br>
Organizational Unit Name (eg, section) []:'''Uniform Server 3.5-Apollo example'''&lt;br&gt;
Common Name (FQDN of your server) [127.0.0.1]:'''fred.gotdns.com'''<br>
Common Name (FQDN of your server) [127.0.0.1]:'''fred.gotdns.com'''&lt;br&gt;
Press any key to continue
Press any key to continue
|}
|}


You can repeat this process at any time, for a self-signed certificate the information you enter is unimportant with the exception of FQDN (fully qualified domain name) if you have one use it (its the full address you would enter in a browser apart from the <nowiki>http://</nowiki> bit).
You can repeat this process at any time, for a self-signed certificate the information you enter is unimportant with the exception of FQDN (fully qualified domain name) if you have one use it (its the full address you would enter in a browser apart from the &lt;nowiki&gt;http://&lt;/nowiki&gt; bit).


'''''Note 1''''': A default value is displayed in square brackets press return to accept this value. If you are feeling lazy press return at each prompt. The resulting certificate is fully functional however it does not look very professional when displayed in a browser.
'''''Note 1''''': A default value is displayed in square brackets press return to accept this value. If you are feeling lazy press return at each prompt. The resulting certificate is fully functional however it does not look very professional when displayed in a browser.
Line 168: Line 169:
The section that you may need to change is '''uniform35''' in this section you set '''accept''' and '''connect''' port values. These have been set to the standard ports values, if you change the Apache listening port change connect to match. If you wish to set the Internet secure port change accept to match this. (Note: You will also need to change your firewall and router forwarding ports)
The section that you may need to change is '''uniform35''' in this section you set '''accept''' and '''connect''' port values. These have been set to the standard ports values, if you change the Apache listening port change connect to match. If you wish to set the Internet secure port change accept to match this. (Note: You will also need to change your firewall and router forwarding ports)


{|style="border:1px solid #aaaaaa"
{|style=&quot;border:1px solid #aaaaaa&quot;
|-
|-
!style="background:#cccccc"|
!style=&quot;background:#cccccc&quot;|
stunnel.conf
stunnel.conf
|-
|-
|style="background:#f8f8f8"|
|style=&quot;background:#f8f8f8&quot;|
&nbsp;; File Name : stunnel.conf<br>
&amp;nbsp;; File Name : stunnel.conf&lt;br&gt;
&nbsp;; Created By: UniCenter - MPG<br>
&amp;nbsp;; Created By: UniCenter - MPG&lt;br&gt;
&nbsp;; Updated to Stunnel 4.24 MPG 1/6/08<br>
&amp;nbsp;; Updated to Stunnel 4.24 MPG 1/6/08&lt;br&gt;
&nbsp;; Added an addtional start file mpg_perl_php_start.bat<br>
&amp;nbsp;; Added an addtional start file mpg_perl_php_start.bat&lt;br&gt;
&nbsp;; Updated to Stunnel 4.20 MPG 25/3/07<br>
&amp;nbsp;; Updated to Stunnel 4.20 MPG 25/3/07&lt;br&gt;
&nbsp;; Updated for 3.5-Apollo  MPG 20/8/07<br>
&amp;nbsp;; Updated for 3.5-Apollo  MPG 20/8/07&lt;br&gt;
&nbsp;; Version 1.1 20/8/07<br>
&amp;nbsp;; Version 1.1 20/8/07&lt;br&gt;
&nbsp;; Notes:<br>
&amp;nbsp;; Notes:&lt;br&gt;
&nbsp;; Drive independent use mpg_stunnel_start.bat and mpg_stunnel_stop.bat<br>
&amp;nbsp;; Drive independent use mpg_stunnel_start.bat and mpg_stunnel_stop.bat&lt;br&gt;
&nbsp;; If not run from these files full path must be specified eg<br>
&amp;nbsp;; If not run from these files full path must be specified eg&lt;br&gt;
&nbsp;;cert = w:\home\admin\www\plugins\stunnel_424\bin\stunnel.pem<br>
&amp;nbsp;;cert = w:\home\admin\www\plugins\stunnel_424\bin\stunnel.pem&lt;br&gt;
&nbsp;;key  = w:\home\admin\www\plugins\stunnel_424\bin\stunnel.pem<br>
&amp;nbsp;;key  = w:\home\admin\www\plugins\stunnel_424\bin\stunnel.pem&lt;br&gt;
&nbsp;; ========================================================================
&amp;nbsp;; ========================================================================


&nbsp;cert = stunnel.pem<br>
&amp;nbsp;cert = stunnel.pem&lt;br&gt;
&nbsp;key = stunnel.pem
&amp;nbsp;key = stunnel.pem


&nbsp;ciphers = ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH<br>
&amp;nbsp;ciphers = ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH&lt;br&gt;
&nbsp;;debug 5=notice 7= full debug<br>
&amp;nbsp;;debug 5=notice 7= full debug&lt;br&gt;
&nbsp;debug = 5
&amp;nbsp;debug = 5


&nbsp;RNDbytes = 64<br>
&amp;nbsp;RNDbytes = 64&lt;br&gt;
&nbsp;RNDoverwrite = yes<br>
&amp;nbsp;RNDoverwrite = yes&lt;br&gt;
&nbsp;session = 300 seconds<br>
&amp;nbsp;session = 300 seconds&lt;br&gt;
&nbsp;verify = level 1
&amp;nbsp;verify = level 1


&nbsp;'''[uniform35]'''<br>
&amp;nbsp;'''[uniform35]'''&lt;br&gt;
&nbsp;;htpps port 443<br>
&amp;nbsp;;htpps port 443&lt;br&gt;
&nbsp;accept = 443<br>
&amp;nbsp;accept = 443&lt;br&gt;
&nbsp;;default connects to local host<br>
&amp;nbsp;;default connects to local host&lt;br&gt;
&nbsp;connect = 80
&amp;nbsp;connect = 80


&nbsp;TIMEOUTbusy = 300 seconds<br>
&amp;nbsp;TIMEOUTbusy = 300 seconds&lt;br&gt;
&nbsp;TIMEOUTclose = 60 seconds<br>
&amp;nbsp;TIMEOUTclose = 60 seconds&lt;br&gt;
&nbsp;TIMEOUTidle = 43200 seconds
&amp;nbsp;TIMEOUTidle = 43200 seconds
|}
|}


322

edits

Navigation menu