ungleich-tools/remote-access.sh
2026-05-26 08:58:18 +02:00

59 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
# Nico Schottelius, 2026-05-26
if [ $# -ne 1 ] ; then
echo $0 hostname.ra.placeX.ungleich.ch
exit 1
fi
target_host=$1; shift
case $target_host in
*.ra.place10.ungleich.ch)
jump="vigir26.place10.ungleich.ch"
#jump="vigir26.place10.ungleich.ch vigir23.place10.ungleich.ch"
;;
*)
echo "Unsupported RA access" >&2
exit 1
esac
set -x
if ! docker ps --format '{{.Names}}' | grep -q "^old-firefox$"; then
echo "Starting old firefox in docker in background"
docker run -ti --rm --net=host --name old-firefox -d \
-v ~/.old-firefox:/root/.mozilla ungleich/firefox-java-vnc
else
echo "Old firefox already running"
fi
echo "Trying to create socks proxy on localhost:3133 (might fail if running already)"
for jhost in $jump; do
if ping -c2 $jhost; then
ssh -D 3133 -f -N -T root@$jhost
if [ $? -eq 0 ]; then break; fi
fi
done
docker exec -d old-firefox firefox $target_host
vncviewer localhost:0
cat <<EOF
Remote access has been setup. To access it, do:
- Configure firefox to use a proxy, type SOCKS, port 3133
- To cleanup:
docker rm -f old-firefox
Typical usernames:
- Supermicro: ADMIN
- ilo3: Administrator
- drac 6: root
Password: placeX/remote-management
EOF