smallstep / truststore

Package to locally install development certificates
Apache License 2.0
96 stars 14 forks source link

Automatically install required dependencies on Linux #20

Open lmco-dvinci opened 1 year ago

lmco-dvinci commented 1 year ago

Hello! I'm working on an internal service at work that uses this. Would you be interested in a patch that implements support for some basic attempts to get the dependencies? For example, it would check if apt-get is in $PATH, and, if so, try to install relevant Debian packages.

Thank you

maraino commented 1 year ago

I think so, are you thinking on installing ca-certificates if it's not there yet?

lmco-dvinci commented 1 year ago

Something like that, yes. I have a version of this working already, but sometimes it'll give me "platform not supported" errors - is there a list of hard deps anywhere, or are these all that are needed? https://github.com/smallstep/truststore/blob/master/truststore_linux.go#L29

maraino commented 1 year ago
  • is there a list of hard deps anywhere, or are these all that are needed?

Not afaik, I created this based on https://github.com/FiloSottile/mkcert/blob/master/truststore_linux.go, but as a package that we can use in other places.

lmco-dvinci commented 1 year ago

I'm thinking that it should try to detect the package manager, then install ca-certificates or whatever the equivalent is. After that, I can trial-and-error anything else that may be needed.

So, the steps taken by the code would be:

  1. determine what tool needs to be used based on FS structure (this is already done)
  2. if it's not available on the PATH, install it from whatever package manager seems to be available
  3. try again
  4. clean up afterwards
lmco-dvinci commented 1 year ago

I've still been working on this. Ignoring SSL certs will be an option, for Alpine and Debian based systems. DNF makes it a pain to disable SSL checks for one-off commands.

Honestly, I don't think a check is even needed for RHEL-like systems after some testing. Even their minimal images include the required utilities, so I'm going to skip implementing it.