1

we're currently using pushover, to send messages to our Servicedesk, when our Monitoring finds Errors within our systems.

Our system collects the data, creates a message, and then sends the needed arguments to a perl script:

use LWP::UserAgent;
use Getopt::Std;

my %opts=();

my $curPath=$ENV{PATH};
$ENV{PATH} = $curPath.";Perl_Path";


getopts('t:u:m:p:', \%opts) or abort("No options given\n"); 

if (defined $opts{t}) {
  $APP_TOKEN=$opts{t};
}
if (defined $opts{u}) {
  $USER_KEY=$opts{u};
}
if (defined $opts{m}) {
  $MESSAGE=$opts{m};
}
if (defined $opts{p}) {
  $PRIO=$opts{p};
}

my $ua=LWP::UserAgent->new(timeout => 10);
my $response = $ua->post( 
  "https://api.pushover.net/1/messages.json", [
  "token" => "$APP_TOKEN",
  "user" => "$USER_KEY",
  "message" => "$MESSAGE",
  "priority" => "$PRIO"
]);

if ($response->is_success) {
    print $response->decoded_content;
}
else {
    die "HERE: ".$response->status_line;
}

This seemingly worked fine until yesterday when our servicedesk noticed, that no message were send anymore.

By executing the script with a dummy message, I reveive the following Error Message after the script dies:

Here: 500 can't connect to api.pushover.net:443 <invalid argument>

I have tried contacting pushover, but they have not been quite as helpful as I hoped they would be. As we didnt change anything about the way we send those messages, I presume something pushover did caused this problem.

Does anybody know why LWP::Useragent might send "invalid Argument" messages? Since I can't seem to find a lot of information online. We did open our firewalls for 2 IPs to be accessed for this, but replacing the hostname with those IP Addresses instead brought up the following Error:

Here: 500 can't connect to api.pushover.net:443 <Bad File Descriptor>

Edit: We are using a strawberry perl Installation for Windows

I kindly ask for advice on a fix for this problem. Thank you in advance.

RhoGu
  • 11
  • 3
  • Which version of LWP are you running? `$ perl -MLWP::UserAgent\ 9` will tell you. // 'Can't connect' sounds like https://metacpan.org/source/OALDERS/libwww-perl-6.53/lib/LWP/Protocol/http.pm#L37, but that's a different format and neither of your two outputs are in this list in the current LWP::UA. Did you update parts of your Perl modules, but not others? Could be a version mismatch in your dependencies. – simbabque Mar 31 '21 at 11:04
  • It seems the command you posted to extract the version is not working for my strawberry perl on Windows. But we did not change anything about the system/perl or the script anyway, so I dont think that is the reason. – RhoGu Mar 31 '21 at 11:48
  • That command includes a backslash and a space. It will complain about the version being to low, and tell you which version it is. The `$` isn't part of the command, that's a convention to show that it's a command line. – simbabque Mar 31 '21 at 11:51
  • Command line returns: Can't open perl script "9": no such file or directory – RhoGu Mar 31 '21 at 12:11
  • 1
    @RhoGu Try `perl -MLWP::UserAgent -e "print $LWP::UserAgent::VERSION"` instead; should work better on Windows. – Dada Mar 31 '21 at 13:03

1 Answers1

0

IT seems that Pushover migrated their API to different IP addresses in order to counteract a DDoS attack on it.

Since our firewall was only configured to allow traffic to the old addresses, our System was unable to send messages to the IP.

Why LWP::Useragent flagged this as "invalid arguments" is currently beyond me, but the problem at hand is currently solved.

RhoGu
  • 11
  • 3