summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit/set-global_user.sh2
-rwxr-xr-xgit/tools/git-ssh-wrapper.sh2
-rw-r--r--git/tools/usefulbutnotthatusefulidkwhattodo0
-rwxr-xr-xport-forward/persistent-ssh.sh35
-rwxr-xr-xport-forward/rm_all_ssh_connections.sh4
-rwxr-xr-xport-forward/ssh-multiport-forward.sh44
-rwxr-xr-xport-forward/ssh-port-forward.sh19
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 @@
1git config --global user.email "hc@email.ch"
2git 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
2ssh -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
3echo "selinux command is untested. copy paste systemd file if you want"
4echo "reboot afterwards(selinux unset, need reboot to take effect, or just do sudo setenforce 0 for temp unset)"
5echo "make sure /root/m exists"
6echo "remember to change the remote port or host if needed"
7
8# disable selinux
9sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
10
11sudo cat << 'EOF' > /etc/systemd/system/ssh-tunnel.service
12[Unit]
13Description=Persistent SSH Tunnel
14After=network.target
15StartLimitIntervalSec=0
16
17[Service]
18Type=simple
19ExecStart=/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
24Restart=always
25RestartSec=10
26RemainAfterExit=no
27KillMode=process
28
29[Install]
30WantedBy=multi-user.target
31EOF
32
33sudo chmod 600 /root/m
34sudo systemctl daemon-reload
35sudo 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
2ss -tnp | grep ':22'
3ps -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
3if [ $# -lt 1 ]; then
4 echo "Usage: $0 <base_number> [additional_ports...]"
5 echo "Example: $0 5 80 443"
6 exit 1
7fi
8
9# First argument is the base number for port range
10j=$1
11shift # Remove first argument from the list, leaving only additional ports
12
13HOST="root@p.0nom.ch"
14
15# Clean management port
16echo "cleaning management port..."
17ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9"
18echo "cleaning attempted."
19
20# Build the SSH command with all port forwards
21SSH_CMD="ssh $HOST"
22
23# Add range-based port forwards (j000-j005)
24for i in $(seq ${j}000 ${j}005); do
25 SSH_CMD+=" -R $i:localhost:$i"
26done
27
28# Add management port forward
29SSH_CMD+=" -R ${j}022:localhost:22"
30
31# Add additional individual port forwards from remaining arguments
32for port in "$@"; do
33 SSH_CMD+=" -R $port:localhost:$port"
34done
35
36# Execute the SSH command
37eval $SSH_CMD
38
39echo "Port forwards are available on:"
40echo "- Ports ${j}000-${j}005"
41echo "- Management port ${j}022"
42if [ $# -gt 0 ]; then
43 echo "- Additional ports: $@"
44fi
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
6j=$1
7HOST="root@p.0nom.ch"
8
9# get the process holding the specified port and kill it
10echo "cleaning management port..."
11ssh $HOST "ss -tunlp | grep :${j}022 | awk '{print $NF}' | sed 's/.*pid=\([^,]*\).*/\1/' | head -n1 | xargs kill -9"
12echo "cleaning attempted."
13
14ssh $HOST $(for i in $(seq ${j}000 ${j}005); do echo "-R $i:localhost:$i"; done; echo "-R ${j}022:localhost:22")
15
16echo "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