Setting up services not to listen on *

One of the greatest things about FreeBSD for servers is the jail infrastructure.  It lets you separate different services from each other, preventing things like cross-site attacks, and helping to minimize the damage if there is someday a breach.  It’s similar to chroot in the old days, and it generally makes sysadmins sleep better at night.

Reading more about jails and the best way to set them up, I learned that as a preliminary step, it’s important to make sure the host machine isn’t running services that listen on * (all available interfaces.)  Listening on “all interfaces” is something a lot of services do by default, but you can configure most of them not to do it.

Section6 Wiki lists a good way to list the services listening on *:

sockstat|grep "\*:[0-9]"

You can also try

sockstat -l

and look for items with a * listed under the local address column

I went ahead and drew up a chart of different services, and steps I took to reconfigure:

http://www.scottspare.com/docs/Service_listen_chart.pdf

(Section6 Wiki)

Posted by Scott in Uncategorized

2 Responses to “Setting up services not to listen on *”

  1. Scott Says:

    Follow-up item: after disabling nmbd as the Section 6 wiki mentioned, I found that I could no longer access Windows network shares from the FreeBSD machine.

    It turns out that the FreeBSD machine didn’t know the IP address of the Windows machine (as tested by nmblookup). It also turns out Samba and windows file sharing have a bunch of different ways they try to figure out the IP address from the machine name.

    Anyway, to fix this, I just edited usr/local/etc/smb.conf to let SAMBA be a WINS server. WINS is one way to let machines know each other by name. I also edited the WINS settings on the Windows machine to use the FreeBSD machine as its WINS server.

  2. Scott Says:

    One other item. CUPS. To get this working right, I edited /usr/local/etc/cups/cupsd.conf, and added the line

    Browsing Off

    and commented out the line reading
    Port 631

Leave a Reply

 
  • jacob: Thanks for a great post. I had one issue with your command: #nice -n 10 portupgrade -aRr. you will get...
  • Pan: Do you have any problem printing from a windows machine? I have an Samsung ML1610 and I can print once from...
  • Scott: One other item. CUPS. To get this working right, I edited /usr/local/etc/cups/cupsd.conf , and added the line...
  • Scott: Follow-up item: after disabling nmbd as the Section 6 wiki mentioned, I found that I could no longer access...
  • Scott: Dan, that’s a great point. I experienced exactly what you’re saying today when I realized...