53 points

Setup Fail2ban

Login only with SSH keys. MFA on SSH login. Use SSH proto 2.

Disable passwords, x11 forwarding, root logins

Reduce Idle timeout interval

Limit users’ SSH access

That should be more than enough for the average use case.

permalink
report
reply
12 points

Regular updates are definitely necessary too. Also, if you do limit SSH users to a chroot make sure you limit TCP (port) forwarding too.

permalink
report
parent
reply
4 points

Containers can help lock services down if you do it right.

permalink
report
parent
reply
3 points

You can have 2FA on ssh?

permalink
report
parent
reply
1 point

Yep. Use SSH keys, not just protocol.

On connection, it’ll ask for your SSH password (this is different from the users password).

After that with something like authelia in place, you’ll be asked for a 2fa code.

permalink
report
parent
reply
0 points

So, no. SSH can’t do 2FA? I would need to set up Authelia and connect through that? I already use ssh keys instead of passwords to connect to my server

permalink
report
parent
reply
34 points
*

Don’t expose anything to the Internet that you don’t absolutely have to. If you can, put everything behind a VPN gateway.

Make backups. Follow the 3-2-1 rule.

permalink
report
reply
5 points

Will a wireguard docker image work for getting ssh access to my server?

permalink
report
parent
reply
10 points
*

I wouldn’t recommend putting ssh behind any vpn connection unles you have a secondary access to the machine (for example virtual tty/terminal from your provider or local network ssh). At best, ssh should be the only publicly accessible service (unless hosting other services that need to be public accessible).

I usually move the ssh port to some higher number just to get rid of the basic scanners/skiddies.

Also disable password login (only keys) and no root login.

And for extra hardening, explicitly allow ssh for only users that need it (in sshd config).

permalink
report
parent
reply
8 points

Ssh behind a wire guard VPN server is technically more secure if you don’t have a key-only login, but a pain if the container goes down or if you need to access the server without access to wireguards VPN client on your device.

permalink
report
parent
reply
1 point

Do the secure thing and only access your Linux shell over Discord!

/s

permalink
report
parent
reply
21 points
*
  • fail2ban / brute forcing prevention
  • quick, frequent updates(!)
  • containerization / virtualization
  • secure passwords, better keys
  • firewall
  • a hardened operating system (distribution)
  • SELinux / Apparmor / … / OpenBSD
  • not installing unnecessary stuff
  • An admin who is an expert and knows what they do.
permalink
report
reply
3 points

Me, two+ decades into tinkering and still a dumbass: “look at me, I’m the expert admin now”

permalink
report
parent
reply
19 points

Don’t turn it on is the ultimate technique

permalink
report
reply
3 points

That’s why “availability” is a core tenet of security (according to some cybersecurity course I took). It is easy to prevent unauthorized access to data if you have no requirements on authorized access.

permalink
report
parent
reply
1 point

barring that, unplug the ethernet.

permalink
report
parent
reply
15 points

fail2ban

permalink
report
reply
19 points

… is an intrusion prevention software framework. Written in the Python programming language, it is designed to prevent brute-force attacks. It is able to run on POSIX systems that have an interface to a packet-control system or firewall installed locally, such as iptables or TCP Wrapper.

permalink
report
parent
reply

Selfhosted

!selfhosted@lemmy.world

Create post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

Community stats

  • 4.8K

    Monthly active users

  • 3.5K

    Posts

  • 75K

    Comments