Index syndication
comment syndication

Archive for openbsd

PHP5 Zip Support on OpenBSD 4.5

This is a cheat sheet on getting PHP5 on OpenBSD to have zip support. I needed this to get CiviCRM to work with Joomla.

First off install some require packages, including the zziplib package:

export PKG_PATH=http://mirror.aarnet.edu.au/pub/OpenBSD/4.5/packages/i386/
pkg_add -v zziplib
pkg_add -v autoconf-2.62

Now download and extract the PECL zip package:

mkdir /usr/local/src/
cd /usr/local/src/
wget http://pecl.php.net/get/zip
tar zxvf zip
cd zip-1.10.2/

Compile PECL zip, making sure you set your correct autoconf to use:

export AUTOCONF_VERSION=2.62
phpize
./configure
make
make install

Finally setup php5 and restart httpd:

cat << EOF >> /var/www/conf/php.ini
extension=zip.so
EOF
sudo apachectl stop
sudo apachectl start

Of course, this will go stale over time as new releases and versions come out, so YMMV.

Using your MacBookPro to PXEBoot OpenBSD

This post does not show a successful outcome in case that’s what you where hoping for.

I was trying to get OpenBSD bootstrapped using the PXEBoot NIC in a server. I decided to use my Mac which has tftp and bootpd installed. This post is quite in depth and technical so if you are game then read on.
Read the rest of this entry »

MySQL on OpenBSD 4.3 using the Apache Chroot

I’m back with some more tech geek goodness for anyone who uses MySQL and OpenBSD.

OpenBSD by default apache runs in a chroot jail, thereby making it more secure in case the www server is compromised. I have talked about this before.

However if you use wordpress or some other web application that needs MySQL (and I’m talking where apache and MySQL reside on the same host), then the chroot jail will not allow your webapp access to the mysql socket file which is by default located in /var/run/mysql/

There are various solutions available online to wait x number of seconds and then to create symlinks, etc – but this was not always working for me – with the result the server would sometimes be up without database availability.

Here is my solution (thanks to NoMoa for the idea) – very simple, no postfix symlink but there is a symlink to allow other applications to access MySQL locally via the default socket location.

First I create the run dirs in the apache jail:

mkdir -p /var/www/var/run/mysql
chown _mysql:_mysql /var/www/var/run/mysql
chmod 711 /var/www/var/run/mysql

Then I add this to the bottom of /etc/rc.local on the webhost.

#mySQL
if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/mysqld_safe ]; then
echo -n " mysqld"; /usr/local/bin/mysqld_safe --user=_mysql --log --open-files-limit=256 --socket=/var/www/var/run/mysql/mysql.sock &
if [ ! -L /var/run/mysql/mysql.sock ]; then
mkdir -p /var/run/mysql
chown _mysql:_mysql /var/run/mysql
chmod 711 /var/run/mysql
ln -fs /var/www/var/run/mysql/mysql.sock /var/run/mysql/mysql.sock
fi
fi

Lastly I add this to my /etc/rc.conf.local

mysql=YES

Note: you may need to change the open-files-limit to suit, but the above paths are as per a standard OpenBSD 4.3 install using the supplied MySQL pkgs.

I tested this all out on OpenBSD 4.3 and it now works fine for me. Whenever the server comes up I never get the dreaded word press DB failure screen. Good luck

Death to Spam

I’ve been hit by a number of Spam comments recently that snuck through the filters.

If you are subscribed to the comments feed, apologies for this.

It turns out that since I moved TechDebug to a VM host, I did not follow my own post and the spam tools where not connecting to Akismet to check the comments. So remember that if you use OpenBSD and the default chroot for Apache, then you need to setup a resolv.conf to allow Apache to resolve hostnames.

It should be all fixed now. If I still get them sneaking through I may have to turn on “logins” to allow commenting. This is my last resort so it’s not in place yet.

Next entries »