FreeBSD - on a laptop
Posted by Eric Stein - July 20, 2006 CE @ 05:00:15 UTC
Recently I installed PC-BSD on my laptop. It was pretty decent, but it had some problems. I would have continued to use it if a kernel compile that I botched hadn't removed its ability to boot. I needed a new OS, and since I'm going to be out of town this weekend, I needed it fast.
I wanted an OS that had:
I wanted an OS that had:
- Network security (I don't want to get cracked)
- Physical security (I don't want my data and RSA keys getting stolen or found with my laptop)
- Low resource desktop environment (my laptop has only 256 MB of RAM)
- Pleasing desktop environment
- All the programs that I use every day
- Powerful command line
- Stability
- Support for my wifi card
- Open source
- Cool factor
Partitioning
During install, I added an extra 3 GB partition to be configured as my home partition later. I'd advise using more than this - I wish I had used more like 8 or 9 GB out of my 17 GB drive, as my home directory is likely to fill up fast.Loading Modules
After installing the OS, the first thing I did was to set up my /boot/loader.conf:if_ath_load="YES"
ipfw_load="YES"
geom_eli_load="YES"
This loads the driver for my wifi card, ipfw (firewall), and the module used for encrypting my home partition. Some modules are loaded by default, so this is the list I have now:ipfw_load="YES"
geom_eli_load="YES"
bash-2.05b# kldstat
Id Refs Address Size Name
1 14 0xc0400000 691928 kernel
2 1 0xc0a92000 d9f4 ipfw.ko
3 1 0xc0aa0000 b944 geom_eli.ko
4 2 0xc0aac000 19f44 crypto.ko
5 2 0xc0ac6000 ad04 zlib.ko
6 1 0xc0ad1000 fa20 if_ath.ko
7 3 0xc0ae1000 3015c ath_hal.ko
8 2 0xc0b12000 3fbc ath_rate.ko
9 1 0xc2438000 16000 linux.ko
Id Refs Address Size Name
1 14 0xc0400000 691928 kernel
2 1 0xc0a92000 d9f4 ipfw.ko
3 1 0xc0aa0000 b944 geom_eli.ko
4 2 0xc0aac000 19f44 crypto.ko
5 2 0xc0ac6000 ad04 zlib.ko
6 1 0xc0ad1000 fa20 if_ath.ko
7 3 0xc0ae1000 3015c ath_hal.ko
8 2 0xc0b12000 3fbc ath_rate.ko
9 1 0xc2438000 16000 linux.ko
Network Security
Security configuration was pretty simple too:linux_enable="YES"
usbd_enable="YES"
syslogd_flags="-ss" # syslogd - no network
portmap_enable="NO" # no portmap - security risk
inetd_enable="NO" # no inetd - no need
firewall_enable="YES" # use ipfw
firewall_script="/etc/rules" # load rules from /etc/rules
hostname="eowyn"
ifconfig_rue0="DHCP" # use DHCP to get an IP (wired)
Setting up ipfw can be decidedly confusing when you first start doing it. It took a few hours to come up with this rules script:usbd_enable="YES"
syslogd_flags="-ss" # syslogd - no network
portmap_enable="NO" # no portmap - security risk
inetd_enable="NO" # no inetd - no need
firewall_enable="YES" # use ipfw
firewall_script="/etc/rules" # load rules from /etc/rules
hostname="eowyn"
ifconfig_rue0="DHCP" # use DHCP to get an IP (wired)
ipfw -q -f flush
cmd="ipfw -q add"
$cmd 00001 allow ip from any to any via lo0
$cmd 00002 allow tcp from any to any out setup keep-state
$cmd 00003 allow tcp from any to any in established
$cmd 00010 deny ip from any to any in frag
$cmd 00020 deny ip from any to 127.0.0.0/8
$cmd 00021 deny ip from 127.0.0.0/8 to any
$cmd 00060 deny icmp from any to any in
$cmd 00600 allow tcp from any to any dst-port 68 in
$cmd 00601 deny udp from any to any dst-port 68 in
$cmd 00603 deny tcp from any to any dst-port 68 in
$cmd 65534 allow ip from any to any out keep-state
$cmd 65535 deny ip from any to any
In a nutshell: let anything on localhost work, allow needed network services to work, and let anything that's connecting to the net out.cmd="ipfw -q add"
$cmd 00001 allow ip from any to any via lo0
$cmd 00002 allow tcp from any to any out setup keep-state
$cmd 00003 allow tcp from any to any in established
$cmd 00010 deny ip from any to any in frag
$cmd 00020 deny ip from any to 127.0.0.0/8
$cmd 00021 deny ip from 127.0.0.0/8 to any
$cmd 00060 deny icmp from any to any in
$cmd 00600 allow tcp from any to any dst-port 68 in
$cmd 00601 deny udp from any to any dst-port 68 in
$cmd 00603 deny tcp from any to any dst-port 68 in
$cmd 65534 allow ip from any to any out keep-state
$cmd 65535 deny ip from any to any
Physical Security
Configuring encrypted swap was extremely simple. All I had to do was add .eli to the end of the device filename for the swap partition (in /etc/fstab). It was a bit more difficult to encrypt a partition, but it is well documented in the handbook. I'm quite happy with the results:bash-2.05b# df -h|grep eli
/dev/ad0s1g.eli 2.9G 384M 2.3G 14% /crypt
bash-2.05b# swapctl -l
Device: 1024-blocks Used:
/dev/ad0s1b.eli 992416 4
/dev/ad0s1g.eli 2.9G 384M 2.3G 14% /crypt
bash-2.05b# swapctl -l
Device: 1024-blocks Used:
/dev/ad0s1b.eli 992416 4
Post a Comment