Last active
February 4, 2018 19:18
-
-
Save claudiainbytes/bc1f3f9e21e80f488c0518f8c480553f to your computer and use it in GitHub Desktop.
SSL certificates: Subject alternative names (SAN) solution for XAMPP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://gist.github.com/nrollr/4daba07c67adcb30693e | |
1. Make a directory called xamppcerts in etc folder | |
mkdir xamppcerts | |
2. Create the following file called localhost.conf | |
[req] | |
default_bits = 1024 | |
distinguished_name = req_distinguished_name | |
req_extensions = v3_req | |
[req_distinguished_name] | |
[v3_req] | |
basicConstraints = CA:FALSE | |
keyUsage = nonRepudiation, digitalSignature, keyEncipherment | |
subjectAltName = @alt_names | |
[alt_names] | |
DNS.1 = localhost | |
DNS.2 = komodoapp.test | |
DNS.3 = gi-prueba.test | |
DNS.3 = your_domain_setting_in_hosts_files.test | |
3. Create the following bash file called generarclaves.sh | |
#!/usr/bin/env bash | |
sudo openssl genrsa -out server.key 2048 | |
sudo openssl genrsa -out localhost.key 2048 | |
sudo openssl rsa -in localhost.key -out localhost.key.rsa | |
sudo openssl req -new -key server.key -subj "/C=/ST=/L=/O=/CN=/emailAddress=/" -out server.csr | |
sudo openssl req -new -key localhost.key.rsa -subj "/C=/ST=/L=/O=/CN=localhost/" -out localhost.csr -config localhost.conf | |
sudo openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt | |
sudo openssl x509 -req -extensions v3_req -days 3650 -in localhost.csr -signkey localhost.key.rsa -out localhost.crt -extfile localhost.conf | |
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain localhost.crt | |
4. To execute the bash | |
sh generarclaves.sh | |
5. Modifying extra/httpd-ssl.conf | |
SSLCertificateFile "/Applications/XAMPP/xamppfiles/etc/xamppcerts/localhost.crt" | |
#SSLCertificateFile "/Applications/XAMPP/xamppfiles/etc/ssl.crt/server.crt" | |
SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/etc/xamppcerts/localhost.key" | |
#SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/etc/ssl.key/server.key" | |
6. Adding the virtualhost for a specific domain. By example: | |
<VirtualHost *:443> | |
ServerAdmin [email protected] | |
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/komodoapp/public" | |
ServerName komodoapp.test | |
ErrorLog "logs/komodoapp.test-error_log" | |
CustomLog "logs/komodoapp.test-access_log" common | |
SSLEngine on | |
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL | |
SSLCertificateFile etc/xamppcerts/localhost.crt | |
SSLCertificateKeyFile etc/xamppcerts/localhost.key | |
<Directory "/Applications/XAMPP/xamppfiles/htdocs/komodoapp/public"> | |
Options All | |
AllowOverride All | |
order allow,deny | |
allow from all | |
</Directory> | |
</VirtualHost> | |
7. Modifying http.conf | |
# Virtual hosts | |
Include etc/extra/httpd-vhosts.conf | |
8. Restart Apache in XAMPP | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment