Archive for the ‘Linux’ Category

Outlook 2007 autodiscover for the rest of us

Sunday, June 7th, 2009

Outlook 2007 has a new feature which is provided to it by default only by Exchange 2007.

I recently thought of giving Outlook a try instead of Windows Live Mail. Of course, the geek in me wanted my Outlook 2007 first run experience to be awesome. I wanted autodiscover to work for me.

It turns out if you read a KB article and a technet article you can figure out that for 99% of POP/IMAP/SMTP installations, placing an autodiscover.xml file at a url of http://myemail.com/autodiscover/autodiscover.xml or at http://autodiscover.myemail.com/autodiscover/autodiscover.xml is all that is needed. The format of the xml is very simple.

<?xml version="1.0" encoding="utf-8"?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
  <Response xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a">
    <Account>
      <AccountType>email</AccountType>
      <Action>settings</Action>
      <Protocol>
        <Type>IMAP</Type>
        <Server>mail.xmtp.net</Server>
        <Port>993</Port>
        <DomainRequired>off</DomainRequired>
        <SPA>off</SPA>
        <SSL>on</SSL>
        <AuthRequired>on</AuthRequired>
      </Protocol>
      <Protocol>
        <Type>SMTP</Type>
        <Server>mail.xmtp.net</Server>
        <Port>25</Port>
        <DomainRequired>off</DomainRequired>
        <SPA>off</SPA>
        <SSL>on</SSL>
        <AuthRequired>on</AuthRequired>
        <UsePOPAuth>on</UsePOPAuth>
        <SMTPLast>on</SMTPLast>
      </Protocol>
      <Protocol>
        <Type>POP3</Type>
        <Server>mail.xmtp.net</Server>
        <Port>995</Port>
        <DomainRequired>off</DomainRequired>
        <SPA>off</SPA>
        <SSL>on</SSL>
        <AuthRequired>on</AuthRequired>
      </Protocol>
    </Account>
  </Response>
</Autodiscover>

 

Do that, and the next time an Outlook2007 client tries to configure itself, it will.

Using the MVPS.ORG Hosts file with ISC Bind

Monday, May 25th, 2009

I run my own DNS in our home. You may think this is crazy, but test after test has shown that nearly all ISPs provide substandard DNS to their customers. Even the finest DNS servers are only responsive 95% of the time. With the number of times you use DNS, you could be losing seconds or minutes per day while you wait for timeouts and rerequests.

Mvps.org maintains a list of “known bad domains”. While it is certainly not a replacement for other security measures, its another line of defense. It is another tool in the bag. For more reasons, read their site.

http://www.mvps.org/winhelp2002/hosts.htm

I don’t want to maintain host files on all of my home systems and all of the VMs too, I’d like to just tell my DNS server about these hosts and have it do the right thing.

By combining the downloaded hosts file and using this little boo script to map it into bind config, I have done just that. I use include files to bind. I’ve added a line like this to my /etc/bind/named.conf.local on my ubuntu server

include "/etc/bind/named.conf.mvps";

Then, I’ve added the output of this boo script to the /etc/bind/named.conf.mvps file. Reload bind and everything is done.

import System.IO
for line as string in [line for line in  @/\n|\r\n/.Split( File.OpenText("HOSTS").ReadToEnd() ) if (not line.StartsWith("#") and line!=string.Empty and not line.Contains("localhost"))]:
    fields = @/ +/.Split(line)
    if (fields.Length > 1):
      host = fields[1]
      print "zone \"${host}\" { type master; file \"/etc/bind/db.local\"; };"

Before hand, host resolution looked like this:

$ host ad.a8.net
ad.a8.net has address 203.190.224.60

After reloading bind, it looks like this:

$ host ad.a8.net
ad.a8.net has address 127.0.0.1
ad.a8.net has IPv6 address ::1

ASP.NET via Mono and Apache

Friday, April 17th, 2009

In my last post I showed how to build Mono trunk on the latest Ubuntu. I pointed out that I am using it on a “server” install of Ubuntu. I don’t have GTK+ or GTK# installed. So what good is Mono? Its good for hosting ASP.NET web applications.

  1. Configure an apache development environment.
    sudo apt-get install apache2-prefork-dev
  2. Grab my mono-dev-update script and tell it to only do mod_mono
    curl http://jrwren.wrenfam.com/scripts/mono-dev-update
    ./mono-dev-update –m mod_mono
  3. Install the apache module
    pushd /opt/mono/src/mod_mono ; sudo make install ; popd
  4. Enable the apache module
    pushd /etc/apache2/mods-enabled;ln –s ../mod_mono.conf . ; popd
  5. Restart Apache
    sudo /etc/init.d/apache2 restart
  6. Test it
    echo ’<%=DateTime.Now%>’ |sudo tee /var/www/index.aspx
    curl localhost/index.aspx

You should see the current date and time displayed. If you don’t, you have done something wrong.  Note that quotes paste poorly out of wordpress, so you may need to type out some of these commands.

Mono trunk on Ubuntu Jaunty

Friday, April 17th, 2009

With the release of Ubuntu 9.04 aka Jaunty later this month, I thought I’d share how to get a current version of Mono on the latest Ubuntu release.

For a number of reasons, Ubuntu always seems to be just a little behind current with its Mono packages. The largest reason IMO is the difficulty in properly packaging Mono for Debian/Ubuntu. I’ve tried and it is not easy.

  1. Make our install a tiny developer environment.
    sudo apt-get install build-essential subversion autoconf libtool bison gettext pkg-config libglib2.0-dev
  2. Install the old Mono 2.0 C# compiler from jaunty so that we can bootstrap the trunk compiler.
    sudo apt-get install mono-mcs
    ln –s /usr/bin/mcs1 /usr/bin/mcs
    This installs enough mono to let the C# compiler run. We will remove this and all its dependencies later.
  3. Fetch the source from SVN. I use a mono-dev-update script to checkout the first time and keep me updated. The script pulls and installs mono, mcs, xsp to /opt/mono on a default ubuntu server install once step 1 above has been performed. To build more parts of mono such as GTK# and MonoDevelop you will need more gtk+ library dependencies.
    sudo mkdir –p /opt/mono/src
    sudo chown $USER /opt/mono /opt/mono/src
    ./mono-dev-update
  4. Remove the bootstrap mcs
    sudo apt-get remove binfmt-support cli-common libmono-corlib1.0-cil libmono-corlib2.0-cil libmono-i18n1.0-cil libmono-i18n2.0-cil libmono-security2.0-cil libmono-system1.0-cil libmono-system2.0-cil libmono0 mono-2.0-gac mono-2.0-runtime mono-common mono-gac mono-jit mono-mcs mono-runtime

The real work is done by the mono-dev-update script. Its a mess of bash script which has served me well for a couple of years now.

I’ll paste the current version of it here, but I’ll also try to keep it up to date for download here.

#!/bin/bash
#mono-dev-update
#Jay R. Wren <jrwren@xmtp.net>
#usage:
#   -s      skip svn operations. don't try to pull updates.
#   -f      force autogen.sh or configure to run.
#   -l n    set build level to value of 'n'. This controls optional package
#           builds. Not used much
#   -n      no auto retry. if make fails, do not try to ./configure and
#           make again.

MONO_PREFIX=/opt/mono
#GNOME_PREFIX=/opt/gnome
GNOME_PREFIX=/usr
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH
export MANPATH=$MANPATH:$MONO_PREFIX/share/man
if [[ ! -d $MONO_PREFIX/src ]];then mkdir $MONO_PREFIX/src; fi
pushd $MONO_PREFIX/src

SVNDIRS="mcs mono xsp monodevelop gtk-sharp gtkmozembed-sharp type-reflector debugger banshee-sample-plugin olive mono-tools"
CVSDIRS="banshee"
MAKEDIRS="mono xsp debugger mono-tools monodevelop gtkmozembed-sharp "
BANSCHEEPLUGINS="banshee-sample-plugin" 

level=0
skipsvn=0

optCount=0;
while getopts :x vfsnd:t:cl:m: OPTS ;do
	if [[ $OPTS == "x" ]]; then outputStyle=xml ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "v" ]]; then action=view ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "f" ]]; then forceAGen="true" ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "s" ]]; then skipsvn=1 ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "n" ]]; then noautoretry="true" ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "d" ]]; then DEBUG="$OPTARG" ; optCount=$((optCount+2)) ; fi
	if [[ $OPTS == "t" ]]; then transform="$OPTARG" ; optCount=$((optCount+2)) ; fi
	if [[ $OPTS == "c" ]]; then for i in $MAKEDIRS;do pushd $i ; make clean ; popd ; done ;exit ; optCount=$((optCount+1)) ; fi
	if [[ $OPTS == "l" ]]; then level="$OPTARG" ; optCount=$((optCount+2)) ; fi
	if [[ $OPTS == "m" ]]; then MAKEDIRS="$OPTARG" ; optCount=$((optCount+2));fi
done
if [[ $optCount != $((OPTIND-1)) ]] ; then echo "optcount($optCount) not equal to OPTIND($OPTIND)";fi

echo "using makedirs $MAKEDIRS"

echo "using prefix $MONO_PREFIX"

if [[ 1 > $skipsvn ]]; then
for i in $SVNDIRS
do
	echo -e "\e[1;31m pushd $i \e[m"
	if [[ -d $i ]];then
		pushd $i
        if [[ ! -d .svn ]];then pushd .. ; svn co http://anonsvn.mono-project.com/source/trunk/$i ;popd; fi
		echo -e "\e[1;31m svn info"
		svn info
		echo 'svn log -r `svn info|grep Revision|cut -f2 -d' '`:HEAD'
		echo -e "\e[m"
		svn log -r `svn info|grep Revision|cut -f2 -d' '`:HEAD
		echo svn up
		nice -n 20 svn up
		if [ $? != 0 ]; then echo "ERROR: $?" ;popd ; break; fi
		pwd
		popd
	fi
done
else
	echo "-s detected, skipping svn update"
fi 

#mono, xsp, MD, GTK# etc
function autogenAndMake () {
	echo "running for $*"
	for i in $*
	do
		if [[ -d $i ]]; then
			echo -e "\e[1;31m pushd $i \e[m"
			pushd $i
			if [[ -f "autogen.sh" ]];then
				PROG=./autogen.sh
			else
				PROG=./configure
			fi
			if [[ "true" != $forceAGen ]]; then
				nice -n 20 make && nice -n 20 make install
			fi

			if [[ "true" != $noautoretry && $? != 0 || "true" == $forceAGen ]]; then
				echo -e "\e[1;31m "
				echo 'make clean ; $PROG --prefix=$MONO_PREFIX --enable-aspnet --enable-aspnetedit --with-preview --with-moonlight && nice -n 20 make && nice -n 20 make install'
				echo -e "\e[m"
				if [[ -f Makefile ]]; then make clean; fi
				$PROG --prefix=$MONO_PREFIX --enable-aspnet --enable-aspnetedit --with-preview --with-moonlight && nice -n 20 make && nice -n 20 make install || break
			fi
			popd
		fi
	done
}

#-l not  speced or even means build all - odd means build only banshee & olive
if [[ $((level % 2)) == 0 ]]; then
autogenAndMake $MAKEDIRS
fi

if [[ $level > 1 ]]; then
	i=gtk-sharp
			echo -e "\e[1;31m pushd $i \e[m"
			pushd $i
			echo -e "\e[1;31m "
			echo 'make clean ; ./bootstrap-2.12 --prefix=$MONO_PREFIX  && nice -n 20 make && nice -n 20 make install'
			echo -e "\e[m"
			if [[ -f Makefile ]]; then make clean ; fi
			./bootstrap-2.12 --prefix=$MONO_PREFIX  && nice -n 20 make && nice -n 20 make install || break
	popd
fi

if [[ $level > 1 ]];then
	#olive
	for i in olive
	do
		if [[ -d $i ]] ; then
			echo -e "\e[1;31m pushd $i \e[m"
			pushd $i
			echo -e "\e[1;31m "
			echo 'make clean ; ./configure  --prefix=$MONO_PREFIX  && nice -n 20 make && nice -n 20 make install'
			echo -e "\e[m"
			if [[ -f Makefile ]]; then make clean ; fi
			./configure  --prefix=$MONO_PREFIX  && nice -n 20 make && nice -n 20 make install || break
			popd
		fi
	done
fi

if [[ $level > 1 ]];then
	#banshee
	if [[ -d banshee ]];then
	pushd banshee
		cvs up
		./configure --prefix=$MONO_PREFIX --disable-helix && nice -n 20 make && nice -n 20 make install || break
	popd
	autogenAndMake $BANSCHEEPLUGINS
	fi
fi

popd

Windows 7

Monday, February 23rd, 2009

I received an email from a local Unix/Linux user group email list this morning with a link to this “review” of Windows 7.

http://jhansonxi.blogspot.com/2009/02/linux-users-review-of-windows-7-beta.html 

These are my thoughts.

Having upgraded from Vista to Win7 beta, on 1.5yr old crappy hardware. I can assure you that many of the points in this "review" are absolute lies.

"Windows 7 Setup …Like in XP it is single-task based so that every partition edit is immediately applied while most Linux installers queue up a series of operations and then perform them in a batch"
is an absolute lie. Its as if the reviewer paid no attention to what he was doing.

"The installation and updates took a long time with several reboots"
Exactly the opposite of my experience. After answering all of the questions up front (see previous lies about the installer) on a Friday night, I went to bed and awoke to a rebooted, ready to use Windows 7. There was no login/reboot experience in the install.

The 2nd paragraph of section 2. Installation, the reviewer babbles on about his awesome Linux setup. And while I agree, all of those things are cool, they have nothing to do with a Windows 7 beta review. This gem hidden in that paragraph pretty much sums up the section: "I haven’t tried any of them but …".  Yeah, I can tell.

In section 3. Storage, he does point out some VERY good differences between LVM and RAID setup at install time in Windows 7 versus Linux.

In section 4. Encryption, He continues to trash BitLocker difficulties in installing. Honestly, this is a great detailed comparison of a feature that I’ve never known anyone to use.

In section 5, he fairly says, "I would have to use the superbar a lot to know if I like it better."

in section 6, he makes a bunch of totally irrelevant points like the lack of an office suite. He calls Windows Media Player 12 a "bloated fatware compared to foobar2000, Media Player Classic, and VLC (on Ubuntu I use Rhythmbox). That is cute, except that it is a total lie. WMP12 is awesome. It starts fast. It is still the only media player that does play speed adjustment well. Its only real comparisons on Windows are iTunes, which it smokes, and Winamp. Yes, I still use foobar2000 and Media Player Classic and VLC. Depending on which type of media I am playing back, I use all of the above. But one things that WMP12 is NOT is bloated. It is damn fast.

He continues to point out that DivX MPEG-4 code doesn’t ship with Windows 7. It’s a good true point. WMP doesn’t do a good job of resolving codec problems. Yes, that sucks. Man up and go grab ffdshow from sourceforge. http://ffdshow-tryout.sourceforge.net/ Do not use k-lite codec pack like he suggests. It actually replaces better codecs in the Direct Media codec configuration.

Finally he ends section 6 saying "There are several similar PVRs for Linux" when pointing out Windows Media Center. Seriously??? I think it would be better to just say "I’m stupid and I don’t know what I am talking about." If you have ever setup and run MythTV and compared it to Windows Media Center, you are seriously on drugs. There is no comparison. The ONLY valid comparison is the cost, and the hours you spend on WMC is easily worth the dollars spend on WMC. At least make the freetard "I am free to modify it" argument here. Because as far as functionality, there is no comparison.

In section 7 he confused WOW64 with 32bit and 64bit. I think he thought he was in the 32bit ODBC setup. It is easy to get confused here, because in 64bit windows, there is still a system32 directory, and worse, system32 contains 64bit binaries. There is also a SysWow64 directory, and it contains all the 32bit compatibility binaries. But again, it shows the ignorance of the reviewer. http://msdn.microsoft.com/en-us/magazine/cc300794.aspx

Same section, next paragraph, there is more ignorance, "The Jet engine is the abandoned offspring of the SQL Server team". Anyone even remotely familiar with the history of product groups at Microsoft knows that this is false.

Section 8 talks about UAC, PC Safeguard and parental controls, but does not really say anything.

I have no idea what Section 9 is even doing in a review article. It tries to make some security point and talks about some XDG security concern on Linux and tries to convince you that it is a concern on windows too with lnk files. Read the paragraph and see if you can find the attack vector. I can’t. Its definitely not email, because Windows 7 doesn’t ship with an email client. The suggested download email client, Windows Live Mail, doesn’t let you execute any attachments.

Section 10 starts off saying "I wanted to try recreating the common Linux practice of separating user files from the rest of the OS with /home as a mount point for a separate partition."  Guess what?  Windows isn’t linux. If you want to run Linux, run Linux. Do things the linux way. If you want to run Windows, do things the windows way. Any Windows administrator will tell you, don’t do what you are trying to do! There is this neat thing call the registry which exists in your home directory. Its not going to be portable across windows installs, so don’t bother with that separate home partition. If you want backups, use backups. A separate partition is not getting you anything here. No idea what the next 3 paragraphs have to do with a Windows 7 review.

Section 11 starts off talking about Homegroups, but doesn’t explain them. See the PDC keynote, and then read these two paragraphs and tell me what is wrong here. The 3rd paragraph attempts to describe Libraries. Again, see the PDC video example and compare to this paragraph.  The remainder of this section tries to declare these new features useless. Ok, I know I already use the Library feature. If you don’t like it, don’t use it. I also found another gem, "I think that when a file transfer occurs it’s done under the AlphaUser account and then the ownership is changed on arrival."  You think do you?  Shouldn’t you KNOW?

Still in section 11, I just had to address this comment, "A default install of Ubuntu doesn’t include SMB file sharing although it’s easily enabled by adding Samba." Yes, so true, and resetting every password for all of your users so that they can access the file share. That is fun to do every time, isn’t it? Again, the rest of this paragraph talks all about Ubuntu features, which is strange for a review of Windows 7.

Section 12 is the epilogue which I wish I had read first so that I didn’t waste my time feeling compelled to write this commentary. "Windows 7 beta seemed relatively stable but I wasn’t really installing much or putting it under continuous use." Yes, I can tell. You haven’t used it at all.

"I had a lot more problems with the initial release of Vista." Fair enough, it just happens to be the opposite experience I had. In fact, I have had almost no issues, at all. On what many would consider a more unstable configuration: I upgraded from Vista.

"I did manage to crash Explorer a few times without trying but this is a "beta" which is the equivalent to an "alpha" for most other software projects." WOW, did you use this thing at all? This "beta" is more like an RC3 for most other software project. I installed Win7 a month ago, on my ONLY computer. Not this VM in which you tested it. I use it every day, and it is the ONLY computer I use. I do 100% of all of my work on it.

"This is the reason why many system administrators wait until the first Windows service pack before mass deployments." No they won’t. They will flock to it because its far better than Vista.

"Some readers may get the impression that I’m against commercial software or closed-source." And he proceeds to give reasons why he is objective. I’ll never consider you objective. But I’ll definitely consider you looney and nuts and wacco.

Finally, my own comments: "Reviews" like this aren’t reviews at all. They are comparisons, and they are not valid comparisons. they provide absolutely no value to anyone. They portrait Linux as better. I love Linux. I use Linux daily — in a server environment. Comparisons like this suggest that Linux doesn’t need to improve or play catch up to Windows. I run Windows on my primary use computer laptop, the one I spend 10+ hrs a day at, because it is just plain better. Linux is better in so many ways, ways that this article touts. But Windows is also better in many ways. Depending on how you use your computer determines which ways are most important to you and which is a better choice. I think I just defined pragmatic in there.