Archive for the ‘OpenBSD’ Category

Beginning LaTeX – Typesetting the OpenBSD FAQ

Monday, May 30th, 2011

I attended a one day training course held by the UK TUG back in July of last year which introduced beginners to LaTeX.
It was relatively simple to get up & running & we were able to put together basic documents with ease after a little practice.
Slides from the course
Handout from the course
To apply what I’d learnt on the course I decided to typeset the OpenBSD FAQ to get me on my way with LaTeX as the official PDF available for download appears to be generated using a pdf printer from the website which is great (links & chapters are there & working) but I don’t think it look that great.
A beautiful OS deserves beautiful documentation! :)
So I had a brief attempt at it the days proceeding the course & got side tracked after doing the very basics on the first 4 chapters. Nearly a year on, I thought I’d have another stab at it.
The tex files are in a Mercurial repo & there’s a PDF too :)
I’ve managed to get 10 of the 15 sections from the faq into tex files so far, with basic formatting applied to text, but there are lots to do yet e.g links, tidying up formatting, setting a typographical convention & applying it consistently.

Dell PowerEdge T105 & *BSD

Friday, February 1st, 2008

Dell where running a special offer this week on the PowerEdge T105 servers.
For £173inc Vat & Shipping they make perfect test boxes, I placed the order on monday & they where here on thursday.
I’ve spent some of today trying ou the AMD64 flavours of FreeBSD 6.3 & 7.0-RC1, NetBSD 4.0 & 200802010002Z snapshot, OpenBSD 4.2 RELEASE & CURRENT.
One word of warning the onboard broadcom network card is a POS, you will need an additional network card installed in the system if you’re planning to have any means of connectivity to you box.
I used a cheapo intel pro/1000 GT PCI network card.

Here are some dmesgs:
FreeBSD 6.3-RELEASE AMD64
FreeBSD 7.0-RC1 AMD64
The broadcom network card was enabled in the bios but wasn’t detected by the kernel

I was unable to NetBSD 4.0 & 200802010002Z as the setup program claimed there where any disks installed.

OpenBSD 4.2-RELEASE GENERIC kernel
OpenBSD 4.2-RELEASE GENERIC.MP kernel
OpenBSD 4.2-CURRENT GENERIC kernel
The broadcom network worked fine during the install process as far as I was able to obtain a IP address from a DHCP server, upon reboot when the system went multiuser & the network card was initialised the system would panic, using the intel card instead stopped the panic onboot, but still panicked on reboot, disabling the broadcom network card in the bios solved any panics. Screenshot
I was unable to test the 4.2-CURRENT GENERIC.MP kernel as the system failed to boot, complaining about em0: watchdog timeout -- resetting
&
wd0a: device timeout writing fsbn 1885728 of 1885728-1885759 (wd0 bn 1885791; cn 11 tn 98 sn 12), retrying Screenshot

I also booted the system off the FreeBSD-CURRENT snapshot using the bootonly iso, the broadcom network card was detected but panicked when attempting to obtain a IP address via DHCP.

Jetway J7F2WE1G5D-OC-PB

Saturday, November 24th, 2007

6 Months ago I bought a mini itx motherboard to replace my current ancient web server / firewall, I went for the Jetway J7F2WE1G5D-OC-PB as it was cheaper then the VIA ones & it also supports expansion via daughterboards, there’s a whole range to choose from, I went for the AD3RTLAN-G which gives you three additional gigabit interfaces which are based on the Realtek 8169 chipset. Sadly this chipset does have some limitations as mentioned in re(4) on OpenBSD
The RealTek 8169, 8169S and 8110S chips are only capable of transmitting
Jumbo frames up to 7440 bytes in size.

But I’m sure that should be good enough for a network of 1 user! =)

Hopefully within the next couple of weeks I well get OpenBSD 4.2 installed on this box & replace the current server, the only holdup for me atm is the builtin VIA Rhine-II interface doesn’t support adjustment of the mtu, which is going to cause some problems as I’m using pppoe(4) & don’t want use mssfixup in PF, using one of the gigabit interfaces instead would be a waste.

Dmesg from the 21/11/07 snapshot of -CURRENT

Using the CPAN shell / Installing Bundle::CPAN on OpenBSD

Monday, September 25th, 2006

Before you can use the CPAN shell on OpenBSD you need to install p5-LWP-UserAgent-Determined from the ports tree/packages.

Otherwise you wont be able to fetch any components properly
eg:

Fetching with Net::FTP:
ftp//cpan.sunsite.ualberta.ca/pub/CPAN/authors/01mailrc.txt.gz
Couldn't fetch 01mailrc.txt.gz from cpan.sunsite.ualberta.ca
Trying with "/usr/bin/lynx -source" to get ftp://CPAN.mirror.rafal.ca/pub/CPAN/authors/01mailrc.txt.gz
gzip: /root/.cpan/sources/authors/01mailrc.txt: unknown suffix: ignored

& the process will bomb out with MD5 checksum errors eg:


Trying with "/usr/bin/lynx -source" to get
ftp://CPAN.mirror.rafal.ca/pub/CPAN/authors/id/A/AN/ANDK/Bundle-CPAN-1.853.tar.gz
gzip: /root/.cpan/sources/authors/id/A/AN/ANDK/Bundle-CPAN-1.853.tar: unknown suffix: ignored
CPAN: Digest::MD5 loaded ok

Trying with "/usr/bin/lynx -source" to get
ftp://CPAN.mirror.rafal.ca/pub/CPAN/authors/id/A/AN/ANDK/CHECKSUMS

Checksum mismatch for distribution file. Please investigate.

Distribution id = A/AN/ANDK/Bundle-CPAN-1.853.tar.gz
CPAN_USERID ANDK (Andreas J. Koenig <andreas .koenig@anima.de%gt;)
CONTAINSMODS
MD5_STATUS
localfile /root/.cpan/sources/authors/id/A/AN/ANDK/Bundle-CPAN-1.853.tar.gz

I'd recommend removing
/root/.cpan/sources/authors/id/A/AN/ANDK/Bundle-CPAN-1.853.tar.gz. Its MD5
checksum is incorrect. Maybe you have configured your 'urllist' with
a bad URL. Please check this array with 'o conf urllist', and retry.

Connecting to a Windows PPTP based VPN through a OpenBSD / PF firewall

Thursday, September 21st, 2006

To be able to connect to a Windows based PPTP VPN through a OpenBSD firewall you’ll need to make a couple of changes to allow GRE traffic through.
first add the following to /etc/sysctl.conf:
net.inet.gre.allow=1
net.inet.gre.wccp=1
net.inet.mobileip.allow=1

then add the following to the filter section in your /etc/pf.conf:
pass in on $ext_if proto gre all keep state
pass out on $ext_if proto gre all keep state

To make the changes effective without having to reboot issue the following as root:

sysctl net.inet.gre.allow=1
sysctl net.inet.gre.wccp=1
sysctl net.inet.mobileip.allow=1
pfctl -f /etc/pf.conf

Chillispot for OpenBSD

Thursday, September 7th, 2006

I’ve written a port for Chillispot based on the patch submitted to the Chillispot mailing list today by Steve Davies.

You can grab a copy of it here

Spamd Statistics

Thursday, July 27th, 2006

After a quick google round I came across this post on misc@
Sadly the link is now dead, but a copy of the script was reposted onto misc@ again which is handy, I’ve also made a copy of the script available here

Anyway, so I copied the script onto one of my openbsd boxes & fired it up resulting in this rather impressive output:
Spamd statistics: (logfile: /var/log/spamd)
Average
Host Seconds Connections (secs/conn)

great!, spamdb lists a huge list of IP addresses & this is all I’m able to get out of it??
After checking out /etc/syslog.conf I found that I hadn’t added the entry for logging spamd when I reformatted, a quick edit & a kill -HUP later things looked much better! :)

Spamd statistics: (logfile: /var/log/spamd)
Average
Host Seconds Connections (secs/conn)
201.27.29.243: 12 1 12.00
217.22.88.123: 24 1 24.00

Dovecot on OpenBSD file_lock_dotlock() errors

Thursday, July 13th, 2006

If after installing Dovecot on OpenBSD you get the following error when you try to access your mailbox:
open(/var/mail/.temp.host.1234.abcdefg) failed: Permission denied
file_lock_dotlock() failed with mbox file /var/mail/user: Permission denied

then uncomment & change the mbox_write_locks entry in /etc/dovecot from mbox_write_locks = dotlock fcntl to mbox_write_locks = fcntl

Everything should spring to life afterwards! :)

Updated Darwin Streaming Server Patch for DSS 5.5.1 on OpenBSD

Monday, May 15th, 2006

Merging the original work of Jeff Ross, Natsuki Sasahara + a pointer from Advisor Joe I have made a new patch which allows Darwin Streaming Server 5.5.1 to compile on OpenBSD

Switching between XFree86 & Xorg

Saturday, December 31st, 2005

To switch between the XFree86 X server & the Xorg X Server on OpenBSD simply delete the X symbolic link
rm /usr/X11R6/bin/X
& create a new symbolic link from your preferred X server to X
e.g for Xorg
ln -s /usr/X11R6/bin/Xorg /usr/X11R6/bin/X
or XFree86 SVGA
ln -s /usr/X11R6/bin/XF86_SVGA /usr/X11R6/bin/X

Restoring missing device & specials files in /dev

Tuesday, November 15th, 2005

If you have accidently deleted or have lost a device or special file in /dev, run the following command as root to rebuild the files
cd /dev
MAKEDEV all

PF Statistics

Sunday, July 3rd, 2005

I’ve gone stat & monitoring crazy in the past few weeks, using Hatchet you can generate graphs & charts from the PF log files on the state of PF. Another tool is also available called pfrtg which does a similar job.

NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server PT2

Monday, January 3rd, 2005

Get the PDF version of the guide here
All Info in this guide was sourced from the following pages (thnx guys) & the patch is a mod of Mike Passwalls original patch for linux
http://homepage.mac.com/nand/macosx/netboot.html (not english)

http://frank.gwc.org.uk/~ali/nb/

http://www.lysator.liu.se/~/torkel/computer/netboot-macosx.html

http://mike.passwall.com/macnc/

ToDo
Make a patch for dhcpd on OpenBSD 3.6
Make the whole thing run on OpenBSD

NetBoot OS X from a OpenBSD Server & NetInstall from a OpenDarwin NFS Server

Monday, January 3rd, 2005

This project is still yet to be finished, at the moment Im using 2 box’s to carry out the installation, the aim is to have one box running OpenBSD doing everything (unfortunately there is no HFS support within the o/s & Im having problems getting mountd to accept connections from clients on a non reserved port)
I did look at FreeBSD 5.3 with HFS+ support but Its early days for the project thus the system panicked everytime I attempt to copy to the NFS share from another host.

1x PC running OpenBSD which is running a tfptd & hacked DHCPD
1x PC running OpenDarwin which has a HFS formatted volume containing the OS X install files shared via NFS
1x Mac (G3 iBook in my case)

Mac gets boot info & kernel image from OpenBSD box & boots, then connects to the OpenDarwin box & starts the GUI/Setup.

I have managed to succesfully install OS X 10.3 & 10.4 with this setup though how the install files where shared on the OpenDarwin box varied between the NetInstall of 10.3 & 10.4.

Lets go through the core part of the setup which needs to be done independent of which version of OS X you are going to be installing.

1. Install OpenDarwin, as OpenDarwin x86 runs off a UFS partition you’ll need a 2nd partition (atleast 2.2gigs if youre installing 10.4) which you’ll format as HFS so remember to partition manually. Note the partition number you’ve installed onto as you’ll need it in the next step!

2. Upon 1st boot you’ll have to manually specify the location of the root partition manually as OpenDarwin doesnt seem to find it & sits there idle.
Press enter at the prompt to specify boot time options & at the prompt enter
rd=disk#s# convention being disk “disknumber” s “partition number”
Once youre logged in edit /Library/Preferences/SystemConfiguration/com.apple.Boot.plist & add rd=disk#s# in the string section under the kernel flags key.

3. Now format the 2nd partition using the newfs_hfs tool
newfs_hfs -v pickaname /dev/disk#s#

4. reboot & log back in, if you look in /Volumes/ you should have a folder called pickaname (or whatever name you picked :P )

5. Using the niutil (netinfo util) you need to create a NFS share
niutil . -create /exports/Volumes/pickaname opts maproot=root:wheel
this will create a share accessible by any host to allow specific hosts use the following command:
niutil . -create /exports/Volumes/pickaname clients 192.168.0.bla
to add aditional IP addresses use the append switch:
niutil . -append /exports/Volumes/pickaname clients 192.168.0.bla

6. To start sharing run:
portmap
nfsd -t -u -n 4
mountd

you may want to add these commands to your /etc/rc to save you having to run it everytime.

7. Run ifconfig -a & note the MAC address of your network card.

1.Install OpenBSD 3.5 (in any configuration you like)
2. Download & extract the sources into /usr/src from the the OpenBSD ftp site
3. Download the patch for dhcpd
& apply to source
patch -p0 < obsd_35patch

4. goto /usr/src/usr.sbin/dhcp/server & run make
5. make a backup copy of your original dhcpd & then overwrite with your new copy
cp /usr/sbin/dhpd /usr/sbin/dhcpd.original
cp dhcpd /usr/sbin/

6. With your dhcpd in place, its onto creating the dhcp lease info. open /etc/dhcpd.conf in your editor & paste the following in & edit to your requirements, you’ll need the MAC addresses of your Mac & PC running OpenDarwin

shared-network LOCAL-NET {
option domain-name "domainname.co.uk";
option domain-name-servers 194.168.4.100, 194.168.8.100;
subnet 192.168.0.0 netmask 255.255.255.0
{option routers 192.168.0.1;
range 192.168.0.2 192.168.0.16;
default-lease-time 600;
max-lease-time 7200;
allow bootp;
not authoritative;
}
host ibook {
hardware ethernet 00:03:66:55:cf:b8;
fixed-address 192.168.0.33;
filename "BootX";
server-name "192.168.0.1";
}
host darwin {
hardware ethernet 00:04:55:66:dd:b5;
fixed-address 192.168.0.10;
}
}

7. Edit /etc/dhcpd.interfaces & enter the name of the interface which dhcpd will run on, run
ifconfig -a if youre unsure of which interface.
8. Edit /etc/bootparams & specify the locations of the root & private folders that the mac will mount on boot
the convention is
hostname root=path private=path eg
ibook root=192.168.0.10:/Volumes/pickaname private=192.168.0.10:/Volumes/pickaname

9.Now onto enabling the services on boot, open /etc/rc.conf.local in your editor & add the following lines:

bootparamd_flags=""
dhcpd_flags="-q"

then open /etc/inetd.conf & uncomment
tftp dgram udp wait root /usr/libexec/tftpd tftpd -s /tftpboot

10. You’ll need to create a folder on the root of your disc called tftpboot, this folder is going to store the files to boot your mac.
11. Using your Mac or the OpenDarwin box copy the following files from your OS X disks to /tftpboot on your openbsd box:
System/Library/CoreServices/BootX
mach_kernel rename it to: mach.macosx
Extensions.mkext rename it to mach.macosx.mkext

To Install OSX 10.3 (Panther)
As the install is spread over multiple discs & the system reboots after the 1st CD is finished, I didnt bother trying to get a full install going at once, Instead I installed the Core & BSD componenets, then rebooted, mounted the NFS share & installed the other components by hand.
1.Copy the contents of CD1 to your nfs share
pax -r -w -p e /Volumes/Mac OS X Install Disc 1/* /Volumes/pickaname/
2. On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname

If the installer complains that there is 0 space available on your Mac to install onto then make sure you have a folder called .vol on your NFS share.

Theoretically is should be possible to install Tiger this way aswell but the installer complains that the harddisk on the Mac cannot be installed onto as the system cannot be started from that volume!!!

To Install OSX 10.4 (Tiger)
Simply copy the .dmg of the latest Beta Seed to the /Volumes/pickaname
On your mac you’ll need to set the following variables either at the openfirmware prompt directly or using the nvram tool within OS X

boot-device enet:192.168.0.1
boot-args rf=nfs:192.168.0.10:/Volumes/pickaname:nameoftigerimage.dmg

It should be possible to install 10.3 this way aswell though I havent tried.
If youre planing on only installing from a disk image then theoretically there is no need to create a HFS partition on the OpenDarwin box & If you can get OpenBSD to accept connections from clients on non reserved ports then the OpenDarwin box can be ditched all together.

The Propper way to fire up MySQL PT2

Wednesday, December 1st, 2004

Thanx to WIntellect @BSD Nexus heres a even more propper way to fire up MySQL on OpenBSD, add the following line to your rc.local
/usr/local/bin/mysqld_safe -u _mysql > /dev/null & echo -n ‘ mysqld’;

Starting apc-upsd automatically on boot

Saturday, November 20th, 2004

To start the apc-upsd daemon automatically on boot add the following line to your rc.local file


if [ -x /usr/local/sbin/apc-upsd ]; then
/usr/local/sbin/apc-upsd & echo -n 'APC UPSD '
fi

Running Darwin Streaming Server on OpenBSD 3.5

Sunday, August 1st, 2004

Today I have mostly been playing with streaming servers, I’ve been meaning to give Apple’s Darwin Streaming server a go for a while now but never got around to trying it, unfortunatly theres no official binaries for OpenBSD but a quick google around & I found this
I download the patch from the url specified in the post & then onto Apples site to download the sources. I was unable to use the patch in its original form as the creator had specified the paths from his computer to the files which ofcourse where invalid on my system. A quick edit of the dif & i was back on track. :)

Heres my moded patch with the paths taken out, place it inside the DarwinStreamingSrc5.0.1.1 directory & patch away :)
As specified in the Jeff Ross’s post, patch the source with
patch -p0 < DSS_5.diff
then compile & install with
./Buildit
./DSS_MakeRoot -f DarwinStreamingSvr
cd DarwinStreamingSvr
sudo ./Install

once installation is completed run
rmuser qtss then run adduser & create a new user with the username qtss,with the shell /sbin/nologin & no password.
otherwise Darwin fails with the following error
Cannot switch to group qtss

Now run /usr/local/sbin/streamingadminserver.pl then openup your browser & goto http://localhost:1220
You should be presented with a login screen! :D
enjoy!

The Propper way to fire up MySQL

Monday, July 26th, 2004

grrr
been pulling my hair out as cron wasnt firing up, tracked the problem down to rc.local, the command to start mysql was preventing cron from running but everything seemed A-OK on the outside.
heres the correct lines to insert into rc.local on OpenBSD to fireup mysql without causing any knock on effects:
if [ -x /usr/local/bin/mysqld_safe ]; then
/usr/local/bin/mysqld_safe > /dev/null & echo -n 'mysql '
fi