Foxpro: Not a database file.

After a crash, Foxpro complained that a dbf was not a database file. Turns out this was due to an incorrect record count in the .dbf header. Bytes 04-07 in the header contain the record count and it seems that if this does not match the expected file size Foxpro complains. Calculate the correct record count and use a hex editor to alter the header.

Bytes 08-09 in the header are a pointer to the first record (Header size)
Bytes 10-11 contain the size of one record.

The record count can be calculated from this, although I was able to use LibreOffice base to open the .dbf. This does not complain if the file size does not match the record count.

Squid on pfSense 2.3

After upgrading to pfSense 2.3 it was evident that squid just wasn’t working.

It’s now working fine after….

Stopping the service. Clearing the squid folder under /var/squid.

And then…

Setting authentication to local – which didn’t work when the correct username and passwords were entered.
And then setting auth back to none – Bingo, we can get through squid.

Using vHosts on pfSense

My way of using vHhosts on pfSense involves Squid reverse proxy, DNS and vHosts.

Make sure you’ve got the Squid3 and vHosts packages installed.

adminaccess
Admin Access

First, the pfSense web gui should be on a port other than 80 or 443. This should be done as a matter of course anyway (use https on port 8443 maybe).

Squid

We need to play around with the Squid Reverse Proxy settings.

Make sure Enable HTTP Reverse Proxy is ticked, and the Reverse HTTP Port is set to 80. Do the same for HTTPS on port 443 if you need to.

reverseproxyserver
Squid Peers

Peer server

Now move over to the Web Servers tab, and add a new web server (A Peer). We are going to add a reference to the pfSense box – where the vHosts server is running. We are telling squid that there is a peer server names pfSense running on localhost (127.0.0.1) and listening at port 10081.

Mapping

mapping
Mapping

Choose the Mappings tab and add a new mapping. We are telling squid, that when it receives a request for a particular URI, to forward that request on to another server. Choose whatever you want for the Group Name and Group Description. From the Peers list, chose the peer server we defined above. In the lower URI’s section, enter the address of the web pages you want to host (eg. test.yourdomain.com), this will correspond with each vHost we define later.

vHosts

So now we create a vHost for each site we will be hosting. Add a new vHosts with the Host name being a URI we entered earlier. The IP Address will be 127.0.0.1. Port will be 10081 as we defined earlier in the Squid Peers section. Set Enabled to true and enter a description if you want.

DNS

Whichever DNS system you are using, you will need to add an entry for the URI’s for each vHost to hit your pfSense host box.

Finally

To make sure everything is updated, restart your Squid and vHost services. Point your browser to on of the sites you’ve defined and things should work…. they did for me.

Checking and securing is down to you..

Setting up IPX and NCPFS on Ubuntu 14.04

It seems that packages are not published yet for 14.04, so if you need to string together a Novell 3.12 server and Linux for some reason, this may help.

The packages from the Maverick release work perfectly.

So visit https://launchpad.net/ubuntu/+source/ncpfs/2.2.6-8/+build/1782020 and download the following files.

  • ipx_2.2.6-8_amd64.deb
  • libncp_2.2.6-8_amd64.deb
  • libpam-ncp_2.2.6-8_amd64.deb
  • ncpfs_2.2.6-8_amd64.deb

The best way to do this (if you’re unsure) is to use wget from a console, just copy the download links from the page and paste so you end up with

wget https://launchpad.net/ubuntu/+source/ncpfs/2.2.6-8/+build/1782020/+files/ipx_2.2.6-8_amd64.deb
wget https://launchpad.net/ubuntu/+source/ncpfs/2.2.6-8/+build/1782020/+files/libncp_2.2.6-8_amd64.deb
wget  https://launchpad.net/ubuntu/+source/ncpfs/2.2.6-8/+build/1782020/+files/libpam-ncp_2.2.6-8_amd64.deb
wget https://launchpad.net/ubuntu/+source/ncpfs/2.2.6-8/+build/1782020/+files/ncpfs_2.2.6-8_amd64.deb

Then install the packages as root.

sudo dpkg -i ipx_2.2.6-8_amd64.deb
sudo dpkg -i libncp_2.2.6-8_amd64.deb
sudo dpkg -i libpam-ncp_2.2.6-8_amd64.deb
sudo dpkg -i ncpfs_2.2.6-8_amd64.deb

Now if you’re attached to a Novell server typing the command slist as root should show it.

There are plenty of tutorials on how to mount a Netware drive, or use pserver to use your linux box as a Netware printer server.

This post was mainly a record for myself.

Watchguard Firewall X750e running pfsense

After many trusted years of service, my original pfsense firewall died (Watchguard X700).   So it was off to ebay to buy a newer model the X750e – faster processor, more RAM.  £40 later on ebay I have myself a large red box!

For those who don’t know pfsense is a damn good open source firewall.   It’s based upon FreeBSD and the firewall software runs particularly well, with a little tweaking, on old Watchguard boxes.  These boxes have a 1.3Ghz celeron processor, 6 x 1Gb NICS, 512Mb RAM.  More than ample for running a firewall.  Get two and you can set one up for automatic-failover!

So if you want a firewall that is industrial grade and want to protect your home a little better than a typical ADSL type firewall, or just want to learn more about one of these babies, then head over to ebay and grab one for a bargain.

To get one working here are the high level steps that I’ve found to work

  1. Flash the BIOS with the original CF card so that you can use large CF cards on the box.
  2. Flash a 4Gb CF card with the latest version of pfsense
  3. Sort out the DMA issue caused by the latest version of pfsense
  4. Install WGXepc so you can control the speed of the howling banshees (aka cooling fans)
  5. Install LCDProc
  6. Configure your firewall for your personal tastes

Good starting point:  https://doc.pfsense.org/index.php/PfSense_on_Watchguard_Firebox

And back to Firefox

So I’ve been using Chrome for a number of years now, and thought it time to try the developer spin of Firefox. So glad I did. It’s smooth, fast and probably less invasive than Chrome. The developer tools are amazing too. My browser of choice. 

Crash report – 22nd Jan 2015

Anonymous UUID: 7CA7ED79-BC1E-4D32-0AD1-248475CD9C97

Thu Jan 22 20:42:23 2015

*** Panic Report ***
panic(cpu 0 caller 0xffffff7f97a0cf63): “GPU Panic: [<None>] 3 3 7f 0 0 0 0 3 : NVRM[0/1:0:0]: Read Error 0x00000100: CFG 0xffffffff 0xffffffff 0xffffffff, BAR0 0xd2000000 0xffffff8130823000 0x0a5480a2, D0, P2/4\n”@/SourceCache/AppleGraphicsControl/AppleGraphicsControl-3.7.21/src/AppleMuxControl/kext/GPUPanic.cpp:127
Backtrace (CPU 0), Frame : Return Address
0xffffff811dfcb680 : 0xffffff8014d3a811
0xffffff811dfcb700 : 0xffffff7f97a0cf63
0xffffff811dfcb7e0 : 0xffffff7f95a11b9f
0xffffff811dfcb8a0 : 0xffffff7f95adb18e
0xffffff811dfcb8e0 : 0xffffff7f95adb1fe
0xffffff811dfcb950 : 0xffffff7f95d5a056
0xffffff811dfcba80 : 0xffffff7f95afe82d
0xffffff811dfcbaa0 : 0xffffff7f95a185f1
0xffffff811dfcbb50 : 0xffffff7f95a160fc
0xffffff811dfcbd50 : 0xffffff7f95a1719c
0xffffff811dfcbe30 : 0xffffff7f959c3f5e
0xffffff811dfcbe90 : 0xffffff7f979dddf6
0xffffff811dfcbee0 : 0xffffff7f979dcab0
0xffffff811dfcbf00 : 0xffffff8014d6be13
0xffffff811dfcbfb0 : 0xffffff8014e192c7
Kernel Extensions in backtrace:
com.apple.nvidia.classic.NVDAResmanTesla(10.0)[796AE430-39FB-3255-8161-D52AFA28EE2B]@0xffffff7f959c1000->0xffffff7f95c2afff
dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f95524000
dependency: com.apple.iokit.IONDRVSupport(2.4.1)[F4738C55-B507-3627-A9CA-3D29A5230A03]@0xffffff7f959b1000
dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[6D99A3BE-D531-3780-880B-13F2FC894A4A]@0xffffff7f9596a000
com.apple.nvidia.classic.NVDANV50HalTesla(10.0)[7FE40648-F15F-3E18-91E2-FDDDF4CDA355]@0xffffff7f95c35000->0xffffff7f95edefff
dependency: com.apple.nvidia.classic.NVDAResmanTesla(10.0.0)[796AE430-39FB-3255-8161-D52AFA28EE2B]@0xffffff7f959c1000
dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f95524000
com.apple.driver.AppleMuxControl(3.7.21)[32B7E2DE-1F9D-3555-B687-7A76A62B81D2]@0xffffff7f979fe000->0xffffff7f97a11fff
dependency: com.apple.driver.AppleGraphicsControl(3.7.21)[62689710-EEA7-307A-AC83-B8F25DA88A6A]@0xffffff7f979f6000
dependency: com.apple.iokit.IOACPIFamily(1.4)[70E2B65E-A91A-3522-A1A0-79FD63EABB4C]@0xffffff7f957f7000
dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f95524000
dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[6D99A3BE-D531-3780-880B-13F2FC894A4A]@0xffffff7f9596a000
dependency: com.apple.driver.AppleBacklightExpert(1.1.0)[0183904C-6A16-32C4-9405-EEFD7F820B02]@0xffffff7f979f9000
com.apple.driver.AGPM(100.14.37)[1A6EDBFD-5D0A-3734-8D20-CDBD58DA6B63]@0xffffff7f979db000->0xffffff7f979edfff
dependency: com.apple.iokit.IOPCIFamily(2.9)[766FC23F-452C-3B74-951C-598BB17BCF06]@0xffffff7f95524000
dependency: com.apple.driver.IOPlatformPluginFamily(5.8.0d49)[55A20B1B-EC55-33F7-ADD5-549F8C738A86]@0xffffff7f963ce000
dependency: com.apple.iokit.IONDRVSupport(2.4.1)[F4738C55-B507-3627-A9CA-3D29A5230A03]@0xffffff7f959b1000
dependency: com.apple.iokit.IOGraphicsFamily(2.4.1)[6D99A3BE-D531-3780-880B-13F2FC894A4A]@0xffffff7f9596a000
dependency: com.apple.AppleGraphicsDeviceControl(3.7.21)[4700601D-3FEB-3B86-B2BA-8D71AF84D1C4]@0xffffff7f979d5000

BSD process name corresponding to current thread: kernel_task

Mac OS version:
14B25

Kernel version:
Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64
Kernel UUID: 89E10306-BC78-3A3B-955C-7C4922577E61
Kernel slide: 0x0000000014a00000
Kernel text base: 0xffffff8014c00000
__HIB text base: 0xffffff8014b00000
System model name: MacBookPro6,2 (Mac-F22586C8)

System uptime in nanoseconds: 97828327738265
last loaded kext at 13685104947179: com.apple.driver.AppleUSBTCKeyEventDriver 240.2 (addr 0xffffff7f97b78000, size 12288)
last unloaded kext at 13784736921471: com.apple.driver.AppleUSBCDC 4.2.2b5 (addr 0xffffff7f97b72000, size 16384)
loaded kexts:
at.obdev.nke.LittleSnitch 4234
com.apple.filesystems.afpfs 11.0
com.apple.nke.asp-tcp 8.0.0
com.apple.filesystems.smbfs 3.0.0
com.apple.driver.AudioAUUC 1.70
com.apple.driver.AppleHWSensor 1.9.5d0
com.apple.driver.AGPM 100.14.37
com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport 4.3.1f2
com.apple.filesystems.autofs 3.0
com.apple.iokit.IOBluetoothSerialManager 4.3.1f2
com.apple.driver.AppleOSXWatchdog 1
com.apple.driver.AppleMikeyHIDDriver 124
com.apple.driver.AppleMikeyDriver 267.0
com.apple.driver.AppleHDA 267.0
com.apple.driver.AppleIntelHDGraphics 10.0.0
com.apple.driver.AppleLPC 1.7.3
com.apple.driver.AppleSMCPDRC 1.0.0
com.apple.driver.AppleIntelHDGraphicsFB 10.0.0
com.apple.driver.AppleSMCLMU 2.0.4d1
com.apple.iokit.IOUserEthernet 1.0.1
com.apple.Dont_Steal_Mac_OS_X 7.0.0
com.apple.driver.AppleHWAccess 1
com.apple.driver.AppleHV 1
com.apple.driver.ACPI_SMC_PlatformPlugin 1.0.0
com.apple.driver.AppleMuxControl 3.7.21
com.apple.GeForceTesla 10.0.0
com.apple.driver.AppleUpstreamUserClient 3.6.1
com.apple.driver.AppleMCCSControl 1.2.10
com.apple.driver.SMCMotionSensor 3.0.4d1
com.apple.driver.AppleUSBTCButtons 240.2
com.apple.driver.AppleUSBTCKeyboard 240.2
com.apple.driver.AppleUSBCardReader 3.5.0
com.apple.driver.AppleIRController 327.5
com.apple.AppleFSCompression.AppleFSCompressionTypeDataless 1.0.0d1
com.apple.AppleFSCompression.AppleFSCompressionTypeZlib 1.0.0d1
com.apple.BootCache 35
com.apple.iokit.SCSITaskUserClient 3.7.0
com.apple.driver.XsanFilter 404
com.apple.iokit.IOAHCIBlockStorage 2.6.5
com.apple.driver.AirPort.Brcm4331 800.20.24
com.apple.driver.AppleUSBHub 705.4.1
com.apple.driver.AppleFWOHCI 5.5.2
com.apple.driver.AppleAHCIPort 3.0.7
com.apple.iokit.AppleBCM5701Ethernet 10.1.2b3
com.apple.driver.AppleUSBEHCI 705.4.14
com.apple.driver.AppleSmartBatteryManager 161.0.0
com.apple.driver.AppleACPIButtons 3.1
com.apple.driver.AppleRTC 2.0
com.apple.driver.AppleHPET 1.8
com.apple.driver.AppleSMBIOS 2.1
com.apple.driver.AppleACPIEC 3.1
com.apple.driver.AppleAPIC 1.7
com.apple.driver.AppleIntelCPUPowerManagementClient 218.0.0
com.apple.nke.applicationfirewall 161
com.apple.security.quarantine 3
com.apple.security.TMSafetyNet 8
com.apple.driver.AppleIntelCPUPowerManagement 218.0.0
com.apple.security.SecureRemotePassword 1.0
com.apple.AppleGraphicsDeviceControl 3.7.21
com.apple.iokit.IOBluetoothHostControllerUSBTransport 4.3.1f2
com.apple.kext.triggers 1.0
com.apple.iokit.IOSerialFamily 11
com.apple.driver.DspFuncLib 267.0
com.apple.kext.OSvKernDSPLib 1.15
com.apple.iokit.IOAudioFamily 200.6
com.apple.vecLib.kext 1.2.0
com.apple.iokit.IOUSBUserClient 705.4.0
com.apple.driver.AppleSMBusPCI 1.0.12d1
com.apple.iokit.IOFireWireIP 2.2.6
com.apple.driver.AppleHDAController 267.0
com.apple.iokit.IOHDAFamily 267.0
com.apple.iokit.IOSurface 97
com.apple.iokit.IOBluetoothFamily 4.3.1f2
com.apple.driver.IOPlatformPluginLegacy 1.0.0
com.apple.driver.IOPlatformPluginFamily 5.8.0d49
com.apple.driver.AppleGraphicsControl 3.7.21
com.apple.driver.AppleBacklightExpert 1.1.0
com.apple.nvidia.classic.NVDANV50HalTesla 10.0.0
com.apple.driver.AppleSMBusController 1.0.13d1
com.apple.nvidia.classic.NVDAResmanTesla 10.0.0
com.apple.iokit.IONDRVSupport 2.4.1
com.apple.iokit.IOGraphicsFamily 2.4.1
com.apple.driver.AppleSMC 3.1.9
com.apple.driver.AppleUSBMultitouch 245.2
com.apple.iokit.IOSCSIBlockCommandsDevice 3.7.0
com.apple.iokit.IOUSBMassStorageClass 3.7.0
com.apple.iokit.IOUSBHIDDriver 705.4.0
com.apple.driver.CoreStorage 471
com.apple.driver.AppleUSBMergeNub 705.4.0
com.apple.driver.AppleUSBComposite 705.4.9
com.apple.iokit.IOSCSIMultimediaCommandsDevice 3.7.0
com.apple.iokit.IOBDStorageFamily 1.7
com.apple.iokit.IODVDStorageFamily 1.7.1
com.apple.iokit.IOCDStorageFamily 1.7.1
com.apple.iokit.IOAHCISerialATAPI 2.6.1
com.apple.iokit.IOSCSIArchitectureModelFamily 3.7.0
com.apple.iokit.IOFireWireFamily 4.5.6
com.apple.iokit.IO80211Family 700.52
com.apple.iokit.IOAHCIFamily 2.7.0
com.apple.iokit.IOEthernetAVBController 1.0.3b3
com.apple.driver.mDNSOffloadUserClient 1.0.1b8
com.apple.iokit.IONetworkingFamily 3.2
com.apple.iokit.IOUSBFamily 705.4.14
com.apple.driver.AppleEFINVRAM 2.0
com.apple.driver.AppleEFIRuntime 2.0
com.apple.iokit.IOHIDFamily 2.0.0
com.apple.iokit.IOSMBusFamily 1.1
com.apple.security.sandbox 300.0
com.apple.kext.AppleMatch 1.0.0d1
com.apple.driver.AppleKeyStore 2
com.apple.driver.AppleMobileFileIntegrity 1.0.5
com.apple.driver.AppleCredentialManager 1.0
com.apple.driver.DiskImages 389.1
com.apple.iokit.IOStorageFamily 2.0
com.apple.iokit.IOReportFamily 31
com.apple.driver.AppleFDEKeyStore 28.30
com.apple.driver.AppleACPIPlatform 3.1
com.apple.iokit.IOPCIFamily 2.9
com.apple.iokit.IOACPIFamily 1.4
com.apple.kec.Libm 1
com.apple.kec.pthread 1
com.apple.kec.corecrypto 1.0
Model: MacBookPro6,2, BootROM MBP61.0057.B0F, 2 processors, Intel Core i7, 2.66 GHz, 8 GB, SMC 1.58f17
Graphics: Intel HD Graphics, Intel HD Graphics, Built-In, 288 MB
Graphics: NVIDIA GeForce GT 330M, NVIDIA GeForce GT 330M, PCIe, 512 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464D44
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1067 MHz, 0x859B, 0x435434473353313036374D2E4D3136464D44
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x93), Broadcom BCM43xx 1.0 (5.106.98.100.24)
Bluetooth: Version 4.3.1f2 15015, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en1
Serial ATA Device: Hitachi HTS545050B9SA02, 500.11 GB
Serial ATA Device: MATSHITADVD-R UJ-898
USB Device: Hub
USB Device: IR Receiver
USB Device: Built-in iSight
USB Device: Hub
USB Device: Apple Internal Keyboard / Trackpad
USB Device: Internal Memory Card Reader
USB Device: BRCM2070 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus:

Hooking up Apache WebDAV to Zentyal Active Directory.

Nothing too tricky here, but this may save someone a little bit of head scratching. Active directory expects the BindDN to be in a slightly different format than OpenLDAP and it’s also on port 389.

You’ll be creating and editing an additional config file for your virtual host; I created mine as. /etc/apache2/sites-available/sitename.co.uk/dav.conf

This configuration grants access to users belonging to the webdav group, so you’ll need to make sure the group is in your active directory and users are assigned to it. It also authorises against the sAMAccountName – which is the user login name, but this can easily be altered to an email address etc.

Alias /webdav /srv/www/sitename.co.uk
<Location /webdav>
 Dav on
 AuthName "Development webdav"
 AuthType Basic
 AuthBasicProvider ldap
 AuthLDAPUrl ldap://localhost:389/cn=Users,dc=sitename,dc=co,dc=uk?sAMAccountName?sub?(objectClass=*)
 AuthLDAPBindDN Administrator@sitename.co.uk
 AuthLDAPBindPassword your-admin-password-for-LDAP-access
 Require ldap-group CN=webdav,CN=Groups,dc=sitename,dc=co,dc=uk
 php_flag engine off
</Location>

Reload you Apache config with sudo service apache2 reload or something which works for you, and then test access with the excellent cadaver client. If you’re accessing from Windows 7 you’ll need to set up for Basic Auth. There’s a detailed walk-through here.