Entries Tagged 'Linux' ↓

Problems with suexec/fastcgid and virtualmin

Since a few version of virtualmin I had some problems with checking the server configuration.

Virtualmin 3.72.gpl_webmin_error

The problem is that I have manually patched suexec and the php fcgid script is in /var/www and not /home.

I had this error for quite a while but last week I fixed it. It was quite simple. Just change this code in “/usr/share/webmin/virtual-server/feature-web.pl:

# Make sure home base is under base directory, or template CGI directory is
if ($tmpl->{'web_suexec'} && $suhome &&
!&same_file($suhome, $home_base) &&
!&is_under_directory($suhome, $home_base) &&
(!$cgibase || !&is_under_directory($suhome, $cgibase))) {
return &text('check_ewebsuexechome',
"<tt>$home_base</tt>", "<tt>$suhome</tt>");
}

<p style="text-align: left;">return undef;
}

To:

# Make sure home base is under base directory, or template CGI directory is
return undef;
if ($tmpl-&gt;{'web_suexec'} &amp;&amp; $suhome &amp;&amp;
!&amp;same_file($suhome, $home_base) &amp;&amp;
!&amp;is_under_directory($suhome, $home_base) &amp;&amp;
(!$cgibase || !&amp;is_under_directory($suhome, $cgibase))) {
return &amp;text('check_ewebsuexechome',
"&lt;tt&gt;$home_base&lt;/tt&gt;", "&lt;tt&gt;$suhome&lt;/tt&gt;");
}  return undef;
}

So just add “return undef;” to the top of that piece of code. Then it will step out of the function before the additional check is executed.

# Make sure home base is under base directory, or template CGI directory is
if ($tmpl->{‘web_suexec’} && $suhome &&
!&same_file($suhome, $home_base) &&
!&is_under_directory($suhome, $home_base) &&
(!$cgibase || !&is_under_directory($suhome, $cgibase))) {
return &text(‘check_ewebsuexechome’,
“<tt>$home_base</tt>”, “<tt>$suhome</tt>”);
}
return undef;
}

Battling spam

We got a lot of complaints about legitimate mails being marked as spam and therefore not being delivered to our customers.  As a solution I wanted the mails to be delivered to the user’s .SPAM folder.

These is the configuration I decided on:

/etc/amavis/conf.d/20-debian_defaults:

$final_spam_destiny       = D_PASS;

/etc/maildroprc:

# Global maildrop filter file

# Uncomment this line to make maildrop default to ~/Maildir for
# delivery- this is where courier-imap (amongst others) will look.
DEFAULT="$HOME/Maildir"
SHELL="/bin/bash"
MAILDIRMAKE=`which maildirmake`
logfile "/var/log/maildrop.log"

`test -d $HOME/Maildir/.SPAM`
if ( $RETURNCODE == 1 )
{
`$MAILDIRMAKE -f SPAM $HOME/Maildir`
`echo INBOX.SPAM &gt;&gt; $HOME/Maildir/courierimapsubscribed`
}

if ( /^X-Spam-Status: Yes/ )
{
to "$HOME/Maildir/.SPAM/"
}

/etc/roundcube-webmail/main.inc.php:

// store spam messages in this mailbox
$rcmail_config['junk_mbox'] = 'SPAM';

// display these folders separately in the mailbox list.
// these folders will automatically be created if they do not exist
$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'SPAM', 'Trash');

Delete all the old Junk-folders:

rm -r /home/*/Maildir/.Junk
rm -r /home/*/homes/*/Maildir/.Junk

To make it extra nice:
/etc/amavis/conf.d/50-user:

use strict;

#
# Place your configuration directives here.  They will override those in
# earlier files.
#
# See /usr/share/doc/amavisd-new/ for documentation and examples of
# the directives you can use in this file
#

#$log_level = 5;

$pax='pax';

read_hash(\%whitelist_sender, '/etc/amavis/whitelist');
read_hash(\%blacklist_sender, '/etc/amavis/blacklist');
read_hash(\%spam_lovers, '/etc/amavis/spam_lovers');

@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);

#------------ Do not modify anything below this line -------------
1;  # ensure a defined return

And:

touch /etc/amavis/whitelist
touch /etc/amavis/blacklist
touch /etc/amavis/spam_lovers

And restart amavis:

/etc/init.d/amavis restart

Transmission daemon on Ubuntu (part 2)

A while ago I blogged about installing the transmision bittorent client on ubuntu 8.10. Back then, in the days, you had to install transmission and install your own daemon script. But as of Ubuntu 9.04 there’s a package for it!

As easy as:

sudo aptitude install transmission-daemon

Be careful! The paths for the config file and the torrent files are changed. So backup before installing this because you may lose data (like me :( ).

Crontab command problems

crontabI recently had some problems with using the crontab command on two of my servers. Don’t know how it happened, but here are two links that solved my problem:

http://ubuntuforums.org/showthread.php?t=625184
http://ubuntuforums.org/showpost.php?p=3907857&postcount=4

Burning from the commandline

cdrecord logoI download a Debian Sid livecd on my home server/HTPC and there’s a cd burner in there. So I would like to burn the downloaded iso. There no X Server running (yet) on the box so I was searching for a nice commandline utility.

I found cdw and it really looked nice so I installed it:

aptitude install cdw

After running it with “cdw” it detected my cd-writer so no configuration needed: nice. Because I once tried mybashburn (or something like that) and that piece of software needed all kinds of configuration. And I don’t like that.

I wanted to burn the debian sid iso with cdw but I couldn’t find an option for doing so. After some searching I found out that I had to go to “preferences” and change the value of “Default image file”. WTF? That’s not very nice I thought. But I tried it. But a no-go. The path to my iso was to long to fit in the box. So I couldn’t even select it.

Don’t get me wrong: cdw IS nice for burning music cd’s or just some files to backup. But isos…. pfff

So I resorted to cdrecord. It’s got a bit of a “hacker” feeling to it but it did the job nicely:

cdrecord driveropts=burnfree /home/leon/debian-live-sid-amd64-xfce-desktop.iso

What I don’t understand is why I have to manually enable burnfree. I mean: the last 5 cdr drives I had, all had burnfree. I’m doubting if they even make cd recorders without burnfree. So why not make it the default? Because apparently “Maybe it causes problems with *some* drives withput burn-free support”. Hja, retards.

But there might be a solution to this problem. Cdrecord checks for “/etc/cdrecord.conf”. And there you can change the default cdrecord parameters. My “/etc/cdrecord.conf” now contains:

driveropts=burnfree

But if it’s correct of if it works: I don’t know. I haven’t yet tested it.

Installing Transmission daemon on Ubuntu

I wanted to install the transmission torrent daemon on my new HTPC server so I can upload a torrent and go to sleep without having to leave my laptop on. Or thinking about starting transmission when my computer (re)boots. So here’s how I installed transmission.

aptitude install transmission
wget http://www.vanutsteen.nl/wp-content/uploads/2008/12/transmission-daemon -O /etc/init.d/transmission-daemon
chmod +x /etc/init.d/transmission-daemon
adduser --home /dev/null --shell /bin/false --no-create-home --disabled-login transmission
mkdir /etc/transmission
chown transmission:transmission -R /etc/transmission
update-rc.d transmission-daemon defaults

And then make sure your “/etc/default/transmission-daemon” looks something like:

TRANSMISSION_HOME=/etc/transmission

# The folder where Transmission stores downloads
TORRENTFOLDER=/media/sda11/downloads

# The port Transmission uses to connect to other peers
PORT=54318

# The name of the user that should run Transmission
USERNAME=transmission

# Login credentials for the Web- and the RPC-interface
REMOTE_USER=admin
REMOTE_PASS=password

You can not visit the daemon on: http://localhost:9091/transmission/web/

Here’s a nice screenshot:

MythTV vs. Freevo vs. XBMC vs. Mediaportal vs. Elisa vs. Boxee vs. Entertainer

I’ve been browsing for what media centre software to install on a htpc. But there are so many choices! Just to name a few:

And they all look great! I’m gonna try to review them all and post the results here.

Follow up:
I've written a new post on this

Flash player 10 with 64 bit support (Alpha)

I’m so tired that Firefox keeps crashing with every shitty Flash movie out there. But… today I read an alpha version of Flash Player 10 with 64 bit suppport (for Linux) is out. Click the link and download the archive an install it (drop flashplayer.so in ~/.mozilla/plugins).

And so far (*knock *knock) I haven’t had A SINGLE CRASH. And all movies I’ve seen so far look ok!

Ow, before installing the version from Adobe, make sure you’ve uninstalled the Ubuntu flash plugin with:

sudo aptitude remove flashplugin-nonfree nspluginwrapper

Good job Adobe! And I’ve ordered a book on Flex which should arive any day now so I’m totally into Adobe now :)

df reporting 100% disk usage

I’ve had a couple of times now that on one of my computers df keeps reporting 100% disk usage. Until now I have resolved this issue by rebooting. But today this happened on one of our servers. And I was reluctant to boot and I had to solve it fast because mysql was down.

After some searching I found that it was because of a process keeping a hold of some deleted files. So after shuttding down some processes I found the right one and df reported a dropping disk usage %. After starting mysql again we were back up again.

Compiling jruby from source in Ubuntu Intrepid Ibex


Very easy to do:

sudo aptitude install ant openjdk-6-jdk
cd ~/src
svn co http://svn.codehaus.org/jruby/trunk/jruby/
cd jruby
ant
bin/jruby --version