alias 'feed to program': permission denied

6 posts / 0 new
Last post
#1 Thu, 08/14/2008 - 08:26

alias 'feed to program': permission denied


I'm having a problem figuring out how to get the 'feed to program' option working for one user's aliases. The problem seems to be that the script is in the user's home directory, which isn't readable by postfix.

Postfix can, of course, access the Maildirs. I assume this is because it changes the uid when a user logs in or when it delivers mail, which make some sense.

However, the 'feed to program' option doesn't seem to take advantage of this.

Would someone be willing to educate me on what I need to do? Here's my setup:

alias: -> 'Feed to script' -> /home/users/jsmith/domains/

[code:1] [jsmith@server ~]$ pwd /home/users/jsmith [jsmith@server ~]$ ls -lad drwxr-x--- 21 jsmith jsmith 4096 Aug 14 08:54 . [jsmith@server ~]$ cd domains/ [jsmith@server domains]$ ls -lad drwxr-xr-x 10 jsmith jsmith 4096 Aug 8 21:54 . [jsmith@server domains]$ cd [jsmith@server]$ ls -lad drwxr-x--- 12 jsmith jsmith 4096 Aug 14 00:03 . [jsmith@server]$ cd includes/ [jsmith@server includes]$ ls -la scriptname.php -rwxr-xr-x 1 jsmith jsmith 4269 Aug 14 08:59 scriptname.php [jsmith@server includes]$ [/code:1]<br><br>Post edited by: kato, at: 2008/08/14 08:27

Fri, 08/15/2008 - 07:49

C'mon, gimme some love! :)

Here's what I see in the logs:
Aug 15 09:45:48 server local[26556]: fatal: execvp /home/users/jsmith/domains/ Permission denied
Aug 15 09:45:49 server postfix/local[26521]: E8562D00ED: to=&lt;;, orig_to=&lt;;, relay=local, delay=2, status=bounced (Command died with status 1: &quot;/home/users/jsmith/domains/;. Command output: local: fatal: execvp /home/users/jsmith/domains/ Permission denied )

Anyone want to help me figure out how to make scripts run in the user's home directory?

Fri, 08/15/2008 - 09:54 (Reply to #2)

Yeah, it looks like that's being executed from within Postfix, and perhaps before being passed off to procmail.

So two thoughts.

One, you could use a procmail rule to execute it rather than using the Postfix alias -- which should execute as that user.

Second, and a bit less secure, you could make all the directories between /home/users/jsmith and /home/users/jsmith/domains/ world executable, which all allow processes to traverse your directory structure.

You can make a directory world executable by typing: chmod o+x /path/to/dir

The problem there is that anyone can now get there, not just Postfix. That said, since it's just executable and not readable, someone typing &quot;ls&quot; won't see anything.

So, procmail is the safer and more secure option. Changing the permissions may be the easier one :-)

Fri, 08/15/2008 - 10:31

Hi Eric

Thanks! So procmail...

I looked over the procmail options in webmin and decided this is beyond my skill. I'll have a looksee at what Google can teach me. Would you be willing to help me get off on the right foot?

I presume this is what I'm looking for:
[li]tell Postfix to deliver normally (to a Maildir?)[/li]
[li]switch over to webmin and go to Procmail server[/li]
[li]enter some voodoo magic in &quot;Create Action&quot;... maybe a regexp that searches for From:[/li]

Any tips on what I'm trying to do here? Check &quot;Action program is a filter&quot;? &quot;Feed headers/body to destination?&quot;

Sat, 08/16/2008 - 07:07 (Reply to #4)

Hi Kato,

Sorry, I haven't had a chance to go through and get a handle on how the procmail building works within Webmin/Usermin. So I'm just sort of thinking out loud here :-)

Yes, in theory, what you're saying above is correct... given a particular user, you'd want to make a regexp that looks for a given From address.

Also, I'm pretty sure you can give users rights to do this from within Usermin, rather than going into the Procmail server section of Webmin. Once you log into Virtualmin, click Webmin -&gt; Usermin Configuration -&gt; Available Modules, then make sure &quot;Procmail Mail Filter&quot; is there. If you want to limit who can acccess Procmail, you can use the &quot;Module Restrictions&quot; section for that.

In the end, once you configure things the way you need, it would end up adding something like this to the procmail file:

* From:.*
| /home/users/jsmith/domains/

I hope that helps in getting your started! :-)

Sat, 08/16/2008 - 07:10

Awesome, thanks.

I think I'll add that to the procmail file, then log into virtualmin and see what shows up :)

Topic locked