I realize "secure" is a very loaded definition.
I need to connect to an SFTP logging server (user/pass only, no ssh key).
The SFTP server has IP whitelisting, and all my server IP's are dynamic. I want to set up a SOCKS5 proxy server with a static IP that will allow me to connect from my servers and proxy the SSH connection. Unfortunately I can't whitelist incoming IP's in the firewall because I'm using Heroku which uses any IP on Amazon
I'm mainly concerned about this proxy server being open to the world, and I want to make sure the steps I have done are good, or if I need to do more. I know that security can go in an extreme direction, but I am not super advanced, so I want a bit of a middle ground which is good for 99.95% of applications.
Here is the steps I have done, nothing else (so no extra configuration or software installation, etc).
- Create an instance on Google Cloud, use
Ubuntu 18.04
, give it a static IP - Open port
tcp:1080
in firewall using Google Cloud web interface, block80
and443
Create a new user with the following command, using a very secure password (it's 24 characters in length, and includes letters and numbers)
useradd -M -s /usr/sbin/nologin -p $(openssl passwd -1 PASSWORD) USERNAME
Install Dante, with the following configuration (
ens4
comes from runningifconfig
and getting the adapter name. I guess this is what Google cloud calls it):logoutput: /var/log/danted.log internal: ens4 port = 1080 external: ens4 socksmethod: username clientmethod: none user.privileged: root user.unprivileged: nobody # comment out user.libwrap lines timeout.io: 43200 client pass { from: 0.0.0.0/0 to: 0.0.0.0/0 log: error } socks pass { from: 0.0.0.0/0 to: logging-service.example.com log: error }
Here were my main concerns:
- Is it OK to have port 1080 open? Some people have said this is bad but they link me to some things I don't understand, like "netplan.io". Is there a simple solution I can do if this is a bad idea?
- I notice you can use the keyword
method
inside theclient
andsocks
blocks... should I put something there? Or does it use what is above undersocksmethod
andclientmethod
? - Should I add something that blocks failed login attempts (I think it is called fail2ban?)
- I did add a restriction on the
socks
part to only allow connection tologging-service.example.com
, although I figure if someone has intruded up until that point something is very wrong. - The
net-ssh
/net-sftp
libraries I'm using also support "jump" proxy's, is that more secure? - It seems weird allowing the world to just connect to port 1080 and attempt to guess username/password. I suppose this makes it the weakest link. As long as the password is long and secure, is there anything else to strengthen this weakest link?
Any other ideas to make this more secure?