Update fickit

This commit is contained in:
nemunaire 2018-12-10 02:16:07 +01:00
parent a499d23149
commit 20df137eeb
12 changed files with 514 additions and 98 deletions

11
.gitignore vendored
View File

@ -5,6 +5,9 @@ SETTINGS/
TEAMS/
submissions/
admin/sync/README.html
fickit-boot-cmdline
fickit-boot-initrd.img
fickit-boot-kernel
fickit-backend-cmdline
fickit-backend-initrd.img
fickit-backend-squashfs.img
@ -13,3 +16,11 @@ fickit-frontend-cmdline
fickit-frontend-initrd.img
fickit-frontend-squashfs.img
fickit-frontend-kernel
fickit-prepare-bios.img
fickit-prepare-cmdline
fickit-prepare-initrd.img
fickit-prepare-kernel
fickit-update-cmdline
fickit-update-initrd.img
fickit-update-kernel
fickit-update-squashfs.img

View File

@ -26,6 +26,7 @@ WORKDIR /srv
ENTRYPOINT ["/srv/admin", "-bind=:8081", "-baseurl=/admin/"]
COPY --from=gobuild /go/src/srs.epita.fr/fic-server/admin/admin /srv/admin
COPY admin/static/check_import.html /srv/htdocs-admin/
COPY admin/static/css/bootstrap.min.css frontend/static/css/glyphicon.css /srv/htdocs-admin/css/
COPY frontend/static/fonts /srv/htdocs-admin/fonts
COPY admin/static/img /srv/htdocs-admin/img

View File

@ -1,6 +1,5 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDO/3qKhSUbGYZBVraFo68oScJahRDNQfG+uwDQlLv7g nemunaire@khonsou
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqEniilVnT/hKEpxe59KvbUoCdGvEUMoVLzwkwpzSr2MIFTddQHXDcxL7+YQhiKrd3veZgR8IWGsuCDy8lEZumpY60omgaQYbpFQHeybC/tFefsMWoHqEeV69CmriNBtVoBPQyLRWZCt0exvJ269POHfyWOJixI3yf9J1En9JV1TzEvU6J7+GV6bLXEd5WghuXxcwRVQHzwnBFXOXOkiGuOqnDix0F5WZTxo5BsM2tbK6kbsT9k4TyfBYl1gA2dqB+swrKk83F9skbPTWZAX7Z5dmJ/ZBV7u+t4lk6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JJt9C98+TXqG01H35tcQamwZMDl1KMrIGCRvywdu+wqB4Z2AkBoI+VH8t2AqXcyKi7ltGZTzbEEItFx4HqlemxgcaM86jho/WlsCvF3AHr9sDJlO93+SuX6gX4sZmRo00KJU9ss/w1FpYjX8crOlr1Ze7YUU/wmTpzzhje50ZNhSRR9R thibaut.passilly@MacBook-Pro.local
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCWrRHAMkZolWFm3jTo0wcBUUJVNKlfO66S2z731nsiQb1r0pQjZDsZjs1YKPp92F2XncQXFUFujOPd4dNT8vkYOKLm6FeDCU8DR9omRwYQq6ZkJ65ySYCLyaKqrH9nKWb2nessAmo1lWzj+K9UmsZeV5tjguxdlpTCod7EHByrRSNTOEURzW96CDsr2IGl2h7XmUDOnMhiTn4y2Qq4sAz0BisP1Y9wBFkLgqYOAVmc+3r41W1w8oCcy2jyGaGp4Bo/mNZdHyozGrEvYXl/uJvOgdTXYufqb4oosoMLrakkEvINybyqspKKX2RNx6HitYdTYNzsZIBHKh70KIDmVvLL ron@CyberWeasley
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkLmYDbAHx+jCPS4XLQDwlgr1WbZ6oyHBYNOJCm8ektdHPrXUuXwjOAns+eieUdH+AS8/Jrgds31qne5wOHesA8vxilHRsJdJPZgndKntAky7xrfr9W7rYGNTBSMn7tiUBOWEg5uz5px/NTmtIdIhkDabG760yyDUNOpvm62MFNIjqixGpVWSjJvf/buKbCZVTq8Foqs40v8HwMaR4Z76Wvtl982B7BBgg1sf34XiN62Q2ej/Heqp+qxlMolTENQ+ezTZcDu39cBO/AV9FLhQ5Faz0SKPXWLz6nksvUMffWEajPnvJMnw/RjXxpW09ZAJuWoi4Xn1LDTTgToVmUu9B mike@IMiykyRo

View File

@ -1,8 +1,10 @@
default-lease-time 600;
max-lease-time 7200;
authoritative;
option subnet-mask 255.255.255.0;
option broadcast-address 172.23.42.255;
option routers 172.23.42.254;
option domain-name-servers 9.9.9.9, 1.1.1.1;
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;
option rfc3442-classless-static-routes 32, 163, 5, 55, 58, 172, 23, 42, 1;

View File

@ -0,0 +1,4 @@
auth_basic "Restricted";
auth_basic_user_file /srv/PKI/shared/ficpasswd;
set $team "$remote_user";

188
configs/nginx-demo.conf Normal file
View File

@ -0,0 +1,188 @@
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
proxy_connect_timeout 1s;
server {
listen 80 default;
rewrite ^ https://$server_name$request_uri permanent;
}
server {
listen 443 default ssl http2;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_dhparam /etc/nginx/ssl/dhparams-4096.pem;
ssl_prefer_server_ciphers on;
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
root /srv/htdocs-frontend/;
error_page 401 /welcome.html;
error_page 403 404 /e404.html;
error_page 413 /e413.html;
error_page 500 502 504 /e500.html;
add_header Strict-Transport-Security max-age=31536000;
location = / {
include fic-auth.conf;
}
location = /index.html {
include fic-auth.conf;
}
location = /welcome.html {
internal;
if ($http_accept ~ "^application/json") {
rewrite ^/(.*).html$ /$1.json;
}
}
location = /e404.html {
internal;
if ($http_accept ~ "^application/json") {
rewrite ^/(.*).html$ /$1.json;
}
}
location = /e413.html {
internal;
if ($http_accept ~ "^application/json") {
rewrite ^/(.*).html$ /$1.json;
}
}
location = /e500.html {
internal;
if ($http_accept ~ "^application/json") {
rewrite ^/(.*).html$ /$1.json;
}
}
location ~ ^/[A-Z] {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /edit {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /rank {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /tags/ {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /register {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /rules {
include fic-auth.conf;
rewrite ^/.*$ /index.html;
}
location /files/ {
alias /srv/FILES/;
sendfile on;
tcp_nodelay on;
}
location /wait.json {
include fic-auth.conf;
root /srv/TEAMS/$team/;
expires epoch;
add_header Cache-Control no-cache;
}
location /stats.json {
root /srv/TEAMS/;
expires epoch;
add_header Cache-Control no-cache;
}
location /my.json {
include fic-auth.conf;
root /srv/TEAMS/$team/;
expires epoch;
add_header Cache-Control no-cache;
if (!-f /srv/startingblock/started) {
rewrite ^/.* /wait.json;
}
}
location = /events.json {
root /srv/TEAMS/;
expires epoch;
add_header Cache-Control no-cache;
}
location = /teams.json {
root /srv/TEAMS/;
expires epoch;
add_header Cache-Control no-cache;
}
location = /themes.json {
root /srv/TEAMS/;
expires epoch;
add_header Cache-Control no-cache;
}
location = /settings.json {
root /srv/SETTINGS/;
expires epoch;
add_header X-FIC-time $msec;
add_header Cache-Control no-cache;
}
location /submit/ {
include fic-auth.conf;
rewrite ^/submit/(.*)$ /submission/$team/$1 break;
proxy_pass http://frontend:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
location /submit/name {
include fic-auth.conf;
rewrite ^/submit/.*$ /chname/$team break;
proxy_pass http://frontend:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
location /registration {
include fic-auth.conf;
rewrite ^/registration /registration/$team break;
proxy_pass http://frontend:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
location /openhint/ {
include fic-auth.conf;
rewrite ^/openhint/(.*)$ /openhint/$team/$1 break;
proxy_pass http://frontend:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
location /wantchoices/ {
include fic-auth.conf;
rewrite ^/wantchoices/(.*)$ /wantchoices/$team/$1 break;
proxy_pass http://frontend:8080/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
}
}

8
configs/update_imgs.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
mkdir -p /boot/imgs
for img in fickit-kernel fickit-boot-initrd.img fickit-frontend-squashfs.img fickit-backend-squashfs.img fickit-update-initrd.img
do
wget -O "/boot/imgs/${img}" "10.10.10.6/${img}"
done

View File

@ -1,29 +1,31 @@
kernel:
image: nemunaire/kernel:4.9.77
cmdline: "console=tty0"
image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-dirty-amd64
cmdline: "console=ttyS0 console=tty0"
init:
- linuxkit/init:be8756f0a6005279d2409a8790b4dd8b2ac11df9
- linuxkit/runc:7b15b00b4e3507d62e3ed8d44dfe650561cd35ff
- linuxkit/containerd:78706a05d00a7385ff2b6b7db280041338e4b34a
- linuxkit/ca-certificates:de21b84d9b055ad9dcecc57965b654a7a24ef8e0
- linuxkit/getty:22e27189b6b354e1d5d38fc0536a5af3f2adb79f
- nemunaire/mdadm:0ac2a0d3e7be84f1aad852c906d54cbff4d1668f
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/containerd:326b096cd5fbab0f864e52721d036cade67599d6
- linuxkit/ca-certificates:v0.6
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
- nemunaire/mdadm:18541ef20acd7e67e07bb2bde4f378239e67c42d
onboot:
- name: sysctl
image: linuxkit/sysctl:4c1ef93bb5eb1a877318db4b2daa6768ed002e21
- name: sysctl
image: linuxkit/sysctl:4c1ef93bb5eb1a877318db4b2daa6768ed002e21
command: ["/usr/bin/sysctl", "-w", "net.ipv6.conf.all.disable_ipv6=1"]
- name: mod
image: linuxkit/modprobe:v0.6
command: ["/bin/sh", "-c", "modprobe e1000e"]
# - name: sysctl
# image: linuxkit/sysctl:v0.6
# command: ["/usr/bin/sysctl", "-w", "net.ipv6.conf.all.disable_ipv6=1"]
# Filesystem
- name: swap
image: linuxkit/swap:b3d5db11b14168874a01b5ea4398186321be836f
command: ["/sbin/swapon", "/dev/sda3", "/dev/sdb3"]
image: linuxkit/swap:v0.6
command: ["/sbin/swapon", "/dev/sda2", "/dev/sdb2"]
- name: mount
image: linuxkit/mount:b346ec277b7074e5c9986128a879c10a1d18742b
command: ["/usr/bin/mountie", "-device", "/dev/md127", "/var/lib/fic" ]
image: linuxkit/mount:v0.6
command: ["/usr/bin/mountie", "-device", "/dev/md0", "/var/lib/fic" ]
# Network
# - name: dhcpcd
@ -32,7 +34,7 @@ onboot:
# - name: ntp
# image: linuxkit/openntpd:536e5947607c9e6a6771957c2ff817230cba0d3c
- name: synchro-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 10.10.10.1/29 dev eth0; ip link set eth0 up;" ]
net: new
runtime:
@ -41,8 +43,8 @@ onboot:
bindNS:
net: /run/netns/synchro
- name: admin-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
command: ["/bin/sh", "-c", "ip a add 192.168.0.1/24 dev eth1; ip link set eth1 up; ip a add 172.17.0.2/24 dev vethin-admin; ip link set vethin-admin up;" ]
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 192.168.23.1/24 dev eth1; ip link set eth1 up; ip a add 172.17.0.2/24 dev vethin-admin; ip link set vethin-admin up;" ]
net: new
runtime:
interfaces:
@ -53,7 +55,7 @@ onboot:
bindNS:
net: /run/netns/fic-admin
- name: backend-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.0.3/24 dev vethin-backend; ip link set vethin-backend up;" ]
net: new
runtime:
@ -64,7 +66,7 @@ onboot:
bindNS:
net: /run/netns/fic-backend
- name: mysql-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.0.4/24 dev vethin-db; ip link set vethin-db up;" ]
net: new
runtime:
@ -75,7 +77,7 @@ onboot:
bindNS:
net: /run/netns/db
- name: bridge-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.0.1/24 dev br0; ip link set veth-admin master br0; ip link set veth-backend master br0; ip link set veth-db master br0; ip link set br0 up; ip link set veth-admin up; ip link set veth-backend up; ip link set veth-db up;" ]
runtime:
interfaces:
@ -83,7 +85,7 @@ onboot:
add: bridge
- name: firewall-synchro
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/bash", "-c", "/sbin/iptables-restore < /etc/iptables/rules-synchro.v4; /sbin/ip6tables-restore < /etc/iptables/rules.v6" ]
binds:
- /etc/iptables/rules-synchro.v4:/etc/iptables/rules-synchro.v4:ro
@ -93,7 +95,7 @@ onboot:
mkdir:
- /var/lib/fic/teams
- name: firewall-admin
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/bash", "-c", "/sbin/iptables-restore < /etc/iptables/rules-admin.v4; /sbin/ip6tables-restore < /etc/iptables/rules.v6" ]
binds:
- /etc/iptables/rules-admin.v4:/etc/iptables/rules-admin.v4:ro
@ -101,8 +103,12 @@ onboot:
net: /run/netns/fic-admin
services:
# - name: getty
# image: linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
# env:
# - INSECURE=true
- name: rngd
image: linuxkit/rngd:94e01a4b16fadb053455cdc2269c4eb0b39199cd
image: linuxkit/rngd:v0.6
- name: db
image: mariadb:latest
command: ["/bin/bash", "/usr/local/bin/docker-entrypoint.sh", "mysqld"]
@ -134,17 +140,19 @@ services:
- FICCA_PASS=jee8AhloAith1aesCeQu5ahgIegaeM4K
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/files:/srv/FILES
- /var/lib/fic/raw_files:/mnt/fic
- /var/lib/fic/dashboard:/srv/DASHBOARD
- /var/lib/fic/files:/srv/FILES
- /var/lib/fic/pki:/srv/PKI
- /var/lib/fic/settings:/srv/SETTINGS
- /var/lib/fic/teams:/srv/TEAMS
- /var/lib/fic/settings:/srv/SETTINGS
net: /run/netns/fic-admin
pid: new
ipc: new
uts: new
runtime:
mkdir:
- /var/lib/fic/dashboard
- /var/lib/fic/files
- /var/lib/fic/raw_files
- /var/lib/fic/pki
@ -156,9 +164,9 @@ services:
- MYSQL_HOST=tcp(db:3306)
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/teams:/srv/TEAMS
- /var/lib/fic/settings:/srv/SETTINGS:ro
- /var/lib/fic/submissions:/srv/submissions
- /var/lib/fic/teams:/srv/TEAMS
net: /run/netns/fic-backend
pid: new
ipc: new
@ -168,15 +176,31 @@ services:
- /var/lib/fic/settings
- /var/lib/fic/submissions
- /var/lib/fic/teams
- name: fic-dashboard
image: nemunaire/fic-dashboard:latest
binds:
- /etc/hosts:/etc/hosts:ro
- /var/lib/fic/dashboard:/srv/DASHBOARD
- /var/lib/fic/teams:/srv/TEAMS:ro
- /var/lib/fic/settings:/srv/SETTINGS:ro
net: /run/netns/fic-admin
pid: new
ipc: new
uts: new
runtime:
mkdir:
- /var/lib/fic/dashboard
- /var/lib/fic/teams
- /var/lib/fic/settings
- name: fic-synchro
image: nemunaire/rsync:f8a6d2b0b1064ea3cb3601a159bb886c47a76ce3
image: nemunaire/rsync:416df0e1fe1562d5d1c63461dacd1267b47a4f05
command: ["/bin/ash", "/root/synchro.sh"]
binds:
- /etc/hosts:/etc/hosts:ro
- /root/.ssh/id_ed25519:/root/.ssh/id_ed25519:ro
- /root/synchro.sh:/root/synchro.sh:ro
- /var/lib/fic/files:/srv/FILES:ro
- /var/lib/fic/pki/ca.key:/srv/PKI/ca.key:ro
#- /var/lib/fic/pki/ca.key:/srv/PKI/ca.key:ro
- /var/lib/fic/pki/shared:/srv/PKI/shared:ro
- /var/lib/fic/settings:/srv/SETTINGS:ro
- /var/lib/fic/submissions:/srv/submissions
@ -193,11 +217,12 @@ services:
- /var/lib/fic/submissions
- /var/lib/fic/teams
- name: sshd
image: nemunaire/rsync:f8a6d2b0b1064ea3cb3601a159bb886c47a76ce3
image: nemunaire/rsync:416df0e1fe1562d5d1c63461dacd1267b47a4f05
binds:
- /etc/hosts:/etc/hosts:ro
- /root/.ssh/authorized_keys:/root/.ssh/authorized_keys:ro
- /var/lib/fic/outofsync:/var/lib/fic/outofsync
- /var/lib/fic/raw_files:/mnt/fic
net: /run/netns/fic-admin
runtime:
mkdir:
@ -235,8 +260,9 @@ files:
[0:0] -A INPUT -m conntrack --ctstate INVALID -j DROP
[0:0] -A INPUT -p icmp -j ACCEPT
[0:0] -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
[0:0] -A INPUT -i eth1 -s 192.168.0.0/24 -p tcp -m conntrack --ctstate NEW -m tcp --dport ssh -j ACCEPT
[0:0] -A INPUT -i eth1 -s 192.168.23.0/24 -p tcp -m conntrack --ctstate NEW -m tcp --dport ssh -j ACCEPT
[0:0] -A INPUT -p tcp -m conntrack --ctstate NEW -m tcp --dport 8081 -j ACCEPT
[0:0] -A INPUT -p tcp -m conntrack --ctstate NEW -m tcp --dport 8082 -j ACCEPT
[0:0] -A INPUT -i vethin-admin -s 172.17.0.0/24 -p tcp -m conntrack --ctstate NEW -j ACCEPT
[0:0] -A INPUT -j LOG
[0:0] -A FORWARD -j LOG

6
fickit-boot.yml Normal file
View File

@ -0,0 +1,6 @@
kernel:
image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-dirty-amd64
cmdline: "console=ttyS0 console=tty0"
init:
- nemunaire/boot:f023f1e3750b65e0434fd180f323d5aefe5e9dd1

View File

@ -1,26 +1,30 @@
kernel:
image: nemunaire/kernel:4.9.77
cmdline: "console=tty0"
image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-dirty-amd64
cmdline: "console=ttyS0 console=tty0"
init:
- linuxkit/init:be8756f0a6005279d2409a8790b4dd8b2ac11df9
- linuxkit/runc:7b15b00b4e3507d62e3ed8d44dfe650561cd35ff
- linuxkit/containerd:78706a05d00a7385ff2b6b7db280041338e4b34a
- linuxkit/ca-certificates:de21b84d9b055ad9dcecc57965b654a7a24ef8e0
- linuxkit/getty:22e27189b6b354e1d5d38fc0536a5af3f2adb79f
- nemunaire/mdadm:0ac2a0d3e7be84f1aad852c906d54cbff4d1668f
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/containerd:326b096cd5fbab0f864e52721d036cade67599d6
- linuxkit/ca-certificates:v0.6
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
- nemunaire/mdadm:18541ef20acd7e67e07bb2bde4f378239e67c42d
onboot:
- name: sysctl
image: linuxkit/sysctl:4c1ef93bb5eb1a877318db4b2daa6768ed002e21
- name: mod
image: linuxkit/modprobe:v0.6
command: ["/bin/sh", "-c", "modprobe r8169;"]
# - name: sysctl
# image: linuxkit/sysctl:v0.6
# Filesystem
- name: swap
image: linuxkit/swap:b3d5db11b14168874a01b5ea4398186321be836f
command: ["/sbin/swapon", "/dev/sda3", "/dev/sdb3"]
image: linuxkit/swap:v0.6
command: ["/sbin/swapon", "/dev/sda2", "/dev/sdb2"]
- name: mount
image: linuxkit/mount:b346ec277b7074e5c9986128a879c10a1d18742b
command: ["/usr/bin/mountie", "-device", "/dev/md127", "/var/lib/fic" ]
image: linuxkit/mount:v0.6
command: ["/usr/bin/mountie", "-device", "/dev/md0", "/var/lib/fic" ]
# Network
# - name: dhcpcd
@ -29,7 +33,7 @@ onboot:
# - name: ntp
# image: linuxkit/openntpd:536e5947607c9e6a6771957c2ff817230cba0d3c
- name: nginx-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.1.2/24 dev vethin-nginx; ip link set vethin-nginx up;" ]
net: new
runtime:
@ -39,19 +43,28 @@ onboot:
peer: veth-nginx
bindNS:
net: /run/netns/nginx
- name: frontal-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
command: ["/bin/sh", "-c", "ip link set bond-frontal up; ifenslave bond-frontal eth1 eth2 eth3; ip a add 172.23.42.1/24 dev bond-frontal; ip a add 163.5.55.58/32 dev bond-frontal;" ]
- name: frontal-ip-setup # without bonding
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip link set eth1 up; ip a add 172.23.42.1/24 dev eth1; ip a add 163.5.55.58/32 dev eth1;" ]
net: /run/netns/nginx
runtime:
interfaces:
- name: eth1
- name: eth2
- name: eth3
- name: bond-frontal
add: bond
# - name: frontal-ip-setup # with bonding
# image: linuxkit/ip:v0.6
# command: ["/bin/sh", "-c", "ip link set bond-frontal up; ifenslave bond-frontal eth1 eth2 eth3; ip a add 172.23.42.1/24 dev bond-frontal; ip a add 163.5.55.58/32 dev bond-frontal;" ]
# net: /run/netns/nginx
# runtime:
# interfaces:
# - name: eth1
# - name: eth2
# - name: eth3
# - name: bond-frontal
# add: bond
- name: frontend-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.1.3/24 dev vethin-frontend; ip link set vethin-frontend up;" ]
net: new
runtime:
@ -62,7 +75,7 @@ onboot:
bindNS:
net: /run/netns/fic-frontend
- name: sshd-ip-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 10.10.10.2/29 dev eth0; ip link set eth0 up;" ]
net: new
runtime:
@ -71,7 +84,7 @@ onboot:
bindNS:
net: /run/netns/sshd
- name: bridge-setup
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 172.17.1.1/24 dev br0; ip link set veth-nginx master br0; ip link set veth-frontend master br0; ip link set br0 up; ip link set veth-nginx up; ip link set veth-frontend up;" ]
runtime:
interfaces:
@ -79,14 +92,14 @@ onboot:
add: bridge
- name: firewall-frontal
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/bash", "-c", "/sbin/iptables-restore < /etc/iptables/rules-frontal.v4; /sbin/ip6tables-restore < /etc/iptables/rules.v6" ]
binds:
- /etc/iptables/rules-frontal.v4:/etc/iptables/rules-frontal.v4:ro
- /etc/iptables/rules.v6:/etc/iptables/rules.v6:ro
net: /run/netns/nginx
- name: firewall-sshd
image: linuxkit/ip:284c21791d8c05c49eccbd8e8cc2fb97bbd61842
image: linuxkit/ip:v0.6
command: ["/bin/bash", "-c", "/sbin/iptables-restore < /etc/iptables/rules-sshd.v4; /sbin/ip6tables-restore < /etc/iptables/rules.v6" ]
binds:
- /etc/iptables/rules-sshd.v4:/etc/iptables/rules-sshd.v4:ro
@ -94,8 +107,12 @@ onboot:
net: /run/netns/sshd
services:
# - name: getty
# image: linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
# env:
# - INSECURE=true
- name: rngd
image: linuxkit/rngd:94e01a4b16fadb053455cdc2269c4eb0b39199cd
image: linuxkit/rngd:v0.6
- name: nginx
image: nginx:alpine
capabilities:
@ -145,7 +162,7 @@ services:
- /var/lib/fic/submissions
- /var/lib/fic/teams
- name: sshd
image: nemunaire/rsync:f66273f042b8a2976fe4af2425943df913b18088
image: nemunaire/rsync:416df0e1fe1562d5d1c63461dacd1267b47a4f05
binds:
- /etc/hosts:/etc/hosts:ro
- /root/.ssh/id_synchro.pub:/root/.ssh/authorized_keys:ro
@ -178,16 +195,16 @@ services:
pid: new
ipc: new
uts: new
- name: dns-server
image: sapcc/unbound
binds:
- /etc/unbound/unbound.conf:/etc/unbound/unbound.conf:ro
capabilities:
- CAP_NET_BIND_SERVICE
net: /run/netns/nginx
pid: new
ipc: new
uts: new
# - name: dns-server
# image: sapcc/unbound
# binds:
# - /etc/unbound/unbound.conf:/etc/unbound/unbound.conf:ro
# capabilities:
# - CAP_NET_BIND_SERVICE
# net: /run/netns/nginx
# pid: new
# ipc: new
# uts: new
files:
@ -215,10 +232,10 @@ files:
source: configs/dhcpd.conf
mode: "0400"
- path: etc/nginx/conf.d/default.conf
source: configs/nginx-prod.conf
source: configs/nginx-demo.conf
mode: "0400"
- path: etc/nginx/fic-auth.conf
source: configs/fic-auth.conf
source: configs/fic-auth-demo.conf
mode: "0400"
- path: www/htdocs-frontend
@ -227,20 +244,20 @@ files:
- path: www/htdocs-frontend/e500.html
source: frontend/static/e500.html
mode: "0644"
- path: www/htdocs-frontend/e500.json
source: frontend/static/e500.json
mode: "0644"
- path: www/htdocs-frontend/img/srs.png
source: frontend/static/img/srs.png
mode: "0644"
- path: www/htdocs-frontend/img/fic.png
source: frontend/static/img/fic.png
mode: "0644"
- path: www/htdocs-frontend/img/logo-epita-bw.png
source: frontend/static/img/logo-epita-bw.png
mode: "0644"
- path: www/htdocs-frontend/img/epita.png
source: frontend/static/img/epita.png
mode: "0644"
- path: www/htdocs-frontend/img/rcc.png
source: frontend/static/img/rcc.png
- path: www/htdocs-frontend/img/comcyber.png
source: frontend/static/img/comcyber.png
mode: "0644"
- path: www/htdocs-frontend/favicon.ico
source: frontend/static/favicon.ico
@ -248,6 +265,9 @@ files:
- path: www/htdocs-frontend/e404.html
source: frontend/static/e404.html
mode: "0644"
- path: www/htdocs-frontend/e404.json
source: frontend/static/e404.json
mode: "0644"
- path: www/htdocs-frontend/css/bootstrap.min.css
source: frontend/static/css/bootstrap.min.css
mode: "0644"
@ -275,27 +295,27 @@ files:
- path: www/htdocs-frontend/js/challenge.js
source: frontend/static/js/challenge.js
mode: "0644"
- path: www/htdocs-frontend/js/public.js
source: frontend/static/js/public.js
mode: "0644"
- path: www/htdocs-frontend/js/bootstrap.min.js
source: frontend/static/js/bootstrap.min.js
mode: "0644"
- path: www/htdocs-frontend/js/popper.min.js
source: frontend/static/js/popper.min.js
mode: "0644"
- path: www/htdocs-frontend/js/jquery.min.js
source: frontend/static/js/jquery.min.js
mode: "0644"
- path: www/htdocs-frontend/js/angular-animate.min.js
source: frontend/static/js/angular-animate.min.js
mode: "0644"
- path: www/htdocs-frontend/js/angular-route.min.js
source: frontend/static/js/angular-route.min.js
mode: "0644"
- path: www/htdocs-frontend/js/blake2b.js
source: frontend/static/js/blake2b.js
mode: "0644"
- path: www/htdocs-frontend/e413.html
source: frontend/static/e413.html
mode: "0644"
- path: www/htdocs-frontend/e413.json
source: frontend/static/e413.json
mode: "0644"
- path: www/htdocs-frontend/fonts/FantasqueSansMono-Regular.woff
source: frontend/static/fonts/FantasqueSansMono-Regular.woff
mode: "0644"
- path: www/htdocs-frontend/fonts/glyphicons-halflings-regular.woff2
source: frontend/static/fonts/glyphicons-halflings-regular.woff2
mode: "0644"
@ -314,21 +334,18 @@ files:
- path: www/htdocs-frontend/welcome.html
source: frontend/static/welcome.html
mode: "0644"
- path: www/htdocs-frontend/public.html
source: frontend/static/public.html
- path: www/htdocs-frontend/welcome.json
source: frontend/static/welcome.json
mode: "0644"
- path: www/htdocs-frontend/index.html
source: frontend/static/index.html
mode: "0644"
- path: www/htdocs-frontend/views/videos.html
source: frontend/static/views/videos.html
- path: www/htdocs-frontend/views/defi.html
source: frontend/static/views/defi.html
mode: "0644"
- path: www/htdocs-frontend/views/home.html
source: frontend/static/views/home.html
mode: "0644"
- path: www/htdocs-frontend/views/theme.html
source: frontend/static/views/theme.html
mode: "0644"
- path: www/htdocs-frontend/views/rank.html
source: frontend/static/views/rank.html
mode: "0644"
@ -338,9 +355,18 @@ files:
- path: www/htdocs-frontend/views/rules.html
source: frontend/static/views/rules.html
mode: "0644"
- path: www/htdocs-frontend/views/tag.html
source: frontend/static/views/tag.html
mode: "0644"
- path: www/htdocs-frontend/views/team-edit.html
source: frontend/static/views/team-edit.html
mode: "0644"
- path: www/htdocs-frontend/views/theme.html
source: frontend/static/views/theme.html
mode: "0644"
- path: www/htdocs-frontend/views/videos.html
source: frontend/static/views/videos.html
mode: "0644"
- path: www/htdocs-frontend/robots.txt
source: frontend/static/robots.txt
mode: "0644"

113
fickit-prepare.yml Normal file
View File

@ -0,0 +1,113 @@
kernel:
# image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-amd64
image: nemunaire/kernel:4.9.77
cmdline: "console=ttyS0 console=tty0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
onboot:
- name: net-setup
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 10.10.10.5/29 dev eth0; ip link set eth0 up;" ]
- name: format
image: linuxkit/format:v0.6
command: ["/bin/sh", "-c", "cat /etc/fdisk_cmd | fdisk /dev/sda && cat /etc/fdisk_cmd | fdisk /dev/sdb && cat /etc/sfdisk_schema | sfdisk /dev/sda && cat /etc/sfdisk_schema | sfdisk /dev/sdb" ]
binds:
- /dev:/dev
- /etc/fdisk_cmd:/etc/fdisk_cmd:ro
- /etc/sfdisk_schema:/etc/sfdisk_schema:ro
- name: raid-setup
image: nemunaire/mdadm:90509bdc0a6ee2bb36635ddc2573ae50130f0f04
command: ["/sbin/mdadm", "--create", "/dev/md0", "--run", "--level=1", "--metadata=0", "--raid-devices=2", "/dev/sda3", "/dev/sdb3" ]
- name: format
image: linuxkit/format:v0.6
command: ["/bin/sh", "-c", "mkswap /dev/sda2; mkswap /dev/sdb2; mkfs.ext4 /dev/md0 && sync" ]
binds:
- /dev:/dev
- name: install-syslinux
image: nemunaire/syslinux:876bf253b5e2db33fe64f5ffa796e5e8609a6792
command: ["/bin/sh", "/root/install_syslinux", "/dev/sda" , "/dev/sdb" ]
binds:
- /dev:/dev
- /root/install_syslinux:/root/install_syslinux:ro
- /root/update_imgs:/root/update_imgs:ro
files:
- path: root/update_imgs
source: configs/update_imgs.sh
mode: "0755"
- path: root/install_syslinux
contents: |
#!/bin/sh
for p; do
mkfs.vfat ${p}1
mkdir -p /boot
mount ${p}1 /boot/
mkdir -p /boot/EFI/boot /boot/imgs
cd /usr/share/syslinux/efi64
cp ldlinux.e64 menu.c32 libcom32.c32 libutil.c32 vesamenu.c32 poweroff.c32 /boot/EFI/boot
cp syslinux.efi /boot/EFI/boot/bootx64.efi
cat <<EOF > /boot/syslinux.cfg
TIMEOUT 30
ONTIMEOUT backend
MENU background #00000000 * *
MENU color title * #FF22BBCC *
MENU color sel * #FFFFFFFF #FF22BBCC *
MENU color hotsel 1;7;37;40 #ffffffff #76a1d0ff *
UI vesamenu.c32
MENU TITLE Server FIC Challenge
LABEL backend
MENU LABEL FIC Backend
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-boot-initrd.img
APPEND console=ttyS0 console=tty0 root=fickit-backend-squashfs.img
LABEL frontend
MENU LABEL FIC Frontend
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-boot-initrd.img
APPEND console=ttyS0 console=tty0 root=fickit-frontend-squashfs.img
LABEL update
MENU LABEL Update images
LINUX /imgs/fickit-kernel
INITRD /imgs/fickit-update-initrd.img
APPEND console=ttyS0 console=tty0
MENU SEPARATOR
LABEL poweroff
MENU LABEL ^Shutdown
KERNEL poweroff.c32
EOF
# BIOS part
dd bs=440 conv=notrunc count=1 if=/usr/share/syslinux/mbr.bin of=${p}
syslinux --install ${p}1
cp /usr/share/syslinux/libcom32.c32 /usr/share/syslinux/libutil.c32 /usr/share/syslinux/poweroff.c32 /usr/share/syslinux/vesamenu.c32 /boot/
# Write images
/root/update_imgs
done
mode: "0550"
- path: etc/sfdisk_schema
contents: |
,500M,U,*
,4M,S,-
,+,R,-
mode: "0440"
- path: etc/fdisk_cmd
contents: |
o
w
mode: "0440"

32
fickit-update.yml Normal file
View File

@ -0,0 +1,32 @@
kernel:
image: nemunaire/kernel:4.9.140-4080ab71159a0b09a0b2ce7d87a7cb7fd719e35d-dirty-amd64
cmdline: "console=ttyS0 console=tty0"
init:
- linuxkit/init:c563953a2277eb73a89d89f70e4b6dcdcfebc2d1
- linuxkit/runc:83d0edb4552b1a5df1f0976f05f442829eac38fe
- linuxkit/getty:2eb742cd7a68e14cf50577c02f30147bc406e478
onboot:
- name: mod
image: linuxkit/modprobe:v0.6
command: ["/bin/sh", "-c", "modprobe e1000e"]
- name: net-setup
image: linuxkit/ip:v0.6
command: ["/bin/sh", "-c", "ip a add 10.10.10.5/29 dev eth0; ip link set eth0 up; mkdir -p /boot; ping -W 20 -c 1 10.10.10.6; for p in /dev/sda /dev/sdb; do mount ${p}1 /boot/ && /root/update_imgs; umount /boot; done && sync && reboot -f" ]
capabilities:
- CAP_SYS_ADMIN
- CAP_SYS_BOOT
- CAP_NET_RAW
- CAP_NET_ADMIN
binds:
- /dev:/dev
- /root/update_imgs:/root/update_imgs:ro
files:
- path: root/update_imgs
source: configs/update_imgs.sh
mode: "0755"