cscg ist super

This commit is contained in:
2026-04-10 03:31:12 +02:00
parent 7a9dfeda60
commit db0324c43d
99 changed files with 92358 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
FROM debian:bookworm AS builder
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends \
libguestfs-tools cloud-image-utils curl linux-image-amd64 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
RUN chmod 0644 /boot/vmlinuz*
RUN curl -Lo user.qcow2 https://cloud.debian.org/images/cloud/bookworm/20260316-2418/debian-12-nocloud-amd64-20260316-2418.qcow2 && \
echo "661a11d853616ba72913ace404961a28350c58eb4041edd2c847aec932d5b99b user.qcow2" | sha256sum --check
COPY entry.service vmentry.sh .
RUN virt-customize -a user.qcow2 \
--update \
--install socat \
--install python3 \
--upload vmentry.sh:/vmentry.sh \
--upload entry.service:/etc/systemd/system/entry.service \
--run-command 'systemctl daemon-reload && systemctl enable entry.service' \
--run-command 'chmod +x /vmentry.sh' \
--run-command 'rm -rf /var/lib/apt/lists/*'
FROM debian:bookworm-slim
RUN \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends \
qemu-system-x86 qemu-utils qemu-kvm \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/user.qcow2 /vm/
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
CMD ["/entrypoint.sh"]

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Challenge
After=network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/bin/bash /vmentry.sh
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,15 @@
#!/bin/bash
qemu-system-x86_64 \
-drive file=/vm/user.qcow2,format=qcow2 \
-m 512M \
-smp 2 \
-enable-kvm \
-nographic \
-display none \
-monitor none \
-snapshot \
-serial null \
-device virtio-net-pci,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::1024-:1024 \
-netdev socket,id=net1,connect=service-target:5555 \
-device e1000,netdev=net1,mac=52:54:00:AA:BB:CC \

View File

@@ -0,0 +1,5 @@
#!/bin/bash
IFACE=$(ip -o link | grep -i 52:54:00:AA:BB:CC | cut -d':' -f2 | xargs)
ip addr add 192.168.100.1/24 dev "$IFACE"
ip link set "$IFACE" up
socat TCP-LISTEN:1024,reuseaddr,fork EXEC:"/bin/bash -li",pty,stderr,setsid,sane