Mark Foster wrote:
Same issue here...running exim as mailnull...
# su mailnull -c spfd -path=/tmp/spfd
This account is currently not available.
I suppose that running spfd then subsequently chown-ing it to mailnull
should work, but then it's still running as root.
The patch below may not be perfect, but it does set the user and group
down when you start as root and supply the right arguments.
TMTOWTDI
--Jonathan Steinert
--- spfd Tue Dec 16 11:43:27 2003
+++ spfd Tue Dec 16 12:02:06 2003
@@ -14,12 +14,13 @@
use Mail::SPF::Query;
use Socket;
+use POSIX qw(setuid setgid);
use strict;
-use vars qw($port $path);
+use vars qw($port $path $group $user);
sub usage () {
- print "usage: spfd ( -port=5970 | -path=/var/spfd )\n";
+ print "usage: spfd ( -port=5970 | -path=/var/spfd )
[-user=(uid|username)] [-group=(gid|groupname)]\n";
print "usage: spfd assuming -port=5970\n";
}
@@ -33,6 +34,20 @@
if ($port and $path) {
usage;
exit 1;
+}
+
+if ($user) {
+ if ($user =~ /\D/) {
+ $user = getpwnam($user);
+ }
+ setuid($user);
+}
+
+if ($group) {
+ if ($group =~ /\D/) {
+ $group = getgrnam($group);
+ }
+ setgid($group);
}
$|++;
-------
Sender Permitted From: http://spf.pobox.com/
Archives at http://archives.listbox.com/spf-discuss/current/
Latest draft at http://spf.pobox.com/draft-mengwong-spf-02.9.4.txt
To unsubscribe, change your address, or temporarily deactivate your subscription,
please go to http://v2.listbox.com/member/?listname(_at_)©#«Mo\¯HÝÜîU;±¤Ö¤Íµø?¡