feat: script para ejecutar comandos rápido creado, arreglo de bugs en teams.sh realizado

This commit is contained in:
Javier Niño Sánchez
2026-10-26 20:43:30 +01:00
parent fee735de34
commit b2ca407e9c
4 changed files with 378 additions and 9 deletions

View File

@@ -46,7 +46,9 @@ EOF
token=$(token_of "$id")
if [[ -z $token ]]; then
token=$(openssl rand -hex 4)
# 64 bits: con el límite de nginx a las rutas que no existen, no se
# puede adivinar por fuerza bruta
token=$(openssl rand -hex 8)
printf '%s\t%s\n' "$id" "$token" >> "$TOKENS"
fi
printf 'TTYD_PORT=%s\nTTYD_BASE=/t/%s\n' "$TTYD_PORT" "$token" |
@@ -87,8 +89,8 @@ write_slips() {
.slip { box-sizing: border-box; width: 50%; height: 90mm; padding: 6mm;
border: 1px dashed #999; text-align: center; break-inside: avoid; }
h1 { margin: 0 0 3mm; font-size: 22pt; }
img { width: 45mm; height: 45mm; image-rendering: pixelated; }
.url { font: 11pt monospace; word-break: break-all; }
img { width: 40mm; height: 40mm; image-rendering: pixelated; }
.url { font: 11pt monospace; overflow-wrap: anywhere; }
</style>
</head>
<body>
@@ -102,7 +104,7 @@ EOF
<div class="slip">
<h1>Equipo $n</h1>
<img src="data:image/png;base64,$(base64 -w 0 "$qr")" alt="">
<p class="url">$url</p>
<p class="url">https://$DOMAIN/t/<wbr>$token/</p>
<p>Primer comando: <code>less LEEME</code></p>
</div>
EOF
@@ -133,9 +135,7 @@ for ((n = 1; n <= count; n++)); do
done
write_routes > state/taller-routes.conf
pct push "$PROXY_ID" state/taller-routes.conf /etc/nginx/taller-routes.conf
pct exec "$PROXY_ID" -- nginx -tq
pct exec "$PROXY_ID" -- systemctl reload nginx
publish_routes state/taller-routes.conf
# Un CT recreado conserva su IP pero no su MAC: borra del proxy las entradas ARP obsoletas
pct exec "$PROXY_ID" -- ip neigh flush to "$SUBNET.0/24"