Add support to run gitea with an optional securityContext #115

Merged
lafriks merged 2 commits from martencassel/helm-chart:set_securitycontext into master 2021-03-01 12:16:49 +00:00
Contributor

Add the option to initialize and run gitea with a securityContext.

Add the option to initialize and run gitea with a securityContext.
martencassel added 1 commit 2021-02-19 14:48:21 +00:00
Add support to run gitea with an optional securityContext
All checks were successful
continuous-integration/drone/pr Build is passing
32b7a0a58d
Contributor

Yes, but I find that when running with the following context:

securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 

The init container fails with the following error: init su: must be suid to work properly

Yes, but I find that when running with the following context: ``` securityContext: runAsNonRoot: true runAsUser: 1000 runAsGroup: 1000 ``` The init container fails with the following error: `init su: must be suid to work properly`
martencassel added 1 commit 2021-02-23 13:56:35 +00:00
Don't set securityContext in initContainer.
All checks were successful
continuous-integration/drone/pr Build is passing
6a75a4217a
Contributor

What I found when trying this PR, is that Gitea required to run root (#120) on only from 1.14 rootless will be available, and only then this will work, as the current image requires root access

What I found when trying this PR, is that Gitea required to run root (#120) on only from 1.14 rootless will be available, and only then this will work, as the current image requires root access
Member

Thanks for your PR i will check on this once 1.14 is the default image :)

Thanks for your PR i will check on this once 1.14 is the default image :)
Author
Contributor

We would like to run gitea as a specific uid in order to access NFS data via kerberos. I don't know if setting the uid is possible in the rootless work that is coming up.

https://github.com/go-gitea/gitea/issues/14780

We would like to run gitea as a specific uid in order to access NFS data via kerberos. I don't know if setting the uid is possible in the rootless work that is coming up. https://github.com/go-gitea/gitea/issues/14780
luhahn approved these changes 2021-02-24 08:43:04 +00:00
Dismissed
luhahn left a comment
Member

Did not have a closer look into this issue yesterday sorry.

Of course we can merge this PR prior to 1.14 since it only adds the possibility to set a security context.

Did not have a closer look into this issue yesterday sorry. Of course we can merge this PR prior to 1.14 since it only adds the possibility to set a security context.
lafriks approved these changes 2021-03-01 12:16:14 +00:00
Dismissed
lafriks added the
kind
enhancement
label 2021-03-01 12:16:31 +00:00
lafriks merged commit 33903d8f6c into master 2021-03-01 12:16:49 +00:00
Contributor

I was hoping to improve the security for my Gitea installation with this. Unfortunately when setting the example as @Dunky13 posted I get the following error from the gitea container iteself (init is fine):

s6-svscan: fatal: unable to mkfifo .s6-svscan/control: Permission denied 
I was hoping to improve the security for my Gitea installation with this. Unfortunately when setting the example as @Dunky13 posted I get the following error from the gitea container iteself (init is fine): ``` s6-svscan: fatal: unable to mkfifo .s6-svscan/control: Permission denied ```
Contributor

I was hoping to improve the security for my Gitea installation with this. Unfortunately when setting the example as @Dunky13 posted I get the following error from the gitea container iteself (init is fine):

s6-svscan: fatal: unable to mkfifo .s6-svscan/control: Permission denied 

gitea/helm-chart#115 (comment)
The security context doesn't work (yet), since it will be released in Gitea 1.14 - we are currently in 1.13. So waiting for the "rootless" release. The security context can only work when gitea doesn't require root access, as it does now

> I was hoping to improve the security for my Gitea installation with this. Unfortunately when setting the example as @Dunky13 posted I get the following error from the gitea container iteself (init is fine): > > ``` > s6-svscan: fatal: unable to mkfifo .s6-svscan/control: Permission denied > ``` > https://gitea.com/gitea/helm-chart/pulls/115#issuecomment-313716 The security context doesn't work (yet), since it will be released in Gitea 1.14 - we are currently in 1.13. So waiting for the "rootless" release. The security context can only work when gitea doesn't require root access, as it does now
Contributor

Yeah, realised it after I posted. A few things have changed with 1.14 so this might be a challenge for those who are using the Helm Chart I guess. Seams to have latest mostly working now on my setup.

Yeah, realised it after I posted. A few things have changed with 1.14 so this might be a challenge for those who are using the Helm Chart I guess. Seams to have `latest` mostly working now on my setup.
Contributor

@Dunky13 just tested with latest-rootless which is v1.14-dev, it failed with the error you posted. Wondering if securityContext should also be applied to the init container as well?

@Dunky13 just tested with `latest-rootless` which is v1.14-dev, it failed with the error you posted. Wondering if `securityContext` should also be applied to the init container as well?
Contributor

@Starefossen I am not sure, haven't tested with rootless, as in the context I'm working in, I need a steady version number. Could possibly be the case. But would require some testing on a cluster either you, or if @luhahn has time & energy to put in that effort?

@Starefossen I am not sure, haven't tested with rootless, as in the context I'm working in, I need a steady version number. Could possibly be the case. But would require some testing on a cluster either you, or if @luhahn has time & energy to put in that effort?
Contributor

Ok, so the problem is init.yaml#L25:

su git -c ' \ 
Ok, so the problem is [init.yaml#L25](https://gitea.com/gitea/helm-chart/src/branch/master/templates/gitea/init.yaml#L25): ``` su git -c ' \ ```
Sign in to join this conversation.
No description provided.