mariadb-alpine icon indicating copy to clipboard operation
mariadb-alpine copied to clipboard

feat: use unprivileged runtime user

Open svasek opened this issue 2 years ago • 5 comments

It's always better to run an application under unprivileged user instead of root ;-)

svasek avatar Mar 17 '22 22:03 svasek

It's always better to run an application under unprivileged user instead of root ;-)

You're not wrong. I think I attempted to do this a good while back but ran into two issues regarding backwards compatability and certain permission concerns. It seems I didn't document it well enough.

Very open to landing it if you can help me build confidence in a seamless upgrade path for all users.

jbergstroem avatar Mar 22 '22 16:03 jbergstroem

Hi @jbergstroem, What issues have you ran into? I've tested it and it seems it works well. How can I help you?

svasek avatar Apr 03 '22 17:04 svasek

What issues have you ran into?

Since existing users will have different ownership of files, this needs to be handled. This applies to configs, user storage and so on. Needs proper testing and likely a "upgrade path".

jbergstroem avatar Apr 03 '22 19:04 jbergstroem

Gonna be testing this a bit now; I think with the recursive ownership it should be safe.

jbergstroem avatar May 25 '22 13:05 jbergstroem

@svasek have tested this pretty extensively now. I don't have a test suite to cover all of this, but I will be writing one test to make sure that the image is not root.

jbergstroem avatar May 30 '22 00:05 jbergstroem

@svasek the problem is that we cant install the mysql client required to import scripts (easier to find with new test suite). Few options:

  1. Manually set user at startup through daemon instead of container (which we already kind of do)
  2. embed a mysql client - via upstream or something smaller if possible (see: https://github.com/jbergstroem/mariadb-alpine/discussions/140)

jbergstroem avatar Oct 18 '22 20:10 jbergstroem

I'm gonna close this for now - happy to reopen if we for instance choose to embed a cli that can import data within a reasonable file size increase range.

jbergstroem avatar Oct 18 '22 21:10 jbergstroem