[Solar-general] [OTServer seguro

Gerardo B Diaz gerardodiaz en hotmail.com
Vie Ene 30 11:12:16 CET 2004


Me interesó este artículo que me llegó por un NL de 
http://www.experts-exchange.com.
A veces tiene artículos técnicos interesantes, que toman de su propia lista 
de discusión.

Me descorazona un poco que nunca pude contestar nada :-(

Las partes que verifiqué me anduvieron. Lo cito completo y como  ejemplo de 
lo que se
publica en ese lugar, para aquellos participantes de la lista que estén 
interesados en
temas técnicos.

Comentarios por email privado.

Saludos
Gerardo Díaz
http://gerardodiaz.tripod.com


-- begin quote--

Accepted Answer from TooKoolKris
Date: 12/03/2003 04:50PM PST
	Accepted Answer

If your secure server is being accessed by the public at large, your secure 
server needs a certificate signed by a CA so that people who visit your 
website know that the website is owned by the organization who claims to own 
it. Before signing a certificate, a CA verifies that the organization 
requesting the certificate was actually who they claimed to be.

Most Web browsers that support SSL have a list of CAs whose certificates 
they automatically accept. If a browser encounters a certificate whose 
authorizing CA is not in the list, the browser asks the user to either 
accept or decline the connection. You can generate a self-signed certificate 
for your secure server, but be aware that a self-signed certificate does not 
provide the same functionality as a CA-signed certificate. A self-signed 
certificate is not automatically recognized by most Web browsers, and a 
self-signed certificate does not provide any guarantee concerning the 
identity of the organization that is providing the website. A CA-signed 
certificate provides both of these important capabilities for a secure 
server. If your secure server will be used in a production environment, you 
probably need a CA-signed certificate.Whether you are getting a certificate 
from a CA or generating your own self-signed certificate, the first step is 
to generate a key.

You must be root to generate a key.

First, cd to the /etc/httpd/conf directory. Remove the fake key and 
certificate that were generated during the installation with the following 
commands:

rm ssl.key/server.key
rm ssl.crt/server.crt

Next, you need to create your own random key. Change to the 
/usr/share/ssl/certs directory, and type in the following command:

make genkey

Your system will display a message similar to the following:

umask 77 ; \
/usr/bin/openssl genrsa -des3 1024 > /etc/httpd/conf/ssl.key/server.key
Generating RSA private key, 1024 bit long modulus
.......++++++
................................................................++++++
e is 65537 (0x10001)
Enter PEM pass phrase:

You now need to type in a passphrase. For best security, it should contain 
at least eight characters, include numbers and/or punctuation, and not be a 
word in a dictionary. Also, remember that your passphrase is case sensitive.

You will need to remember and enter this passphrase every time you start 
your secure server, so do not forget it.

Re-type the passphrase to verify that it is correct. Once you have typed it 
in correctly, /etc/httpd/conf/ssl.key/server.key, containing your key, is 
created.

Note that if you do not want to type in a passphrase every time you start 
your secure server, you will need to use the following two commands instead 
of make genkey to create the key.

Use the following command to create your key:

/usr/bin/openssl genrsa 1024 > /etc/httpd/conf/ssl.key/server.key

Then use the following command to make sure the permissions are set 
correctly for the file:

chmod go-rwx /etc/httpd/conf/ssl.key/server.key

After you use the above commands to create your key, you will not need to 
use a passphrase to start your secure server.

Disabling the passphrase feature for your secure server is a security risk. 
It is NOT recommend that you disable the passphrase feature for secure 
server. The problems associated with not using a passphrase are directly 
related to the security maintained on the host machine. For example, if an 
unscrupulous individual compromises the regular UNIX security on the host 
machine, that person could obtain your private key (the contents of your 
server.key file). The key could be used to serve Web pages that appear to be 
from your secure server.

If UNIX security practices are rigorously maintained on the host computer 
(all operating system patches and updates are installed as soon as they are 
available, no unnecessary or risky services are operating, and so on), 
secure server's passphrase may seem unnecessary. However, since your secure 
server should not need to be re-booted very often, the extra security 
provided by entering a passphrase is a worthwhile effort in most cases.

The server.key file should be owned by the root user on your system and 
should not be accessible to any other user. Make a backup copy of this file. 
and keep the backup copy in a safe, secure place. You need the backup copy 
because if you ever lose the server.key file after using it to create your 
certificate request, your certificate will no longer work and the CA will 
not be able to help you. Your only option would be to request (and pay for) 
a new certificate.

Once you have a key, make sure you are in the /usr/share/ssl/certs 
directory, and type the following command:

make testcert

You will see the following output, and you will be prompted for your 
passphrase (unless you generated a key without a passphrase):

umask 77 ; \
/usr/bin/openssl req -new -key /etc/httpd/conf/ssl.key/server.key
-x509 -days 365 -out /etc/httpd/conf/ssl.crt/server.crt
Using configuration from /usr/share/ssl/openssl.cnf
Enter PEM pass phrase:

After you enter your passphrase (or without a prompt if you created a key 
without a passphrase), you will be asked for more information. The 
computer's output and a set of inputs looks like the following (you will 
need to provide the correct information for your organization and host):

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a
DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:North Carolina
Locality Name (eg, city) [Newbury]:Raleigh
Organization Name (eg, company) [My Company Ltd]:My Company, Inc.
Organizational Unit Name (eg, section) []:Documentation
Common Name (your name or server's hostname) []:myhost.example.com
Email Address []:myemail en example.com

After you provide the correct information, a self-signed certificate will be 
created in /etc/httpd/conf/ssl.crt/server.crt. You will need to restart your 
secure server after generating the certificate with following the command:

/sbin/service httpd restart





Comment from TIMFOX123
Date: 12/03/2003 07:43PM PST
	Author Comment

I will try this!   You are a brainiack you know that Kris !  I have some 
more questions but that will be later.  The points will corrispond :)

Assisted Answer from chicagoan
Date: 12/03/2003 08:21PM PST
	Assisted Answer

Two seperate things you're asking - regarding email:
As far as encrypting email using PKI, you don't need a certificate, all you 
need is a key pair.
Public keys can be posted openly on websites or emailed in plaintext.
Keyserver and certificate bring us to the realm of identity.
Public keys residing on keyserver can be signed by others and establish a 
'ring of trust'.
If you know me and I sign Kris' key, you then can trust his key.
Two of the biggest keyservers are:
ldap://certserver.pgp.com
http://pgpkeys.mit.edu:11371

As Kris said regarding SSL, the same is true about email.
A certificate obtained from a Certificate Authority that is trusted by 
virtue of being a corporate entity with a reputation, like Thawte or 
Verisign, means that they have investigated the certificate holder and I can 
be reasonably sure of your identity.

While you can sign a certificate youself, it's meaningless unless I already 
trust you and know it's you who issued the certificate.



Comment from TIMFOX123
Date: 12/04/2003 08:00PM PST
	Author Comment

I am amazed on what little I knew on this.  You guys have been great.  I am 
going to check some of this out and soon close this thread.  YOu have been 
great.

Comment from TooKoolKris
Date: 12/05/2003 05:00AM PST
	Comment

Thanks for the compliments and good luck.

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail