Compare commits
6 commits
679668e2c2
...
02a9eb8a35
| Author | SHA1 | Date | |
|---|---|---|---|
| 02a9eb8a35 | |||
| 6586346bce | |||
| 5d53df6f1a | |||
| 175015d0ea | |||
| 997d7f475a | |||
| 50ad1f0712 |
6 changed files with 35 additions and 21 deletions
|
|
@ -18,4 +18,6 @@ COPY --from=gobuild /go/src/login-validator/login-validator /bin/login-validator
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/login-validator", "-bind=:8081"]
|
ENTRYPOINT ["/bin/login-validator", "-bind=:8081"]
|
||||||
|
|
||||||
|
WORKDIR /data
|
||||||
|
|
||||||
LABEL org.mobyproject.config='{"capabilities": ["CAP_NET_BIND_SERVICE"]}'
|
LABEL org.mobyproject.config='{"capabilities": ["CAP_NET_BIND_SERVICE"]}'
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var lc loginChecker
|
lc := &loginChecker{}
|
||||||
|
|
||||||
if auth != nil && *auth == "ldap" {
|
if auth != nil && *auth == "ldap" {
|
||||||
log.Printf("Auth method: LDAP(%s@%s:%d?%s)", *ldapbindusername, *ldapAddr, *ldapPort, *ldapbase)
|
log.Printf("Auth method: LDAP(%s@%s:%d?%s)", *ldapbindusername, *ldapAddr, *ldapPort, *ldapbase)
|
||||||
|
|
@ -87,6 +87,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
log.Printf("%d students loaded", len(lc.students))
|
||||||
|
|
||||||
// Prepare graceful shutdown
|
// Prepare graceful shutdown
|
||||||
interrupt := make(chan os.Signal, 1)
|
interrupt := make(chan os.Signal, 1)
|
||||||
|
|
@ -100,7 +101,7 @@ func main() {
|
||||||
|
|
||||||
log.Println("Registering handlers...")
|
log.Println("Registering handlers...")
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/login", &lc)
|
mux.Handle("/login", lc)
|
||||||
mux.HandleFunc("/logout", logout)
|
mux.HandleFunc("/logout", logout)
|
||||||
mux.HandleFunc("/passwd", passwd)
|
mux.HandleFunc("/passwd", passwd)
|
||||||
http.HandleFunc("/", mux.ServeHTTP)
|
http.HandleFunc("/", mux.ServeHTTP)
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,13 @@ func readStudentsList(studentsFile string) (stds []Student, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
for _, i := range list {
|
for _, i := range list {
|
||||||
var s Student
|
stds = append(stds, Student{
|
||||||
|
Lastname: i[0],
|
||||||
s.Lastname = i[0]
|
Firstname: i[1],
|
||||||
s.Firstname = i[1]
|
Login: i[2],
|
||||||
s.Login = i[2]
|
EMail: i[3],
|
||||||
s.EMail = i[3]
|
Phone: i[4],
|
||||||
s.Phone = i[4]
|
})
|
||||||
|
|
||||||
stds = append(stds, s)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return stds, nil
|
return stds, nil
|
||||||
|
|
|
||||||
16
server.yml
16
server.yml
|
|
@ -154,7 +154,7 @@ services:
|
||||||
net: /run/netns/dmzi-wg
|
net: /run/netns/dmzi-wg
|
||||||
|
|
||||||
- name: login-validator
|
- name: login-validator
|
||||||
image: nemunaire/adlin-login-validator:923d04a3c3c744f4a60c882f0264ffff88b7a9f6
|
image: nemunaire/adlin-login-validator:7b6560b8ebf5d726ac1f2740621075dfb59b5e58
|
||||||
# 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=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=krb5", "-krb5realm=CRI.EPITA.FR"]
|
||||||
# command: ["/bin/login-validator", "-bind=:8081", "-auth=fwd", "-fwduri=https://adlin.nemunai.re/auth"]
|
# command: ["/bin/login-validator", "-bind=:8081", "-auth=fwd", "-fwduri=https://adlin.nemunai.re/auth"]
|
||||||
|
|
@ -162,13 +162,16 @@ services:
|
||||||
net: /run/netns/login
|
net: /run/netns/login
|
||||||
binds:
|
binds:
|
||||||
- /etc/resolv.conf:/etc/resolv.conf:ro
|
- /etc/resolv.conf:/etc/resolv.conf:ro
|
||||||
- /var/lib/adlin/students.csv:/students.csv:ro
|
- /var/lib/adlin/students:/data/:ro
|
||||||
- /var/lib/adlin/pxelinux.cfg:/var/tftp/pxelinux.cfg
|
- /var/lib/adlin/pxelinux.cfg:/var/tftp/pxelinux.cfg
|
||||||
- /var/lib/adlin/shadows:/var/tftp/shadows
|
- /var/lib/adlin/shadows:/var/tftp/shadows
|
||||||
- /srv/solver.sh:/var/solver.sh:ro
|
- /srv/solver.sh:/var/solver.sh:ro
|
||||||
- /srv/tftp/challenge-initrd.img:/var/tftp/challenge-initrd.img:ro
|
- /srv/tftp/challenge-initrd.img:/var/tftp/challenge-initrd.img:ro
|
||||||
- /etc/ssl/certs:/etc/ssl/certs:ro
|
- /etc/ssl/certs:/etc/ssl/certs:ro
|
||||||
- /usr/share/ca-certificates:/usr/share/ca-certificates:ro
|
- /usr/share/ca-certificates:/usr/share/ca-certificates:ro
|
||||||
|
runtime:
|
||||||
|
mkdir:
|
||||||
|
- /var/lib/adlin/students
|
||||||
- name: nginx-login
|
- name: nginx-login
|
||||||
image: nginx:stable-alpine
|
image: nginx:stable-alpine
|
||||||
capabilities:
|
capabilities:
|
||||||
|
|
@ -941,6 +944,15 @@ files:
|
||||||
source: challenge-initrd.img
|
source: challenge-initrd.img
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
- path: root/.ash_history
|
||||||
|
contents: |
|
||||||
|
tail -f /var/log/login-validator.log
|
||||||
|
ln -sf nemunaire.csv /var/lib/adlin/students/students.csv
|
||||||
|
ln -sf students2025.csv students.csv
|
||||||
|
pkill -HUP login-validator
|
||||||
|
cd /var/lib/adlin
|
||||||
|
mode: "0640"
|
||||||
|
|
||||||
trust:
|
trust:
|
||||||
org:
|
org:
|
||||||
- linuxkit
|
- linuxkit
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,9 @@
|
||||||
width: calc(100vw / 12 - 0.26vw);
|
width: calc(100vw / 12 - 0.26vw);
|
||||||
}
|
}
|
||||||
.student-title {
|
.student-title {
|
||||||
width: calc(2 * (100vw / 12 - 0.22vw) + 0.2vw);
|
/* width: calc(2 * (100vw / 12 - 0.22vw) + 0.2vw); */
|
||||||
font-size: 15px;
|
/* font-size: 15px; */
|
||||||
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
.student h5 {
|
.student h5 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
|
@ -60,7 +61,7 @@
|
||||||
<div ng-controller="StudentProgressionController" class="m-4">
|
<div ng-controller="StudentProgressionController" class="m-4">
|
||||||
<div class="card-group offset-md-1 col-md-10 offset-lg-2 col-lg-8">
|
<div class="card-group offset-md-1 col-md-10 offset-lg-2 col-lg-8">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img src="photos/thumb/{{ img | lowercase }}" class="card-img-top" alt="{{ student.login }}">
|
<img src="/dashboard/photos/thumb/{{ img | lowercase }}" class="card-img-top" alt="{{ student.login }}">
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
@ -100,8 +101,8 @@
|
||||||
<div ng-cloak ng-if="!onestudent">
|
<div ng-cloak ng-if="!onestudent">
|
||||||
<div ng-controller="StudentsProgressionController" class="d-flex flex-wrap">
|
<div ng-controller="StudentsProgressionController" class="d-flex flex-wrap">
|
||||||
<div class="card student student-title d-flex flex-column justify-content-around" style="background-image: url('https://srs.epita.fr/assets/images/logo-srs.png');">
|
<div class="card student student-title d-flex flex-column justify-content-around" style="background-image: url('https://srs.epita.fr/assets/images/logo-srs.png');">
|
||||||
<h5 class="text-center" title="SRS" ng-cloak>
|
<h5 class="text-center text-truncate mb-0" title="SRS" ng-cloak>
|
||||||
ADLIN TP {{tutoid+1}}
|
TP {{tutoid+1}}
|
||||||
<span ng-click="toogleDropdown()">
|
<span ng-click="toogleDropdown()">
|
||||||
<svg class="bi bi-chevron-down" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
<svg class="bi bi-chevron-down" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z" clip-rule="evenodd"/>
|
<path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z" clip-rule="evenodd"/>
|
||||||
|
|
@ -120,7 +121,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card student d-flex flex-column justify-content-between" ng-repeat="(login, mychallenges) in students" ng-if="login != 'nemunaire'" style="background-image: url('photos/square/{{ mychallenges.img | lowercase }}')" ng-show="!filterBadgeState.challenge || (filterBadgeState.state == 'bad' && (!mychallenges[filterBadgeState.challenge] || !mychallenges[filterBadgeState.challenge].recent)) || (filterBadgeState.state == 'passed' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent) || (filterBadgeState.state == 'online' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent <= 300) || (filterBadgeState.state == 'offline' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent > 300)">
|
<div class="card student d-flex flex-column justify-content-between" ng-repeat="(login, mychallenges) in students" ng-if="login != 'nemunaire'" style="background-image: url('/dashboard/photos/square/{{ mychallenges.img | lowercase }}')" ng-show="!filterBadgeState.challenge || (filterBadgeState.state == 'bad' && (!mychallenges[filterBadgeState.challenge] || !mychallenges[filterBadgeState.challenge].recent)) || (filterBadgeState.state == 'passed' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent) || (filterBadgeState.state == 'online' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent <= 300) || (filterBadgeState.state == 'offline' && mychallenges[filterBadgeState.challenge] && mychallenges[filterBadgeState.challenge].recent > 300)">
|
||||||
<h5 class="login text-truncate" title="{{ login }}">
|
<h5 class="login text-truncate" title="{{ login }}">
|
||||||
<span class="badge" ng-class="{'badge-success': mychallenges['ping'] && mychallenges['ping'].recent < 120, 'badge-info': mychallenges['ping'] && mychallenges['ping'].recent >= 120 && mychallenges['ping'].recent < 300, 'badge-warning': mychallenges['ping'] && mychallenges['ping'].recent >= 300 && mychallenges['ping'].recent < 900, 'badge-danger': mychallenges['ping'] && mychallenges['ping'].recent >= 900, 'badge-dark': !mychallenges['ping']}" title="{{ mychallenges['ping'].time }}">
|
<span class="badge" ng-class="{'badge-success': mychallenges['ping'] && mychallenges['ping'].recent < 120, 'badge-info': mychallenges['ping'] && mychallenges['ping'].recent >= 120 && mychallenges['ping'].recent < 300, 'badge-warning': mychallenges['ping'] && mychallenges['ping'].recent >= 300 && mychallenges['ping'].recent < 900, 'badge-danger': mychallenges['ping'] && mychallenges['ping'].recent >= 900, 'badge-dark': !mychallenges['ping']}" title="{{ mychallenges['ping'].time }}">
|
||||||
💻
|
💻
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ kernel:
|
||||||
cmdline: "console=tty0 console=ttyS0 root=/dev/sda1 root=/dev/sr0 adlin.format=/dev/sda quiet"
|
cmdline: "console=tty0 console=ttyS0 root=/dev/sda1 root=/dev/sr0 adlin.format=/dev/sda quiet"
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- nemunaire/adlin-tuto2:55c520c84f1aeb93d5af2255851ece5589312271
|
- nemunaire/adlin-tuto2:5a42a080ac2644e92aef80647f37580c5dda1d01
|
||||||
|
|
||||||
files:
|
files:
|
||||||
- path: etc/hostname
|
- path: etc/hostname
|
||||||
|
|
@ -178,7 +178,7 @@ files:
|
||||||
|
|
||||||
- path: etc/shadow
|
- path: etc/shadow
|
||||||
contents: |
|
contents: |
|
||||||
root:$6$R0XGKnrwzA4kTcET$6JsBy0Ib7xzy3OUZLq81/Cu4XswmOzv4VmCBJ76jAq/lJ049rxrHsyzGhUY8TONLdlbKfm0.EhCKB4NLivdck/:18336:0:99999:7:::
|
root:$y$j9T$.GjDIyRkcMni489J0rTPS0$.TecjwXa3nlysU16kk7KFIZ2QLIA66Jt5ZG39aE7hf1:18336:0:99999:7:::
|
||||||
daemon:*:18316:0:99999:7:::
|
daemon:*:18316:0:99999:7:::
|
||||||
bin:*:18316:0:99999:7:::
|
bin:*:18316:0:99999:7:::
|
||||||
sys:*:18316:0:99999:7:::
|
sys:*:18316:0:99999:7:::
|
||||||
|
|
|
||||||
Reference in a new issue