<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>phaq &#187; Utilities</title>
	<atom:link href="http://phaq.phunsites.net/category/faq/utilities/feed/" rel="self" type="application/rss+xml" />
	<link>http://phaq.phunsites.net</link>
	<description>my daily IT madness</description>
	<lastBuildDate>Mon, 30 Jan 2012 10:07:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Install Icinga with MySQL and IDOUtils on FreeBSD</title>
		<link>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/</link>
		<comments>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:24:23 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=920</guid>
		<description><![CDATA[It&#8217;s not hard to install Icinga on FreeBSD, at least if you&#8217;re satisfied with default options. Should you however require Icinga with IDOUtils and MySQL support, then you need to take additional steps. Note: This howto requires a patch to your FreeBSD ports tree. The patch has been submitted to the FreeBSD port maintainers. I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not hard to install <a href="http://www.icinga.org" target="_blank">Icinga</a> on FreeBSD, at least if you&#8217;re satisfied with default options.<br />
Should you however require Icinga with IDOUtils and MySQL support, then you need to take additional steps.</p>
<p><span id="more-920"></span></p>
<p><b>Note: This howto requires a <a href="http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt">patch</a> to your FreeBSD ports tree. The patch has been submitted to the FreeBSD port maintainers. I hope that it will eventually end up in the ports tree.</b></p>
<p>My initial readings about this was on the official Icinga docs covering <a href="http://docs.icinga.org/latest/en/quickstart-idoutils-freebsd.html" target="_blank">installing Icinga on FreeBSD with IDOUtils</a>.<br />
However, as it turned out, the docs our a bit outdated, and yet do not reflect a way of doing the install using ports.</p>
<p>So here&#8217;s just a short primer on what I did do install Icinga from ports, imposing as little additional work four you, my fellow reader, as well <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Now let&#8217;s turn to Icinga, which has a port on it&#8217;s own, which you&#8217;ll find it at <strong>/usr/ports/net-mgtm/icinga</strong>. First change to that directory.</p>
<pre>cd /usr/ports/net-mgtm/icinga</pre>
<p>Now download the <a href="http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt">patch file</a> I made into your ports directory.<br />
The patch will inject a new rc-script for ido2db and enable your port to build IDOutils.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# fetch http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt</pre>
<p>Then apply the patch like this:</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# patch -p0 &lt; patch_icinga_1.5.1_idoutils_fbs_port.txt
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- Makefile.org	2012-01-28 16:36:46.000000000 +0000
|+++ Makefile	2012-01-28 17:51:38.000000000 +0000
--------------------------
Patching file Makefile using Plan A...
Hunk #1 succeeded at 27.
Hunk #2 succeeded at 109.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- /dev/null	2012-01-28 18:00:51.000000000 +0000
|+++ files/ido2db.in	2012-01-28 18:00:30.000000000 +0000
--------------------------
(Creating file files/ido2db.in...)
Patching file files/ido2db.in using Plan A...
Hunk #1 succeeded at 1.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- files/pkg-message.in.org	2012-01-28 17:48:37.000000000 +0000
|+++ files/pkg-message.in	2012-01-28 17:49:38.000000000 +0000
--------------------------
Patching file files/pkg-message.in using Plan A...
Hunk #1 succeeded at 4.
done</pre>
<p>Now you&#8217;re ready to configure the port:</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# make config</pre>
<p>Note the now <strong>IDOUtils</strong> option that now has appeared. Check it to enable IDOUtils.</p>
<p><a href="http://phaq.phunsites.net/files/2012/01/idoutils_config_screen.png" rel="lightbox[920]"><img class="aligncenter size-medium wp-image-929" src="http://phaq.phunsites.net/files/2012/01/idoutils_config_screen-300x180.png" alt="" width="300" height="180" /></a></p>
<p>Then compile and install as usual. The port will install also all required dependies, two of them being mysql55-client and libdbi-drivers, both to be found at /usr/ports/databases.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# make install clean</pre>
<p>Afterwards, you should end up with a few additional files, which would not be installed with the stock FreeBSD port.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# ls -l /usr/local/bin/ido*
-rwxrwxr--  1 root  wheel  238326 Jan 28 16:53 /usr/local/bin/ido2db
-rwxrwxr--  1 root  wheel   80419 Jan 28 16:53 /usr/local/bin/idomod.o

[root@mgmp-bs01 /usr/ports/net-mgmt/icinga]# ls -l /usr/local/etc/rc.d/ido2db
-r-xr-xr-x  1 root  wheel  738 Jan 28 18:00 /usr/local/etc/rc.d/ido2db</pre>
<p>Now you can enable Icinage and IDO2DB in /etc/rc.conf by adding these lines:</p>
<pre>icinga_enable="YES"
ido2db_enable="YES"</pre>
<p>Of course, you still need to perform the usual Icinga configuration steps, which are not covered in this post.<br />
Please check with the <a href="http://docs.icinga.org/latest/en" target="_blank">official docs</a> for this procedure.</p>
<p>If your configuration is proper, you should notice this in your logs indicating that IDOMOD (IDOUtils) is really working.</p>
<pre>[1327773651] Icinga 1.5.1 starting... (PID=95448)
[1327773651] Local time is Sat Jan 28 18:00:51 UTC 2012
[1327773651] LOG VERSION: 2.0
[1327773651] idomod: IDOMOD 1.5.1 (09-09-2011) Copyright (c) 2005-2008 Ethan Galstad (nagios@nagios.org), Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org))
[1327773651] idomod: Successfully connected to data sink.  26 queued items to flush.
[1327773651] idomod: Successfully flushed 26 queued items to data sink.
[1327773651] Event broker module '/usr/local/bin/idomod.o' initialized successfully.
[1327773651] Finished daemonizing... (New PID=95450)</pre>
<p>That&#8217;s it, you conquered the beast!</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VpnInit AppleScript: Override and Restore Default VPN-Routes on OS X</title>
		<link>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/</link>
		<comments>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 17:37:04 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=876</guid>
		<description><![CDATA[Years ago I wrote a small script to restore local default route after connecting the RAS VPN on Windows. Now, I made up a similar script to do the same on OS X. The basic idea, now and then, was that I would not want to send all traffic through the VPN. Thus the script [...]]]></description>
			<content:encoded><![CDATA[<p>Years ago I wrote a small script <a href="/2007/06/06/ras_initvbs-override-and-restore-routes-with-windows-ras/">to restore local default route after connecting the RAS VPN on Windows</a>.</p>
<p>Now, I made up a similar script to do the same on OS X.<br />
<span id="more-876"></span><br />
The basic idea, now and then, was that I would not want to send all traffic through the VPN.<br />
Thus the script will assist in restoring your local default route after the VPN connection is established.<br />
Furthermore, it&#8217;ll add some specific routes directed to the VPN.</p>
<p>This way, all your usual traffic (internet, surfing, skype, whatever) is sent through your default gateway, while more specific routes (your business stuff) is sent through the VPN.</p>
<p>Below&#8217;s the code for the initial release. It may lack some details yet, like auto-detecting the tunnel device name, but it does the job already.</p>
<p>Just copy the code into Apple Script Editor and save it to a convenient location. Make sure you save it as &#8220;Application&#8221; and not as &#8220;Script&#8221; (which is the default). You you don&#8217;t, double-clicking the script will open the Script Editor instead of executing the script. Surely, not what you want.</p>
<p>Pay attention to the variables on the top, which need to be edited before you save the Script: _vpn_name, _default_gw, _networks, and _sudo_password (optional).<br />
I hope directions are clear enough from the comments sections.</p>
<pre>
# VpnInit
# ---
# an AppleScript utility to connect your vpn,
# restore local default route and add selected
# routes directed to the VPN only
# thus you'll end up sending only selected
# traffic through the VPN, while the rest
# goes through your local default gateway
# as usual
# ---
# released "as is" under the terms of GPL v2.
# Copyright © 2011 Gianpaolo Del Matto
# 
# r0.1 initial release 2011/12/29
#
# ToDo:
# - hardcoding the "sudo" password is a bad idea, maybe
#	need a better way to get away with it
# - vpn tunnel (utun0) is still hardcoded,
#	should be auto-detected
#

# the name of your vpn connection
#
set _vpn_name to "My VPN"

# your local default gateway
#
set _default_gw to "192.168.1.1"

# your remote networks to pass via VPN, separate multiple with comma
# like so: {"1.2.3.4/30", "5.6.7.8/30"}
#
set _networks to {"192.168.2.1/24"}

# your super-user (root) password
# actually needed to bypass the prompts
# leave empty to get prompted
#
set _sudo_password to ""

# ##################################################################
# DO NOT CHANGE ANYTHING BELOW
# ##################################################################

# kindly borrowed from
# http://www.macosxautomation.com/applescript/uiscripting/index.html
# make sure that support for assistive devices is enabled
#
tell application "System Events"
	if UI elements enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script requires access for assistive devices be enabled." &amp; return &amp; return &amp; "To continue, click the OK button and enter an administrative password in the forthcoming security dialog." with icon 1
		end tell
		set UI elements enabled to true
		if UI elements enabled is false then
			display dialog "This script cannot run while access for assistive devices is disabled." &amp; return &amp; "Exiting now." buttons {"OK"} with icon 2
			return "user cancelled"
		end if
	end if
end tell

# now dive into the VPN setup part
#
tell application "System Events"
	set _if_tunnel to "utun0" #	do not change, will be auto-detected, just giving a reasonable default
	tell current location of network preferences
		if exists service _vpn_name then
			# try to connect the VPN service if it's disconnected
			#
			if current configuration of service _vpn_name is not connected then
				connect service _vpn_name
			end if

			# give it some time to settle
			#
			set _retval to false
			repeat until (_retval) is true
				set counter to 0
				repeat while counter is less than 16
					# exit if we get connected
					#
					if current configuration of service _vpn_name is connected then
						set _retval to true
						exit repeat
					end if

					# opt for exit if still not connected after 15 seconds
					#
					if counter is equal to 15 then
						display dialog "VPN '" &amp; _vpn_name &amp; "' is still not connected after 15 seconds. Do you want to keep waiting?" with title "VPN still not connected" buttons {"Yes", "No"}
						if button returned of result is "No" then
							# bail out if user decided not to wait any longer
							#
							set _retval to true
							return
						else
							# otherwise reset the counter so we can trigger again
							#
							set counter to 0
						end if
					end if

					set counter to counter + 1
					delay 1
				end repeat
			end repeat

			# now go to post processing and to the following:
			# - delete default route via vpn
			# - restore original default route
			# - add specific routes to vpn
			#
			if current configuration of service _vpn_name is connected then
				# restore local default route
				#
				do shell script "route delete default" password _sudo_password with administrator privileges
				do shell script "route add default " &amp; _default_gw password _sudo_password with administrator privileges

				# inject custom routes via VPN
				#
				repeat with _network in _networks
					do shell script "route add -interface " &amp; _network &amp; " utun0" password _sudo_password with administrator privileges
				end repeat
			end if
		else
			# bail out if the VPN service does not exist
			#
			display dialog "Given VPN '" &amp; _vpn_name &amp; "' does not exist. Please check the name"
		end if
	end tell
end tell
</pre>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recognize IPv6-enabled Websites with &#8220;sixornot&#8221; Firefox Plugin</title>
		<link>http://phaq.phunsites.net/2011/06/11/recognize-ipv6-enabled-websites-with-sixornot-firefox-plugin/</link>
		<comments>http://phaq.phunsites.net/2011/06/11/recognize-ipv6-enabled-websites-with-sixornot-firefox-plugin/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 12:50:08 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=652</guid>
		<description><![CDATA[Three days have passed since World IPv6 Day and we&#8217;re still here As of today, some content providers have decided to leave their IPv6 stack enabled on their services, which is generally a good thing. Now, if you want to know if they site you&#8217;re visiting is running IPv4 or IPv6, I&#8217;d recommend installing the [...]]]></description>
			<content:encoded><![CDATA[<p>Three days have passed since <a href="http://www.worldipv6day.org/" target="_blank">World IPv6 Day</a> and we&#8217;re still here <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
As of today, some content providers have decided to leave their IPv6 stack enabled on their services, which is generally a good thing.</p>
<p>Now, if you want to know if they site you&#8217;re visiting is running IPv4 or IPv6, I&#8217;d recommend installing the &#8220;sixornot&#8221; Firefox plugin, which reveals this at a glance.<br />
<span id="more-652"></span><br />
The plugin is available from <a href="https://addons.mozilla.org/en-US/firefox/addon/sixornot/" target="_blank">Mozilla Add-ons page</a> and adds a decent dropdown to the right of the address bar.</p>
<div align="center">
<a href="http://phaq.phunsites.net/files/2011/06/sixornot.png" rel="lightbox[652]"><img src="http://phaq.phunsites.net/files/2011/06/sixornot-253x300.png" alt="" width="253" height="300" class="alignnone size-medium wp-image-655" /></a>
</div>
<p>This will help you identify quickly which protocol the site is running. Klicking on the dropdown will reveal further information about the remote and local IP addresses.</p>
<div align="center">
<a href="http://phaq.phunsites.net/files/2011/06/sixornot2.png" rel="lightbox[652]"><img src="http://phaq.phunsites.net/files/2011/06/sixornot2-300x248.png" alt="" width="300" height="248" class="alignnone size-medium wp-image-654" /></a>
</div>
<p>After all, a very decent plugin without any bloat. Thanks to the author.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/06/11/recognize-ipv6-enabled-websites-with-sixornot-firefox-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CUPS PDF Printer for OS X</title>
		<link>http://phaq.phunsites.net/2011/05/12/cups-pdf-printer-for-os-x/</link>
		<comments>http://phaq.phunsites.net/2011/05/12/cups-pdf-printer-for-os-x/#comments</comments>
		<pubDate>Thu, 12 May 2011 19:47:35 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=629</guid>
		<description><![CDATA[Yes, I know, OS X has already a &#8220;print to pdf&#8221; feature. This does however not work for those applications which don&#8217;t use the OS X native printing dialog, e.g. some Java apps. This is where CUPS-PDF kicks in. It adds a virtual printer to the system, thus enabling non-native applications to print to a [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I know, OS X has already a &#8220;print to pdf&#8221; feature. This does however not work for those applications which don&#8217;t use the OS X native printing dialog, e.g. some Java apps.</p>
<p>This is where <a href="https://bitbucket.org/codepoet/cups-pdf-for-mac-os-x/wiki/Home" target="_blank">CUPS-PDF</a> kicks in. It adds a virtual printer to the system, thus enabling non-native applications to print to a PDF as well.</p>
<p>Mission accomplished!</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/05/12/cups-pdf-printer-for-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Redmine on FreeBSD</title>
		<link>http://phaq.phunsites.net/2011/05/08/setting-up-redmine-on-freebsd/</link>
		<comments>http://phaq.phunsites.net/2011/05/08/setting-up-redmine-on-freebsd/#comments</comments>
		<pubDate>Sun, 08 May 2011 21:57:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[HowTo's]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=618</guid>
		<description><![CDATA[&#8220;Redmine is a flexible project management web application. Written using Ruby on Rails framework, it is cross-platform and cross-database.&#8221; (redmine.org) Here&#8217;s my short primer on setting up Redmine on FreeBSD. In my case, I just wanted a rather simplistic and stripped-down environment, which was the reason to choose Redmine. While it can perfectly integrate with [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Redmine is a flexible project management web application. Written using Ruby on Rails framework, it is cross-platform and cross-database.&#8221; (redmine.org)</p>
<p>Here&#8217;s my short primer on setting up Redmine on FreeBSD.<br />
<span id="more-618"></span><br />
In my case, I just wanted a rather simplistic and stripped-down environment, which was the reason to choose Redmine.<br />
While it can perfectly integrate with Apache, Nginx and other web-servers, I preferred to use the minimalistic &#8220;thin&#8221; web-server.<br />
I do as well use self-compiled port in favor to binary packages. Feel free to use binary packages if you like <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h3>Installing the software</h3>
<p>Redmine requires a database server. Either MySQL or PostgreSQL or sqlite.<br />
If chose to use MySQL and installed it from the ports using defaults:</p>
<p><code><br />
[root@localhost ~] cd /usr/ports/databases/mysql51-server; make build install<br />
</code></p>
<p>Then install Redmine from /usr/ports/www/redmine.</p>
<p><code><br />
[root@localhost ~] cd /usr/ports/www/redmine; WITHOUT_X11=true make config build install<br />
</code></p>
<p>It&#8217;s important to fire up the &#8220;config dialog&#8221; to include the &#8220;thin&#8221; web-server:</p>
<div align="center">
<a href="http://www.redmine.org/projects/redmine/wiki/Guide" target="_blank"><a href="http://phaq.phunsites.net/files/2011/05/redmine_opts.png" rel="lightbox[618]"><img src="http://phaq.phunsites.net/files/2011/05/redmine_opts-300x167.png" alt="" title="redmine_opts" width="300" height="167" class="aligncenter size-medium wp-image-619" /></a>
</div>
<h3>Enable service configuration</h3>
<p>Enable the services in your /etc/rc.conf.</p>
<p><code><br />
mysql_enable="YES"                      # enable MySQL server<br />
redmine_enable="YES"                    # enable redmine server<br />
redmine_flags="-a 0.0.0.0 -p 3000 -e production --ssl --ssl-key-file=/usr/local/www/redmine/config/server.key --ssl-cert-file=/usr/local/www/redmine/config/server.crt"<br />
</code></p>
<p>I choose to enable SSL in the configuration above. If you don&#8217;t need SSL, then change the &#8220;redmine_flags&#8221; line to read as follows:</p>
<p><code><br />
redmine_flags="-a 0.0.0.0 -p 3000 -e production"<br />
</code></p>
<h3>Prepare MySQL</h3>
<p>Now start mysql server:</p>
<p><code><br />
[root@localhost ~] /usr/local/etc/rc.d/mysql-server start<br />
</code></p>
<p>Fire up the mysql console.<br />
If this happens to be the first time you use MySQL, then you won&#8217;t have a password yet. It may be a good idea then, to first assign new passwords and remove the default database stuff. Do this </p>
<p><code><br />
delete from user where user='';<br />
delete from db where user='';<br />
drop database test;<br />
flush privileges;<br />
</code></p>
<p>Now create the database and user for use with Redmine:</p>
<p><code><br />
create database redmine character set utf8;<br />
create database redmine_devel;<br />
create database redmine_test;<br />
create user 'redmine'@'localhost' identified by 'A_secRET_passw0RD';<br />
grant all privileges on redmine.* to 'redmine'@'localhost';<br />
grant all privileges on redmine_devel.* to 'redmine'@'localhost';<br />
grant all privileges on redmine_test.* to 'redmine'@'localhost';<br />
</code></p>
<h3>Prepare Redmine</h3>
<p>For Redmine you&#8217;ll need to edit some configuration files at /usr/local/www/redmine/config first.<br />
First copy the &#8220;database.yml.example&#8221; file to &#8220;database.yml&#8221;.</p>
<p><code><br />
[root@localhost ~]# cd /usr/local/www/redmine/config<br />
[root@locahost /data/local/www/redmine/config]# cp database.yml.example database.yml<br />
</code></p>
<p>Now edit the &#8220;database.yml&#8221; file to your correct database settings:</p>
<pre>
production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: A_secRET_passw0RD
  encoding: utf8

development:
  adapter: mysql
  database: redmine_development
  host: localhost
  username: redmine
  password: A_secRET_passw0RD
  encoding: utf8

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: redmine_test
  host: localhost
  username: redmine
  password: A_secRET_passw0RD
  encoding: utf8
</pre>
<p>Now create the session store and import the initial database as follows:</p>
<p><code><br />
[root@localhost /data/local/www/redmine/config]# rake generate_session_store<br />
[root@localhost /data/local/www/redmine/config]# RAILS_ENV=production rake db:migrate<br />
</code></p>
<p>To enable mail processing, you need to copy &#8220;email.yml.example&#8221; to &#8220;email.yml&#8221;:</p>
<p><code><br />
[root@locahost /data/local/www/redmine/config]# cp email.yml.example email.yml<br />
</code></p>
<p>Then edit &#8220;email.yml&#8221; to your proper email settings. The following example is for SMTP delivery through an external host:</p>
<pre>
production:
  delivery_method: :smtp
  smtp_settings:
    address: SMTP.DOMAIN.TLD
    port: 25
    domain: SMTP.DOMAIN.TLD
    authentication: :login
    user_name: "smtp_user_name"
    password: "some_password"

development:
  delivery_method: :smtp
  smtp_settings:
    address: SMTP.DOMAIN.TLD
    port: 25
    domain: SMTP.DOMAIN.TLD
    authentication: :login
    user_name: "smtp_user_name"
    password: "some_password"
</pre>
<h3>Optional: Enable SSL mode</h3>
<p>I enabled SSL for the &#8220;thin&#8221; web-server in /etc/rc.conf. If you choose to not use SSL, skip this step.</p>
<p>To enable SSL, you need to create the SSL private key and a certificate.<br />
I&#8217;m giving just the command list here, as this procedure is otherwise very well documented over there at the <a href="http://www.modssl.org/docs/2.8/ssl_faq.html" target="_blank">mod_ssl FAQ</a>.</p>
<p><code><br />
openssl genrsa -des3 -out server.key.cryped 1024<br />
openssl rsa -in server.key.crypted -out server.key<br />
openssl req -new -key server.key -out server.csr<br />
openssl req -new -x509 -days 365 -key server.key -out server.crt<br />
</code></p>
<p>The above procedure would essentially create a password-protected key (step 1), which would then get the password removed (step 2). I&#8217;d then create a signing request in the 3rd step and have a self-signed certificate created (last command).<br />
The removal of the password is essential to start the web-server without prompting for a password.</p>
<p>Now, there was just one little cave-at I came along. On my setup, Redmine would not properly run in SSL mode in some cases create redirect url containing http:// instead of https://.<br />
I suspect this is a problem caused by the &#8220;thin&#8221; web-server, which would not properly state that it runs in SSL mode to the application. Obviously, wenn running &#8220;thin&#8221; in SSL mode, it would no longer word in &#8220;http plain&#8221; mode, so this causes some errors.</p>
<p>For example, when logging on to your host using https://HOSTNAME:3000, you&#8217;d get redirected to http://HOSTNAME:3000/login?back_url=http://HOSTNAME:3000&#8243;.<br />
Now, as this obviously won&#8217;t work, there&#8217;s a little change required in the &#8220;/usr/local/www/redmine/vendor/rails/actionpack/lib/action_controller/request.rb&#8221; file.</p>
<p>Look out for this text block:</p>
<pre>
    # Is this an SSL request?
    def ssl?
      @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
    end
</pre>
<p>Then change it to look like this:</p>
<pre>
    # Is this an SSL request?
    def ssl?
        true
    end
</pre>
<p>This will force Redmine into thinking it&#8217;s permanently SSL enabled, thus it will always generate proper https:// URLs.<br />
This particular issue would propably not come up when using Apache or Nginx in SSL forwarding mode.</p>
<h3>Start using Redmine</h3>
<p>Now you&#8217;re basically done. Start accessing Redmine through https://YOURHOSTNAME:3000 (or http://YOURHOSTNAME:3000, in case you left SSL disabled).</p>
<p>And don&#8217;t forget to change your default username/password settings upon first login.</p>
<p>I recommed the <a href="http://www.redmine.org/projects/redmine/wiki/Guide" target="_blank">Redmine User&#8217;s Guide</a> for further reading <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/05/08/setting-up-redmine-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mac OS HFS+ case-insensitivenesss screws SVN</title>
		<link>http://phaq.phunsites.net/2011/04/29/mac-os-hfs-case-insensitiveness-screws-svn/</link>
		<comments>http://phaq.phunsites.net/2011/04/29/mac-os-hfs-case-insensitiveness-screws-svn/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:39:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=606</guid>
		<description><![CDATA[So I work on OS X for a few years now, but until today that I didn&#8217;t really care about the underlying HFS+ file system. But while working on a project using SVN, I got this unexpected error message: gianpaolo-del-mattos-macbook-pro:trunk Gianpaolo$ svn update svn: URL 'svn+ssh://...../webinterface/files/lib/webmin' of existing directory '...../webinterface/files/lib/Webmin' does not match expected URL [...]]]></description>
			<content:encoded><![CDATA[<p>So I work on OS X for a few years now, but until today that I didn&#8217;t really care about the underlying HFS+ file system.<br />
But while working on a project using SVN, I got this unexpected error message:</p>
<p><code><br />
gianpaolo-del-mattos-macbook-pro:trunk Gianpaolo$ svn update<br />
svn: URL 'svn+ssh://...../webinterface/files/lib/webmin' of existing directory '...../webinterface/files/lib/Webmin' does not match expected URL 'svn+ssh://..../webinterface/files/lib/Webmin'<br />
</code><br />
<span id="more-606"></span><br />
What had happened? Looking into the repository I found two folders, one by the name of &#8216;webmin&#8217; and the other being &#8216;Webmin&#8217;.<br />
Googl&#8217;ing for the error message I found references to SVN on Windows, having issues checking out folders by the same name onto a case-insensitive NTFS.</p>
<p>I though OS X would be case-sensitive, it&#8217;s basically UNIXish in it&#8217;s core, right? WRONG.<br />
For historical reasons, OS X uses HFS+ with case-sensitivity disabled by default. Thus folders &#8216;webmin&#8217; and &#8216;Webmin&#8217; or even &#8216;webmiN&#8217; are the same.</p>
<p>Test this on your own. Fire up a terminal and create a folder called &#8216;Test&#8217;.</p>
<pre>
mkdir Test
</pre>
<p>Now try to enter it using the name of &#8216;TESt&#8217;:</p>
<pre>
cd TESt
</pre>
<p>You&#8217;ll notice that it indeed works. HFS+ default settings are case-preserving, but nevertheless case-insensitive.</p>
<p>Solution? One possible work-around would be to REFORMAT the whole disk using HFS+ with case-sensitivity enabled, which would require a complete reinstall of OS X. There&#8217;s some issues with this, though. Various sources report, that some applications may not work properly on case-sensitive HFS+ volumes.</p>
<p>So, a more versatile, but albeit complicated, work-around would be to create virtual disk image and use this to store case-sensitive content.<br />
For this you need to start &#8220;Disk Utility&#8221;. Although my screenshot is in german language, you should get the point easily.</p>
<div align="center">
<a href="http://phaq.phunsites.net/files/2011/04/casesensitive1.png" rel="lightbox[606]"><img src="http://phaq.phunsites.net/files/2011/04/casesensitive1-300x229.png" alt="" title="casesensitive1" width="300" height="229" class="aligncenter size-medium wp-image-609" /></a>
</div>
<ol>
<li>Create a new disk image and give it some memorizable name (I used &#8216;CaseSensitive&#8217; in the example) and store it in any folder you like</li>
<li>Give it some practical size depending on your need</li>
<li>Use HFS+ with journaling and case-sensitiveness as file system</li>
<li>Make sure you create this as a writable image</li>
</ol>
<p>This will create a new disk image by the name of &#8216;CaseSensitive.dmg&#8217;. It should get mounted automatically. If not, just double-clicking should do so.</p>
<p>Now you can move all your content to the Disk Image. When it&#8217;s mounted, you can access it&#8217;s path through &#8216;/Volumes/CaseSensitive&#8217; (the name in fact depending on the image name you chose earlier).</p>
<p>For me, this fixed the afore-mentioned SVN issue, as I could now properly checkout my repository and have the case-sensitive folders co-exist beneath each other.</p>
<div align="center">
<a href="http://phaq.phunsites.net/files/2011/04/casesensitive2.png" rel="lightbox[606]"><img src="http://phaq.phunsites.net/files/2011/04/casesensitive2-300x157.png" alt="" title="casesensitive2" width="300" height="157" class="aligncenter size-medium wp-image-610" /></a>
</div>
<p>Mission accomplished <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/04/29/mac-os-hfs-case-insensitiveness-screws-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Legacy DOS Boot Floppies</title>
		<link>http://phaq.phunsites.net/2010/12/18/legacy-dos-boot-floppies/</link>
		<comments>http://phaq.phunsites.net/2010/12/18/legacy-dos-boot-floppies/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 17:11:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DOS]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=399</guid>
		<description><![CDATA[DOS never dies! So don&#8217;t the boot floppies I have these since years and made them ready for web-download in 2001 already. Now I gathered them back from my archives to put them aside to download at phunsites.net. Maybe, these are of use to others to. Here&#8217;s a short overview of the bootdisks available: MS-DOS [...]]]></description>
			<content:encoded><![CDATA[<p>DOS never dies! So don&#8217;t the boot floppies <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I have these since years and made them ready for web-download in 2001 already.<br />
Now I gathered them back from my archives to put them aside to download at phunsites.net.</p>
<p>Maybe, these are of use to others to.<br />
<span id="more-399"></span><br />
Here&#8217;s a short overview of the bootdisks available:</p>
<ul>
<li><a href="http://phaq.phunsites.net/files/2010/12/msdos6.zip">MS-DOS 6.22*</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/msdos7.zip">MS-DOS 7.0 Beta (never released)**</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/pcdos7.zip">IBM PC-DOS 7.01*</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/drdos7.zip">DR-DOS 7.03**</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/win95.zip">Windows 95 4.00.950*</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/win95b.zip">Windows 95 4.00.1212*</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/win98.zip">Windows 98 4.10.1998*</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/win98se.zip">Windows 95 SE 4.10.2222</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/winme.zip">Windows ME 4.90</a></li>
</ul>
<p>Additionally, there&#8217;s the following tools available:</p>
<ul>
<li><a href="http://phaq.phunsites.net/files/2010/12/dd.zip">DOS/Windows Version of &#8216;dd&#8217;</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/cdoderhd.zip">DOS/Windows CLI to overwrite floppy boot code; will allow to boot from HD even if the floppy is inserted</a></li>
<li><a href="http://phaq.phunsites.net/files/2010/12/cd-rom.zip">DOS CD-ROM drivers for various drives</a></li>
</ul>
<p>Maybe these can still be of value, despite floppy drives being gone and virtualization on the edge.</p>
<p><b>Disclaimer:</b> I take no liability whatsoever damage could arise out of the use of these disk images.<br />
These boot disks are provided &#8220;as is&#8221;. The copyright of the software contained on the boot disks retains to their respective copyright holder.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2010/12/18/legacy-dos-boot-floppies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An AutoFS executable map to automount device nodes</title>
		<link>http://phaq.phunsites.net/2008/01/24/an-autofs-executable-map-to-automount-device-nodes/</link>
		<comments>http://phaq.phunsites.net/2008/01/24/an-autofs-executable-map-to-automount-device-nodes/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 01:31:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/2008/01/24/an-autofs-executable-map-to-automount-device-nodes/</guid>
		<description><![CDATA[For my company&#8217;s hard disk-based backup system I needed the ability to automount disk drives by their device name into a standard directory structure. One possible approach would be to add some lines like these to fstab: /dev/sda1 /mnt/sda1 ext3 defaults,noauto 0 0 This may be good enough in some cases, though it wasn&#8217;t sufficient [...]]]></description>
			<content:encoded><![CDATA[<p>For my company&#8217;s hard disk-based backup system I needed the ability to automount disk drives by their device name into a standard directory structure.</p>
<p>One possible approach would be to add some lines like these to fstab:</p>
<pre>
/dev/sda1       /mnt/sda1       ext3    defaults,noauto 0       0</pre>
<p>This may be good enough in some cases, though it wasn&#8217;t sufficient for me, when there were dozens of device nodes which could get mounted eventually.</p>
<p>So I basically wanted something that would allow me to just access a directory, while the underlying disk was mounted automatically, then having it unmounted automatically if not in use, but still being dynamic in it&#8217;s nature so it would auto-adjust.<br />
<span id="more-112"></span><br />
Now there&#8217;s a simple trick using an AutoFS feature called &#8220;executable maps&#8221;, which would allow me to achive this all.</p>
<p>The idea is, that all devices (let&#8217;s say /dev/sda1, /dev/sda2, /dev/sdb1, /dev/sdc1 as an example) will get mounted to /mnt/disks/[devicename].</p>
<p>First make sure, that AutoFS is installed. On Debian for example, it is installed like this:</p>
<pre>
apt-get install autofs</pre>
<p>Then create a file called /etc/auto.disks with the following lines therein:</p>
<pre>
#!/bin/bash

# $1 is passed-over from automount
# key refers to the mount point we are looking for
key="$1"

# default mount options
opts="-fstype=ext3,rw"

# if a block device exists at /dev/[key]
# pass it back to automount
[ -b /dev/${key} ] &amp;&amp; { echo "$opts \"; echo -e "t:/dev/${key}"; }</pre>
<p>Don&#8217;t forget to <strong>chmod 755</strong> /etc/auto.disks.</p>
<p>This script will create an automounter map dynamically as soon as it passed<br />
a device node. It it finds it (e.g. while looking up /dev/sda1, which exists), it&#8217;ll<br />
return the map to automount, which will cause the device node to be mounted.</p>
<p>In my case, the script didn&#8217;t need to be very sophisticated as I only have ext3-formatted disks, but it&#8217;s easy to script it for automatic file system recognition.</p>
<p>Btw, the script can be tested like this to see if it&#8217;s actually working:</p>
<pre>
satyr:~# bash /etc/auto.disks sda1
-fstype=ext3,rw
        :/dev/sda1
satyr:~# bash /etc/auto.disks sdx1</pre>
<p>The first command returns the map for an existing device node /dev/sda1, while the second command returns nothing as /dev/sdx1 doesn&#8217;t exist on the system.</p>
<p>Now set AutoFS to use the executable map for /mnt/disks directory. Add this line to /etc/auto.master:</p>
<pre>
/mnt/disks  /etc/auto.disks --timeout=360</pre>
<p>This will cause AutoFS to examine the executable map on all requested sub directories beneath /mnt/disks. So if you&#8217;re going to access /mnt/disks/sda1, /mnt/disks/sda2, /mnt/disks/sdb1, /mnt/disks/sdc1, the block devices corresponding to the directories are mounted automatically &#8212; as long as the devices exist of course.</p>
<p>The timeout value designates after how much time (of inactivity) an automounted file system expires and get&#8217;s unmounted.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2008/01/24/an-autofs-executable-map-to-automount-device-nodes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extract boot image from bootable &quot;El Torito&quot; CD-ROM</title>
		<link>http://phaq.phunsites.net/2007/03/21/extract-boot-image-from-bootable-el-torito-cd-rom/</link>
		<comments>http://phaq.phunsites.net/2007/03/21/extract-boot-image-from-bootable-el-torito-cd-rom/#comments</comments>
		<pubDate>Wed, 21 Mar 2007 06:13:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/2007/03/21/extract-boot-image-from-bootable-el-torito-cd-rom/</guid>
		<description><![CDATA[Bootable &#8220;El Torito&#8221; CD-ROMs usually use a boot loader such as isolinux. The loader will allow to boot any particular disk image located inside the iso9660 filesystem. This makes it very easy to change a particular boot image. It&#8217;s merely a matter of picking the right file, changing it and burning a new CD-ROM. Now [...]]]></description>
			<content:encoded><![CDATA[<p>Bootable &#8220;El Torito&#8221; CD-ROMs usually use a boot loader such as isolinux. The loader will allow to boot any particular disk image located inside the iso9660 filesystem.</p>
<p>This makes it very easy to change a particular boot image. It&#8217;s merely a matter of picking the right file, changing it and burning a new CD-ROM.<br />
<span id="more-88"></span><br />
Now there are also CD-ROMs which do not rely upon a boot loader or images inside the iso9660 filesystem.<br />
Instead, the bootable image is stored within the first sectors of the CD-ROM, referenced only from the boot catalog by it&#8217;s sector offset. This actually means, that the boot image is hidden and neither visible from the iso9660 filesystem nor loaded from there.</p>
<p>This drawing should get you the basic idea (have a look at the <a href="http://www.phoenix.com/NR/rdonlyres/98D3219C-9CC9-4DF5-B496-A286D893E36A/0/specscdrom.pdf" target="_blank">El Torito Specification</a> for further Details):</p>
<pre>               +-------------------------+
    Sector 0:  |          SYSTEM         |
               |-------------------------|
    Sector 16: |      Primary Volume     |
               |-------------------------|
    Sector 17: |    Boot Record Volume   |-------+
               |-------------------------|       |
               |                         |       |
               |-------------------------|       |
               | Set Termination Volume  |       |
               |-------------------------|       |
               |     Boot Catalog        | &lt;-----+
               |                         |-------+
               |-------------------------|       |
               |  Bootable Disk/Loader   | &lt;-----+
               |-------------------------|
               |   CD-ROM File System    |
               +-------------------------+</pre>
<p>So to change the boot image, it needs to be extracted from the CD-ROM first.</p>
<p>This is where <a href="http://freshmeat.net/projects/geteltorito/" target="_blank">geteltorito</a> comes in, a perl utility by    Rainer Krienke, which serves exactly this purpose.</p>
<p>Luckily enough I found this one before I started writing an image dumper on my own&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2007/03/21/extract-boot-image-from-bootable-el-torito-cd-rom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

