title: Setting up SSL for Xampp Apache on Mac OS X to address missing_subjectAltName on Chrome
body: <p>I'm trying to setup SSL for Apache (installed via XAMPP) on Mac OS X Yosemite.</p>
  
  <p>Let's assume that I have a local hostname called 'my-local-host' already setup. I followed the instructions <a href="http://brianflove.com/2014/12/01/self-signed-ssl-certificate-on-mac-yosemite/" rel="nofollow noreferrer">here</a> to setup the certs running the following commands:</p>
  
  <pre><code># 1. Create host key
  sudo ssh-keygen -f my-local-host.key
  
  # 2. Create SSL certificate
  sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout my-local-host.key -out my-local-host.crt
  
  # 3. Create nopass Host Key
  sudo openssl rsa -in my-local-host.key -out my-local-host.nopass.key
  </code></pre>
  
  <p>Note: I did all this inside the <code>/Applications/XAMPP/xamppfiles/apache2/ssl</code> directory.</p>
  
  <p>After this, I added a virtual host listing to <code>httpd-vhosts.conf</code>.</p>
  
  <pre><code>&lt;VirtualHost *:443&gt;
      ServerName my-local-host
      DocumentRoot "/path/to/my-local-host/files"
  
      SSLEngine on
      SSLCertificateFile "/Applications/XAMPP/xamppfiles/apache2/ssl/my-local-host.crt"
      SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/apache2/ssl/my-local-host.key"
  
      &lt;FilesMatch "\.(cgi|shtml|phtml|php)$"&gt;
          SSLOptions +StdEnvVars
      &lt;/FilesMatch&gt;
      &lt;Directory "/Applications/XAMPP/xamppfiles/cgi-bin"&gt;
          SSLOptions +StdEnvVars
      &lt;/Directory&gt;
  
      &lt;Directory "/path/to/my-local-host/files"&gt;
          ServerSignature Off
          Options Indexes FollowSymLinks Includes execCGI
          AllowOverride All
          Require all granted
      &lt;/Directory&gt;
      ErrorLog "logs/my_local_host_log"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I then added the certificate to system Keychain with the following:</p>
  
  <pre><code>sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /Applications/XAMPP/xamppfiles/apache2/ssl/my-local-host.crt
  </code></pre>
  
  <p>And then I restarted Apache and attempted to load <a href="https://my-local-host" rel="nofollow noreferrer">https://my-local-host</a> in the Chrome browser. Here's the error I received:</p>
  
  <pre><code>This server could not prove that it is my-local-host; its security certificate is from [missing_subjectAltName].
  </code></pre>
  
  <p>After searching online it appears that this is an issue relating to Chrome dropping CommonName support from Chrome 58.</p>
  
  <p>I found this aptly title post: <a href="https://github.com/webpack/webpack-dev-server/issues/906" rel="nofollow noreferrer">Missing [missing_subjectAltName] in ssl certificate (since Chrome 58)</a> that sported a command for creating a compliant certificate:</p>
  
  <pre><code>sudo openssl req -newkey rsa:2048 -x509 -nodes -keyout my-local-host.key -new -out my-local-host.crt -subj /CN=my-local-host -reqexts SAN -extensions SAN -config &lt;(cat /System/Library/OpenSSL/openssl.cnf ; printf '[SAN]\nsubjectAltName=DNS:my-local-host') -sha256 -days 3650  
  </code></pre>
  
  <p>Unfortunately, when I run this I get the following error:</p>
  
  <pre><code>error on line -1 of /dev/fd/63
  80231:error:02001009:system library:fopen:Bad file descriptor:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/crypto/bio/bss_file.c:126:fopen('/dev/fd/63','rb')
  80231:error:2006D002:BIO routines:BIO_new_file:system lib:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/crypto/bio/bss_file.c:131:
  80231:error:0E078002:configuration file routines:DEF_LOAD:system lib:/SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/crypto/conf/conf_def.c:199:
  </code></pre>
  
  <p>Is there some other, less cumbersome way I can create a compliant certificate that addresses the issue with <code>missing_subjectAltName</code> on Chrome?</p>