Simple job

Status
This thread has been locked.

Tulip

hi
Banned
Feedback score
3
Posts
3,970
Reactions
2,066
Resources
0
I need SSH switched to a different port and all ports blocked but bungee and SSH. Let me know if you can do this. Not paying more than $5. If you don't know what you are doing; please leave. I want someone experienced and who won't lock me out. Thanks.
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Chearful

thomas.gg
Supreme
Feedback score
115
Posts
1,398
Reactions
2,236
Resources
0
Based on Ubuntu 14.04:

Get Nano if you don't have it already:
Code:
apt-get update
apt-get install nano

Get iptables if you don't have it already:
Code:
apt-get update
apt-get install iptables

First off, to ensure that we do not lock ourselves out, we are going to keep ports 22 and the port you are changing the SSH over to open. (Where 123.456.789.012 is, replace with your ip addr. of the one you are SSHing into).

Code:
iptables -A INPUT -p tcp -s 123.456.789.012 --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -s 123.456.789.012 --dport {NEWPORT} -j ACCEPT

Now that we've created a "failsafe", let's move on:

This will open up your Bungee port
Code:
iptables -A INPUT -p tcp --dport 25565 -j ACCEPT

Now to move SSH over:
Code:
nano /etc/ssh/sshd_config
Move to the part where it says
# What ports, IPs and protocols we listen for
Port 22

And then replace port 22 with whatever port you want. Then, save the edits you just made and reboot SSH.

Test that you can still connect to SSH on your new port before proceeding with:

Code:
iptables -A INPUT -p tcp --dport 22 -j DROP

And then we can open up SSH to all IPs:

Code:
iptables -A INPUT -p tcp --dport {PORT CHANGED TO} -j ACCEPT

Then make sure everything works as intended, and then you can run

Code:
service iptables save

Disclaimer: I'm not responsible if you lock yourself out or any shit like that.
 
Status
This thread has been locked.
Top