Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

BSD Cafe Billboard

  1. Home
  2. BSD
  3. FreeBSD
  4. Tell about your best practices setting up a FreeBSD server

Tell about your best practices setting up a FreeBSD server

Scheduled Pinned Locked Moved FreeBSD
setuphardeningbest-practicesfreebsd
5 Posts 4 Posters 130 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nibori
    wrote last edited by
    #1

    There are many guides on setting up / hardening your server. Books, the manual, all good resources.

    I don't expect you to reproduce full books worth of content, or dump a lifetime of experience into a single post - but certainly anything you think important, under-covered or underappreciated in the "usual" resources, would be keen to know!

    To start, if I had to call out one best practice that stuck on me, it would be keeping the base system minimal, and putting services into jails (or, maybe daemonless going forward).

    pertho@mastodon.bsd.cafeP 1 Reply Last reply
    5
    8
    • N Offline
      N Offline
      nibori
      wrote last edited by
      #2

      Sidenote: some of the search results coming up

      • https://docs.freebsd.org/en/books/handbook/security/
      • https://github.com/wravoc/harden-freebsd (comments at https://forums.freebsd.org/threads/my-freebsd-hardening-script.89523/)
      • https://www.freebsdsoftware.org/blog/hardening-freebsd-server/
      • https://vez.mrsk.me/freebsd-defaults
      • https://hardenedbsd.org/content/about
      1 Reply Last reply
      0
      • stefano@mastodon.bsd.cafeS stefano@mastodon.bsd.cafe shared this topic
        pastorinni@techhub.socialP pastorinni@techhub.social shared this topic
        ponderstibbons@mas.toP ponderstibbons@mas.to shared this topic
        pertho@mastodon.bsd.cafeP pertho@mastodon.bsd.cafe shared this topic
      • N nibori

        There are many guides on setting up / hardening your server. Books, the manual, all good resources.

        I don't expect you to reproduce full books worth of content, or dump a lifetime of experience into a single post - but certainly anything you think important, under-covered or underappreciated in the "usual" resources, would be keen to know!

        To start, if I had to call out one best practice that stuck on me, it would be keeping the base system minimal, and putting services into jails (or, maybe daemonless going forward).

        pertho@mastodon.bsd.cafeP This user is from outside of this forum
        pertho@mastodon.bsd.cafeP This user is from outside of this forum
        pertho@mastodon.bsd.cafe
        wrote last edited by
        #3

        @nibori Wouldn't mind a list of sysctl.conf keys & values people use!

        1 Reply Last reply
        1
        • oz1tmm@techhub.socialO oz1tmm@techhub.social shared this topic
        • nuintariN Online
          nuintariN Online
          nuintari
          wrote last edited by nuintari
          #4

          A few things I always do.

          1. Use ZFS. Unless you are severely memory constrained, ZFS is the sane choice. I even use ZFS for single disk installations.

          2. Set a ZFS refreservation to prevent the disk from filling up completely. ZFS does NOT like full disks.

          zfs create -o refreservation=<5-10 percent of total pool space> <poolname>/reserved\n
          
          1. Enable automagick ZFS scrubbing:
          sysrc -f /etc/periodic.conf daily_scrub_zfs_enable=YES
          sysrc -f /etc/periodic.conf daily_scrub_zfs_default_threshold=7
          
          1. My "standard" set of sysctl.conf settings, most of these can be set during installation. Most of them are security oriented, the last one is because the ZFS default is almost always too low.
          security.bsd.see_other_uids=0
          security.bsd.see_other_gids=0
          security.bsd.see_jail_proc=0
          security.bsd.unprivileged_read_msgbuf=0
          security.bsd.unprivileged_proc_debug=0
          kern.randompid=1
          vfs.zfs.vdev.min_auto_ashift=12
          
          1. enable jumbo frames, sizing is card dependent, and changes if I am using VLANs or not. But I aim for interfaces that are directly speaking IP to have an MTU of 9000, because damn near everything supports that.

          ex:

          ifconfig_ix0="up mtu 9100 ... "
          create_args_vlan1005="vlan 1005 vlandev ix0 mtu 9000 ... "
          
          1. Disable various NIC offloading capabilities. I have never seen them work well under load. Your mileage may vary, and admittedly I haven't retested this since probably 13.something-RELEASE, but I was getting an order of magnitude better performance with it all switched off:
          ifconfig_ix0="... -rxcsum -rxcsum6 -txcsum -txcsum6 -tso -lro -vlanhwtag -vlanhwtso -vlanhwcsum -mextpg
          
          1. Disable password authentication in /etc/ssh/sshd_config:
          ChallengeResponseAuthentication no
          PasswordAuthentication no
          UsePAM no
          
          1. Install rocinante, and bastille if this is going to be a jail host. I try to keep my base systems fairly lean.
          1 Reply Last reply
          1
          • BigSneakyDuckB Offline
            BigSneakyDuckB Offline
            BigSneakyDuck
            wrote last edited by
            #5

            I recently submitted a Bugzilla PR for the FreeBSD Handbook's Security chapter, noting that it does not contain the phrase "hardening" or cover the how to perform the kind of hardening measures that I've seen documented in other OSes, or mandated by workplace policies.

            https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294167

            This is far from my area of expertise so any additional comments there on what the Handbook should include would be welcome. Obviously there will be some hardening requirements for personal laptops that are different to hardening for servers and vice versa, which makes structuring the chapter a bit tricky. In fact one of my complaints in the PR is that advice which should be drilled into all users, like taking note of FreeBSD Security Advisories, is at the very bottom of a long page - anybody who reads that far will have to get past a lot of material only relevant for more specialist use cases.

            https://docs.freebsd.org/en/books/handbook/security/

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            Powered by NodeBB Contributors
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups