Todd Smith Org

March 21, 2009

Sendmail and smrsh nightmares

Filed under: Server Technology — admin @ 7:52 pm

I spent a good hour or almost at least trying to figure this out. What a pain….

Basically, I was trying to setup the ability for Ubersmith to receive mails to the alias that they have you create during installation. For most installations this should probably be pretty straight forward:

But I kept getting this error in my mail.log file:

Mar 22 01:37:38 support smrsh: uid 25: attempt to use “php -q -f /vhosts/support.domain.dom/htdocs/cron/gateway.php support.domain.dom 1″ (stat failed)
Mar 22 01:37:38 support sm-mta[22733]: n2M1aRGF022722: to=”|php -q -f /vhosts/support.domain.dom/htdocs/cron/gateway.php support.domain.dom 1″, ctladdr= (25/0), delay=00:00:36, xdelay=00:00:00, mailer=prog, pri=13679, dsn=5.0.0, stat=Service unavailable
Mar 22 01:37:38 support sm-mta[22733]: n2M1aRGF022722: n2M1bcGG022733: DSN: Service unavailable

Here’s our mail alias:

support: “|php -q -f /vhosts/support.domain.dom/htdocs/cron/gateway.php support.domain.dom 1″

So the usual solution would be to do the following:

cd /etc/mail
ln -s /path/to/php php

However, that wasn’t working…. Most likely because my php executable is not in some search path for smrsh.

Finally I discovered this /usr/adm/sm.bin!

root@support:/usr/adm/sm.bin# strings `which smrsh` | grep usr
/usr/adm/sm.bin
/bin:/usr/bin:/usr/ucb
root@support:/usr/adm/sm.bin#

Well, what have we here? /usr/adm/sm.bin looks a little foreign to me.
Obviously the second line is my hard-coded path, which it looks like smrsh thought it was on a sun platform during compile time, but whatever….

So let’s have a look at the docs… They read…

If your platform doesn’t have a default SMRSH_CMDDIR setting, you will
next need to create the directory /usr/adm/sm.bin and populate
it with the programs that your site feels are allowable for sendmail
to execute. This directory is explicitly specified in the source
code for smrsh, so changing this directory must be accompanied with
a change in smrsh.c.

Let me try that. It’s worth a shot.

mkdir -p /usr/adm/sm.bin
cd !$
ln -s /opt/bin/php
ls -aFl

root@support:/usr/adm/sm.bin# ls -aFl
total 0
drwxr-xr-x 2 root root 72 Mar 21 18:39 ./
drwxr-xr-x 3 root root 72 Mar 21 18:38 ../
lrwxrwxrwx 1 root root 24 Mar 21 18:39 php -> /opt/bin/php*
root@support:/usr/adm/sm.bin#

Now my mail.log looks a little bit more like expected….

Mar 22 02:47:44 support sm-mta[23613]: n2M2jvox023571: to=”|php -q -f /vhosts/support.domain.dom/htdocs/cron/gateway.php support.domain.dom 1″, ctladdr= (25/0), delay=00:01:12, xdelay=00:00:01, mailer=prog, pri=5357, dsn=2.0.0, stat=Sent

I hope you found this helpful

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress