Skip to content

Conversation

@cederom
Copy link
Contributor

@cederom cederom commented Nov 26, 2025

Summary

  • Sometimes a HTTPS version of the site needs to be tested locally before PR is submitted (i.e. to detect HTTP hardcoded links and/or components from external sites ).
  • This script genrates local testing SSL key and certificate using openssl. No external tools or sites needs to be used.
  • Enter key password (used to sign crt and launch srv) and cert details. Then: bundle exec jekyll serve --ssl-cert server.crt --ssl-key server.key.

Impact

  • Only local testing when HTTPS/SSL also needs to be tested this script provides quickest possible way to generate self-signed certificate locally.
  • No external tools or sites needs to be used.

Testing

Tested on FreeBSD 14.3:

  1. Generate ssl server.key + server.crt:
% ./ssltestgen.sh
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:PL
State or Province Name (full name) [Some-State]:WAW
Locality Name (eg, city) []:WAW
Organization Name (eg, company) [Internet Widgits Pty Ltd]:CeDeROM
Organizational Unit Name (eg, section) []:R&D
Common Name (e.g. server FQDN or YOUR name) []:localhost
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Enter pass phrase for server.key:
Certificate request self-signature ok
subject=C = PL, ST = WAW, L = WAW, O = CeDeROM, OU = R&D, CN = localhost
  1. Start local Jekyll with ssl:
% bundle exec jekyll serve --ssl-cert server.crt --ssl-key server.key
(..)
Enter PEM pass phrase:
    Server address: https://127.0.0.1:4000
  Server running... press ctrl-c to stop.

* This script genrates local testing SSL key and certificate using openssl.
* Enter key password (used to sign crt and launch srv) and cert details.
* Then: `bundle exec jekyll serve --ssl-cert server.crt --ssl-key server.key`.

Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
@acassis
Copy link
Contributor

acassis commented Nov 26, 2025

@cederom please explain "Why?" in the summary. That is the goal here? ("and why?")

@cederom
Copy link
Contributor Author

cederom commented Nov 26, 2025

@acassis done :-) Should I also update the git commit message? :-)

@xiaoxiang781216 xiaoxiang781216 merged commit b4dcbf7 into apache:master Nov 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants