Skip to content

Commit

Permalink
Use a numeric USER instruction in Dockerfiles (#1083)
Browse files Browse the repository at this point in the history
  • Loading branch information
srguglielmo committed Jul 15, 2020
1 parent 97141c8 commit abb5ee5
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
12 changes: 8 additions & 4 deletions Base/Dockerfile
Expand Up @@ -41,11 +41,15 @@ RUN echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata

#========================================
# Add normal user with passwordless sudo
# Add normal user and group with passwordless sudo
#========================================
RUN useradd seluser \
--shell /bin/bash \
RUN groupadd seluser \
--gid 1201 \
&& useradd seluser \
--create-home \
--gid 1201 \
--shell /bin/bash \
--uid 1200 \
&& usermod -a -G sudo seluser \
&& echo 'ALL ALL = (ALL) NOPASSWD: ALL' >> /etc/sudoers \
&& echo 'seluser:secret' | chpasswd
Expand Down Expand Up @@ -75,7 +79,7 @@ RUN mkdir -p /opt/selenium /var/run/supervisor /var/log/supervisor \
#===================================================
# Run the following commands as non-privileged user
#===================================================
USER seluser
USER 1200:1201


CMD ["/opt/bin/entry_point.sh"]
2 changes: 1 addition & 1 deletion Distributor/Dockerfile.txt
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#========================
# Selenium Configuration
Expand Down
2 changes: 1 addition & 1 deletion Hub/Dockerfile.txt
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#========================
# Selenium Configuration
Expand Down
2 changes: 1 addition & 1 deletion NodeBase/Dockerfile.txt
Expand Up @@ -85,7 +85,7 @@ RUN apt-get -qqy update \
# Run the following commands as non-privileged user
#===================================================

USER seluser
USER 1200

#==============================
# Scripts to run Selenium Node and XVFB
Expand Down
2 changes: 1 addition & 1 deletion NodeChrome/Dockerfile.txt
Expand Up @@ -25,7 +25,7 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
COPY wrap_chrome_binary /opt/bin/wrap_chrome_binary
RUN /opt/bin/wrap_chrome_binary

USER seluser
USER 1200

#============================================
# Chrome webdriver
Expand Down
2 changes: 1 addition & 1 deletion NodeFirefox/Dockerfile.txt
Expand Up @@ -30,7 +30,7 @@ RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo "0.
&& chmod 755 /opt/geckodriver-$GK_VERSION \
&& ln -fs /opt/geckodriver-$GK_VERSION /usr/bin/geckodriver

USER seluser
USER 1200

COPY generate_config /opt/bin/generate_config

Expand Down
2 changes: 1 addition & 1 deletion NodeOpera/Dockerfile.txt
Expand Up @@ -32,7 +32,7 @@ RUN wget -q -O - https://deb.opera.com/archive.key | apt-key add - \
COPY wrap_opera_binary /opt/bin/wrap_opera_binary
RUN /opt/bin/wrap_opera_binary

USER seluser
USER 1200

#=====================
# Opera webdriver
Expand Down
2 changes: 1 addition & 1 deletion Router/Dockerfile.txt
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#========================
# Selenium Configuration
Expand Down
2 changes: 1 addition & 1 deletion Sessions/Dockerfile.txt
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#========================
# Selenium Configuration
Expand Down
2 changes: 1 addition & 1 deletion Standalone/Dockerfile.txt
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#====================================
# Scripts to run Selenium Standalone
Expand Down

0 comments on commit abb5ee5

Please sign in to comment.