Collecting mails not dependable

Moderator: crythias

Locked
SultanOfSwing
Znuny newbie
Posts: 22
Joined: 06 Nov 2013, 18:30
Znuny Version: 4.0.10
Real Name: Fabian
Company: Company

Collecting mails not dependable

Post by SultanOfSwing »

Hi,

our new OTRS-server has started to act up in the way that it won't collect mails in a reliable fashion. I've looked through the log in /var/log/messages in order to get a clue what is wrong but so far I haven't found anything.

I finally cought something a few weeks ago but clicked the error message away because the is a bit of a user inside me. :-) While manually collecting mails today the little unicorn of error messages returned:

Code: Select all

Backend ERROR: OTRS-CGI-21 Perl: 5.14.2 OS: linux Time: Fri Apr 25 09:58:14 2014 Message: Invalid Challenge Token! RemoteAddress: *HappyClientIP-Address* RequestURI: /otrs/index.pl?Action=AdminMailAccount;Subaction=Run;ID=1;ChallengeToken=*HappyToken*; Traceback (10237): Module: Kernel::Output::HTML::Layout::ChallengeTokenCheck (OTRS 3.3.4) Line: 1156 Module: Kernel::Modules::AdminMailAccount::Run (OTRS 3.3.4) Line: 57 Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.4) Line: 863 Module: /opt/otrs/bin/cgi-bin/index.pl (unknown version) Line: 41
Normally I would also suspect our Exchange server to be the culprit since it has been a bit twitchy lately but our other two OTRS instances have shown no similar errors. The other thing is, that today the error came again and again when I wanted to pull mails from the server until I went into the mail settings and just pressed save without changing anything.

Since not all of you have crystal balls, here is a bit of information about the OTRS server and its environment:

-OS: Debian 7.4 (VM on an ESXi Host)
-OTRS 3.3.4
-mail-config:
--mail-Inbox hosted on an Exchange 2010 Server
--mails are being collected using IMAPS
--cronjob is configured to collect mails every 2 minutes

I also frequently get the error message that the scheduler is not running. According to our OTRS consultant I should not worry about it.


I'm grateful for any insights you guys might have on this. If I have left something out, tell me!


Best regards

Fabian
-
OTRS 3.3.8
MySQL 5.5
Debian 7.4 64bit
FAQ- + Support-Package
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Collecting mails not dependable

Post by crythias »

Kernel/Output/HTML/Layout.pm:

Code: Select all

sub ChallengeTokenCheck {
    my ( $Self, %Param ) = @_;

    # return if feature is disabled
    return 1 if !$Self->{ConfigObject}->Get('SessionCSRFProtection');

    # get challenge token and check it
    my $ChallengeToken = $Self->{ParamObject}->GetParam( Param => 'ChallengeToken' ) || '';

    # check regular ChallengeToken
    return 1 if $ChallengeToken eq $Self->{UserChallengeToken};

    # check ChallengeToken of all own sessions
    my @Sessions = $Self->{SessionObject}->GetAllSessionIDs();
    for my $SessionID (@Sessions) {
        my %Data = $Self->{SessionObject}->GetSessionIDData( SessionID => $SessionID );
        next if !$Data{UserID};
        next if $Data{UserID} ne $Self->{UserID};
        next if !$Data{UserChallengeToken};

        # check ChallengeToken
        return 1 if $ChallengeToken eq $Data{UserChallengeToken};
    }

    # no valid token found
    if ( $Param{Type} && lc $Param{Type} eq 'customer' ) {
        $Self->CustomerFatalError(
            Message => 'Invalid Challenge Token!',
        );
    }
    else {
        $Self->FatalError(
            Message => 'Invalid Challenge Token!',
        );
    }
It appears that the user ID=1 is invalid or not the user running the mailaccount.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SultanOfSwing
Znuny newbie
Posts: 22
Joined: 06 Nov 2013, 18:30
Znuny Version: 4.0.10
Real Name: Fabian
Company: Company

Re: Collecting mails not dependable

Post by SultanOfSwing »

Hi,

thanks for the quick reply!

Since OTRS can fetch mails without changing the configuration most of the time, I think we can rule that one out. And yes there is also an Active Directory user behind the Inbox.

And it can't be that OTRS is pulling mail too oftne from the server otherwise the account would just get locked automatically. At least that is what usually happens when Android devices try to log on using a wrong password (apperantly Android devices have a very high retry cycle). There is also no mention of it in the EventLogs.
OTRS 3.3.8
MySQL 5.5
Debian 7.4 64bit
FAQ- + Support-Package
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Collecting mails not dependable

Post by crythias »

The error message seems to indicate the error originates from the web module. (At least, that's what it looks like at first glance.) So, it *feels* like someone's pressing "Fetch Mail".
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SultanOfSwing
Znuny newbie
Posts: 22
Joined: 06 Nov 2013, 18:30
Znuny Version: 4.0.10
Real Name: Fabian
Company: Company

Re: Collecting mails not dependable

Post by SultanOfSwing »

Guess I made a mess out of expressing myself!

The error occurs when I press the "fetch mail" button. But OTRS also fails to collect mails on its own and it does that sporadically. To be precise, I was hoping that there would be a connection between these two incidents.
OTRS 3.3.8
MySQL 5.5
Debian 7.4 64bit
FAQ- + Support-Package
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Collecting mails not dependable

Post by crythias »

SultanOfSwing wrote:OTRS also fails to collect mails on its own and it does that sporadically
How can you tell? What happens?

"fails to collect mails on its own" -- If you stopped there, I'd assume problems with the scheduler.
SultanOfSwing wrote:I also frequently get the error message that the scheduler is not running. According to our OTRS consultant I should not worry about it.
If mail is collected on a schedule, it would be interesting to know if the failure to collect mail coincides with scheduler not running.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SultanOfSwing
Znuny newbie
Posts: 22
Joined: 06 Nov 2013, 18:30
Znuny Version: 4.0.10
Real Name: Fabian
Company: Company

Re: Collecting mails not dependable

Post by SultanOfSwing »

I can tell that it is not working bcause I get calls every now and then by people who tell me that they hav written an email to our ticket system a couple of hours ago without an answear. When I subsequently fetch the mails by using the button in the admin interface I get a bunch of new mails.


Is there another way to set the fetchmail proccess on motion? I always thought that it was just using cronjobs.
OTRS 3.3.8
MySQL 5.5
Debian 7.4 64bit
FAQ- + Support-Package
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Collecting mails not dependable

Post by crythias »

SultanOfSwing wrote:Is there another way to set the fetchmail proccess on motion? I always thought that it was just using cronjobs.
I don't believe you've set up cronjobs to properly function.

If it has been literally hours between fetches, your crontab would not be obeyed.

crontab -l -u otrs
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
SultanOfSwing
Znuny newbie
Posts: 22
Joined: 06 Nov 2013, 18:30
Znuny Version: 4.0.10
Real Name: Fabian
Company: Company

Re: Collecting mails not dependable

Post by SultanOfSwing »

The cronjobs seem right. The cron daemon is also running. The list of cronjobs for the otrs user goes as follows:

Code: Select all

# --
# cron/aaa_base - base crontab package
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# Who gets the cron emails?
MAILTO="root@localhost"
# --
# cron/cache - delete expired cache
# Copyright (C) 2001-2010 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# delete expired cache weekly (Sunday mornings)
20 0 * * 0  $HOME/bin/otrs.DeleteCache.pl --expired >> /dev/null
30 0 * * 0  $HOME/bin/otrs.LoaderCache.pl -o delete >> /dev/null
# --
# cron/fetchmail - fetchmail cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# fetch every 5 minutes emails via fetchmail
#*/5 * * * * [ -x /usr/bin/fetchmail ] && /usr/bin/fetchmail -a >> /dev/null
#*/5 * * * *    /usr/bin/fetchmail -a --ssl >> /dev/null
# --
# cron/generic_agent - otrs.GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2012 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# generate dashboard stats every hour
*/5 * * * *    $HOME/bin/otrs.GenerateDashboardStats.pl >> /dev/null
# --
# cron/generic_agent - otrs.GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2012 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 20 minutes
*/20 * * * *    $HOME/bin/otrs.GenericAgent.pl >> /dev/null

# example to execute otrs.GenericAgent.pl on 23:00 with
# Kernel::Config::GenericAgentMove job file
#0 23 * * * $HOME/bin/otrs.GenericAgent.pl -c "Kernel::Config::GenericAgentMove" >> /dev/null
# --
# cron/generic_agent - otrs.GenericAgent.pl cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# start generic agent every 10 minutes
*/10 * * * *    $HOME/bin/otrs.GenericAgent.pl -c db >> /dev/null
# --
# cron/pending_jobs - pending_jobs cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# check every 120 min the pending jobs
45 */2 * * *    $HOME/bin/otrs.PendingJobs.pl >> /dev/null
# --
# cron/postmaster - postmaster cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# check daily the spool directory of OTRS
10 0 * * *  $HOME/bin/otrs.ReprocessMails.pl >> /dev/null
# --
# cron/postmaster_mailbox - postmaster_mailbox cron of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# fetch emails every 10 minutes
*/10 * * * *    $HOME/bin/otrs.PostMasterMailbox.pl >> /dev/null
# --
# cron/rebuild_ticket_index - rebuild ticket index for OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# just every day
01 01 * * * $HOME/bin/otrs.RebuildTicketIndex.pl >> /dev/null
# --
# cron/session - delete old session ids of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# delete every 120 minutes old/idle session ids
55 */2 * * *    $HOME/bin/otrs.DeleteSessionIDs.pl --expired >> /dev/null
# --
# cron/unlock - unlock old locked ticket of the OTRS
# Copyright (C) 2001-2009 xxx, http://otrs.org/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

# unlock every hour old locked tickets
35 * * * *  $HOME/bin/otrs.UnlockTickets.pl --timeout >> /dev/null
But just for the record: Thanks so far!
OTRS 3.3.8
MySQL 5.5
Debian 7.4 64bit
FAQ- + Support-Package
Locked