SSL certification is missing

I'm trying to setup an SSL SVN. I got a tutorial, but when I'm trying to run the following command apache2-ssl-certificate I'm getting a command not found error message. My question is how can I fix this problem?


Solution 1:

The tutorial you've found is unfortunately very old. To generate a SSL cert run the following:

mkdir -p /etc/apache2/ssl
openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem
ln -sf /etc/apache2/ssl/apache.pem /etc/apache2/ssl/`/usr/bin/openssl x509 -noout -hash < /etc/apache2/ssl/apache.pem`.0
chmod 600 /etc/apache2/ssl/apache.pem 

This will create a SSL cert that expires in 365 days. To adjust the lifetime just change the -days 365 argument.
Make sure that /etc/apache2/ports.conf contains something like:

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

Assuming you still enabled SSL (sudo a2enmod ssl) you need to create a new virtual host. For example create a file /etc/apache2/sites-available/svn, containing among others:

NameVirtualHost *:443
<virtualhost *:443>
        ...
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/apache.pem
        ...
</virtualhost>

and enable this site with sudo a2ensite svn. So you have a site that listens for SSL connection. I hope this helps.