marblerun icon indicating copy to clipboard operation
marblerun copied to clipboard

emit cert as Java KeyStore

Open aep opened this issue 1 year ago • 3 comments

Use case

java requires using a "keystore" instead of just pem encoded certs. so we'll have to emit those from premain.

Describe your solution

(https://github.com/pavlo-v-chernykh/keystore-go) could be used to provide the nessesary template func

something like

"Marbles": {
        "javathing": {
            "Parameters": {
                "Files": {
                    "/app/keystore.jks": "{{ javaKeyStore .MarbleRun.MarbleCert.Cert }}",

aep avatar Jul 20 '22 14:07 aep

I would prefer not to add language specific encodings to the manifest. In my opinion, parsing files is something that should be left to the application itself.

If PEM is something your application does not handle well, you can also use raw, to get the certificate in DER encoded certificate, or hex, to get the DER certificate hex encoded. See the docs for more details.

Tagging @m1ghtym0 in case he has a different opinion.

daniel-weisse avatar Jul 21 '22 06:07 daniel-weisse

Yeah that would be the ideal design but the client insists to run applications unmodified using gramine.

I think a workable path would be to have generic transformer plugins in premain, but unfortunately premain doesn't know which file is the certificate.

Another possible solution is to just downstream fork premain and hardcode this specific behavior. but other people using java will have the same issue

aep avatar Jul 21 '22 06:07 aep

I agree with Daniel that ideally, encodings should be language neutral. However, I see the problem here and it's just another encoding. IMO, that's not a big deal and we can have as many encodings as necessary, especially in hindsight of lift&shift. So, @aep please feel free to add JavaKeyStore as a file encoding.

m1ghtym0 avatar Jul 21 '22 07:07 m1ghtym0