Trying to secure phpmyadmin, we already did the following:
Cookie Auth login
firewall off tcp port 3306.
running on non-standard port
Now we would like to implement https... but how could it work with phpmyadmin running already on a non-stardard port?
This is the apache config:
# PHP MY ADMIN
<VirtualHost *:$CUSTOMPORT>
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_value include_path .
</IfModule>
</Directory>
# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
Order Deny,Allow
Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Order Deny,Allow
Deny from All
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/phpmyadmin.log combined
</VirtualHost>
Edit:
I created a custom SSL certificate with apache itself, based on this link and then followed the tips given by James and I get this:
[Sun Nov 04 16:02:38 2012] [info] Init: Seeding PRNG with 656 bytes of entropy
[Sun Nov 04 16:02:38 2012] [error] Init: Unable to read server certificate from file /etc/apache2/ssl/pma.crt
[Sun Nov 04 16:02:38 2012] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Sun Nov 04 16:02:38 2012] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
[Mon Nov 05 18:22:54 2012] [info] Init: Seeding PRNG with 656 bytes of entropy
[Mon Nov 05 18:22:54 2012] [error] Init: Unable to read server certificate from file /etc/apache2/ssl/pma.crt
[Mon Nov 05 18:22:54 2012] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Mon Nov 05 18:22:54 2012] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
Edit:
File exists, key is there, it ends with '-' end these are the privileges:
drwxr-xr-x 2 root root 4096 4. Nov 14:45 .
drwxr-xr-x 8 root root 4096 4. Nov 14:30 ..
-rw-r--r-- 1 root root 1041 4. Nov 14:45 pma.crt
-rw-r--r-- 1 root root 1679 4. Nov 14:45 pma.key