Jump to content

mkcert and docker question


maxxd

Recommended Posts

Hey y'all.

I'm not sure which sub-forum is most appropriate for this question, so I'm putting it here because here's where I go first. Anyway - does anybody use mkcert with Docker? It seems like a perfect solution to enable local SSL-enabled development and testing, but I'm still getting the 'Potential Security Risk' warning when I hit my local dev site.

The problem is that the system I'm working on now is all about php-based "micro-services" that talk to each other via AWS SQS queues, and some (one in particular) are throwing an "Unknown SSL protocol error" when using a super old version of the AWS PHP API to move a file into an S3 bucket hosted on my localstack environment. It's not helped by the fact that I have to mix php 7.2 and 5.6 in separate docker containers in this image to get everything to play mostly OK with each other.

Sorry for the rambling - it's late. My question is this: what am I missing in my mkcert setup that I'm still getting the authentication error in the browser? This is what I've got specific to this issue (I've installed wget and libnss3-tools and my image is based on php:7.4-apache:

Dockerfile:

# create the locally trusted SSL certificates
RUN mkdir /usr/local/.ssh
RUN wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.1/mkcert-v1.4.1-linux-amd64
RUN mv mkcert-v1.4.1-linux-amd64 mkcert
RUN chmod +x mkcert
RUN cp mkcert /usr/local/bin/
RUN mkcert -install
RUN mkcert -cert-file /usr/local/.ssh/laravel-local.pem -key-file /usr/local/.ssh/laravel-local-key.pem '*.laravel.local' laravel.local localhost 127.0.0.1

Apache.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost.com
    DocumentRoot "/var/www/html/public"
    ServerName "laravel.local"
    <Directory "/var/www/html/public/">
        AllowOverride All
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "/var/www/html/public"
    ServerName "laravel.local"
    SSLEngine On
    SSLCertificateFile "/usr/local/.ssh/laravel-local.pem"
    SSLCertificateKeyFile "/usr/local/.ssh/laravel-local-key.pem"
</VirtualHost>

docker-compose:

laravel:
    build:
      context: .
    image: laravel:new
    volumes:
      - ../project:/var/www/html
      - ../logs/:/var/log/
    ports:
      - 8001:80
      - 443:443
    environment:
      - ENVIRONMENT=development
    networks:
      - laravel

Obviously there's more to each of the files, but I've included the pertinent parts - let me know if more would be helpful.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.