Skip to content

Commit d19ee7a

Browse files
committed
docker error workaround
1 parent 6734e53 commit d19ee7a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ RUN apk update && \
4747
&& apk del .ruby-builddeps \
4848
&& rm -rf /var/cache/apk/*
4949

50-
RUN adduser -g msfconsole -D $MSF_USER
50+
RUN adduser -g msfconsole -D $MSF_USER -u 1000
5151

5252
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip $(which ruby)
5353
RUN /usr/sbin/setcap cap_net_raw,cap_net_bind_service=+eip $(which nmap)

docker/bin/msfconsole

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ if [[ $PARAMS == *"--rebuild"* ]]; then
2727
exit $?
2828
fi
2929

30-
docker-compose run --rm --service-ports ms ./msfconsole -r docker/msfconsole.rc "$PARAMS"
30+
# workaround if current user id is not the same as in the container.
31+
# Otherwise the ~/.msf4 folder is not writeable
32+
if [[ $EUID -ne 1000 ]]; then
33+
docker-compose run --rm -u root --service-ports ms ./msfconsole -r docker/msfconsole.rc "$PARAMS"
34+
else
35+
docker-compose run --rm --service-ports ms ./msfconsole -r docker/msfconsole.rc "$PARAMS"
36+
fi

0 commit comments

Comments
 (0)