dhcp & tftp/http servers merged

Szymon Karpiński 7 years ago
parent 57c2a0d373
commit 2a68ab6c2d
  1. 8
      dhcp/Dockerfile
  2. 5
      dhcp/Readme.md
  3. 18
      linux/Readme.md
  4. 19
      server/Dockerfile
  5. 0
      server/dhcpd.conf
  6. 6
      server/run.sh
  7. 17
      server/supervisor.conf
  8. 6
      tftp/Dockerfile
  9. 10
      tftp/Readme.md
  10. 11
      tftp/http.xinetd.conf
  11. 13
      tftp/tftp.xinetd.conf

@ -1,8 +0,0 @@
FROM debian:buster
RUN apt update && apt install -y isc-dhcp-server
RUN mkdir -p /var/lib/dhcp && touch /var/lib/dhcp/dhcpd.leases
COPY dhcpd.conf /etc/dhcp/dhcpd.conf
COPY run.sh /run.sh
RUN chmod +x /run.sh
ENV INTERFACE=eth0
CMD ["/run.sh"]

@ -1,5 +0,0 @@
##DHCP Docker
Example run command:
```
docker run --privileged --net host -it -e"INTERFACE=enp0s31f6" images/dhcp
```

@ -1,2 +1,18 @@
# Linux for cloning
Run `make` to build.
## About
`images/linux` is Debian 10 system adapted for network booting and sending/receiving disk images via UDP. It is designed to work together with `images/server`.
On boot, full system image will be downloaded, mounted read only and will become new root (see `src/etc/initramfs-tools`). User will be presented with menu allowing sending/receiving images and root shell access (see `src/scripts`). Whole environment will be read-only, except `/tmp` where writeable `tmpfs` will be mounted.
## Installation
To build just run:
```
sudo make
```
This will download base system to `build/cache`, copy it to `build/rootfs` and continue build there. After successful completion of this command, a fully functional linux root filesystem will be present in `build/rootfs`.
`debootstrap` is required to download base Linux system. When more advanced (encrypted home etc.) partition setup is used, one might need to remount the partition on which the build is taking place with `exec` and `dev` before running `make`:
```
sudo mount -i -o remount,exec,dev /home/whatever
```

@ -0,0 +1,19 @@
FROM debian:buster
RUN apt update
RUN apt install -y supervisor
RUN apt install -y isc-dhcp-server
RUN apt install -y tftpd-hpa
RUN apt install -y busybox
# Supervisor
COPY supervisor.conf /supervisor.conf
# DHCP server
RUN mkdir -p /var/lib/dhcp && touch /var/lib/dhcp/dhcpd.leases
COPY dhcpd.conf /etc/dhcp/dhcpd.conf
COPY run.sh /run.sh
RUN chmod +x /run.sh
ENV INTERFACE=eth0
CMD ["/run.sh"]

@ -1,6 +1,10 @@
#!/bin/bash
set -e
# Inteface setup
ip addr flush dev $INTERFACE
ip addr add 192.168.14.2/24 dev $INTERFACE
ip link set dev $INTERFACE up
dhcpd -d --no-pid $INTERFACE
# Supervisor
supervisord -n -c /supervisor.conf

@ -0,0 +1,17 @@
[supervisord]
loglevel = DEBUG
[program:dhcp]
command = dhcpd -d --no-pid %(ENV_INTERFACE)s
autostart = true
autorestart = true
[program:tftp]
command = in.tftpd -L -s /tftpboot
autostart = true
autorestart = true
[program:http]
command = busybox httpd -f -p 8014 -h /tftpboot
autostart = true
autorestart = true

@ -1,6 +0,0 @@
FROM debian:buster
RUN apt update && apt install -y xinetd tftpd-hpa busybox
COPY tftp.xinetd.conf /etc/xinetd.d/tftp
COPY http.xinetd.conf /etc/xinetd.d/http
RUN echo "http-boot 8014/tcp" >> /etc/services
CMD ["script", "-c", "/usr/sbin/xinetd -d"]

@ -1,10 +0,0 @@
##TFTP Docker
Starts TFTP server serving files from `/tftpboot`.
A directory to serve files from must be bound to `/tftpboot` on run.
Example run command:
```
docker run --net host -v /path/to/your/files:/tftpboot images/tftp
```

@ -1,11 +0,0 @@
service http-boot
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /bin/busybox
server_args = httpd -if -h /tftpboot
port = 8014
flags = IPv4
}

@ -1,13 +0,0 @@
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Loading…
Cancel
Save