Challenge image: embbed files into yaml recipe

This commit is contained in:
nemunaire 2018-02-23 20:56:35 +01:00 committed by Pierre-Olivier Mercier
parent ba3f4250f5
commit ef17e1860e
7 changed files with 75 additions and 30 deletions

View File

@ -1,2 +1,74 @@
init:
- nemunaire/challenge:712906291b27a2b2cde544e9bff4fe443c2058ab-dirty
- nemunaire/challenge:e0d9663aba0794fb455be9844eed30793d4fb9fb-dirty
files:
- path: etc/motd
contents: |
Welcome to AdLin!
mode: "0644"
- path: etc/ssmtp/ssmtp.conf
contents: |
mailhub=172.23.200.4
mode: "0644"
- path: usr/share/man/man6/adlin.6.gz
source: subject/adlin.6.gz
mode: "0644"
- path: root/adlin-TP1-topologie.png
source: subject/adlin-TP1-topologie.png
mode: "0644"
# Fonts
- path: /usr/share/consolefonts/Inconsolata-16b.psf.gz
source: fonts/Inconsolata-16b.psf.gz
mode: "0644"
- path: /usr/share/consolefonts/Inconsolata-16r.psf.gz
source: fonts/Inconsolata-16r.psf.gz
mode: "0644"
- path: /usr/share/consolefonts/Inconsolata-32b.psf.gz
source: fonts/Inconsolata-32b.psf.gz
mode: "0644"
- path: /usr/share/consolefonts/Inconsolata-32r.psf.gz
source: fonts/Inconsolata-32r.psf.gz
mode: "0644"
- path: bin/adlin
source: challenge/adlin
mode: "0755"
- path: etc/issue
source: challenge/issue
mode: "0644"
- path: etc/passwd
contents: |
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
news:x:9:13:news:/var/spool/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucp:/bin/false
operator:x:11:0:operator:/root:/bin/bash
mode: "0644"
- path: etc/periodic/15min/netreboot
contents: |
#!/bin/sh
ping -c 1 172.23.0.1 && \
sleep 3 && \
reboot -f
mode: "0755"
- path: init
source: challenge/init
mode: "0755"
- path: sbin/fakelogin
contents: |
#!/bin/sh
[ "$2" = "root" ] &&
echo -e "\\e[01mTip: vous souvenez-vous du mot de passe root ?\\e[0m" ||
echo -e "\\e[01mTip: cette machine n'est pas reliée au LDAP de l'école.\\e[0m"
exec login $@
mode: "0755"

View File

@ -56,8 +56,4 @@ RUN rm -rf /out/etc/inittab
FROM scratch
COPY --from=mirror /out/ /
COPY init /init
COPY bin/ /bin/
COPY etc/ /etc/
COPY lib/ /lib/
COPY sbin/ /sbin/

View File

@ -42,7 +42,7 @@ token_format() {
\"challenge\": ${TID},"
}
>&2 cat <<EOF
cat <<EOF
{
"login": "${ULGN}",${challenge}
"token": "${TOKEN}"${DATA}
@ -83,7 +83,7 @@ case "${TOKENID}" in
exit 2
;;
token5)
HDATA=$(dig +short +time=1 +tries=0 adlin.nemunai.re $2 | sed 's/"//g') || {
HDATA=$(dig +short +time=1 +tries=0 adlin.nemunai.re $2 | sed 's/["\\]//g') || {
echo "Try again! Your resolver settings seems not good :(" >&2
exit 3
}

View File

@ -1,11 +0,0 @@
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/false
daemon:x:2:2:daemon:/sbin:/bin/false
adm:x:3:4:adm:/var/adm:/bin/false
lp:x:4:7:lp:/var/spool/lpd:/bin/false
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
news:x:9:13:news:/var/spool/news:/bin/false
uucp:x:10:14:uucp:/var/spool/uucp:/bin/false
operator:x:11:0:operator:/root:/bin/bash

View File

@ -1,5 +0,0 @@
#!/bin/sh
ping -c 1 192.168.23.1 && \
sleep 3 && \
reboot -f

View File

@ -1,7 +0,0 @@
#!/bin/sh
[ "$2" = "root" ] &&
echo "Tip: vous souvenez-vous du mot de passe root ?" ||
echo "Tip: cette machine n'est pas reliée au LDAP de l'école."
exec login $@