Skip to content

Commit deccae4

Browse files
EadomEadom
Eadom
authored and
Eadom
committed
Change image base to ubuntu16.04, add some safety options of xinetd.
1 parent c68ebc7 commit deccae4

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Dockerfile

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:14.04
1+
FROM ubuntu:16.04
22

33
RUN sed -i "s/http:\/\/archive.ubuntu.com/http:\/\/mirrors.tuna.tsinghua.edu.cn/g" /etc/apt/sources.list
44
RUN apt-get update && apt-get -y dist-upgrade
@@ -9,13 +9,23 @@ RUN useradd -m ctf
99
COPY ./bin/ /home/ctf/
1010
COPY ./ctf.xinetd /etc/xinetd.d/ctf
1111
COPY ./start.sh /start.sh
12+
RUN echo "Blocked by ctf_xinetd" > /etc/banner_fail
1213

1314
RUN chmod +x /start.sh
1415
RUN chown -R root:ctf /home/ctf
1516
RUN chmod -R 750 /home/ctf
1617
RUN chmod 740 /home/ctf/flag
18+
1719
RUN cp -R /lib* /home/ctf
1820
RUN cp -R /usr/lib* /home/ctf
21+
22+
RUN mkdir /home/ctf/dev
23+
RUN mknod /home/ctf/dev/null c 1 3
24+
RUN mknod /home/ctf/dev/zero c 1 5
25+
RUN mknod /home/ctf/dev/random c 1 8
26+
RUN mknod /home/ctf/dev/urandom c 1 9
27+
RUN chmod 666 /home/ctf/dev/*
28+
1929
RUN mkdir /home/ctf/bin
2030
RUN cp /bin/sh /home/ctf/bin
2131
RUN cp /bin/ls /home/ctf/bin

ctf.xinetd

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# replace helloworld to your program
21
service ctf
32
{
43
disable = no
54
socket_type = stream
65
protocol = tcp
76
wait = no
87
user = root
8+
type = UNLISTED
9+
port = 9999
910
bind = 0.0.0.0
1011
server = /usr/sbin/chroot
12+
# replace helloworld to your program
1113
server_args = --userspec=1000:1000 /home/ctf ./helloworld
12-
type = UNLISTED
13-
port = 9999
14+
banner_fail = /etc/banner_fail
15+
# safety options
16+
per_source = 10 # the maximum instances of this service per source IP address
17+
rlimit_cpu = 20 # the maximum number of CPU seconds that the service may use
18+
#rlimit_as = 1024M # the Address Space resource limit for the service
19+
#access_times = 2:00-9:00 12:00-24:00
1420
}

0 commit comments

Comments
 (0)