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

Support password protected private keys #361

Open
chrisr-cs opened this issue Apr 6, 2022 · 2 comments
Open

Support password protected private keys #361

chrisr-cs opened this issue Apr 6, 2022 · 2 comments

Comments

@chrisr-cs
Copy link

chrisr-cs commented Apr 6, 2022

Currently the private key can be specified with '--key' but the password cannot be provided for it (unless I have missed an option).

Would it be possible to support private key files that are password protected by adding an argument for the password?

Thank-you.

@csstaub
Copy link
Member

csstaub commented Apr 7, 2022

Have you tried it with the keystore password flag?

I believe we propagate that here:
https://github.com/ghostunnel/ghostunnel/blob/master/certloader/keystore.go#L75
https://github.com/ghostunnel/ghostunnel/blob/master/certloader/certigo.go#L37

Internally keystores and PEM files are treated almost the same; we turn keystores into PEM before loading.

@chrisr-cs
Copy link
Author

chrisr-cs commented Apr 11, 2022

I tried with an encrypted key and using the storepass flag:
ghostunnel server --listen IP:PORT --target localhost:PORT --key ~/private_key_enc.pem --cert ~/cert.pem --disable-authentication --storepass password

The output was:
starting ghostunnel in server mode
using cert/key files on disk as certificate source
error: unable to load certificates: tls: failed to parse private key
error: tls: failed to parse private key

Note that the private key was encrypted using:
openssl rsa -aes256 -in private_key.pem -out private_key_enc.pem

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

No branches or pull requests

2 participants