Live data from Hacker News

FreeBSD SSH Hardening

gist.github.com

61–70 of 121 posts

Re: FreeBSD SSH Hardening

#61
post #58

Earlier quoted context omitted.

I like it a lot ... I just dont know what to do about all my 'weak' results.

Generally they’re going to be for legacy ciphers/MACs/etc. If you don’t need them, you can turn them off. If you’re the only one accessing your servers, you can honestly just pick a single option for each based on the highest security option that’s supported by all your client devices. https://infosec.mozilla.org/guidelines/openssh.html is a good starting point. The lists of available options are sorted from left ->…

Yeah I was kinda hoping that each of the fields would point to some instructions on disabling - but that is just me being too lazy to google things.

edit: thanks for that link - swiped their kex, ciphers and macs and didnt break anything (that I know of)

Re: FreeBSD SSH Hardening

#62
post #39

NanoBSD? I feel like an important part of "hardening" a server is to remove/disable unused services. Does anyone know if NanoBSD is actively worked-on by the FreeBSD team and/or still in use? For those note aware, NanoBSD is an official build from FreeBSD team that allows you to compile a slimmed down FreeBSD build that is read-only yet can run any/all FreeBSD software. I can find very little about NanoBSD other than…

I looked into this for a project a couple of years ago (to boot VMs from minimal customized ISO) and ended up using mfsbsd instead. https://github.com/mmatuska/mfsbsd

I've used Martin Matuska's mfsbsd in the past to install a system with ZFS on root. I believe now that's natively supported, but back in the day it was quite an involved thing :)

Re: FreeBSD SSH Hardening

#63
post #34

Earlier quoted context omitted.

Thanks, that's an interesting tool. But geezus, it's daunting to address SSH weaknesses unless you know ssh and it's configuration top to bottom. I don't! And I am not afraid to admit it. I just use ssh "as-is" on mainstream platforms, for example, whatever Amazon gives me on lightsail linux images or windows-10 or whatever's on my Mac and hope for the best. I mean, there's 4 different groups of algorithms to think a…

If you like Wireguard's security, you can emulate it in your sshd_config: Ciphers chacha20-poly1305@openssh.com KexAlgorithms curve25519-sha256@libssh.org MACs hmac-sha2-512-etm@openssh.com The MAC is irrelevant, as that function is built into the AEAD cipher, which are to be preferred (the alternate is AES-GCM). This will shut off a lot of legacy SSH clients. Android Connectbot specifically needs the AES cipher; add…

Exactly my finding too!

Except certain version of MacOS (and Windows) ssh client would also be unable to connect.

Re: FreeBSD SSH Hardening

#64
post #23

Earlier quoted context omitted.

In the same vein, protecting your SSH server with spiped[1] does 99% of the job. (= No need to setup fail2ban, password auth is not a big deal anymore, protects against out-of-date SSH servers and/or zero-days exploits, ...) [1] https://www.tarsnap.com/spiped.html

Is Spiped similar in-concept to a VPN?

Not really. spiped is more an equivalent to mutual SSL (aka "Client certs SSL"). It basically just encrypts and mutually auths individual connections.

It works at the TCP level, not the IP level.

Re: FreeBSD SSH Hardening

#65
post #34

Earlier quoted context omitted.

If you like Wireguard's security, you can emulate it in your sshd_config: Ciphers chacha20-poly1305@openssh.com KexAlgorithms curve25519-sha256@libssh.org MACs hmac-sha2-512-etm@openssh.com The MAC is irrelevant, as that function is built into the AEAD cipher, which are to be preferred (the alternate is AES-GCM). This will shut off a lot of legacy SSH clients. Android Connectbot specifically needs the AES cipher; add…

Exactly my finding too! Except certain version of MacOS (and Windows) ssh client would also be unable to connect.

I don't know about MacOS, but Microsoft's native OpenSSH supports this configuration.

    C:\>ssh -vv me@myDJBserver.myco.com
    OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
    ...
    debug2: KEX algorithms: curve25519-sha256@libssh.org
    ...
    debug2: ciphers ctos: chacha20-poly1305@openssh.com
    debug2: ciphers stoc: chacha20-poly1305@openssh.com
    ...
    debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC:  compression: none
    debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC:  compression: none
    ...
    $
Above you can also see that the MAC is implicit with the chosen AEAD cipher.

Re: FreeBSD SSH Hardening

#66
post #13

SSH hardening guide bonus edition: Disable password login if you can, leave the algorithm settings as they are and use an up to date version of OpenSSH. OpenSSH already agressively deprecates algorithms that are problematic. None of the algorithms enabled by default has any known security issue. But your manual tweaks from a random document you read on the Internet may enable an algorithm that we may later learn to b…

Also, configure sshd to use blacklistd:

https://docs.freebsd.org/en/books/handbook/firewalls/#firewa...

Re: FreeBSD SSH Hardening

#67
post #15

Earlier quoted context omitted.

Safest setup disable password login. disable ssh login. Put the computer back in the box and put the box under your bed.

Then, using aluminum foil and unfolded crisp packets make your room into a Faraday cage. Never open the door for any reason whatsoever. In fact, remove the door altogether.

Ensure lead bricks are used to build the said room.

Re: FreeBSD SSH Hardening

#68
post #15

Earlier quoted context omitted.

Safest setup disable password login. disable ssh login. Put the computer back in the box and put the box under your bed.

Then, using aluminum foil and unfolded crisp packets make your room into a Faraday cage. Never open the door for any reason whatsoever. In fact, remove the door altogether.

I absolutely disable sshd on machines where I never need to login remotely like my laptops. My servers of course run sshd.

Re: FreeBSD SSH Hardening

#69
post #9

The first thing i do on a new remote box is to move SSH to another non-standard port other than 22. I use the same port for every remote boxes I have. Then add that port into `.ssh/config` on local box. Second is to disable root login. Third is to copy my private key over and disable password login. 3 essential steps to secure SSH.

Just use blacklistd [0], on FreeBSD, instead of changing the port. It works with sshd, and it temporarily blocks IPs that are abusive.

[0]: https://docs.freebsd.org/en/books/handbook/firewalls/#firewa...

Re: FreeBSD SSH Hardening

#70

I always heard that FreeBSD has unparalleled networking Does it mean that it'd be worth picking FreeBSD over Linux for my C# crud app if it had to handle a lot of requests/sec? (let's ignore db for the moment)

C# support isn't great on FreeBSD yet, so probably not.
Post reply on HN