more hosts, keychain, small stuff
This commit is contained in:
@@ -2,6 +2,7 @@ FROM debian:latest
|
|||||||
RUN apt update && apt --yes install openssh-server python3 sudo iproute2 iputils-ping traceroute vim && mkdir -p /root/.ssh/ && mkdir -p /run/sshd && rm -f /etc/ssh/ssh_host*
|
RUN apt update && apt --yes install openssh-server python3 sudo iproute2 iputils-ping traceroute vim && mkdir -p /root/.ssh/ && mkdir -p /run/sshd && rm -f /etc/ssh/ssh_host*
|
||||||
RUN apt --yes install dnsmasq udhcpc less tcpdump
|
RUN apt --yes install dnsmasq udhcpc less tcpdump
|
||||||
RUN apt --yes install telnet netcat-openbsd wget curl man net-tools
|
RUN apt --yes install telnet netcat-openbsd wget curl man net-tools
|
||||||
|
RUN apt --yes install keychain
|
||||||
# RUN apt install --yes nginx python3-pip
|
# RUN apt install --yes nginx python3-pip
|
||||||
# RUN pip3 install 'uvicorn[standard] fastapi'
|
# RUN pip3 install 'uvicorn[standard] fastapi'
|
||||||
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
interface=eth2
|
interface=eth2
|
||||||
domain=sshworkshop.local
|
domain=sshworkshop.local
|
||||||
dhcp-range=set:workshop,192.168.0.10,192.168.0.200,12h
|
dhcp-range=set:workshop,192.168.0.1,192.168.0.200,36h
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# csv2cards.sh → html
|
# csv2cards.sh → html with guaranteed colour styling
|
||||||
|
|
||||||
CSV=${1:-credentials.csv}
|
CSV=${1:-credentials.csv}
|
||||||
OUT=${2:-cards.html}
|
OUT=${2:-cards.html}
|
||||||
|
|
||||||
# start the document
|
# --------------------------------------------------------------
|
||||||
|
# 1️⃣ Write the full HTML header (including the colour CSS)
|
||||||
cat >"$OUT" <<'EOF'
|
cat >"$OUT" <<'EOF'
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -14,7 +16,7 @@ cat >"$OUT" <<'EOF'
|
|||||||
@page { size: A4 portrait; margin: 1cm; }
|
@page { size: A4 portrait; margin: 1cm; }
|
||||||
body { font-family: monospace; display: flex; flex-wrap: wrap; gap: 0.5cm; }
|
body { font-family: monospace; display: flex; flex-wrap: wrap; gap: 0.5cm; }
|
||||||
.card {
|
.card {
|
||||||
width: 9cm; /* fits 2‑3 cards across A4 */
|
width: 9cm;
|
||||||
border: 1px solid #333;
|
border: 1px solid #333;
|
||||||
padding: 0.3cm;
|
padding: 0.3cm;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -22,14 +24,25 @@ cat >"$OUT" <<'EOF'
|
|||||||
}
|
}
|
||||||
.field { margin: 0.1cm 0; }
|
.field { margin: 0.1cm 0; }
|
||||||
.label { font-weight: bold; }
|
.label { font-weight: bold; }
|
||||||
|
|
||||||
|
/* ---- 6‑colour palette (exactly as you requested) ---- */
|
||||||
|
.bg0 { background:#eeff90; } /* light lime */
|
||||||
|
.bg1 { background:#b9ffbf; } /* pastel green */
|
||||||
|
.bg2 { background:#b6e1ff; } /* soft blue */
|
||||||
|
.bg3 { background:#ffd795; } /* peach */
|
||||||
|
.bg4 { background:#f0a6fc; } /* lavender */
|
||||||
|
.bg5 { background:#f397a5; } /* coral */
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# read CSV, skip header, emit a <div class="card"> per line
|
# --------------------------------------------------------------
|
||||||
awk -F',' 'NR>1{
|
# 2️⃣ Convert each CSV row into a coloured card
|
||||||
printf "<div class=\"card\">\n"
|
awk -F',' '
|
||||||
|
NR>1{
|
||||||
|
col = (NR-2) % 6 # 0‑5 cycle
|
||||||
|
printf "<div class=\"card bg%d\">\n", col
|
||||||
printf " <div class=\"field\"><span class=\"label\">IP:</span> %s</div>\n", $1
|
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\">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\">User:</span> %s</div>\n", $3
|
||||||
@@ -37,8 +50,9 @@ awk -F',' 'NR>1{
|
|||||||
printf "</div>\n"
|
printf "</div>\n"
|
||||||
}' "$CSV" >>"$OUT"
|
}' "$CSV" >>"$OUT"
|
||||||
|
|
||||||
# close the document
|
# --------------------------------------------------------------
|
||||||
|
# 3️⃣ Close the HTML document
|
||||||
cat >>"$OUT" <<'EOF'
|
cat >>"$OUT" <<'EOF'
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
388
helpers/fireworks.sh
Executable file
388
helpers/fireworks.sh
Executable file
@@ -0,0 +1,388 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# This holiday decoration script was put together by Bryan Lunduke.
|
||||||
|
# www.Lunduke.com
|
||||||
|
#
|
||||||
|
# Some portions were inspired or copied from other works. Where that is
|
||||||
|
# the case it is noted within the source.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
Color_Off='\033[0m' # Text Reset
|
||||||
|
|
||||||
|
# Regular Colors
|
||||||
|
Black='\033[0;30m' # Black
|
||||||
|
Red='\033[0;31m' # Red
|
||||||
|
Green='\033[0;32m' # Green
|
||||||
|
Yellow='\033[0;33m' # Yellow
|
||||||
|
Blue='\033[0;34m' # Blue
|
||||||
|
Purple='\033[0;35m' # Purple
|
||||||
|
Cyan='\033[0;36m' # Cyan
|
||||||
|
White='\033[0;37m' # White
|
||||||
|
|
||||||
|
# Bold
|
||||||
|
BBlack='\033[1;30m' # Black
|
||||||
|
BRed='\033[1;31m' # Red
|
||||||
|
BGreen='\033[1;32m' # Green
|
||||||
|
BYellow='\033[1;33m' # Yellow
|
||||||
|
BBlue='\033[1;34m' # Blue
|
||||||
|
BPurple='\033[1;35m' # Purple
|
||||||
|
BCyan='\033[1;36m' # Cyan
|
||||||
|
BWhite='\033[1;37m' # White
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ShowTree () {
|
||||||
|
#
|
||||||
|
# The base of this animated tree was copied from ChrisBASHTree
|
||||||
|
# https://github.com/sergiolepore/ChristBASHTree
|
||||||
|
#
|
||||||
|
trap "tput reset; tput cnorm; exit" 2
|
||||||
|
clear
|
||||||
|
tput civis
|
||||||
|
lin=2
|
||||||
|
col=$(($(tput cols) / 2))
|
||||||
|
c=$((col-1))
|
||||||
|
est=$((c-2))
|
||||||
|
color=0
|
||||||
|
tput setaf 2; tput bold
|
||||||
|
|
||||||
|
# Tree
|
||||||
|
for ((i=1; i<20; i+=2))
|
||||||
|
{
|
||||||
|
tput cup $lin $col
|
||||||
|
for ((j=1; j<=i; j++))
|
||||||
|
{
|
||||||
|
echo -n \*
|
||||||
|
}
|
||||||
|
let lin++
|
||||||
|
let col--
|
||||||
|
}
|
||||||
|
|
||||||
|
tput sgr0; tput setaf 3
|
||||||
|
|
||||||
|
# Trunk
|
||||||
|
for ((i=1; i<=2; i++))
|
||||||
|
{
|
||||||
|
tput cup $((lin++)) $c
|
||||||
|
echo 'mWm'
|
||||||
|
}
|
||||||
|
new_year=$(date +'%Y')
|
||||||
|
let new_year++
|
||||||
|
tput setaf 1; tput bold
|
||||||
|
|
||||||
|
tput cup $lin $((c - 6)); echo MERRY CHRISTMAS
|
||||||
|
|
||||||
|
let c++
|
||||||
|
k=1
|
||||||
|
|
||||||
|
# Lights and decorations
|
||||||
|
while true; do
|
||||||
|
for ((i=1; i<=35; i++)) {
|
||||||
|
# Turn off the lights
|
||||||
|
[ $k -gt 1 ] && {
|
||||||
|
tput setaf 2; tput bold
|
||||||
|
tput cup ${line[$[k-1]$i]} ${column[$[k-1]$i]}; echo \*
|
||||||
|
unset line[$[k-1]$i]; unset column[$[k-1]$i] # Array cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
li=$((RANDOM % 9 + 3))
|
||||||
|
start=$((c-li+2))
|
||||||
|
co=$((RANDOM % (li-2) * 2 + 1 + start))
|
||||||
|
tput setaf $color; tput bold # Switch colors
|
||||||
|
tput cup $li $co
|
||||||
|
echo o
|
||||||
|
line[$k$i]=$li
|
||||||
|
column[$k$i]=$co
|
||||||
|
color=$(((color+1)%8))
|
||||||
|
# Flashing text
|
||||||
|
sh=1
|
||||||
|
for l in C O D E
|
||||||
|
do
|
||||||
|
tput cup $((lin+1)) $((c+sh))
|
||||||
|
#echo $l
|
||||||
|
let sh++
|
||||||
|
sleep 0.01
|
||||||
|
done
|
||||||
|
}
|
||||||
|
k=$((k % 2 + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ShowMenorah () {
|
||||||
|
|
||||||
|
|
||||||
|
# Draw the Menorah
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "${Blue} |"
|
||||||
|
echo -e "${Blue} | | | | | | | | |"
|
||||||
|
echo -e "${Blue} | | | | | | | | |"
|
||||||
|
echo -e "${Blue} | | | | | | | | |"
|
||||||
|
echo -e "${Blue} \ \ \ \ | / / / /"
|
||||||
|
echo -e "${Blue} \ \ \ \_|_/ / / /"
|
||||||
|
echo -e "${Blue} \ \ \ | / / /"
|
||||||
|
echo -e "${Blue} \ \ \__|__/ / / Happy Hanukkah!"
|
||||||
|
echo -e "${Blue} \ \ | / / ${White}Chag Hanukkah sameach!"
|
||||||
|
echo -e "${Blue} \ \___|___/ /"
|
||||||
|
echo -e "${Blue} \ | /"
|
||||||
|
echo -e "${Blue} \____|____/"
|
||||||
|
echo -e "${Blue} |"
|
||||||
|
echo -e "${Blue} __|__"
|
||||||
|
echo -e "${Blue} ____|____"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Count the candles for each night
|
||||||
|
while true; do
|
||||||
|
for ((i=1; i<=9; i++)) {
|
||||||
|
|
||||||
|
tput cup 2 0; echo -e "${White} |"
|
||||||
|
|
||||||
|
if [ $i -eq 1 ]
|
||||||
|
then # Night 0 - Shamash only
|
||||||
|
tput cup 2 0; echo -e "${White} |"
|
||||||
|
tput cup 3 0; echo -e "${White} ${Blue} | ${White} "
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Shamash only"
|
||||||
|
|
||||||
|
elif [ $i -eq 2 ]
|
||||||
|
then # Night 1
|
||||||
|
tput cup 3 0; echo -e "${White} ${Blue} | ${White} |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 1 "
|
||||||
|
|
||||||
|
elif [ $i -eq 3 ]
|
||||||
|
then # Night 2
|
||||||
|
tput cup 3 0; echo -e "${White} ${Blue} | ${White} | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 2 "
|
||||||
|
|
||||||
|
elif [ $i -eq 4 ]
|
||||||
|
then # Night 3
|
||||||
|
tput cup 3 0; echo -e "${White} ${Blue} | ${White} | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 3 "
|
||||||
|
|
||||||
|
elif [ $i -eq 5 ]
|
||||||
|
then # Night 4
|
||||||
|
tput cup 3 0; echo -e "${White} ${Blue} | ${White}| | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 4 "
|
||||||
|
|
||||||
|
elif [ $i -eq 6 ]
|
||||||
|
then # Night 5
|
||||||
|
tput cup 3 0; echo -e "${White} | ${Blue} | ${White}| | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 5 "
|
||||||
|
|
||||||
|
elif [ $i -eq 7 ]
|
||||||
|
then # Night 6
|
||||||
|
tput cup 3 0; echo -e "${White} | | ${Blue} | ${White}| | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 6 "
|
||||||
|
|
||||||
|
elif [ $i -eq 8 ]
|
||||||
|
then # Night 7
|
||||||
|
tput cup 3 0; echo -e "${White} | | | ${Blue} | ${White}| | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 7 "
|
||||||
|
|
||||||
|
elif [ $i -eq 9 ]
|
||||||
|
then # Night 8
|
||||||
|
tput cup 3 0; echo -e "${White} | | | | ${Blue} | ${White}| | | |"
|
||||||
|
tput cup 6 0; echo -e "${Blue} | | | | | | | | | ${White}Night 8 "
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
sleep 0.5
|
||||||
|
}
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function colorstr()
|
||||||
|
{
|
||||||
|
local row=$1
|
||||||
|
local col=$2
|
||||||
|
local color=$3
|
||||||
|
local v
|
||||||
|
case "$color" in
|
||||||
|
red) v=31;;
|
||||||
|
green) v=34;;
|
||||||
|
blue) v=32;;
|
||||||
|
purple) v=35;;
|
||||||
|
cyan) v=36;;
|
||||||
|
yellow) v=33;;
|
||||||
|
brown) v=33;;
|
||||||
|
white) v=37;;
|
||||||
|
*) v=;;
|
||||||
|
esac
|
||||||
|
shift 3
|
||||||
|
|
||||||
|
if [[ $multiple -ne 0 ]]; then
|
||||||
|
touch $lock_file
|
||||||
|
while [[ $(ls $lock_file_base.* 2>/dev/null | head -n 1) != $lock_file ]]
|
||||||
|
do
|
||||||
|
sleep 0.05
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
tput cup $row $col
|
||||||
|
echo -n -e "\e["$v"m"
|
||||||
|
set -f
|
||||||
|
echo -n $*
|
||||||
|
set +f
|
||||||
|
if [[ $multiple -ne 0 ]]; then
|
||||||
|
rm -f $lock_file
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function center_colorstr()
|
||||||
|
{
|
||||||
|
local row=$1
|
||||||
|
local color=$2
|
||||||
|
shift 2
|
||||||
|
local s="$*"
|
||||||
|
local slen=${#s}
|
||||||
|
colorstr $row $(((cols / 2) - (slen / 2))) $color "$s"
|
||||||
|
}
|
||||||
|
|
||||||
|
function fireworks()
|
||||||
|
{
|
||||||
|
local row=$((rows - 1))
|
||||||
|
local col=$(((RANDOM % (cols / 2)) + (cols / 4)))
|
||||||
|
local height=$((RANDOM % rows - 2))
|
||||||
|
local slant
|
||||||
|
local h
|
||||||
|
local color1=${colors[$((RANDOM % ${#colors[*]}))]}
|
||||||
|
local color2=${colors[$((RANDOM % ${#colors[*]}))]}
|
||||||
|
local color3=${colors[$((RANDOM % ${#colors[*]}))]}
|
||||||
|
while [[ $color1 == $color2 || $color1 == $color3 || $color2 == $color3 ]]
|
||||||
|
do
|
||||||
|
color2=${colors[$((RANDOM % ${#colors[*]}))]}
|
||||||
|
color3=${colors[$((RANDOM % ${#colors[*]}))]}
|
||||||
|
done
|
||||||
|
|
||||||
|
case $((RANDOM % 4)) in
|
||||||
|
0) slant=-2;;
|
||||||
|
1) slant=-1;;
|
||||||
|
2) slant=1;;
|
||||||
|
3) slant=2;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $height -gt 5 ]]; then
|
||||||
|
h=$height
|
||||||
|
|
||||||
|
while [[ $h -gt 0 ]]
|
||||||
|
do
|
||||||
|
colorstr $row $col $color1 '.'
|
||||||
|
let row--
|
||||||
|
if [[ $((col + slant)) -ge $((cols - 3)) || $((col + slant)) -le 2 ]]; then break; fi
|
||||||
|
let col+=slant
|
||||||
|
let h--
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $((col + slant)) -lt $((cols - 3)) && $((col + slant)) -gt 2 ]]; then
|
||||||
|
|
||||||
|
h=$((height / 5))
|
||||||
|
|
||||||
|
while [[ $h -gt 0 ]]
|
||||||
|
do
|
||||||
|
colorstr $row $col $color2 '.'
|
||||||
|
let row++
|
||||||
|
if [[ $((col + slant)) -ge $((cols - 3)) || $((col + slant)) -le 2 ]]; then break; fi
|
||||||
|
let col+=slant
|
||||||
|
let h--
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
colorstr $((row)) $((col - 1)) $color3 '***'
|
||||||
|
colorstr $((row - 1)) $((col)) $color3 '*'
|
||||||
|
colorstr $((row + 1)) $((col)) $color3 '*'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function runFireworks()
|
||||||
|
{
|
||||||
|
|
||||||
|
rows=$(tput lines)
|
||||||
|
cols=$(tput cols)
|
||||||
|
colors=(red green blue purple cyan yellow brown)
|
||||||
|
lock_file=
|
||||||
|
lock_file_base=/tmp/$(basename $0 .sh)
|
||||||
|
|
||||||
|
multiple=0
|
||||||
|
if [[ "$1" ]]; then
|
||||||
|
nsingle=$1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
nsingle=10
|
||||||
|
fi
|
||||||
|
if [[ "$1" ]]; then
|
||||||
|
nmultiple=$1
|
||||||
|
shift
|
||||||
|
if [[ $nmultiple -gt 8 ]]; then nmultiple=8; fi
|
||||||
|
else
|
||||||
|
nmultiple=6
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
until [ 1 -eq 2 ]
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
clear
|
||||||
|
|
||||||
|
pids=
|
||||||
|
for i in $(seq 1 $nmultiple)
|
||||||
|
do
|
||||||
|
let multiple++
|
||||||
|
lock_file=$lock_file_base.$i
|
||||||
|
fireworks &
|
||||||
|
pids="$pids $!"
|
||||||
|
done
|
||||||
|
|
||||||
|
trap "kill -9 $pids 2>/dev/null" EXIT
|
||||||
|
|
||||||
|
wait $pids
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" = "Tree" ]
|
||||||
|
|
||||||
|
then
|
||||||
|
ShowTree
|
||||||
|
exit
|
||||||
|
|
||||||
|
elif [ "$1" = "Menorah" ]
|
||||||
|
then
|
||||||
|
ShowMenorah
|
||||||
|
exit
|
||||||
|
|
||||||
|
elif [ "$1" = "Fireworks" ]
|
||||||
|
then
|
||||||
|
runFireworks
|
||||||
|
exit
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${White}Possible options for Lunduke's Shell Holiday Decorations: ${Blue}Tree Menorah Fireworks"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
@@ -5,13 +5,13 @@ dpkg-reconfigure openssh-server
|
|||||||
ip addr replace dev eth1 10.192.40.2/29
|
ip addr replace dev eth1 10.192.40.2/29
|
||||||
|
|
||||||
# the "southbound" interface towards all the clients that we are DHCP server for
|
# the "southbound" interface towards all the clients that we are DHCP server for
|
||||||
ip addr replace dev eth2 192.168.0.1/24
|
ip addr replace dev eth2 192.168.0.254/24
|
||||||
|
|
||||||
# "eastbound" gw<->jumphost1 eth3 and 172.16.200/23 behind jumphost1
|
# "eastbound" gw<->jumphost1 eth3 and 172.16.200/23 behind jumphost1
|
||||||
ip addr replace dev eth3 172.16.202.32/31
|
ip addr replace dev eth3 172.16.202.32/31
|
||||||
# ip route replace 172.16.200/23 via 172.16.202.33
|
# ip route replace 172.16.200/23 via 172.16.202.33
|
||||||
|
|
||||||
echo "nameserver 192.168.0.1" > /etc/resolv.conf
|
echo "nameserver 192.168.0.254" > /etc/resolv.conf
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
@@ -25,8 +25,10 @@ echo "nameserver 192.168.0.1" > /etc/resolv.conf
|
|||||||
/usr/local/bin/online-users.sh
|
/usr/local/bin/online-users.sh
|
||||||
) > /online-users.txt & # ← background the whole subshell
|
) > /online-users.txt & # ← background the whole subshell
|
||||||
|
|
||||||
(/usr/sbin/sshd -D) &
|
|
||||||
|
|
||||||
# launch dnsmasq (automatically backgrounds)
|
# launch dnsmasq (automatically backgrounds)
|
||||||
dnsmasq --no-daemon
|
(dnsmasq --no-daemon --log-facility=/dns.log --log-queries) &
|
||||||
|
# dnsmasq --no-daemon
|
||||||
|
|
||||||
|
/usr/sbin/sshd -D
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ create_user_from_shared_names_list () {
|
|||||||
my_pwd=${my_pwhash_pwd#*,}
|
my_pwd=${my_pwhash_pwd#*,}
|
||||||
useradd -m ${my_username} -p "${my_pwhash}" -s /bin/bash
|
useradd -m ${my_username} -p "${my_pwhash}" -s /bin/bash
|
||||||
# su - ${my_username} -c 'mkdir -p .ssh'
|
# su - ${my_username} -c 'mkdir -p .ssh'
|
||||||
|
su - ${my_username} -c "echo 'alias fireworks=\"fireworks.sh Fireworks\"' >> ~/.bash_aliases"
|
||||||
echo "$my_pwd" > /home/${my_username}/PASSWORD
|
echo "$my_pwd" > /home/${my_username}/PASSWORD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
dpkg-reconfigure openssh-server
|
dpkg-reconfigure openssh-server
|
||||||
# my_username=$(shuf -n 1 /etc/workshopnames.yml | cut -b 3-)
|
# my_username=$(shuf -n 1 /etc/workshopnames.yml | cut -b 3-)
|
||||||
udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname)
|
# udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname)
|
||||||
# once we have our IP, create the matching user.
|
# # once we have our IP, create the matching user.
|
||||||
my_last_octet=$(ip -4 a s dev eth0 | grep / | cut -f 4 -d . | cut -f 1 -d /)
|
# my_last_octet=$(ip -4 a s dev eth0 | grep / | cut -f 4 -d . | cut -f 1 -d /)
|
||||||
|
my_last_octet=$(( $(hostname | tr -cd '0-9') )) ## just keep the numbers from the hostname
|
||||||
|
# ip addr replace dev eth0 192.168.0.${my_last_octet}/24
|
||||||
|
# ip route replace default via 192.168.0.1
|
||||||
|
udhcpc -i eth0 -x hostname:$(hostname) -F $(hostname) -r 192.168.0.${my_last_octet} # request .1 for linux1, etc. GW should be .254
|
||||||
my_username_pwhash=$(sed -n "${my_last_octet}{p;q}" /etc/workshopnames.yml)
|
my_username_pwhash=$(sed -n "${my_last_octet}{p;q}" /etc/workshopnames.yml)
|
||||||
my_username="${my_username_pwhash%%:*}"
|
my_username="${my_username_pwhash%%:*}"
|
||||||
my_pwhash_pwd="${my_username_pwhash#*: }"
|
my_pwhash_pwd="${my_username_pwhash#*: }"
|
||||||
@@ -14,4 +18,5 @@ su - ${my_username} -c 'mkdir .ssh'
|
|||||||
echo "$my_pwd" > /home/${my_username}/PASSWORD
|
echo "$my_pwd" > /home/${my_username}/PASSWORD
|
||||||
# cp /root/.ssh/authorized_keys /home/${my_username}/.ssh/ && chown ${my_username}:${my_username} /home/${my_username}/.ssh/authorized_keys
|
# cp /root/.ssh/authorized_keys /home/${my_username}/.ssh/ && chown ${my_username}:${my_username} /home/${my_username}/.ssh/authorized_keys
|
||||||
printf "172.16.202.33\tjumphost1\n" >> /etc/hosts
|
printf "172.16.202.33\tjumphost1\n" >> /etc/hosts
|
||||||
|
su - ${my_username} -c "echo 'alias fireworks=\"fireworks.sh Fireworks\"' >> ~/.bash_aliases"
|
||||||
/usr/sbin/sshd -D
|
/usr/sbin/sshd -D
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ topology:
|
|||||||
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
||||||
- ./config/authorized_keys:/root/.ssh/authorized_keys:ro
|
- ./config/authorized_keys:/root/.ssh/authorized_keys:ro
|
||||||
- ./setups/linux.sh:/usr/local/bin/setup.sh:ro
|
- ./setups/linux.sh:/usr/local/bin/setup.sh:ro
|
||||||
|
- ./helpers/fireworks.sh:/usr/local/bin/fireworks.sh:ro
|
||||||
|
- ./helpers/ssh-agent-environment.sh:/usr/local/bin/ssh-agent-environment.sh:ro
|
||||||
memory: 256MB
|
memory: 256MB
|
||||||
cpu-set: 4-7
|
cpu-set: 4-7
|
||||||
nodes:
|
nodes:
|
||||||
@@ -36,6 +38,7 @@ topology:
|
|||||||
binds:
|
binds:
|
||||||
- ./setups/jumphost.sh:/usr/local/bin/setup.sh:ro
|
- ./setups/jumphost.sh:/usr/local/bin/setup.sh:ro
|
||||||
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
- ./config/names-hashes.yml:/etc/workshopnames.yml:ro
|
||||||
|
- ./helpers/fireworks.sh:/usr/local/bin/fireworks.sh:ro
|
||||||
memory: 4GB
|
memory: 4GB
|
||||||
cpu-set: 2-3
|
cpu-set: 2-3
|
||||||
jumphost2:
|
jumphost2:
|
||||||
@@ -107,6 +110,20 @@ topology:
|
|||||||
linux48: {kind: linux}
|
linux48: {kind: linux}
|
||||||
linux49: {kind: linux}
|
linux49: {kind: linux}
|
||||||
linux50: {kind: linux}
|
linux50: {kind: linux}
|
||||||
|
linux51: {kind: linux}
|
||||||
|
linux52: {kind: linux}
|
||||||
|
linux53: {kind: linux}
|
||||||
|
linux54: {kind: linux}
|
||||||
|
linux55: {kind: linux}
|
||||||
|
linux56: {kind: linux}
|
||||||
|
linux57: {kind: linux}
|
||||||
|
linux58: {kind: linux}
|
||||||
|
linux59: {kind: linux}
|
||||||
|
linux60: {kind: linux}
|
||||||
|
linux61: {kind: linux}
|
||||||
|
linux62: {kind: linux}
|
||||||
|
linux63: {kind: linux}
|
||||||
|
linux64: {kind: linux}
|
||||||
|
|
||||||
links:
|
links:
|
||||||
# - endpoints: ["a1:eth1","br-clab:eth1"]
|
# - endpoints: ["a1:eth1","br-clab:eth1"]
|
||||||
@@ -166,3 +183,17 @@ topology:
|
|||||||
- endpoints: [ "linux48:eth0", "br-clab-intonly:l48" ]
|
- endpoints: [ "linux48:eth0", "br-clab-intonly:l48" ]
|
||||||
- endpoints: [ "linux49:eth0", "br-clab-intonly:l49" ]
|
- endpoints: [ "linux49:eth0", "br-clab-intonly:l49" ]
|
||||||
- endpoints: [ "linux50:eth0", "br-clab-intonly:l50" ]
|
- endpoints: [ "linux50:eth0", "br-clab-intonly:l50" ]
|
||||||
|
- endpoints: [ "linux51:eth0", "br-clab-intonly:l51" ]
|
||||||
|
- endpoints: [ "linux52:eth0", "br-clab-intonly:l52" ]
|
||||||
|
- endpoints: [ "linux53:eth0", "br-clab-intonly:l53" ]
|
||||||
|
- endpoints: [ "linux54:eth0", "br-clab-intonly:l54" ]
|
||||||
|
- endpoints: [ "linux55:eth0", "br-clab-intonly:l55" ]
|
||||||
|
- endpoints: [ "linux56:eth0", "br-clab-intonly:l56" ]
|
||||||
|
- endpoints: [ "linux57:eth0", "br-clab-intonly:l57" ]
|
||||||
|
- endpoints: [ "linux58:eth0", "br-clab-intonly:l58" ]
|
||||||
|
- endpoints: [ "linux59:eth0", "br-clab-intonly:l59" ]
|
||||||
|
- endpoints: [ "linux60:eth0", "br-clab-intonly:l60" ]
|
||||||
|
- endpoints: [ "linux61:eth0", "br-clab-intonly:l61" ]
|
||||||
|
- endpoints: [ "linux62:eth0", "br-clab-intonly:l62" ]
|
||||||
|
- endpoints: [ "linux63:eth0", "br-clab-intonly:l63" ]
|
||||||
|
- endpoints: [ "linux64:eth0", "br-clab-intonly:l64" ]
|
||||||
Reference in New Issue
Block a user