Tags:
create new tag
view all tags

SID-02352: Watchlistnotify sends mail to root or www-data

Status: Answered Answered TWiki version: 6.0.2 Perl version: 5.18.2
Category: CategoryPlugins Server OS: Linux3.13.0 Last update: 5 years ago

I installed the WatchlistPlugin and made a crontab as root to run watchlistnotify. But I don't recieve emails when topics are changed by ANOTHER user (it took me about two days to find out that you mustn't check Watchlistnotify with your own changes, because -so I found out- your own changes won't be mailed). In my mail.log I discovered that TWiki (Watchlistnotify) is trying to sent mail from Root to Root(user), and not to myself. What did I do wrong?

-- Emiel Van Riel - 2018-03-29

Discussion and Answer

In ~/twiki/data/warn201803.txt I found: "ERROR: Can't send mail using Net::SMTP. 5.7.0 User not authenticated".

-- Emiel Van Riel - 2018-03-29

I've not yet used that plugin myself, but here's some pointers about TWiki's mail system:

  1. From a look at the code, I can confirm that you don't get mails for your own changes. That's not a bad idea, but for clarity it should go into the plugin's documentation.
  2. The "From" information is taken from your configuration settings {WebMasterName} and {WebMasterEmail}.
  3. The "To" information is taken from the user's registration info.
  4. TWiki's mailer uses Net::SMTP where available - and in most Linux distributions it is part of the Perl core. This module doesn't write to mail.log.
  5. The error message in your warn log is what Net::SMTP has received from the SMTP server. Since all mail processes go through the same sub in TWiki, I wonder: Are there any other Mail mechanisms (registration, WebNotify) which work in your installation?

There are a couple of configuration settings relevant to the cause:

  • {SMTP}{MAILHOST} - the host to which Net::SMTP tries to deliver the mail. This host's policy decides whether you need to authenticate - and in the last few years most SMTP providers have switched to require authentication to fight spam.
  • {SMTP}{SENDERHOST} - The name of the sending system. Some SMTP providers reject mails coming from "localhost".
  • {SMTP}{Username} - A valid user name for the SMTP provider.
  • {SMTP}{Password} - The corresponding password.
  • {SMTP}{Debug} - if set to a true value, then the whole SMTP dialog (including cleartext passwords!) will be written to the log file. This can help a lot.

I've seen that some SMTP providers require SSL or TLS encryption which unfortunately isn't supported by "older" versions of Net::SMTP. Again, the service provider's policy (often provided as configuration hints for mail clients) should help.

-- Harald Jörg - 2018-03-29

Thanks Harald. Indeed I have WebNotify running, and this is working well. WebNotify sends me a notification to my e-mail adress right away after any changes (by another user). This makes me think the e-mail part is doing well.

Could this have to do with the right of users to the webs? Or to the permissions of the WatchlistPlugin directories or files in the TWiki folder?

-- Emiel Van Riel - 2018-03-29

It works now. First I disabled WatchlistPlugin in Configure, then I enabled the Plugin. Looks like it works fine now.

-- Emiel Van Riel - 2018-03-29

If WebNotify works, then we can indeed forget about problems with the email settings. And since your cron entry runs as root, file system permissions shouldn't be an issue either. So far, the main suspect is the watchlistnotify script.

A way to split the problem in half would be to get watchlistnotify running from the command line, this provides more verbose output. Maybe the mail to root was cron's way of telling you that something went wrong? Do you have access to the content of this mail?

BTW: The WatchlistPlugin has its own debug settings under {Plugins}{WatchlistPlugin}{Debug}: If you set it to a true value, then the log contains some more information, e.g. the complete email text (including To: address).

-- Harald Jörg - 2018-03-29

Oops... forget what I wrote... I didn't catch your recent info.

-- Harald Jörg - 2018-03-29

I'm sorry, but I cheered to early. Watchlistnotify seems to work SOMETIMES, but not all the time. With the digest option, the cronjob gives an error: "Use of uninitialized value $tag in lc at /var/www/mydomain.com/twiki/lib/TWiki/I18N.pm line 64." And the WARNdate.txt file in ../twiki/data gives: " | 2018-04-04 - 09:16:40 | ERROR: Can't send mail using Net::SMTP. 5.7.0 User not authenticated ". It also gives several warnings: " Attempt to read meta data failed: AccessControlException: Access to VIEW Main.twikiuser for BaseUserMapping_666 is denied. toegang tot web niet toegestaan" Where should I look to solve this?

(I also get sometimes the errormessage of SID-02175 "Insecure dependency in sysopen while running with -T switch at /var/www/mydomain,com/twiki/lib/CGI/Session/Driver/file.pm line 107." I don't know if this is related.)

-- Emiel Van Riel - 2018-04-04

Thanks for the diagnostic info! I have some more infos and guesses (As I wrote, I am not familiar with that plugin):

  • The warning Use of uninitialized value $tag in lc... is just a harmless but annoying warning and has been fixed after 6.0.2 came out.
  • The message Can't send mail using Net::SMTP. 5.7.0 User not authenticated is really strange because as far as I can see all mails go through the same process - I have no idea why the user would not be authenticated "sometimes".
  • The AccessControlException says that a TWiki guest has tried to access Main.twikiuser which is strange. Do you have a file data/Main/twikiuser.txt in your installation? In any case, though it looks like an error, it is only a warning - the meta data are simply ignored in that case.
  • The error message of SID-02175 is really annoying but has resisted any attempt to track it down so far. It happens in some cases when TWiki throws away a session it considers "invalid" - but watchlist actions or scripts running from cron shouldn't establish a session at all.

So, I only can ask you to activate TWiki's debugging in configure by setting {Plugins}{WatchlistPlugin}{Debug} and {SMTP}{Debug} to 1, and then examine the log files whether you spot a difference between mails that work and mails that don't.

-- Harald Jörg - 2018-04-12

I finally got it working! I think that during my search for a solution I changed something in my host settings. I started up front with testing Postfix and SendEmailPlugin, and finally I got everything working. Good to see that the warning Use of uninitialized value $tag in lc... has been fixed. The AccessControlException for TWiki guest to access Main.twikiuser I will find out later, but this is not appropriate for this support question. And I hope the error message of SID-02175 can be solved in the future (but I am not able to do such things).

-- Emiel Van Riel - 2018-04-13

This seems to be related to TWikibug:Item7228: Switchboard configuration for sendemail is never copied into LocalSite.cfg

-- Peter Thoeny - 2018-04-19

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Watchlistnotify sends mail to root or www-data
SupportCategory CategoryPlugins
TWiki version 6.0.2
Server OS Linux3.13.0
Web server Apache 2.4.7
Perl version 5.18.2
Browser & version Firefox 59.0
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2018-04-19 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.