diff options
| -rwxr-xr-x | git/set-global_user.sh | 2 | ||||
| -rwxr-xr-x | git/tools/git-ssh-wrapper.sh | 2 | ||||
| -rw-r--r-- | git/tools/usefulbutnotthatusefulidkwhattodo | 0 | ||||
| -rwxr-xr-x | port-forward/persistent-ssh.sh | 35 | ||||
| -rwxr-xr-x | port-forward/rm_all_ssh_connections.sh | 4 | ||||
| -rwxr-xr-x | port-forward/ssh-multiport-forward.sh | 44 | ||||
| -rwxr-xr-x | port-forward/ssh-port-forward.sh | 19 |
7 files changed, 0 insertions, 106 deletions
diff --git a/git/set-global_user.sh b/git/set-global_user.sh deleted file mode 100755 index 30e11eb..0000000 --- a/git/set-global_user.sh +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | git config --global user.email "hc@email.ch" | ||
| 2 | git config --global user.name "hc" | ||
diff --git a/git/tools/git-ssh-wrapper.sh b/git/tools/git-ssh-wrapper.sh deleted file mode 100755 index dc23334..0000000 --- a/git/tools/git-ssh-wrapper.sh +++ /dev/null | |||
| @@ -1,2 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ssh -v -A -o ForwardAgent=yes "$@" | ||
diff --git a/git/tools/usefulbutnotthatusefulidkwhattodo b/git/tools/usefulbutnotthatusefulidkwhattodo deleted file mode 100644 index e69de29..0000000 --- a/git/tools/usefulbutnotthatusefulidkwhattodo +++ /dev/null | |||
diff --git a/port-forward/persistent-ssh.sh b/port-forward/persistent-ssh.sh deleted file mode 100755 index 36d14dd..0000000 --- a/port-forward/persistent-ssh.sh +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | echo "selinux command is untested. copy paste systemd file if you want" | ||
| 4 | echo "reboot afterwards(selinux unset, need reboot to take effect, or just do sudo setenforce 0 for temp unset)" | ||
| 5 | echo "make sure /root/m exists" | ||
| 6 | echo "remember to change the remote port or host if needed" | ||
| 7 | |||
| 8 | # disable selinux | ||
| 9 | sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config | ||
| 10 | |||
| 11 | sudo cat << 'EOF' > /etc/systemd/system/ssh-tunnel.service | ||
| 12 | [Unit] | ||
| 13 | Description=Persistent SSH Tunnel | ||
| 14 | After=network.target | ||
| 15 | StartLimitIntervalSec=0 | ||
| 16 | |||
| 17 | [Service] | ||
| 18 | Type=simple | ||
| 19 | ExecStart=/usr/bin/ssh \ | ||
| 20 | -i /root/m \ | ||
| 21 | -o "ExitOnForwardFailure=yes" \ | ||
| 22 | -o "StrictHostKeyChecking=no" \ | ||
| 23 | -N -R 24:localhost:22 root@p.0nom.ch | ||
| 24 | Restart=always | ||
| 25 | RestartSec=10 | ||
| 26 | RemainAfterExit=no | ||
| 27 | KillMode=process | ||
| 28 | |||
| 29 | [Install] | ||
| 30 | WantedBy=multi-user.target | ||
| 31 | EOF | ||
| 32 | |||
| 33 | sudo chmod 600 /root/m | ||
| 34 | sudo systemctl daemon-reload | ||
| 35 | sudo systemctl enable --now ssh-tunnel | ||
diff --git a/port-forward/rm_all_ssh_connections.sh b/port-forward/rm_all_ssh_connections.sh deleted file mode 100755 index f19300d..0000000 --- a/port-forward/rm_all_ssh_connections.sh +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ss -tnp | grep ':22' | ||
| 3 | ps -ef | grep sshd | grep -v grep | awk '{if($3!=1) print $2}' | xargs kill | ||
| 4 | #sudo systemctl restart sshd | ||
diff --git a/port-forward/ssh-multiport-forward.sh b/port-forward/ssh-multiport-forward.sh deleted file mode 100755 index 40d4ef6..0000000 --- a/port-forward/ssh-multiport-forward.sh +++ /dev/null | |||
| @@ -1,44 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # Check if at least one argument is provided | ||
| 3 | if [ $# -lt 1 ]; then | ||
| 4 | echo "Usage: $0 <base_number> [additional_ports...]" | ||
| 5 | echo "Example: $0 5 80 443" | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 9 | # First argument is the base number for port range | ||
| 10 | j=$1 | ||
| 11 | shift # Remove first argument from the list, leaving only additional ports | ||
| 12 | |||
| 13 | HOST="root@p.0nom.ch" | ||
| 14 | |||
| 15 | # Clean management port | ||
| 16 | echo "cleaning management port..." | ||
| 17 | ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9" | ||
| 18 | echo "cleaning attempted." | ||
| 19 | |||
| 20 | # Build the SSH command with all port forwards | ||
| 21 | SSH_CMD="ssh $HOST" | ||
| 22 | |||
| 23 | # Add range-based port forwards (j000-j005) | ||
| 24 | for i in $(seq ${j}000 ${j}005); do | ||
| 25 | SSH_CMD+=" -R $i:localhost:$i" | ||
| 26 | done | ||
| 27 | |||
| 28 | # Add management port forward | ||
| 29 | SSH_CMD+=" -R ${j}022:localhost:22" | ||
| 30 | |||
| 31 | # Add additional individual port forwards from remaining arguments | ||
| 32 | for port in "$@"; do | ||
| 33 | SSH_CMD+=" -R $port:localhost:$port" | ||
| 34 | done | ||
| 35 | |||
| 36 | # Execute the SSH command | ||
| 37 | eval $SSH_CMD | ||
| 38 | |||
| 39 | echo "Port forwards are available on:" | ||
| 40 | echo "- Ports ${j}000-${j}005" | ||
| 41 | echo "- Management port ${j}022" | ||
| 42 | if [ $# -gt 0 ]; then | ||
| 43 | echo "- Additional ports: $@" | ||
| 44 | fi | ||
diff --git a/port-forward/ssh-port-forward.sh b/port-forward/ssh-port-forward.sh deleted file mode 100755 index c4cb0a8..0000000 --- a/port-forward/ssh-port-forward.sh +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # opens 5 ports | ||
| 4 | |||
| 5 | #file will be run from where the user executes the script | ||
| 6 | j=$1 | ||
| 7 | HOST="root@p.0nom.ch" | ||
| 8 | |||
| 9 | # get the process holding the specified port and kill it | ||
| 10 | echo "cleaning management port..." | ||
| 11 | ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9" | ||
| 12 | echo "cleaning attempted." | ||
| 13 | |||
| 14 | ssh $HOST $(for i in $(seq ${j}000 ${j}005); do echo "-R $i:localhost:$i"; done; echo "-R ${j}022:localhost:22") | ||
| 15 | |||
| 16 | echo "port forward is available on ports ${j}000-${j}005, ssh on ${j}022" | ||
| 17 | |||
| 18 | #ideally port forward from 2 onwards, there seems to be a problem for 1000(or just change all to j001) | ||
| 19 | #jupyter lab --port=2001 --ip=0.0.0.0 | ||
