mirror of
https://github.com/FiloSottile/mkcert.git
synced 2026-04-25 13:36:02 +03:00
[GH-ISSUE #60] How to actually use the certs? #33
Labels
No labels
TLS stack issue
Windows
bug
duplicate
duplicate
enhancement
help wanted
help wanted
pull-request
question
question
root store
waiting for info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mkcert#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @j1elo on GitHub (Aug 15, 2018).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/60
Hi, totally newbie question here. I'm not a web developer and this is the first time I configure self-signed certificates, so bear with me. Also I'd like to propose adding a section in the documentation for people in my situation.
This is what I'm currently doing, step by step command-line style. Server is an Amazon AWS machine with Ubuntu 16.04, in which I'm doing some WebRTC tests; Chrome and Firefox will refuse to allow webcam and microphone access to insecure sites (except for
localhost), so I need to serve an HTTPS page from my test server:At this point, I open this URL in Chrome:
https://ec2-11-22-33-44.region.compute.amazonaws.com:8080/But it still shows a warning page right before loading, and after dismissing the warning, a RED warning with "Not secure" text is shown in the address bar.
What I expected is that Chrome loads the page without any security warnings and with a GREEN lock in the address bar.
What steps I'm missing to make this work as intended?
I wanted to do this because the name that AWS gives your machine depends on the region of that particular machine and it also changes every time the machine starts up, so the best would be to have a certificate that doesn't mind what is the actual name of the subdomain, and be able to use the generated cert in several machines.
---- UPDATE ----
The reason for this problem is that a restriction exists in how the wildcard certificates work by spec, not anything to do specifically with mkcert. It turns out that a wildcard such
*.example.comwon't match sub-subdomains such asa.b.example.com.Solution is to use wildcards for only one subdomain level:
@j1elo commented on GitHub (Aug 15, 2018):
More info:
Chrome says this in its warning screen:
And Firefox says something similar:
Does this mean that it's not possible to create certificates for
AnySubdomain.example.com?@nickkaczmarek commented on GitHub (Aug 16, 2018):
I may be misunderstanding this, but since you're hitting your site from the
amazonaws.comtld, mkcert won't work for this. You'll probably need to use let's encrypt or something and put that certificate on your aws server. Someone who knows more may have more insight, but that's how I understand this. This might be helpful, https://docs.aws.amazon.com/acm/latest/userguide/setup-website.html@neoKushan commented on GitHub (Aug 17, 2018):
I don't believe you're using the tool as it was intended, as it's very much aimed at generating certs for local development. For deploying to AWS (or any server, really) you are best looking into something like Let's Encrypt for genuine SSL (or using the SSL cert that the cloud provider usually gives you). I don't know enough about aws to help with this, but there's plenty of documentation out there.
@j1elo commented on GitHub (Aug 17, 2018):
I see no reason why these certs wouldn't work for external machines; even the README of this project starts by showing how to generate a cert for such one! (example.com)
$ mkcert example.com '*.example.org' myapp.dev localhost 127.0.0.1 ::1I'm not a web dev and had zero idea of how to configure a certificate, so I just wanted to have a pair of files that can be copied to whatever machine, regardless of it being local or remote, and instantly have a valid HTTPS connection to them... well, that was the objective. Maybe I should have looked into Let's Encrypt for the AWS machine.
In any case, I actually made it work without any further problem whatsoever. The reason for my problem is that a restriction exists in how the wildcard certificates work by spec, not anything to do specifically with mkcert. It turns out that a wildcard such
*.example.comwon't match sub-subdomains such asa.b.example.com. As simple as that.So I used
mkcertto generate a certificate for*.region.compute.amazonaws.com. Problem solved.I won't close this issue yet to allow the author see it and consider my proposal of adding a section in the documentation that talks about this use case. @FiloSottile thank you for this tool!
@Suleman-Elahi commented on GitHub (Aug 18, 2018):
Same question here.... how to use this.... everytime it says "ERROR: xyz is not a valid hostname or IP"

@nickkaczmarek commented on GitHub (Aug 22, 2018):
@Suleman-Elahi DId you try it with an administrator command prompt?
@Suleman-Elahi commented on GitHub (Aug 23, 2018):
Doesn't help
@j1elo commented on GitHub (Aug 23, 2018):
That error doesn't depend on running with or without Administrator CMD. It happens because a regular expression fails to match.
Note how the error says:
ERROR: "'*.example.org'"it is including the single quotes inside the double quotes. Of course,'*.example.org'is an invalid hostname. Try*.example.orgwithout quotes. Or with double quotes. It all depends on how the CMD interpreter treats simple (and double) quotes in call arguments.That's probably a documentation bug in mkcert. Please handle it in a new issue, and don't derail already existing ones such as this one.
@Suleman-Elahi commented on GitHub (Aug 23, 2018):
Thank you very much !!!! @j1elo