Mar 15
Most Hacked O/S
icon1 admin | icon2 FreeBSD, Linux, Security | icon4 03 15th, 2008| icon3No Comments »

Zone-H has published its statistics from 2005-2007 on hacks by OS, and more. Topping the list was Linux, with two Windows variants below.

Operational System   Year 2005   Year 2006   Year 2007 
Linux 276.350 446.311 306.076
Windows 2003 72.377 183.953 114.137
Windows 2000 101.151 69.754 23.838
FreeBSD 23.653 31.075 18.542
Unknown 2.834 3.802 9.314
SolarisSunOS 6.193 9.797 5.226
Windows NT/9x 5.921 4.023 1.204
MacOSX 2.139 2.247 1.488
Windows XP 498 393 323
HP-UX 667 166 259
AIX 367 101 124
SCO UNIX 19 5 92
Unix 7 134 79
Tru64 54 25 40
OpenBSD 21 13 39
NetBSDOpenBSD 366 229 36
IRIX 771 211 34
BSDOS 498 49 26
NovellNetware 30 24 9
OpenServer 0 0 7
OS390 1 3 3
MacOS 27 6 3
OS2 9 9 2
Compaq Tru64 23 13 1
NetBSD 31 14 1
Digital UNIX 2 3 1
Windows .NET 10 1 1
VM 1 0 0

Mar 11

Not a bad list of “10 Linux Commands You’ve Never Used“. Obviously most of these are application to any nix variant, so are worth checking out.

My personal favourite tool –

 ldd, want to know which Linux thread library java is linked to?

# ldd /usr/java/jre1.5.0_11/bin/java
libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00bd4000)
libdl.so.2 => /lib/libdl.so.2 (0x00b87000)
libc.so.6 => /lib/tls/libc.so.6 (0x00a5a000)
/lib/ld-linux.so.2 (0x00a3c000)

Mar 11

If your SysV (used by cache programs, and others) isn’t working inside your FreeBSD jail simply set “security.jail.sysvipc_allowed=1″ in /etc/sysctl.conf. Note that there are possible security implications with this.

Mar 11

pkg_add is a FreeBSD tool for installing packages, much like Linux’s apt-get and other tools. When you run it you can use the -r option to fetch a package, for example:

 pkg_add -v -r zip

When you do this, you’ll see it going off to download from one of the main FreeBSD servers, which can often be far away from you and a lot slower. If you’d like to download locally set the PACKAGEROOT environment variable to the server you’d like to use. For example:

export PACKAGEROOT=ftp://ftp.za.freebsd.org

“za” is the country code for South Africa. Most countries have local mirrors, and there are lists online. For example, “uk” or “au” would be for the UK or Australia.

Mar 10
em Driver Debug
icon1 admin | icon2 FreeBSD, Networking | icon4 03 10th, 2008| icon3No Comments »

If you’ve used FreeBSD chances are you’ve used the em driver (for Intel gigabit network cards). Debugging packet loss and link errors can be difficult, so here’s a handy tip for those of you using the driver –

Using sysctl, you can get “debug” information off of your cards.  Execute “sysctl hw.em0.stats=1” and “sysctl hw.em0.debug_info=1” each time you want the information to be logged to /var/log/messages (or dmesg). You can replace “em0″ with whichever network card you want, for a quick list of what seems to be available you can run “sysctl -a hw.”

Here’s what you can expect to see –

/kernel: em0: Adapter hardware address = 0xc62931e0
/kernel: em0:CTRL  = 0×3c0249
/kernel: em0:RCTL  = 0×0 PS=(0×8402)
/kernel: em0:tx_int_delay = 0, tx_abs_int_delay = 0
/kernel: em0:rx_int_delay = 0, rx_abs_int_delay = 0
/kernel: em0: fifo workaround = 0, fifo_reset = 0
/kernel: em0: hw tdh = 0, hw tdt = 0
/kernel: em0: Num Tx descriptors avail = 0
/kernel: em0: Tx Descriptors not avail1 = 0
/kernel: em0: Tx Descriptors not avail2 = 0
/kernel: em0: Std mbuf failed = 0
/kernel: em0: Std mbuf cluster failed = 0
/kernel: em0: Driver dropped packets = 0
/kernel: em0: Excessive collisions = 0
/kernel: em0: Symbol errors = 0
/kernel: em0: Sequence errors = 0
/kernel: em0: Defer count = 0
/kernel: em0: Missed Packets = 0
/kernel: em0: Receive No Buffers = 0
/kernel: em0: Receive length errors = 0
/kernel: em0: Receive errors = 0
/kernel: em0: Crc errors = 0
/kernel: em0: Alignment errors = 0
/kernel: em0: Carrier extension errors = 0
/kernel: em0: XON Rcvd = 0
/kernel: em0: XON Xmtd = 0
/kernel: em0: XOFF Rcvd = 0
/kernel: em0: XOFF Xmtd = 0
/kernel: em0: Good Packets Rcvd = 0
/kernel: em0: Good Packets Xmtd = 0

Mar 10

FreeBSD

FreeBSD has long been plagued by less-than-best SMP performance, especially in versions 4 and 5. Slashdot is reporting FreeBSD 7.0 SMP performs much better, and is ahead of Linux.

“After major improvements in SMP support in FreeBSD 7.0, benchmarks show it performing 15% better than the latest Linux kernels (PDF, see slides 17 to 19) on 8 CPUs under PostgreSQL and MySQL. While a couple of benchmarks are not conclusive evidence, it can be assumed that FreeBSD will once again be a serious performance contender. Some posters on LWN have noted that the level of Linux performance could be related to the Completely Fair Scheduler, which was merged into the 2.6.23 Linux kernel.”

There has since been an update trying to prove that Linux is faster –

Update: 03/06 21:32 GMT by KD : An anonymous reader sent in word that Linux kernel developer Nick Piggin reran the benchmark today and came to a different conclusion: In his benchmark Linux was faster than FreeBSD.

But whoever the winner, the performance is clearly much, much better than before.