Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add passphrase option #746

Merged
merged 7 commits into from
Oct 15, 2021
Merged

Conversation

chris--jones
Copy link
Contributor

This PR adds the passphrase option for a PEM certification - fix #162
I had to copy and paste some code from the union library (trimmed as much as possible) to add a shim to enable configuring ssl passphrase

What changes did you make?
Added the option to read passphrase (from environment variable as recommended in previous conversations)
Added a shim to allow for the missing functionality from union
Updated README to reflect the new option, with an example of creating a cert

Provide some example code that this change will affect, if applicable:

  this.server = options.https.passphrase
    // if passphrase is set, shim must be used as union does not support
    ? require('./shims/https-server-shim')(serverOptions)
    : union.createServer(serverOptions);

Is there anything you'd like reviewers to focus on?
I realise this might be controversial, but given that union has not been updated in some time I think this is an ok short-term solution until a longer term one is implemented, either:

  • fork union and make the fix there
  • re-implement unions functionality within this project
  • replace union with another library

Of all these options I think the best one is to find a replacement for union, but as a relative newcomer to this code-base I'm not sure specifically what functions this library is supporting nor am I brave enough (yet) to do any major refactoring.

Please ensure that your pull request fulfills these requirements:

  • The pull request is being made against the master branch
  • Tests for the changes have been added (for bug fixes / features)
  • New features/options have been documented in:
    • http-server --help text (n/a)
    • README.md
    • doc/http-server.1

What is the purpose of this pull request? (bug fix, enhancement, new feature,...)
Enhancement / new feature - #162

add a shim to enable configuring ssl passphrase
update readme
@thornjad thornjad added minor version non-breaking, non-trivial change feature labels Oct 13, 2021
@thornjad
Copy link
Member

Tests are failing with this error:

test/main.test.js http-server main TypeError: Cannot read property 'passphrase' of undefined:
     Error: TypeError: Cannot read property 'passphrase' of undefined
      at test/main.test.js:283:9

README.md Outdated Show resolved Hide resolved
lib/shims/https-server-shim.js Outdated Show resolved Hide resolved
@thornjad thornjad mentioned this pull request Oct 15, 2021
Copy link
Member

@thornjad thornjad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank for for tackling a very old missing feature!

@thornjad thornjad merged commit 51204e1 into http-party:master Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature minor version non-breaking, non-trivial change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support PEM passphrase for HTTPS
2 participants