diff options
Diffstat (limited to 'libexec/check_ftp')
-rw-r--r-- | libexec/check_ftp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/libexec/check_ftp b/libexec/check_ftp index 3ec2899..42e6291 100644 --- a/libexec/check_ftp +++ b/libexec/check_ftp @@ -1,11 +1,27 @@ #!perl # +# Copyright (C) 2020--2021 Tom Ryder <tom@sanctum.geek.nz> +# +# This file is part of nagios-check-ftp. +# +# nagios-check-ftp is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# nagios-check-ftp is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# nagios-check-ftp. If not, see <https://www.gnu.org/licenses/>. +# + +# # Check that we can connect to an FTP server, with opportunistic TLS; the # check_ftp plugin that comes with Monitoring::Plugin doesn't do this. # -# Author: Tom Ryder <tom@sanctum.geek.nz> -# License: MIT -# package main; # Force me to write this properly @@ -18,13 +34,13 @@ use 5.010_001; # Import required modules use English qw(-no_match_vars); -use Exception::Class ( PluginException => { alias => 'throw' } ); +use Exception::Class qw(TLSException); use Monitoring::Plugin; use Net::FTP; use Try::Tiny; # Decree package version -our $VERSION = '1.01'; +our $VERSION = '2.00'; # Add description and license package variables our $DESCRIPTION = <<'EOF'; @@ -32,7 +48,8 @@ This plugin makes an FTP connection to a nominated server, optionally including a STARTTLS upgrade for FTPS. It does not support implicit FTPS. EOF our $LICENSE = <<'EOF'; -MIT License <https://opensource.org/licenses/MIT> +GNU General Public License, Version 3 or newer +<https://www.gnu.org/licenses/gpl-3.0.html> EOF # Custom plugin options @@ -81,7 +98,7 @@ try { # If we connected and the server reports that it supports TLS, try it if ( defined $mp->opts->starttls ) { my $ssl = $ftp->can_ssl - or throw 'Client can\'t TLS'; + or TLSException->throw('Client can\'t TLS'); $ftp->feature('AUTH TLS') or $mp->add_message( WARNING => 'AUTH TLS not listed in features' ); $ftp->starttls |