truststore icon indicating copy to clipboard operation
truststore copied to clipboard

Automatically install required dependencies on Linux

Open lmco-dvinci opened this issue 2 years ago • 5 comments

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

lmco-dvinci avatar Jun 20 '23 14:06 lmco-dvinci

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

maraino avatar Jun 20 '23 17:06 maraino

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

lmco-dvinci avatar Jun 20 '23 17:06 lmco-dvinci

  • 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.

maraino avatar Jun 23 '23 01:06 maraino

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 avatar Jun 24 '23 17:06 lmco-dvinci

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.

lmco-dvinci avatar Jul 25 '23 16:07 lmco-dvinci