Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 1212

Hiding SSH behind Wireguard

by iShagg - 07 May, 2024 - 05:32 AM
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
#1
I made a script that will automatically setup wireguard to act like a LAN when connected to and will filter out any and all public traffic. This make's it to where you can only connect to SSH by being connected to wireguard...the script handles everything for you, all you have to do is set permissions and run. Unfortunately this only works on Rocky OS right now as that's the application I needed it for but it can easily be modified for any linux os.

How to use:

chmod +x hide_ssh.sh
sudo ./hide_ssh.sh
when it pauses and tells you to grab the client config file...do so before continuing or you will lock yourself out (cat /etc/wireguard/client.config) copy this and save it for later
press any key

after this if you're in an ssh session it will boot you from that session

open wireguard on the client computer
click add tunnel -> add empty tunnel -> paste the config you saved earlier
now hit activate
after you activate now ssh into the machine using the following ip: 10.0.0.1

there you go, a private SSH session, go ahead and try to nmap it, you'll get closed port!



the script:

https://pastecode.dev/s/3mslguav
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
#2
if anyone needs the script for something other than Rocky OS I can edit it for you...I don't mind
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
Bumped #3
This is a bump
This post is by a banned member (UberFuck) - Unhide
UberFuck  
Godlike
1.557
Posts
375
Threads
5 Years of service
#4
Looks cool. Not sure how nmap wouldn't see it as an open port though.
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
#5
(This post was last modified: 08 May, 2024 - 02:13 AM by iShagg.)
(08 May, 2024 - 02:10 AM)UberFuck Wrote: Show More
Looks cool. Not sure how nmap wouldn't see it as an open port though.

I'm not sure why it doesn't discover the wireguard port...but it will not discover the ssh port, I tried scanning the wireguard port multiple times with different methods and best I came up with was "filtered" status

Love your pfp btw
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
#6
I might redo this thread tonight breaking everything down
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
Bumped #7
This is a bump
This post is by a banned member (iShagg) - Unhide
iShagg  
Registered
49
Posts
7
Threads
Bumped #8
This is a bump

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 2 Guest(s)