Compare commits

..

13 Commits

12 changed files with 88 additions and 18 deletions

View File

@ -1,6 +1,6 @@
init:
- nemunaire/challenge:64dfdf00665351139e74647ab57b12008a7ac87b
- nemunaire/adlin-shadow-up:b368191dfd79645f3eca099a00bef8dfcdb7a2e9
- nemunaire/challenge:83269c87e08c786a8f865882bc34bd38f8d8b120
- nemunaire/adlin-shadow-up:c5e6c7f7afff788f6429a0ad1a7be982a47d5410
files:
- path: etc/motd
@ -72,6 +72,25 @@ files:
- path: init
source: pkg/challenge/init
mode: "0755"
- path: root/.ash_history
contents: |
cat my_ip
ip a
man 6 adlin
mode: "0644"
- path: etc/profile.d/cmd-colors.sh
contents: |
alias ip="ip -c"
alias ls="ls -c"
export LESS_TERMCAP_mb=$(printf "\e[1;37m")
export LESS_TERMCAP_md=$(printf "\e[1;36m")
export LESS_TERMCAP_me=$(printf "\e[0m")
export LESS_TERMCAP_se=$(printf "\e[0m")
export LESS_TERMCAP_so=$(printf "\e[1;47;30m")
export LESS_TERMCAP_ue=$(printf "\e[0m")
export LESS_TERMCAP_us=$(printf "\e[1;32m")
mode: "0644"
- path: sbin/fakelogin
contents: |
#!/bin/sh

View File

@ -1,6 +1,6 @@
init:
- busybox
- nemunaire/adlin-login-app:4862e66e6cbd283342632117f6be0bcf88db3d17
- nemunaire/adlin-login-app:8b08f3038128bacbbc939fc7a7a460723d80c3d4
files:
- path: /etc/ssl/certs/ISRG_Root_X1.pem

View File

@ -1,4 +1,4 @@
FROM alpine:edge AS mirror
FROM alpine:3.17 AS mirror
RUN mkdir -p /out/etc/apk/ && \
cp /etc/apk/repositories /out/etc/apk/ && \
@ -34,6 +34,7 @@ RUN apk add --no-cache --initdb -p /out \
kbd-bkeymaps \
kbd-doc \
kbd-vlock \
less \
losetup \
mandoc \
man-pages \

View File

@ -3,7 +3,9 @@
mount -t proc proc /proc
mount -t sysfs sysfs /sys
/bin/busybox --install -s
rm /dev/null; mknod -m 0666 /dev/null c 1 3
rm /dev/zero; mknod -m 0666 /dev/zero c 1 5
ln -sf ssmtp /usr/sbin/sendmail
mdev -s
@ -64,9 +66,6 @@ done
/usr/bin/setsid /bin/shadow-up > /dev/null 2> /var/log/sup.log &
# Prepare bonus 2
rm /dev/null; mknod -m 0666 /dev/null c 1 3
rm /dev/zero; mknod -m 0666 /dev/zero c 1 5
mkdir -p /mnt
for l in a b c d e f g h i j k l m n o p q r s t u v w x y z zz; do

View File

@ -11,6 +11,8 @@ ADD cmd ./
RUN go build -v -ldflags="-s -w" -tags netgo -o login-app
RUN apk add --no-cache kbd
FROM alpine:3.17
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>
@ -21,5 +23,7 @@ COPY --from=gobuild /go/src/login-app/login-app /bin/login-app
COPY --from=gobuild /usr/share/udhcpc/default.script /usr/share/udhcpc/default.script
COPY --from=gobuild /etc/terminfo/l/linux /etc/terminfo/l/linux
COPY --from=gobuild /usr/share/terminfo/l/linux /usr/share/terminfo/l/linux
COPY --from=gobuild /usr/bin/loadkeys /usr/bin/loadkeys
COPY --from=gobuild /usr/share/keymaps/xkb/fr.map.gz /usr/share/keymaps/xkb/us.map.gz /usr/share/keymaps/xkb/fr-bepo.map.gz /usr/share/keymaps/xkb/us-colemak.map.gz /usr/share/keymaps/xkb/
ENTRYPOINT ["/bin/login-app"]

View File

@ -14,6 +14,9 @@ func CreateLoginDialog(app *tview.Application, next func(username, password stri
form.GetFormItemByLabel("Login").(*tview.InputField).GetText(),
form.GetFormItemByLabel("Password").(*tview.InputField).GetText(),
)
}).
AddButton("Settings...", func() {
goToSettings(app)
})
form.SetBorder(true).SetTitle(" SRS Adlin - Login ")

View File

@ -0,0 +1,42 @@
package main
import (
"os/exec"
"github.com/rivo/tview"
)
var LastKeymap = 0
func goToSettings(app *tview.Application) {
var form *tview.Form
form = tview.NewForm().
AddDropDown("Keymap", []string{"QWERTY us", "AZERTY fr", "BÉPO", "Colemak us"}, LastKeymap, nil).
AddButton(" Save config ", func() {
if kbmap, _ := form.GetFormItemByLabel("Keymap").(*tview.DropDown).GetCurrentOption(); LastKeymap != kbmap {
file := "/usr/share/keymaps/xkb/"
switch kbmap {
case 1:
file += "fr.map.gz"
case 2:
file += "fr-bepo.map.gz"
case 3:
file += "us-colemak.map.gz"
default:
file += "us.map.gz"
}
exec.Command("/usr/bin/loadkeys", file).Run()
LastKeymap = kbmap
}
askLogin(app)
})
form.GetFormItemByLabel("Keymap").(*tview.DropDown).SetFieldWidth(25)
form.SetBorder(true).SetTitle(" SRS Adlin - Settings ")
app.SetRoot(modal(form, 25, 7), true)
app.SetFocus(form)
return
}

View File

@ -6,7 +6,7 @@ import (
func CreateUEFIDialog(app *tview.Application, next func()) {
modal := tview.NewModal().
SetText("Not UEFI boot\nYou should reboot, enter UEFI Setup (F2) and disable Legacy boot").
SetText("This machine does not boot in UEFI mode!\nYou should reboot now, enter UEFI Setup (F2) and disable Legacy boot. Or choose another machine, that boot in UEFI.").
AddButtons([]string{"Reboot", "Ignore"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
if buttonLabel == "Reboot" {

View File

@ -100,7 +100,7 @@ func main() {
log.Println("Registering handlers...")
mux := http.NewServeMux()
mux.Handle("/login", lc)
mux.Handle("/login", &lc)
mux.HandleFunc("/logout", logout)
mux.HandleFunc("/passwd", passwd)
http.HandleFunc("/", mux.ServeHTTP)
@ -119,6 +119,8 @@ mloop:
log.Println("Reloading students files...")
if lc.students, err = readStudentsList(studentsFile); err != nil {
log.Println("Error during students.csv reload:", err)
} else {
log.Printf("Students reloaded: %d students allowed to login", len(lc.students))
}
case syscall.SIGTERM, syscall.SIGINT:
break mloop

View File

@ -12,7 +12,7 @@ ADD cmd ./
RUN go build -v -ldflags="-s -w" -tags netgo -o shadow-up
FROM alpine:3.17
FROM scratch
MAINTAINER Pierre-Olivier Mercier <nemunaire@nemunai.re>
COPY --from=gobuild /go/src/shadow-up/shadow-up /bin/shadow-up

View File

@ -153,7 +153,7 @@ services:
command: ["/bin/arp-spoofer", "-iface=br-ext", "-ip-spoof=172.17.0.15"]
- name: login-validator
image: nemunaire/adlin-login-validator:a74d2aa0973c54ee79fb71211327f67e60537192
image: nemunaire/adlin-login-validator:277f96ed66533497364804a551c91f1ffeafd40d
# command: ["/bin/login-validator", "-bind=:8081", "-auth=ldap", "-ldaphost=auth.cri.epita.net", "-ldapport=636", "-ldaptls", "-ldapbase=dc=epita,dc=net"]
command: ["/bin/login-validator", "-bind=:8081", "-auth=krb5", "-krb5realm=CRI.EPITA.FR"]
# command: ["/bin/login-validator", "-bind=:8081", "-auth=fwd", "-fwduri=https://adlin.nemunai.re/auth"]

View File

@ -201,27 +201,27 @@ aux prochains TP.
# HISTORIQUE
2023 - Sixième édition du cours à destination des SRS 2024.
*2023* - Sixième édition du cours à destination des SRS 2024.
Immersion encore plus grande dans le SI?
2022 - Cinquième édition du cours à destination des SRS 2023.
*2022* - Cinquième édition du cours à destination des SRS 2023.
Travail sur le réalisme des exercices.
2021 - Quatrième édition du cours à destination des SRS 2022.
*2021* - Quatrième édition du cours à destination des SRS 2022.
Introduction de références à Matrix.
2020 - Troisième édition du cours à destination des SRS 2021.
*2020* - Troisième édition du cours à destination des SRS 2021.
Des étudiants avec involontairement de bonnes idées d'exercices supplémentaires.
2019 - Deuxième édition du cours à destination des SRS 2020.
*2019* - Deuxième édition du cours à destination des SRS 2020.
Le chaos s'est un peu trop invité.
2018 - Première édition du cours à destination des SRS 2019.
*2018* - Première édition du cours à destination des SRS 2019.
Oops la salle machine...