July 3rd, 2009

A New Program – Minaide (見ないで) v0.0.1


I have written a new program. It is basically a wrapper for Openssl. Openssl is a library of encryption utilities and algorithms. I have implemented only 1 encryption algorithm, aes-256 in cbc mode. I am planning to add more possible algorithms via a preference pane in a later release. At the moment, the program is not very pretty. It does work however.

It does not tell you if you got the password wrong when decrypting. It will output a junk file and fail.

It only works with single files or single directories right now. It will in future releases deal with multiple file selections, I hope. Also, the UI is a little basic. I want to add bindings to make it easier to use. I also have to write up a Readme and some disclaimers.

On the up side, it is localised into Japanese as well.

anyway….
Here is the program. -> Minaide-0.0.1.dmg.zip

It has been tested only on OS X 10.5.6. I can’t think of any reason it wouldn’t work on previous versions of OS X though. Feel free to mail me comments and suggestions.

July 1st, 2009

Random acts of kindness.


So it is pissing down in Fukuoka this week. Today while I was taking shelter in the arch of a bank, 2 old ladies came out and told me I could go in. When I told them I was just waiting for the Bus, they asked where I was headed. I said ******* (not tell’en ya), and they immediately offered to drive me home! It was a mother and daughter i found out on the trip. The mother was over 80 and lived through the war in Tokyo. She had been to the US and some other stuff that I couldn’t understand because of her speech patterns.
This has got to be one of the best things about Japan. Random kindness. I love it.

SBSH0007.JPGOh, the pic is of my first name plate for 剣道(Kendo). You wear it on the waste armour so everyone knows who you are. It says Australia(豪州) at the top in small Kanji and Drew(土竜) in big Kanji. I am chuffed to have got it, and I will be even more so when I get to put it on my very own armour next week. I have bought a full set of armour for 剣道(Kendo). I must remember to take my camera next week and get photo’s of it all before I start using it.

June 26th, 2009

Alcoholism


The dinner of champions.SBSH0006.jpg

June 26th, 2009

RIP – Michael Jackson : 2009-06-25


Love him or hate him, you have to respect his achievements as a musician. An Idol for millions, and a sound I grew up with. An era has ended with his passing. No matter how crazy he was he will be long remembered, more for his music than his antics.

Good Bye Michael Jackson.

June 25th, 2009

Replacing Courier with Dovecot


I have replaced my courier pop server with dovecot. I did this because the site i have used to model my server on is doing so. Also, because Apple is reportadly changing to Dovecot.

Apparently it is better for lots of wonderful reasons. I am not sure what they are, but what the hell.

This is how I did it.

You can follow these instructions by mostly cutting and pasting the commands into your terminal.

First you get and compile the source code.
curl -O http://dovecot.org/releases/1.1/dovecot-1.1.16.tar.gz
tar -xvf dovecot-1.1.16.tar.gz
cd dovecot-1.1.16
./configure --with-mysql --with-storages=raw,dbox,maildir,mbox --with-ssldir=/usr/ssl
make -j3
sudo make install

Setup the log files
sudo touch /var/log/dovecot.log
sudo touch /var/log/dovecot_err.log
sudo chmod 644 /var/log/dove*

We need to setup some directories for the ssl certivicates that we will make.

sudo mkdir -p /etc/ssl/private
sudo mkdir -p /etc/ssl/certs

edit the file dovecot-1.1.16/doc/dovecot-openssl.cnf
run mkcert.sh in the same directory (will have to change permissions first.)
chmod +x mkcert.sh
sudo ./mkcert.sh

echo 'driver = mysql' >> dovecot-sql.conf
echo 'connect = host=127.0.0.1 port=3306 dbname=postfix user=myownmailserver password=getthefuckoutofhere' >> dovecot-sql.conf
echo 'default_pass_scheme = MD5-CRYPT' >> dovecot-sql.conf
echo "password_query = SELECT password FROM mailbox WHERE username = '%u'" >> dovecot-sql.conf
echo "user_query = SELECT maildir, 102 AS uid, 27 AS gid FROM mailbox WHERE username = '%u'" >> dovecot-sql.conf

Now we make the main config file. We will be creating a file that contains only the differences from the defaults.

echo 'base_dir: /var/run/dovecot/' >> dovecot.conf
echo 'log_path: /var/log/dovecot_err.log' >> dovecot.conf
echo 'info_log_path: /var/log/dovecot.log' >> dovecot.conf
echo 'protocols: imaps pop3s' >> dovecot.conf
echo 'ssl_cert_file: /etc/ssl/certs/dovecot.pem' >> dovecot.conf
echo 'ssl_key_file: /etc/ssl/private/dovecot.pem' >> dovecot.conf
echo 'login_dir: /var/run/dovecot/login' >> dovecot.conf
echo 'login_executable(default): /usr/local/libexec/dovecot/imap-login' >> dovecot.conf
echo 'login_executable(imap): /usr/local/libexec/dovecot/imap-login' >> dovecot.conf
echo 'login_executable(pop3): /usr/local/libexec/dovecot/pop3-login' >> dovecot.conf
echo 'login_user: _cyrus' >> dovecot.conf
echo 'login_processes_count: 1' >> dovecot.conf
echo 'login_max_processes_count: 12' >> dovecot.conf
echo 'login_max_connections: 24' >> dovecot.conf
echo 'max_mail_processes: 10' >> dovecot.conf
echo 'first_valid_uid: 102' >> dovecot.conf
echo 'mail_uid: 102' >> dovecot.conf
echo 'mail_gid: 27' >> dovecot.conf
echo 'mail_location: maildir:/usr/local/virtual/%u' >> dovecot.conf
echo 'mail_executable(default): /usr/local/libexec/dovecot/imap' >> dovecot.conf
echo 'mail_executable(imap): /usr/local/libexec/dovecot/imap' >> dovecot.conf
echo 'mail_executable(pop3): /usr/local/libexec/dovecot/pop3' >> dovecot.conf
echo 'mail_process_size: 600' >> dovecot.conf
echo 'mail_plugin_dir(default): /usr/local/lib/dovecot/imap' >> dovecot.conf
echo 'mail_plugin_dir(imap): /usr/local/lib/dovecot/imap' >> dovecot.conf
echo 'mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3' >> dovecot.conf
echo 'auth default:' >> dovecot.conf
echo ' mechanisms: plain login' >> dovecot.conf
echo ' username_format: %Lu' >> dovecot.conf
echo ' process_size: 600' >> dovecot.conf
echo ' passdb:' >> dovecot.conf
echo ' driver: sql' >> dovecot.conf
echo ' args: /usr/local/etc/dovecot-sql.conf' >> dovecot.conf
echo ' userdb:' >> dovecot.conf
echo ' driver: sql' >> dovecot.conf
echo ' args: /usr/local/etc/dovecot-sql.conf' >> dovecot.conf

Now we move them into place and set permissions.

sudo mv dovecot.conf /usr/local/etc/
sudo mv dovecot-sql.conf /usr/local/etc/
sudo chmod 0644 /usr/local/etc/dovecot*
sudo chown root:wheel /usr/local/etc/dovecot*

Now we start it once, to allow it to create dirs it needs

sudo /usr/local/sbin/dovecot
sudo killall dovecot

Now we are going to make the plist file that OS X will use to launch the server at boot time for us.

echo '<?xml version="1.0" encoding="UTF-8"?>' >> org.dovecot.plist
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> org.dovecot.plist
echo '<plist version="1.0">' >> org.dovecot.plist
echo '<dict>' >> org.dovecot.plist
echo ' <key>Label</key>' >> org.dovecot.plist
echo ' <string>org.xj.dovecot</string>' >> org.dovecot.plist
echo ' <key>Program</key>' >> org.dovecot.plist
echo ' <string>/usr/local/sbin/dovecot</string>' >> org.dovecot.plist
echo ' <key>RunAtLoad</key>' >> org.dovecot.plist
echo ' <true/>' >> org.dovecot.plist
echo '</dict>' >> org.dovecot.plist
echo '</plist>' >> org.dovecot.plist

Now we move the newly created file to the correct place and fix it’s permissions.

sudo mv org.xj.dovecot.plist /System/Library/LaunchDaemons/
sudo chown root:wheel /System/Library/LaunchDaemons/org.xj.dovecot.plist
sudo chmod 0644 /System/Library/LaunchDaemons/org.xj.dovecot.plist

Finally we start the service correctly.

sudo launchctl load /System/Library/LaunchDaemons/org.xj.dovecot.plist

That should be it. If you have any problems… let me know.
REMEMBER THAT YOU CAN NOT HAVE ANY OTHER IMAP or POP SERVER RUNNING WHEN YOU START DOVECOT, OR IT WILL NOT BE ABLE TO BIND TO THE PORTS IT NEEDS.

June 24th, 2009

Installing Clamav 0.95.2 on Leopard 10.5.6


One of the many programs running on my server is Clamav. It is an open source virus checker. I don’t use it because I think I might get a virus (like that would ever happen). I have it because it makes for a more complete mail server. I may not be affected by viruses, but others are and if I ever get an IT job I should know how to setup and run a proper mail server, including a virus checker.

Previously I followed the tutorial available at http://amadain.net/2007/11/03/postfix-amavis-spamassassin-dspam-and-clamav-working-together-mac-osx-leopard and then modified it with the tutorial from http://osx.topicdesk.com/content/view/139/41/. However, while this did get Clamav installed, it just didn’t work like I wanted it to. There were permissions problems and service setup problems.

I wrote a “from scratch” tutorial for installing Clamav 0.95.2 on Leopard.

This howto can also be downloaded in this file -> Installing Clamav.pdf.

I am assuming you have XCode installed. If you don’t have XCode installed, go to http://developer.apple.com and get it. It is free, but you have to sign up.

I have also created this shell script if you have no interest at all in following the directions and just want it installed. This script will install clamav and create files that will cause the clamav daemon to launch at boot, along with the updating program freshclam. It will also start the clamav service and the freshclam service. clam-install.sh script.

To run the script, simply unzip it, and in the terminal window type.

sudo ./clam-install.sh

You will have to type your password here.

We will also be using the terminal exclusively. No other editors will be required.

This is a copy and paste tutorial. if you don’t feel like reading you could just cut and paste the commands in order to end up with an installed and running virus scanner.

Firstly we have to get the Clamav sourcecode from sourceforge.

curl -O http://jaist.dl.sourceforge.net/sourceforge/clamav/clamav-0.95.2.tar.gz

Then we need to expand the archive and configure it. This configuration will install clamav in the /usr/local default locations.

tar -xvf clamav-0.95.2.tar.gz
cd clamav-0.95.2
./configure --with-user=_clamav --with-group=_clamav

Now we build and then install clamav.

make
sudo make install
cd ..

That should have installed without any problems. Now we need to setup a few things before we start running it.

First, lets setup the logfiles for clamav and it’s update agent freshclam.

sudo touch /var/log/freshclam.log
sudo touch /var/log/clamd.log
sudo chown _clamav /var/log/freshclam.log
sudo chown _clamav /var/log/clamd.log

We also need to create the path for the virus database and set permissions.

sudo mkdir /var/lib/clamav
sudo chown _clamav:wheel /var/lib/clamav
sudo chmod 0744 /var/lib/clamav

We add the _clamav user to the daemon group to allow it to save it’s PID file in the same place as other programs. (for tidyness).

sudo dscl . -append /Groups/daemon GroupMembership _clamav

Now we need should edit the confg files for clamav and freshclam.
We are going to use the terminal to create the config files we need.
First we will create clamd.conf. Simply copy and paste the following to your terminal window. Be sure to press return afterwards.

echo LogFile /var/log/clamd.log >> clamd.conf
echo LogFileMaxSize 2M >> clamd.conf
echo LogTime yes >> clamd.conf
echo LogSyslog yes >> clamd.conf
echo LogFacility LOG_MAIL >> clamd.conf
echo PidFile /var/run/clamd.pid >> clamd.conf
echo TemporaryDirectory /var/tmp >> clamd.conf
echo DatabaseDirectory /var/lib/clamav >> clamd.conf
echo LocalSocket /tmp/clamd.socket >> clamd.conf
echo FixStaleSocket yes >> clamd.conf
echo ReadTimeout 300 >> clamd.conf
echo IdleTimeout 60 >> clamd.conf
echo MaxDirectoryRecursion 20 >> clamd.conf
echo SelfCheck 600 >> clamd.conf
echo User _clamav >> clamd.conf
echo AllowSupplementaryGroups yes >> clamd.conf
echo Foreground yes >> clamd.conf
echo DetectPUA yes >> clamd.conf
echo AlgorithmicDetection yes >> clamd.conf
echo ScanPE yes >> clamd.conf
echo ScanELF yes >> clamd.conf
echo DetectBrokenExecutables yes >> clamd.conf
echo ScanOLE2 yes >> clamd.conf
echo ScanPDF yes >> clamd.conf
echo ScanMail yes >> clamd.conf
echo PhishingSignatures yes >> clamd.conf
echo ScanHTML yes >> clamd.conf
echo ScanArchive yes >> clamd.conf

Now you have created a file called clamd.conf in your current directory. We need to modify it a little and move it before we can use it.

sudo chmod 0644 clamd.conf
sudo chown _clamav:wheel clamd.conf
sudo mv clamd.conf /usr/local/etc/

Easy.

Next we will create the config file for freshclam.
echo DatabaseDirectory /var/lib/clamav >> freshclam.conf
echo UpdateLogFile /var/log/freshclam.log >> freshclam.conf
echo LogFileMaxSize 2M >> freshclam.conf
echo LogTime yes >> freshclam.conf
echo LogSyslog yes >> freshclam.conf
echo PidFile /var/run/freshclam.pid >> freshclam.conf
echo DatabaseOwner _clamav >> freshclam.conf
echo AllowSupplementaryGroups yes >> freshclam.conf
echo DatabaseMirror database.clamav.net >> freshclam.conf
echo MaxAttempts 2 >> freshclam.conf
echo Checks 2 >> freshclam.conf
echo Foreground yes >> freshclam.conf

As with the clamd config file we need to modify it and move it.

sudo chmod 0644 freshclam.conf
sudo chown _clamav:wheel freshclam.conf
sudo mv freshclam.conf /usr/local/etc/

You now have a fully functional installation of clamav. However, you should run freshclam once as root once to get your virus patterns and to setup the database for clamav to use.

sudo freshclam

You can now use clamav to scan your files. This is a great setup for interfacing with postfix to scan all mails arriving to your server.

If you are going to run a server with clamav as the virus checker, then you should have clamav start up in daemon mode when your computer boots, and also have the freshclam updater run automatically. To do this you will need to create 2 more files. We need to create 2 .plist files in the /System/Library/LaunchDaemons/ folder.

Even if your not going to run a mail server, it is a good idea to set up freshclam to update the virus patterns automatically. To do this we will create a file that we will call net.clamav.freshclam.plist and we will use settings to load freshclam at boot, and have it update twice a day.

Just copy and paste the following into your terminal window to create the file.

echo "<?xml version="1.0" encoding="UTF-8"?> " >> net.clamav.freshclam.plist
echo '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> net.clamav.freshclam.plist
echo "<plist version="1.0">" >> net.clamav.freshclam.plist
echo "<dict>" >> net.clamav.freshclam.plist
echo " <key>KeepAlive</key>" >> net.clamav.freshclam.plist
echo " <true/>" >> net.clamav.freshclam.plist
echo " <key>Label</key>" >> net.clamav.freshclam.plist
echo " <string>org.clamav.freshclam</string>" >> net.clamav.freshclam.plist
echo " <key>OnDemand</key>" >> net.clamav.freshclam.plist
echo " <false/>" >> net.clamav.freshclam.plist
echo " <key>Program</key>" >> net.clamav.freshclam.plist
echo " <string>/usr/local/bin/freshclam</string>" >> net.clamav.freshclam.plist
echo " <key>ProgramArguments</key>" >> net.clamav.freshclam.plist
echo " <array>" >> net.clamav.freshclam.plist
echo " <string>/usr/local/bin/freshclam</string>" >> net.clamav.freshclam.plist
echo " <string>-d</string>" >> net.clamav.freshclam.plist
echo " <string>-c</string>" >> net.clamav.freshclam.plist
echo " <string>2</string>" >> net.clamav.freshclam.plist
echo " </array>" >> net.clamav.freshclam.plist
echo " <key>RunAtLoad</key>" >> net.clamav.freshclam.plist
echo " <false/>" >> net.clamav.freshclam.plist
echo " <key>ServiceIPC</key>" >> net.clamav.freshclam.plist
echo " <false/>" >> net.clamav.freshclam.plist
echo " <key>UserName</key>" >> net.clamav.freshclam.plist
echo " <string>_clamav</string>" >> net.clamav.freshclam.plist
echo "</dict>" >> net.clamav.freshclam.plist
echo "</plist>" >> net.clamav.freshclam.plist

Now you have the file, it needs, like the others, to be modified then installed.

sudo chmod 644 net.clamav.freshclam.plist
sudo chown root:wheel net.clamav.freshclam.plist
sudo mv net.clamav.freshclam.plist /System/Library/LaunchDaemons/

This will now load at your next reboot. If your like me however, and you never turn off your machine or reboot, then you should enter the following to start the service.

sudo launchctl load /System/Library/LaunchDaemons/net.clamav.freshclam.plist

For those of you who wish to have clamav start at boot time )especially for intergration with postfix or some other MTA), i have provided the appropriate plist below. Just cut and past into the terminal.

echo "<?xml version="1.0" encoding="UTF-8"?>" >> net.clamav.clamd.plist
echo '<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >> net.clamav.clamd.plist
echo "<plist version="1.0">" >> net.clamav.clamd.plist
echo "<dict>" >> net.clamav.clamd.plist
echo " <key>Label</key> " >> net.clamav.clamd.plist
echo " <string>net.clamav.clamd</string>" >> net.clamav.clamd.plist
echo " <key>OnDemand</key>" >> net.clamav.clamd.plist
echo " <false/>" >> net.clamav.clamd.plist
echo " <key>Program</key>" >> net.clamav.clamd.plist
echo " <string>/usr/local/sbin/clamd</string>" >> net.clamav.clamd.plist
echo " <key>ProgramArguments</key>" >> net.clamav.clamd.plist
echo " <array>" >> net.clamav.clamd.plist
echo " <string>clamd</string>" >> net.clamav.clamd.plist
echo " </array>" >> net.clamav.clamd.plist
echo " <key>ServiceIPC</key>" >> net.clamav.clamd.plist
echo " <false/>" >> net.clamav.clamd.plist
echo " <key>UserName</key>" >> net.clamav.clamd.plist
echo " <string>_clamav</string>" >> net.clamav.clamd.plist
echo "</dict>" >> net.clamav.clamd.plist
echo "</plist>" >> net.clamav.clamd.plist

Once created, the file needs to be modified and moved before it is usable.

sudo chmod 644 net.clamav.clamd.plist
sudo chown root:wheel net.clamav.clamd.plist
sudo mv net.clamav.clamd.plist /System/Library/LaunchDaemons/

This will now load at your next reboot. If your like me however, and you never turn off your machine or reboot, then you should enter the following to start the service.

sudo launchctl load /System/Library/LaunchDaemons/net.clamav.clamd.plist

Congratulations, you now have a fully installed virus checker and startup scripts for Clamav 0.95.2 on OS X 10.5.6

June 18th, 2009

Green Thumb Attack!!!!


I think that should read “black thumb”, i can’t remember ever making anything grow outside disgust and resentment… LOL

Anyway, In my efforts to cut living expenses, I have invested in a garden of sorts… Today saw the start of planting… I have layed seed for capsicum, parsley, carrots and celery. I am also fermenting tomatoes to get seed ready for planting. The thing i didn’t think of is that potting mix is mostly shit, and so attracts bugs…. damn, i already have a fly buzzing the area… (pardon the pun).

Here’s hoping I can actually grow something!
SBSH0001.jpg

June 17th, 2009

Awesome Pic


I actually laughed out loud when i saw this. You gotta love 4chan.
2009.6.17.jpg

June 17th, 2009

New 竹刀(bamboo sword)


Yay! I got my first new 竹刀 in 4 years today. The best part is the owner of the shop gave it to me free!!! as a Thankyou for that, I have included a link to his shop at the bottom of this post. I will be buying my other Kendo stuff through that shop as well. They have a deal with the the Jr High I am working at, so I can get the stuff a little cheeper than your average Joe.

I am using a size 38 竹刀. While I am not entirely sure what that means, the man in charge of 剣道(Kendo) at school tells me that it is the correct size for me to practice on.

The kids tell me I am doing well, and remembering all the stuff quickly…. but I don’t believe them. My foot work is crap, as is my timing. I am also having trouble not using my right hand for power in each of the strikes. I’m supposed to get the power from the left hand, and use the right only for guidance. It is difficult… But I will keep at it, after all it is a shite load of fun. Sooner or later I will remember to take my camera to school, and get a picture of myself in the full kit. Oh well, back to work….

http://ko-budo.com/

June 14th, 2009

Presents!!!!


What wonderful thing did I buy for myself this time? In years gone buy I have bought Doc Martins, computers, PSP’s etc for my day, this year…..

1KG of カキピ. That’s right, I spent ¥800 on a present for myself.SBSH0001.JPG

June 14th, 2009

Bacon, Eggs, fired tomato, BBQ sauce(last of) and a glass of Scotch.


Because you should have a good breakfast(12:30). Because I haven’t had Bacon and Eggs for over 2 years. Because it’s my Birthday. If only I didn’t have to do the dishes as well…
Image549.jpg

June 14th, 2009

HAPPY B’DAY TO ME


June 13th, 2009

Upgrade autoconf on OS X


This morning I upgraded my autoconf version to 2.63, it was very easy.
Get the source from http://www.gnu.org/software/autoconf/.

Type the following commands at the command prompt in the directory you downloaded too.
tar -xvf autoconf-2.63.tar.bz2
cd autoconf-2.63
./configure --prefix=/usr
make && sudo make install

That’s it. simple.

THIS WILL OVERWRITE THE APPLE SUPPLIED VERSION. USE AT YOUR OWN RISK.

June 13th, 2009

Upgrade automake on OS X 10.5


This morning I upgraded my automake version to 1.11, it was very easy.
Get the source from http://www.gnu.org/software/automake/.

Type the following commands at the command prompt in the directory you downloaded too.
tar -xvf automake-1.11.tar.bz2
cd automake-1.11
./configure --prefix=/usr --infodir=/usr/share/info
make && sudo make install
sudo rm -r /usr/share/automake-1.10

That’s it. simple.

THIS WILL OVERWRITE THE APPLE SUPPLIED VERSION. USE AT YOUR OWN RISK.

June 10th, 2009

Tictactoe v0.3


This post sees the release of a more complete and Tictactoe game. I have made many changes since the last release, and have a lot more to make. Here is the source for my game –> Tictactoe.tar.bz2.

I can’t think of any reason it wouldn’t compile on any *nix.