Skip to content

Commit

Permalink
Use a numeric USER instruction in Dockerfiles (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
srguglielmo authored Jul 14, 2020
1 parent bba2ca8 commit 42778d9
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
12 changes: 8 additions & 4 deletions Base/Dockerfile
Original file line number Diff line number Diff line change
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 Hub/Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USER seluser
USER 1200

#========================
# Selenium Configuration
Expand Down
2 changes: 1 addition & 1 deletion NodeBase/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,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
Original file line number Diff line number Diff line change
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 NodeDebug/Dockerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt-get update -qqy \
fluxbox \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

USER seluser
USER 1200

#==============================
# Generating the VNC password as seluser
Expand Down
2 changes: 1 addition & 1 deletion NodeFirefox/Dockerfile.txt
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 Standalone/Dockerfile.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
USER seluser
USER 1200

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

0 comments on commit 42778d9

Please sign in to comment.