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

How to pass password of encrypted private key when enabling grpc.ssl #903

Open
ShivaniSK opened this issue May 27, 2024 · 7 comments
Open

Comments

@ShivaniSK
Copy link

Issue description

I have below config in my application.yml file

grpc:
server:
port: 50055
ssl:
cert-chain: classpath:certificate.crt
private-key: classpath:cert.key

However the private key "cert.key" which I have is encrypted with a password.
How do I pass the password in above yml file.?

Also is there a way to enable ssl for the micronaut server as well with same PEM certificate as we pass for above GRPC server?

micronaut:
application:
name: Elysium GRPC API
server:
port: 8081
ssl:
enabled: true
key-store:
file: classpath:certificate.crt
password: classpath:cert.key

The above config does not work as its expecting a password instead of filepath.

@graemerocher
Copy link
Contributor

you can always set the values of GrpcSslConfiguration programmatically if you need to load data from files etc.

@ShivaniSK
Copy link
Author

Hi @graemerocher ,
I have the certificate and key files. However the private key is encrypted. Is there a way to decrypt it automatically if we pass the decryption password?

Also is it possible to pass .jks or .p12 files instead of PEM?

@graemerocher
Copy link
Contributor

no you will have to implement this decryption logic. There is an extension mechanism called https://docs.micronaut.io/4.0.x/api/io/micronaut/context/env/PropertyExpressionResolver.html where you could implement your own expression resolver. This mechanism is extensible and allows things like ${random.port}. Theoretically you could implement ${decrypt.foo.bar} and have it call the PropertyExpressionResolver to perform the decryption. However there is nothing in the framework that does this by default for you today, you would have to implement this logic.

@ShivaniSK
Copy link
Author

Thanks for the update @graemerocher . And is there a way to pass .jks or .p12 instead of PEM files?

@graemerocher
Copy link
Contributor

not to my knowledge

@ShivaniSK
Copy link
Author

ShivaniSK commented May 27, 2024

you can always set the values of GrpcSslConfiguration programmatically if you need to load data from files etc.

Hi @graemerocher , can you point me to the documentation where we can understand how to programmatically set these values. How do we set these values so that they reflect on application startup.

@graemerocher
Copy link
Contributor

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