sprig icon indicating copy to clipboard operation
sprig copied to clipboard

public/private ssh rsa keys

Open louiseohalloran opened this issue 6 years ago • 6 comments

Hi Can you tell me if there is any way to generate public and private ssh rsa keys using sprig

I mean the equivalent to running ssh-keygen ?

Thanks

louiseohalloran avatar Oct 16 '19 10:10 louiseohalloran

There are functions documented at https://masterminds.github.io/sprig/crypto.html that might help. These include examples.

mattfarina avatar Oct 16 '19 13:10 mattfarina

Thanks @mattfarina, I did have a look there but I think there is no function to create the public and private key pair generated when you run ssh-keygen ( id_rsa, id_rsa.pub )

louiseohalloran avatar Oct 16 '19 14:10 louiseohalloran

I think something like https://gist.github.com/devinodaniel/8f9b8a4f31573f428f29ec0e884e6673#file-gistfile1-txt-L81 would be needed

louiseohalloran avatar Oct 16 '19 14:10 louiseohalloran

Anyone have a solution for this? I need to mount a public key file to a Kubernetes pod without mounting the private key portion.

rally25rs avatar May 08 '20 11:05 rally25rs

You can generate a private key (which includes the public key) like this : https://play.golang.org/p/I4NIZ-xY1w0

However, the function to get the public key (getPublicKey) seems not to be exposed. https://github.com/Masterminds/sprig/blob/master/crypto.go#L258 It also maybe wants a "PrivateKey" type object not the string that the private key returns.

max-allan avatar Mar 09 '21 21:03 max-allan

that could be awesome to create ssh keyPair !!

thomas10-10 avatar Mar 20 '24 10:03 thomas10-10