-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.lite
More file actions
126 lines (113 loc) · 5.98 KB
/
Dockerfile.lite
File metadata and controls
126 lines (113 loc) · 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
FROM openaf/oaf:edge as main
USER root
RUN sed -i 's/v[0-9]*\.[0-9]*/edge/g' /etc/apk/repositories\
&& apk update\
&& apk upgrade --available\
&& apk --no-cache add tar gzip bash tmux vim iperf iperf-doc tcpdump tcpdump-doc nmap nmap-doc iftop iftop-doc drill netcat-openbsd netcat-openbsd-doc lynx lynx-doc iproute2 iproute2-doc iptables iptables-doc fping fping-doc conntrack-tools conntrack-tools-doc lazydocker iputils iptraf-ng iptraf-ng-doc ngrep ngrep-doc tcptraceroute tcptraceroute-doc socat socat-doc mtr mtr-doc termshark curl curl-doc inetutils-telnet websocat bash-completion python3 sysstat sysstat-doc iotop iotop-doc htop htop-doc mc mandoc man-pages util-linux-doc tinyproxy tinyproxy-doc strace strace-doc procps\
&& /openaf/opack install SocksServer Morse oJob-common\
&& mkdir /openaf/ojobs\
&& curl -s https://ojob.io/oaf/colorFormats.yaml > /openaf/ojobs/colorFormats.yaml\
&& curl -s https://ojob.io/net/doh.yaml > /openaf/ojobs/doh.yaml\
&& curl -s https://ojob.io/net/jdbc.yaml > /openaf/ojobs/jdbc.yaml\
&& curl -s https://ojob.io/net/latency.yaml > /openaf/ojobs/latency.yaml\
&& curl -s https://ojob.io/net/publicIP.yaml > /openaf/ojobs/publicIP.yaml\
&& curl -s https://ojob.io/net/sslDates.yaml > /openaf/ojobs/sslDates.yaml\
&& curl -s https://ojob.io/net/whois.yaml > /openaf/ojobs/whois.yaml\
&& curl -s https://ojob.io/net/testHosts.yaml > /openaf/ojobs/testHosts.yaml\
&& curl -s https://ojob.io/email/send.yaml > /openaf/ojobs/emailSend.yaml\
&& curl -s https://ojob.io/ssh/tunnel.yaml > /openaf/ojobs/tunnel.yaml\
&& curl -s https://ojob.io/httpServers/EasyHTTPSd.yaml > /openaf/ojobs/EasyHTTPSd.yaml\
&& curl -s https://ojob.io/httpServers/EasyHTTPd.yaml > /openaf/ojobs/EasyHTTPd.yaml\
&& curl -s https://ojob.io/httpServers/EchoHTTPd.yaml > /openaf/ojobs/EchoHTTPd.yaml\
&& curl -s https://ojob.io/httpServers/MetricsHTTPd.yaml > /openaf/ojobs/MetricsHTTPd.yaml\
&& curl -s https://ojob.io/httpServers/RedirectHTTPd.yaml > /openaf/ojobs/RedirectHTTPd.yaml\
&& curl -s https://ojob.io/httpServers/uploadHTTPSd.yaml > /openaf/ojobs/uploadHTTPSd.yaml\
&& curl -s https://ojob.io/httpServers/uploadHTTPd.yaml > /openaf/ojobs/uploadHTTPd.yaml\
&& cd /openaf/ojobs\
&& /openaf/ojob ojob.io/get airgap=true job=ojob.io/grid/data/gc2\
&& mv ojob.io_grid_data_gc2.yaml javaGC.yaml\
&& sed javaGC.yaml -i -e "s/ojob.io_grid_show.yaml/\/openaf\/ojobs\/ojob.io_grid_show.yaml/"\
&& /openaf/oaf --sb /openaf/ojobs/colorFormats.yaml\
&& /openaf/oaf --sb /openaf/ojobs/doh.yaml\
&& /openaf/oaf --sb /openaf/ojobs/jdbc.yaml\
&& /openaf/oaf --sb /openaf/ojobs/latency.yaml\
&& /openaf/oaf --sb /openaf/ojobs/publicIP.yaml\
&& /openaf/oaf --sb /openaf/ojobs/sslDates.yaml\
&& /openaf/oaf --sb /openaf/ojobs/whois.yaml\
&& /openaf/oaf --sb /openaf/ojobs/testHosts.yaml\
&& /openaf/oaf --sb /openaf/ojobs/emailSend.yaml\
&& /openaf/oaf --sb /openaf/ojobs/javaGC.yaml\
&& /openaf/oaf --sb /openaf/ojobs/tunnel.yaml\
&& /openaf/oaf --sb /openaf/ojobs/EasyHTTPSd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/EasyHTTPd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/EchoHTTPd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/MetricsHTTPd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/RedirectHTTPd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/uploadHTTPSd.yaml\
&& /openaf/oaf --sb /openaf/ojobs/uploadHTTPd.yaml\
&& chown -R openaf:0 /openaf\
&& chown openaf:0 /openaf/.opack.db\
&& chmod -R u+rwx,g+rwx,o+rx,o-w /openaf/*\
&& chmod a+rwx /openaf\
&& sudo chmod g+w /openaf/.opack.db\
&& sudo adduser mitm -u 666 -D 2>/dev/null
COPY ojobs/softVersions.yaml /openaf/ojobs/softVersions.yaml
COPY ojobs/socksProxy.yaml /openaf/ojobs/socksProxy.yaml
RUN /openaf/oaf --sb /openaf/ojobs/softVersions.yaml\
&& chown openaf:0 /openaf/ojobs/softVersions.yaml\
&& chmod u+rwx,g+rwx,o+rx /openaf/ojobs/softVersions.yaml\
&& /openaf/oaf --sb /openaf/ojobs/socksProxy.yaml\
&& chown openaf:0 /openaf/ojobs/socksProxy.yaml\
&& chmod u+rwx,g+rwx,o+rx /openaf/ojobs/socksProxy.yaml
# Setup netutils folder
# ---------------------
RUN mkdir /netutils\
&& chmod a+rwx /netutils\
&& chown openaf:0 /netutils\
&& mkdir -p /run/lock
# Setup welcome message and vars
# ------------------------------
COPY welcome.txt /etc/netutils
RUN echo " (lite version)" >> /etc/netutils\
&& gzip /etc/netutils\
&& echo "zcat /etc/netutils.gz" >> /etc/bash/start.sh\
&& echo "echo ''" >> /etc/bash/start.sh\
&& echo "alias oafptab='oafp in=lines linesvisual=true linesjoin=true out=ctable'" >> /etc/bash/start.sh\
&& echo "alias oaf-light-theme='colorFormats.yaml op=set theme=thin-light-bold'" >> /etc/bash/start.sh\
&& echo "alias oaf-dark-theme='colorFormats.yaml op=set theme=thin-intense-bold'" >> /etc/bash/start.sh\
&& echo "alias help='source /etc/bash/start.sh'" >> /etc/bash/start.sh\
&& echo "export PATH=$PATH:/openaf:/openaf/ojobs:/opt/python/bin" >> /etc/bash/start.sh\
&& cp /etc/bash/start.sh /etc/profile.d/start.sh
# Add bash completion
# -------------------
RUN /openaf/oaf --bashcompletion all > /openaf/.openaf_completion.sh\
&& chmod a+x /openaf/.openaf_*.sh\
&& chown openaf:openaf /openaf/.openaf_*.sh\
&& echo ". /openaf/.openaf_completion.sh" >> /etc/bash/start.sh
# Documentation
# -------------
COPY USAGE.md /USAGE.md
COPY EXAMPLES.md /EXAMPLES.md
RUN gzip /USAGE.md\
&& gzip /EXAMPLES.md\
&& echo "#!/bin/sh" > /usr/bin/usage-help\
&& echo "#!/bin/sh" > /usr/bin/examples-help\
&& echo "zcat /USAGE.md.gz | oafp in=md mdtemplate=true | less -r" >> /usr/bin/usage-help\
&& echo "zcat /EXAMPLES.md.gz | oafp in=md mdtemplate=true | less -r" >> /usr/bin/examples-help\
&& chmod a+x /usr/bin/usage-help\
&& chmod a+x /usr/bin/examples-help
# Copy scripts
# ------------
COPY scripts/* /usr/bin/
RUN chmod a+x /usr/bin/sysstat-start.sh\
&& chmod a+x /usr/bin/sysstat-stop.sh\
&& chmod a+x /usr/bin/switch-user-by-pid.sh\
&& chmod a+x /usr/bin/switch-fs-by-pid.sh
# -------------------
FROM scratch as final
COPY --from=main / /
ENV OAF_HOME=/openaf
ENV PATH=$PATH:$OAF_HOME:$OAF_HOME/ojobs
USER openaf
WORKDIR /netutils
CMD ["/usr/bin/usage-help"]