Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Nov 1, 2024
2 parents 87db1c7 + 97d6e27 commit faa7ead
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 2 deletions.
24 changes: 24 additions & 0 deletions bin/check-endpoints
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env perl

use strict;
use warnings;
use v5.14;

BEGIN {
use File::Basename qw(dirname);
use File::Spec;
my $d = dirname(File::Spec->rel2abs($0));
require "$d/../setenv.pl";
}

use Getopt::Long;
use Open311::Endpoint::Integration::UK;

my ($verbose);
GetOptions (
'verbose|v' => \$verbose,
);

my $uk = Open311::Endpoint::Integration::UK->new;

$uk->check_endpoints($verbose);
4 changes: 3 additions & 1 deletion perllib/Integrations/Surrey/Boomi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ has ua => (
timeout => 3 * 60, # Boomi can take longer than the default 60s when handling large/multiple photos.
);
$ua->ssl_opts(SSL_cipher_list => 'DEFAULT:!DH'); # Disable DH ciphers, server's key is too small apparently
my $hash = encode_base64($self->config->{username} . ':' . $self->config->{password}, "");
my $un = $self->config->{username} || '';
my $pw = $self->config->{password} || '';
my $hash = encode_base64("$un:$pw", "");
$ua->default_header('Authorization' => "Basic $hash");
$ua->default_header('Content-Type' => "application/json");
return $ua;
Expand Down
2 changes: 1 addition & 1 deletion perllib/Open311/Endpoint/Integration/Boomi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ has integration_class => (
default => 'Integrations::Surrey::Boomi',
);


sub get_integration { $_[0]->boomi }

sub service {
my ($self, $id, $args) = @_;
Expand Down
36 changes: 36 additions & 0 deletions perllib/Open311/Endpoint/Integration/UK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use Module::Pluggable
instantiate => 'new';
use JSON::MaybeXS;
use Path::Tiny;
use URI;

use Open311::Endpoint::Schema;

Expand Down Expand Up @@ -141,4 +142,39 @@ sub confirm_upload {
}
}

sub check_endpoints {
my ($self, $verbose) = @_;
my @plugins = ();
foreach ($self->plugins) {
if ($_->isa('Open311::Endpoint::Integration::Multi')) {
push @plugins, $_ foreach $_->plugins;
} else {
push @plugins, $_;
}
}
my @urls = ();
foreach (@plugins) {
if ($_->can('get_integration')) {
my $config = $_->get_integration->config;
push @urls, $config->{api_url} # Abavus, ATAK, Alloy, Boomi
|| $config->{endpoint_url} # Confirm, Ezytreev, Symology, Uniform, WDM
|| $config->{endpoint} # Salesforce
|| $config->{url} # Echo, Whitespace
|| $config->{jadu_api_base_url} # Jadu
|| $config->{collective_endpoint}; # Bartec
} elsif ($_->can('endpoint')) {
push @urls, $_->endpoint;
}
}
my %hosts;
foreach (grep { $_ } @urls) {
$hosts{URI->new($_)->host} = 1;
}
foreach (sort keys %hosts) {
my $check = `openssl s_client -connect $_:443 < /dev/null 2>/dev/null| openssl x509 -checkend 604800 -noout`;
next if $check =~ /will not expire/ && !$verbose;
print "$_: $check";
}
}

__PACKAGE__->run_if_script;
1 change: 1 addition & 0 deletions t/open311/endpoint/uk.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test_multi(0, 'Open311::Endpoint::Integration::UK',
'Open311::Endpoint::Integration::UK::Rutland' => 'rutland',
'Open311::Endpoint::Integration::UK::Shropshire' => 'shropshire_confirm',
'Open311::Endpoint::Integration::UK::Southwark' => 'southwark_confirm',
'Open311::Endpoint::Integration::UK::Surrey' => 'surrey_boomi',
'Open311::Endpoint::Integration::UK::Sutton' => 'sutton_echo',
'Open311::Endpoint::Integration::UK::Hampshire' => 'hampshire_confirm',
);
Expand Down

0 comments on commit faa7ead

Please sign in to comment.