Created
September 18, 2017 01:33
-
-
Save xkon/230b22120bf56a6fe218b7449b9d0215 to your computer and use it in GitHub Desktop.
更改apk源为中科大,ruby源为ruby-china,以加快build速度的 metasploit-framework Dockerfile 。源Dockerfile地址:https://github.com/rapid7/metasploit-framework
This file contains hidden or 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
FROM ruby:2.4.1-alpine | |
MAINTAINER Rapid7 | |
ARG BUNDLER_ARGS="--jobs=8 --without development test coverage" | |
ENV APP_HOME /usr/src/metasploit-framework/ | |
ENV MSF_USER msf | |
ENV NMAP_PRIVILEGED="" | |
WORKDIR $APP_HOME | |
COPY Gemfile* m* Rakefile $APP_HOME | |
COPY lib $APP_HOME/lib | |
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \ | |
apk update && \ | |
apk add \ | |
sqlite-libs \ | |
nmap \ | |
nmap-scripts \ | |
nmap-nselibs \ | |
postgresql-libs \ | |
ncurses \ | |
libcap \ | |
&& apk add --virtual .ruby-builddeps \ | |
autoconf \ | |
bison \ | |
build-base \ | |
ruby-dev \ | |
openssl-dev \ | |
readline-dev \ | |
sqlite-dev \ | |
postgresql-dev \ | |
libpcap-dev \ | |
libxml2-dev \ | |
libxslt-dev \ | |
yaml-dev \ | |
zlib-dev \ | |
ncurses-dev \ | |
git \ | |
&& echo "gem: --no-ri --no-rdoc" > /etc/gemrc \ | |
&& gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/ \ | |
&& gem update --system \ | |
&& gem install bundler \ | |
&& bundle config mirror.https://rubygems.org https://gems.ruby-china.org \ | |
&& bundle install --system $BUNDLER_ARGS \ | |
&& apk del .ruby-builddeps \ | |
&& rm -rf /var/cache/apk/* | |
RUN adduser -g msfconsole -D $MSF_USER | |
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip $(which ruby) | |
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip /usr/bin/nmap | |
USER $MSF_USER | |
ADD ./ $APP_HOME | |
CMD ["./msfconsole", "-r", "docker/msfconsole.rc"] |
更改进入MSF后的工作目录为 /home/msf/.msf4
➜ metasploit-framework git:(master) ✗ git diff docker/msfconsole.rc
diff --git a/docker/msfconsole.rc b/docker/msfconsole.rc
index 2ced959..da12e89 100644
--- a/docker/msfconsole.rc
+++ b/docker/msfconsole.rc
@@ -7,4 +7,5 @@ else
end
run_single("setg LHOST #{lhost}")
run_single("db_connect #{ENV['DATABASE_URL']}") if ENV['DATABASE_URL']
+run_single("cd /home/msf/.msf4")
</ruby>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
与原文件diff结果: