Created
March 19, 2014 22:53
-
-
Save bburky/9653123 to your computer and use it in GitHub Desktop.
Dockerfile to setup environment for https://www.securusglobal.com/community/2014/03/17/how-i-got-root-with-sudo/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Only CentOS 6.4 is avialable, not 6.5 | |
#FROM centos:6.4 | |
# Unoffical repository. Has CentOS 6.5 | |
FROM tianon/centos:6.5 | |
# Add zip and sudo. Is sudo usually absent from default installs? | |
RUN yum install -y sudo zip | |
# Make a original-docs.zip with some files in it | |
RUN cd "$(mktemp -d)" \ | |
&& echo "a" > doc1 \ | |
&& mkdir dir \ | |
&& echo "b" > dir/doc2 \ | |
&& zip -r /root/original-docs.zip . \ | |
&& chmod 600 /root/original-docs.zip | |
# Make extracted-docs.zip an empty zip. zip doesn't really like that though | |
RUN cd "$(mktemp -d)" \ | |
&& touch empty \ | |
&& zip /var/lib/extracted-docs.zip empty \ | |
&& zip /var/lib/extracted-docs.zip -d empty | |
# Cleanup | |
RUN rm -r /tmp/* | |
ADD extract_docs.sh /usr/local/bin/extract_docs.sh | |
RUN chmod +x /usr/local/bin/extract_docs.sh | |
# Setup users | |
RUN adduser kevin | |
RUN echo "root:pass" | chpasswd | |
RUN echo "kevin:pass" | chpasswd | |
# Allow kevin to run extract_docs.sh | |
RUN echo "kevin ALL=/usr/local/bin/extract_docs.sh" > /etc/sudoers.d/sudoescape | |
USER kevin | |
CMD bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
zip -U /root/original-docs.zip -O /var/lib/extracted-docs.zip "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment