-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for non-root containers #1584
base: master
Are you sure you want to change the base?
Changes from all commits
3cf538c
c2f8fc2
af959ba
deb8892
1f283d7
a984ff8
5c97820
e452fec
8bb646e
b76dd96
4524b24
f0c374e
1d854cc
4163e2c
13e8663
2053f9d
9f2d13d
9831e43
b0c08b7
493490e
93b4cae
339c6f6
e042186
5b3c8af
a88e09a
6ac6ca6
5020778
d224159
2491511
ca8f66a
d3e63ef
63e15d7
0a337ab
7a92697
62633f7
a9c7328
9264bbf
e23b95c
714e525
a5c98ea
304401f
0ae86e7
0efcf93
d359557
43c9507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,12 +15,38 @@ ARG USE_CHROMIUM=0 | |
ARG CHROME_RELEASE=114.0.5735.90 | ||
ARG CHROMEDRIVER_MAJOR_RELEASE=114 | ||
|
||
COPY rootfs/ / | ||
COPY --chown=noroot:noroot rootfs/ / | ||
|
||
RUN apt-dpkg-wrap apt-get update && \ | ||
apt-dpkg-wrap apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" jibri libgl1-mesa-dri procps jitsi-upload-integrations jitsi-autoscaler-sidecar jq pulseaudio dbus dbus-x11 rtkit unzip fonts-noto && \ | ||
/usr/bin/install-chrome.sh && \ | ||
apt-cleanup && \ | ||
adduser jibri rtkit | ||
apt-cleanup | ||
|
||
RUN mkdir -p /etc/jitsi/autoscaler-sidecar && \ | ||
mkdir -p /config/logs && \ | ||
mkdir -p /config/recordings && \ | ||
mkdir -p /home/jibri && chown -R noroot:noroot /home/jibri | ||
|
||
RUN chown -R noroot:noroot /etc/cont-init.d && \ | ||
chown -R noroot:noroot /etc/services.d && \ | ||
chown -R noroot:noroot /etc/jitsi && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this necessary? Even if files are owned by root we can read them, right? |
||
chown -R noroot:noroot /run && \ | ||
chown -R noroot:noroot /config && \ | ||
chown -R noroot:noroot /var && \ | ||
chown -R noroot:noroot /opt/jitsi && \ | ||
chown -R noroot:noroot /tmp && \ | ||
chown -R noroot:noroot /defaults && \ | ||
chown -R noroot:noroot /usr/bin | ||
|
||
RUN chmod +x /etc/cont-init.d/* && \ | ||
chmod +x /etc/services.d/10-xorg/* && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any chance we can use wildcards to use a single command here? |
||
chmod +x /etc/services.d/20-icewm/* && \ | ||
chmod +x /etc/services.d/30-pulse/* && \ | ||
chmod +x /etc/services.d/40-jibri/* && \ | ||
chmod +x /etc/services.d/50-autoscaler-sidecar/* && \ | ||
chmod +x /opt/jitsi/jibri/launch.sh | ||
|
||
|
||
USER noroot | ||
|
||
VOLUME /config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
DAEMON="/usr/bin/Xorg -nocursor -noreset +extension RANDR +extension RENDER -logfile /tmp/xorg.log -config /etc/jitsi/jibri/xorg-video-dummy.conf ${DISPLAY}" | ||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON" | ||
exec /bin/bash -c "exec $DAEMON" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
DAEMON="/usr/bin/icewm-session" | ||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON" | ||
exec /bin/bash -c "exec $DAEMON" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
HOME=/home/jibri | ||
exec s6-setuidgid jibri /bin/bash -c "exec /usr/bin/pulseaudio" | ||
exec /bin/bash -c "exec /usr/bin/pulseaudio" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
# we have to set it, otherwise chrome won't find ~/.asoundrc file | ||
HOME=/home/jibri | ||
|
||
DAEMON=/opt/jitsi/jibri/launch.sh | ||
# pre-warm google chrome before jibri launches to ensure fast chrome launch during recordings | ||
s6-setuidgid jibri /usr/bin/google-chrome --timeout=1000 --headless about:blank | ||
exec s6-setuidgid jibri /bin/bash -c "exec $DAEMON" | ||
/usr/bin/google-chrome --timeout=1000 --headless about:blank | ||
exec /bin/bash -c "exec $DAEMON" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,21 @@ RUN apt-dpkg-wrap apt-get update && \ | |
apt-dpkg-wrap apt-get install -y jicofo && \ | ||
apt-cleanup | ||
|
||
COPY rootfs/ / | ||
COPY --chown=noroot:noroot rootfs/ / | ||
|
||
RUN chown -R noroot:noroot /etc/cont-init.d && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, is this necessary? If it is, which I'd like you to double-check, let's a script in the base image which all mages call, instead of duplicating the code on each of them. |
||
chown -R noroot:noroot /etc/services.d && \ | ||
chown -R noroot:noroot /run && \ | ||
chown -R noroot:noroot /var && \ | ||
chown -R noroot:noroot /usr/share/jicofo && \ | ||
chown -R noroot:noroot /etc/jitsi && \ | ||
chown -R noroot:noroot /etc/jitsi/jicofo && \ | ||
mkdir -p /config && chown -R noroot:noroot /config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should go on the base image. |
||
|
||
RUN chmod +x /usr/share/jicofo/jicofo.sh && \ | ||
chmod +x /etc/cont-init.d/* && \ | ||
chmod +x /etc/services.d/jicofo/* | ||
|
||
USER noroot | ||
|
||
VOLUME /config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
JAVA_SYS_PROPS="-Djava.util.logging.config.file=/config/logging.properties -Dconfig.file=/config/jicofo.conf" | ||
DAEMON=/usr/share/jicofo/jicofo.sh | ||
DAEMON_DIR=/usr/share/jicofo/ | ||
|
||
exec s6-setuidgid jicofo /bin/bash -c "cd $DAEMON_DIR; JAVA_SYS_PROPS=\"$JAVA_SYS_PROPS\" exec $DAEMON" | ||
exec /bin/bash -c "cd $DAEMON_DIR; JAVA_SYS_PROPS=\"$JAVA_SYS_PROPS\" exec $DAEMON" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
JAVA_SYS_PROPS="-Djava.util.logging.config.file=/config/logging.properties" | ||
|
||
DAEMON=/usr/share/jigasi/jigasi.sh | ||
DAEMON_OPTS="--nocomponent=true --configdir=/ --configdirname=config --min-port=${JIGASI_PORT_MIN:-20000} --max-port=${JIGASI_PORT_MAX:-20050}" | ||
|
||
exec s6-setuidgid jigasi /bin/bash -c "JAVA_SYS_PROPS=\"$JAVA_SYS_PROPS\" exec $DAEMON $DAEMON_OPTS" | ||
exec /bin/bash -c "JAVA_SYS_PROPS=\"$JAVA_SYS_PROPS\" exec $DAEMON $DAEMON_OPTS" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/with-contenv bash | ||
#!/command/with-contenv bash | ||
|
||
export JAVA_SYS_PROPS="-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION=/ -Dnet.java.sip.communicator.SC_HOME_DIR_NAME=config -Djava.util.logging.config.file=/config/logging.properties -Dconfig.file=/config/jvb.conf" | ||
|
||
DAEMON=/usr/share/jitsi-videobridge/jvb.sh | ||
|
||
exec s6-setuidgid jvb /bin/bash -c "exec $DAEMON" | ||
exec /bin/bash -c "exec $DAEMON" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,11 +61,36 @@ RUN wget -qO /etc/apt/trusted.gpg.d/prosody.gpg https://prosody.im/files/prosody | |
mv prosody-mod-auth-matrix-user-verification-$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN/mod_matrix_power_sync.lua /prosody-plugins && \ | ||
rm -rf prosody-mod-auth-matrix-user-verification-$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN v$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN.tar.gz | ||
|
||
COPY rootfs/ / | ||
COPY --chown=noroot:noroot rootfs/ / | ||
|
||
COPY --from=builder /usr/local/lib/lua/5.4 /usr/local/lib/lua/5.4 | ||
COPY --from=builder /usr/local/share/lua/5.4 /usr/local/share/lua/5.4 | ||
COPY --chown=noroot:noroot --from=builder /usr/local/lib/lua/5.4 /usr/local/lib/lua/5.4 | ||
COPY --chown=noroot:noroot --from=builder /usr/local/share/lua/5.4 /usr/local/share/lua/5.4 | ||
|
||
RUN mkdir -pm777 /var/run/saslauthd && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a single RUN block, here and elsewhere. |
||
mkdir -p /config/noroot_data && \ | ||
mkdir -p /config/certs && \ | ||
mkdir -p /config/conf.d && \ | ||
mkdir -p /prosody-plugins-custom | ||
|
||
RUN chown -R noroot:noroot /etc/cont-init.d && \ | ||
chown -R noroot:noroot /etc/services.d && \ | ||
chown -R noroot:noroot /etc/ldap && \ | ||
chown -R noroot:noroot /run && \ | ||
chown -R noroot:noroot /var && \ | ||
chown -R noroot:noroot /defaults && \ | ||
chown -R noroot:noroot /prosody-plugins && \ | ||
chown -R noroot:noroot /prosody-plugins-custom && \ | ||
mkdir -p /config/saslauthd | ||
|
||
RUN chmod +x /etc/cont-init.d/* && \ | ||
chmod +x /etc/services.d/10-saslauthd/* && \ | ||
chmod +x /etc/services.d/prosody/* | ||
|
||
RUN cp -r /defaults/* /config | ||
RUN chown -R noroot:noroot /config | ||
|
||
EXPOSE 5222 5280 | ||
|
||
USER noroot | ||
|
||
VOLUME ["/config", "/prosody-plugins-custom"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,7 +215,7 @@ http_interfaces = { "*", "::" } | |
http_interfaces = { "*" } | ||
{{ end }} | ||
|
||
data_path = "/config/data" | ||
data_path = "/config/noroot_data" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't do this please. It will break existing installations for no good reason. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the only way I could get over permission issues while generating TLS certificates by prosody to /config/data. If you have any ideas that can preserve the current setup and still solve the SSL issue with this user I am definitely open to hearing. but I'm curious to know why this will break the existing installations. since the /config/data is still there and the prosody PID is also still in /config/data. this is just changing the data directory to noroot_data to be able to generate SSLs. It appears to me that once the 10-config script is done it will even move the certificates to /config/certs and removes them from noroot_data at the end of the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What user does the 10-config script run as? A cursory look at https://github.com/bjc/prosody/blob/master/util/prosodyctl/cert.lua reveals some ownership changes if the user is root. Or maybe we should set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The user is noroot, with user and group ids = 1000. I bet that's why it can't create the certs in /config/data since apparently we can't change that one's ownership but it can create the certs in noroot_data and move them to the correct location since it's the owner. I could not find a better way to make this work, so I reverted it back to noroot_data so prosody doesn't break. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we can configure the prosody user and group with the options I showed above, did you test that? Why can noroot create stuff in /config/data tough? We need to fix this before this PR can land. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @saghul yes precisely. our I don't see why putting The bottom line is, if we can't use noroot_data as a temp path for generating certificates, we need to find a way to change ownership of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oh hold on. Why can't we change the permissions of that?
Aha. Maybe try with chattr -i ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @saghul did not work. tried this: all of that resulted in: same old same old. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hum, that's very odd, as if the user running |
||
|
||
smacks_max_unacked_stanzas = 5; | ||
smacks_hibernation_time = 60; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 are already done in the base image. Is it necessary?