Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

ssh tunnels

SSH Tunnels

t1

ssh -f user@finalsrv.protected -L 9998:localhost:1234 -N

t2

On your local machine, if you want a tunnel that will exit at 1.2.3.4, you can run this and then access port 7070 in your browser proxy to browse originating from 1.2.3.4

ssh user@1.2.3.4 -D 7070 -N sleep 9999

t3

The -p specifies a port. The -t option is required because I’m using keys. -L says to bind 7070 locally and send it to port 5590 but then -D says use port 5590 as my exit port.

ssh -p 8888 -t -L7070:localhost:5590 root@jumphost ssh -p 22 -t -D5590 user@finalhost

Jump Scripts

Single Jump

$ cat jump-malchias.sh
ssh -p 44443 root@malchias.com -D 7070

Jump Through JUmp

$ cat jump-somedomain.sh
ssh -L 7070:localhost:7071 -t -p 44443 root@malchias.com ssh -i /home/malchias/.ssh/id_ed25519 root@somesite.com -D 7071

Permissions

root@malchias:~# ls /home/malchias/.ssh/ -alF
total 20
drwx------ 2 malchias malchias 4096 Mar 10 21:53 ./
drwxr-xr-x 3 malchias malchias 4096 May 24 15:20 ../
-rw------- 1 malchias malchias  464 Mar 10 21:49 id_ed25519
-rw-r--r-- 1 malchias malchias   99 Mar 10 21:49 id_ed25519.pub
-rw-r--r-- 1 malchias malchias 1536 Mar 31 16:24 known_hosts

Public Key

root@malchias:~# cat /home/malchias/.ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDpOg9klJHLKJGWeF9sRuWdZ5t5yzOvvwFO+DzmIMrow malchias@malchias

Old Algo

scp -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -c aes256-ctr mediawiki-1.12.4.tar.gz james@192.168.7.49:/home/james/
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oHostKeyAlgorithms=+ssh-rsa -c aes256-ctr james@192.168.7.49