Re: mj_create_list fails with postfix

Duncan Cunningham <[email protected]> Wed, 08 Oct 2008 10:47:22 -0500
Newsgroups gmane.mail.majordomo.general
Message-ID <[email protected]>
I did some poking around and found that postfix will take a -bv but the 
output of the command is emailed to the user who ran the command, rather 
than outputted to stdout.  So there is no way the mj_create_list script 
could get the output of the command.  Thank you for your help, and I 
will try to see if I can find another way to look up an address with 
postfix.

Duncan Cunningham

Daniel Liston wrote:
> I have never used majorcool, but I did experiment with it late in the 
> 20th
> century.  :)
>
> I think the problem is/was that majorcool is older than most replacements
> for sendmail so does not have logic to support them.  Even sendmail 
> itself
> has added so many security enhancements, that sendmail -bv does not 
> return
> the same results for different users.
>
> "sendmail -bv $list" if executed from the command line produces different
> results based on the uid executing the command and whether or not the 
> value
> of $list is a local or fully qualified email address.  On Fedora 8 as 
> root;
>
>> 19:05:30 [root mqueue]# sendmail -bv dliston
>> dliston... deliverable: mailer local, user dliston
>> 19:05:40 [root mqueue]# sendmail -bv [email protected]
>> [email protected]... deliverable: mailer relay, host mail.sonny.com, 
>> user [email protected]
>
> The same commands as dliston (a TrustedUser), and member of the mail 
> group;
>
>> 19:09:21 [dliston ~]$ sendmail -bv dliston
>> Notice: -bv may give misleading output for non-privileged user
>> can not chdir(/var/spool/mqueue/): Permission denied
>> Program mode requires special privileges, e.g., root or TrustedUser.
>> 19:09:32 [dliston ~]$ sendmail -bv [email protected]
>> Notice: -bv may give misleading output for non-privileged user
>> can not chdir(/var/spool/mqueue/): Permission denied
>> Program mode requires special privileges, e.g., root or TrustedUser.
>
> Based on the above, I have a feeling that even if I install majorcool on
> a system that uses sendmail, the mj_create_list routine might need to be
> tweaked.
>
> On my system, I changed the 700 permission to 750 on /var/spool/mqueue
> and added myself and majordomo to the mail and smmsp groups to finally
> get reasonable output from the sendmail -bv <address> command.  You might
> have to do something similar for postfix.  The object of the sendmail -bv
> is to verify an address exists.  In the case of creating a list, this
> logic is reversed to make sure you are NOT attempting to create an 
> address
> that already exists before actually creating it.
>
> If sendmail -bv $list results in $list... deliverable, the address 
> already
> exists and you should get a squawk.  If the result is $list... User 
> unknown,
> the routine should continue and create the new list.
>
> That is about as far as I can go to help with postfix or majorcool.
>
> Sorry,
> Dan Liston
>
>
> Duncan Cunningham wrote:
>> $sendmail_command is defined as /usr/sbin/sendmail.  
>> /usr/sbin/sendmail is a symlink to /usr/sbin/mailwrapper.  The 
>> mailwrapper allows programs to use postfix as if it were sendmail.  
>> mailer and bounce_mailer variables are defined as :
>>
>> $mailer = "$sendmail_command -oi -oee -f\$sender";
>> $bounce_mailer = "$sendmail_command -oi -oee -f\$sender -t";
>>
>> Lastly, I am trying to use the create list function with majorcool.
>>
>> Duncan Cunningham
>>
>> Daniel Liston wrote:
>>> Hi Duncan,
>>>
>>> $sendmail_command is defined in the majordomo.cf file.  Is yours 
>>> pointed to
>>> postfix?  Also of interest are the $mailer definition and comments.
>>>
>>> # $sendmail_command -- Pathname to the sendmail program
>>> #                      usually /usr/lib/sendmail, but some newer BSD 
>>> systems
>>> #                      seem to prefer /usr/sbin/sendmail
>>> #
>>> # $sendmail_command = "/usr/lib/sendmail";
>>> $sendmail_command = "/usr/sbin/sendmail";
>>>
>>> # $mailer -- What program and args do I use to send mail to the list?
>>> # $bounce_mailer -- What is used to send mail anywhere else?
>>> # The variables $to, $from, $subject, and $sender can be 
>>> interpolated into
>>> # this command line.  Note, however, that the $to, $from, and $subject
>>> # variables may be provided by the person sending mail, and much 
>>> mischief
>>> # can be had by playing with this variable.  It is perfectly safe to 
>>> use
>>> # $sender, but the others are insecure.
>>> #
>>> # Sendmail option -oi:  Do not take a . on a line by itself as the 
>>> message
>>> #                       terminator.
>>> # Sendmail option -oee: Force sendmail to exit with a zero exit 
>>> status if
>>> #                       if it's not going to give useful information.
>>> #
>>> $mailer = "$sendmail_command -oi -oee -f\$sender";
>>> $bounce_mailer = "$sendmail_command -oi -oee -f\$sender -t";
>>>
>>> # You can special case the mailer used to deliver outbound mail as 
>>> follows:
>>> #
>>> # To use TLB and use no outgoing alias:
>>> # if ($main'program_name eq 'mj_resend' && $opt_l eq 'test-list') {
>>> #   $mailer = "/usr/local/majordomo/tlb /usr/local/lists/${opt_l}.tlb";
>>> # }
>>> #
>>> # To use a different Sendmail queue for this list's mail:
>>> # if ($main'program_name eq 'mj_resend' && $opt_l eq 'test-list') {
>>> #   $mailer = "$sendmail_command -oQ /var/spool/listq -f\$sender";
>>> # }
>>>
>>> Lastly, are you using the create list function of majorcool with 
>>> majorcool,
>>> or are you trying to use it as in independent application?  If the 
>>> latter,
>>> you might be interested in trying out a script I wrote a few years 
>>> back at;
>>>
>>>    ftp://ftp.ccsf.org/majordomo-contrib/listadd5.pl.gz
>>>
>>> Dan Liston
>>>
>>> Duncan Cunningham wrote:
>>>> Hi,
>>>>
>>>> I am trying to get the mj_create_list script from majorcool working 
>>>> with majordomo.  When I try to create a list through majorcool 
>>>> using the script, it errors out saying: Checking for existing 
>>>> aliases... address '$list' already exists.  It doesn't matter what 
>>>> I call the list, it will fail.  I did some poking around in the 
>>>> script and the following line causes the failure.
>>>>
>>>> &squawk("address '$list' already exists")
>>>>                unless system("$sendmail_command -bv $list 
>>>> >/dev/null");
>>>>
>>>> We are using postfix for mailing and from what I can tell, postfix 
>>>> will return 0 whether $list exists or not, causing the squawk 
>>>> command to always execute.  Anyone have any ideas of how I can get 
>>>> this working with postfix?
>>>>
>>>> Thanks,
>>>> Duncan Cunningham
>>>>
>>
>>