Farid Ahmadian / Slackware

Slackware 12.0 - Apache HTTPS

Public domain

Step 1: Generate a Private Key

# openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus
e is 65537 (0x10001)
Enter pass phrase for server.key: 1234
Verifying - Enter pass phrase for server.key: 1234

Step 2: Generate a CSR (Certificate Signing Request)

# openssl req -new -key server.key -out server.csr

Enter pass phrase for server.key: 1234
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) [AU]:IR
State or Province Name (full name) [Some-State]:Zanjan
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:ISP
Organizational Unit Name (eg, section) []:IT
Common Name (eg, YOUR name) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Step 3: Remove Passphrase from Key

# cp server.key server.key.org
# openssl rsa -in server.key.org -out server.key

Enter pass phrase for server.key.org: 1234
writing RSA key

Step 4: Generating a Self-Signed Certificate

# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Signature ok
Getting Private key

Step 5: Installing the Private Key and Certificate

cp server.crt /etc/httpd/
cp server.key /etc/httpd/

Step 6: Activating SSL in /etc/httpd/httpd.conf

LoadModule ssl_module lib/httpd/modules/mod_ssl.so
Include /etc/httpd/extra/httpd-ssl.conf

Step 7: Restart Apache

/etc/rc.d/rc.httpd stop
/etc/rc.d/rc.httpd start

BY: Pejman Moghadam
TAG: https, openssl, apache
DATE: 2012-01-25 15:45:36

Farid Ahmadian / Slackware [ TXT ]

With many thanks and best wishes for dear Pejman Moghadam, someone who taught me alot in linux and life :)