more
This commit is contained in:
60
README.md
60
README.md
@@ -50,4 +50,62 @@ iptables -t nat -A POSTROUTING -o br-ext -p tcp -d 192.168.0.0/24 --dport 22
|
||||
|
||||
## Deploy
|
||||
containerlab (via vscode) & go.
|
||||
it takes about a minute for the setup to be ready (DHCP etc).
|
||||
it takes a good minute (with 50 workstations) for the setup to be ready (DHCP etc).
|
||||
to create a csv of the online-users, run
|
||||
`echo "IP,host,username,pwd"; cat online-users.txt | awk -F' +' 'BEGIN{OFS=","} {$1=$1; print}'`
|
||||
on linux-gateway.
|
||||
|
||||
## prep workshop
|
||||
once the lab is deployed and the online-users.txt is built, generate the cards to print out:
|
||||
|
||||
### generate CSV
|
||||
`(echo "IP,host,username,pwd"; cat online-users.txt | awk -F' +' 'BEGIN{OFS=","} {$1=$1; print}') > credentials.csv`
|
||||
|
||||
### csv2cards script
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
# csv2cards.sh → html
|
||||
CSV=${1:-credentials.csv}
|
||||
OUT=${2:-cards.html}
|
||||
|
||||
# start the document
|
||||
cat >"$OUT" <<'EOF'
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Credentials cards</title>
|
||||
<style>
|
||||
@page { size: A4 portrait; margin: 1cm; }
|
||||
body { font-family: monospace; display: flex; flex-wrap: wrap; gap: 0.5cm; }
|
||||
.card {
|
||||
width: 9cm; /* fits 2‑3 cards across A4 */
|
||||
border: 1px solid #333;
|
||||
padding: 0.3cm;
|
||||
box-sizing: border-box;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.field { margin: 0.1cm 0; }
|
||||
.label { font-weight: bold; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
EOF
|
||||
|
||||
# read CSV, skip header, emit a <div class="card"> per line
|
||||
awk -F',' 'NR>1{
|
||||
printf "<div class=\"card\">\n"
|
||||
printf " <div class=\"field\"><span class=\"label\">IP:</span> %s</div>\n", $1
|
||||
printf " <div class=\"field\"><span class=\"label\">Host:</span> %s</div>\n", $2
|
||||
printf " <div class=\"field\"><span class=\"label\">User:</span> %s</div>\n", $3
|
||||
printf " <div class=\"field\"><span class=\"label\">Pass:</span> %s</div>\n", $4
|
||||
printf "</div>\n"
|
||||
}' "$CSV" >>"$OUT"
|
||||
|
||||
# close the document
|
||||
cat >>"$OUT" <<'EOF'
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
```
|
||||
download html, print from browser. Should be automatically A4.
|
||||
|
||||
113
sshlab.clab.yml
113
sshlab.clab.yml
@@ -11,7 +11,7 @@ topology:
|
||||
image: workshop-debian:v1
|
||||
network-mode: none
|
||||
binds:
|
||||
- ./names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
- ./config/authorized_keys:/root/.ssh/authorized_keys:ro
|
||||
- ./setups/linux.sh:/usr/local/bin/setup.sh:ro
|
||||
memory: 256MB
|
||||
@@ -29,12 +29,13 @@ topology:
|
||||
binds:
|
||||
- ./config/dnsmasq.conf:/etc/dnsmasq.conf:ro
|
||||
- ./setups/gateway.sh:/usr/local/bin/setup.sh:ro
|
||||
- ./names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
- ./helpers/online-users.sh:/usr/local/bin/online-users.sh:ro
|
||||
jumphost1:
|
||||
kind: linux
|
||||
binds:
|
||||
- ./setups/jumphost.sh:/usr/local/bin/setup.sh:ro
|
||||
- ./names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
||||
memory: 4GB
|
||||
cpu-set: 2-3
|
||||
jumphost2:
|
||||
@@ -56,18 +57,56 @@ topology:
|
||||
- ./namepicker/webserver.py:/usr/local/bin/webserver.py:ro
|
||||
- ./setups/webserver.sh:/usr/local/bin/setup.sh:ro
|
||||
memory: 1GB
|
||||
linux1:
|
||||
kind: linux
|
||||
linux2:
|
||||
kind: linux
|
||||
linux3:
|
||||
kind: linux
|
||||
linux4:
|
||||
kind: linux
|
||||
linux5:
|
||||
kind: linux
|
||||
linux6:
|
||||
kind: linux
|
||||
linux1: {kind: linux}
|
||||
linux2: {kind: linux}
|
||||
linux3: {kind: linux}
|
||||
linux4: {kind: linux}
|
||||
linux5: {kind: linux}
|
||||
linux6: {kind: linux}
|
||||
linux7: {kind: linux}
|
||||
linux8: {kind: linux}
|
||||
linux9: {kind: linux}
|
||||
linux10: {kind: linux}
|
||||
linux11: {kind: linux}
|
||||
linux12: {kind: linux}
|
||||
linux13: {kind: linux}
|
||||
linux14: {kind: linux}
|
||||
linux15: {kind: linux}
|
||||
linux16: {kind: linux}
|
||||
linux17: {kind: linux}
|
||||
linux18: {kind: linux}
|
||||
linux19: {kind: linux}
|
||||
linux20: {kind: linux}
|
||||
linux21: {kind: linux}
|
||||
linux22: {kind: linux}
|
||||
linux23: {kind: linux}
|
||||
linux24: {kind: linux}
|
||||
linux25: {kind: linux}
|
||||
linux26: {kind: linux}
|
||||
linux27: {kind: linux}
|
||||
linux28: {kind: linux}
|
||||
linux29: {kind: linux}
|
||||
linux30: {kind: linux}
|
||||
linux31: {kind: linux}
|
||||
linux32: {kind: linux}
|
||||
linux33: {kind: linux}
|
||||
linux34: {kind: linux}
|
||||
linux35: {kind: linux}
|
||||
linux36: {kind: linux}
|
||||
linux37: {kind: linux}
|
||||
linux38: {kind: linux}
|
||||
linux39: {kind: linux}
|
||||
linux40: {kind: linux}
|
||||
linux41: {kind: linux}
|
||||
linux42: {kind: linux}
|
||||
linux43: {kind: linux}
|
||||
linux44: {kind: linux}
|
||||
linux45: {kind: linux}
|
||||
linux46: {kind: linux}
|
||||
linux47: {kind: linux}
|
||||
linux48: {kind: linux}
|
||||
linux49: {kind: linux}
|
||||
linux50: {kind: linux}
|
||||
|
||||
links:
|
||||
# - endpoints: ["a1:eth1","br-clab:eth1"]
|
||||
@@ -83,3 +122,47 @@ topology:
|
||||
- endpoints: [ "linux4:eth0", "br-clab-intonly:l4" ]
|
||||
- endpoints: [ "linux5:eth0", "br-clab-intonly:l5" ]
|
||||
- endpoints: [ "linux6:eth0", "br-clab-intonly:l6" ]
|
||||
- endpoints: [ "linux7:eth0", "br-clab-intonly:l7" ]
|
||||
- endpoints: [ "linux8:eth0", "br-clab-intonly:l8" ]
|
||||
- endpoints: [ "linux9:eth0", "br-clab-intonly:l9" ]
|
||||
- endpoints: [ "linux10:eth0", "br-clab-intonly:l10" ]
|
||||
- endpoints: [ "linux11:eth0", "br-clab-intonly:l11" ]
|
||||
- endpoints: [ "linux12:eth0", "br-clab-intonly:l12" ]
|
||||
- endpoints: [ "linux13:eth0", "br-clab-intonly:l13" ]
|
||||
- endpoints: [ "linux14:eth0", "br-clab-intonly:l14" ]
|
||||
- endpoints: [ "linux15:eth0", "br-clab-intonly:l15" ]
|
||||
- endpoints: [ "linux16:eth0", "br-clab-intonly:l16" ]
|
||||
- endpoints: [ "linux17:eth0", "br-clab-intonly:l17" ]
|
||||
- endpoints: [ "linux18:eth0", "br-clab-intonly:l18" ]
|
||||
- endpoints: [ "linux19:eth0", "br-clab-intonly:l19" ]
|
||||
- endpoints: [ "linux20:eth0", "br-clab-intonly:l20" ]
|
||||
- endpoints: [ "linux21:eth0", "br-clab-intonly:l21" ]
|
||||
- endpoints: [ "linux22:eth0", "br-clab-intonly:l22" ]
|
||||
- endpoints: [ "linux23:eth0", "br-clab-intonly:l23" ]
|
||||
- endpoints: [ "linux24:eth0", "br-clab-intonly:l24" ]
|
||||
- endpoints: [ "linux25:eth0", "br-clab-intonly:l25" ]
|
||||
- endpoints: [ "linux26:eth0", "br-clab-intonly:l26" ]
|
||||
- endpoints: [ "linux27:eth0", "br-clab-intonly:l27" ]
|
||||
- endpoints: [ "linux28:eth0", "br-clab-intonly:l28" ]
|
||||
- endpoints: [ "linux29:eth0", "br-clab-intonly:l29" ]
|
||||
- endpoints: [ "linux30:eth0", "br-clab-intonly:l30" ]
|
||||
- endpoints: [ "linux31:eth0", "br-clab-intonly:l31" ]
|
||||
- endpoints: [ "linux32:eth0", "br-clab-intonly:l32" ]
|
||||
- endpoints: [ "linux33:eth0", "br-clab-intonly:l33" ]
|
||||
- endpoints: [ "linux34:eth0", "br-clab-intonly:l34" ]
|
||||
- endpoints: [ "linux35:eth0", "br-clab-intonly:l35" ]
|
||||
- endpoints: [ "linux36:eth0", "br-clab-intonly:l36" ]
|
||||
- endpoints: [ "linux37:eth0", "br-clab-intonly:l37" ]
|
||||
- endpoints: [ "linux38:eth0", "br-clab-intonly:l38" ]
|
||||
- endpoints: [ "linux39:eth0", "br-clab-intonly:l39" ]
|
||||
- endpoints: [ "linux40:eth0", "br-clab-intonly:l40" ]
|
||||
- endpoints: [ "linux41:eth0", "br-clab-intonly:l41" ]
|
||||
- endpoints: [ "linux42:eth0", "br-clab-intonly:l42" ]
|
||||
- endpoints: [ "linux43:eth0", "br-clab-intonly:l43" ]
|
||||
- endpoints: [ "linux44:eth0", "br-clab-intonly:l44" ]
|
||||
- endpoints: [ "linux45:eth0", "br-clab-intonly:l45" ]
|
||||
- endpoints: [ "linux46:eth0", "br-clab-intonly:l46" ]
|
||||
- endpoints: [ "linux47:eth0", "br-clab-intonly:l47" ]
|
||||
- endpoints: [ "linux48:eth0", "br-clab-intonly:l48" ]
|
||||
- endpoints: [ "linux49:eth0", "br-clab-intonly:l49" ]
|
||||
- endpoints: [ "linux50:eth0", "br-clab-intonly:l50" ]
|
||||
|
||||
Reference in New Issue
Block a user