Commit graph

65 commits

Author SHA1 Message Date
Lorenz Kästle
42ef1fa2fa check_ssh: linter + style fixes 2024-10-31 16:00:41 +01:00
Lorenz Kästle
78258c4cd0 check_ssh: do not export local variables 2024-10-31 15:55:40 +01:00
Lorenz Kästle
6410ef8acb check_ssh: clang-format 2024-10-31 15:55:04 +01:00
Lorenz Kästle
fa15fdcf5d Merge branch 'master' into fix/check_ssh-variable-stuff 2024-10-31 15:27:01 +01:00
Lorenz Kästle
611b33a30e check_ssh: update copyright 2024-10-31 14:47:49 +01:00
RincewindsHat
0fd0421052 check_ssh: set elapsed time properly
Previous to this commit, `elapsed_time` was only set after being read,
which was quite likely wrong and a bug.
This commit actually set the value before it is being read again.
2024-09-06 01:53:47 +02:00
RincewindsHat
829ec76f00 check_ssh: Remove unused variable iteration 2024-08-28 23:40:22 +02:00
RincewindsHat
04115904ad check_ssh: Always initialize elapsed_time 2024-08-28 23:39:57 +02:00
Lorenz Kästle
66f62dd336
check_ssh: patches from op5 (#1738)
* check_ssh: properly parse a delayed version control string

This resolves an issue with SSH servers which do not respond with their
version control string as the first thing in the SSH protocol version
exchange phase after connection establishment.

This patch also makes sure that we disregard a potential comment in the
version exchange string to avoid nonsense mismatches. In the future, we
might want to add the capability to match against a user specified comment.

In addition, the patch largely improves the communication towards the
server, which adds better protocol adherence.

Of course, new test cases are added to support the trigger and guard
against regressions of the bugs solved by this patch.

This fixes op5#7945 (https://bugs.op5.com/view.php?id=7945)

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh.t: Fix a few typos

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh: Handle non-alpha software versions

This patch fixes a bug where we would reject version control strings
that do not contain letters, because the assumption is made that they
always do. This is not required by the RFC however, and there exist
implementations that do not contain letters.

I've also added a few references to the RFC to make the process of
parsing the control string more apparent.

This fixes op5#8716 (https://bugs.op5.com/view.php?id=8716)

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh: Fix a typo in "remote-protocol parameter

remote-protcol -> remote-protocol

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* Remove unused variable

* Formating fixes

* Update translations

* Remove merge conflict artefact from previous merge

* Set fixed include paths

* Improve code style to be slightly more readable

* Update test cases for different netcat behaviour and reduce sleep time

---------

Signed-off-by: Anton Lofgren <alofgren@op5.com>
Co-authored-by: Anton Lofgren <alofgren@op5.com>
2024-03-27 00:35:16 +01:00
RincewindsHat
51db32cc1d check_ssh: Use C99 booleans 2023-10-18 20:24:13 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Sven Nierlein
a7d7992777 check_ssh: change warning to critical for protocal/version errors
It makes more sense to exit critical if a explicit version/protocol is requested. This
would also be more consistent with other plugins. Other string matching plugins like
check_snmp or check_http exit critical if the result does not match.

Signed-off-by: Sven Nierlein <sven@nierlein.de>

Closes #1268
2014-11-28 14:35:03 +01:00
Sven Nierlein
ed914472e9 Merge pull request #1190 from waja/github780
check_ssh: check protocol
2014-06-30 13:42:02 +02:00
Jan Wagner
4f5e20187f check_ssh: Reverting a387120
This seems to result into more problems in the wild then before 'fixing' it

Closes Debian #739254
Reopen Debian #734811
2014-02-17 12:18:17 +01:00
Holger Weiss
7ee3525423 Merge branch 'maint'
* maint:
  check_ssh: Get rid of sshd: Read from socket failed: Connection reset by peer
  fixed tests when there is no direct internet connection
  NEWS: Mention fix for check_http's -S option
  Fix for SSL Versioning when multiple options are used.
  Fix #1217 spec file fails to build due to duplicate files and unused files
  check_http: Don't let "-N" expect an argument
  README: Change GitHub URL
  README: Clarify license notice
  Update URLs and mailing list addresses
  Just using the posix conform extended regular expression grep
  check_oracle: --db +ASM bad string matching check_oracle doesn't correctly check for pmon +ASM instance from at least Oracle 11 as the pmon proces was renamed from ora_pmon_.* to asm_pmon_.*. -- Just turning attached patch of github issue #1207 into a push request. (Closes #1207)
  Update web site URLs

Conflicts:
	FAQ
	NEWS
	README
	SUPPORT
	configure.in
	monitoring-plugins.spec.in
	pkg/solaris/pkginfo.in
	plugins-root/check_dhcp.c
	plugins-root/check_icmp.c
	plugins-scripts/check_ifoperstatus.pl
	plugins-scripts/check_mssql.pl
	plugins/check_apt.c
	plugins/check_by_ssh.c
	plugins/check_cluster.c
	plugins/check_dbi.c
	plugins/check_dig.c
	plugins/check_disk.c
	plugins/check_dns.c
	plugins/check_dummy.c
	plugins/check_fping.c
	plugins/check_game.c
	plugins/check_hpjd.c
	plugins/check_http.c
	plugins/check_ide_smart.c
	plugins/check_ldap.c
	plugins/check_load.c
	plugins/check_mrtg.c
	plugins/check_mrtgtraf.c
	plugins/check_mysql.c
	plugins/check_mysql_query.c
	plugins/check_nagios.c
	plugins/check_nt.c
	plugins/check_ntp.c
	plugins/check_ntp_peer.c
	plugins/check_ntp_time.c
	plugins/check_nwstat.c
	plugins/check_overcr.c
	plugins/check_pgsql.c
	plugins/check_ping.c
	plugins/check_procs.c
	plugins/check_radius.c
	plugins/check_real.c
	plugins/check_smtp.c
	plugins/check_snmp.c
	plugins/check_ssh.c
	plugins/check_swap.c
	plugins/check_tcp.c
	plugins/check_time.c
	plugins/check_ups.c
	plugins/check_users.c
	plugins/negate.c
	plugins/urlize.c
	plugins/utils.h
	po/Makevars
	po/de.po
	po/fr.po
	po/monitoring-plugins.pot
2014-01-21 16:07:38 +01:00
Thomas Guyot-Sionnest
11cf54ca78 Merge branch 'rename' 2014-01-21 07:59:07 -05:00
Spenser Reinhardt
212575b858 plugins/*.c: Alterations for timeout messages.
.c file changes for misleading timeout messages in help functions. Solution to pull request #1209 tracker by awiddersheim.

Files: plugins/check_apt.c, plugins/check_by_ssh.c, plugins/check_dbi.c, plugins/check_dig.c, plugins/check_disk.c, plugins/check_dns.c, plugins/check_game.c, plugins/check_http.c, plugins/check_ldap.c, plugins/check_ntp.c, plugins/check_ntp_peer.c, plugins/check_ntp_time.c, plugins/check_nwstat.c, plugins/check_overcr.c, plugins/check_pgsql.c, plugins/check_ping.c, plugins/check_procs.c, plugins/check_radius.c, plugins/check_real.c, plugins/check_smtp.c, plugins/check_snmp.c, plugins/check_ssh.c, plugins/check_tcp.c, plugins/check_time.c, plugins/check_ups.c, plugins/negate.c
2014-01-21 11:33:45 +01:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
This is an initial take at renaming the project to Monitoring Plugins.
It's not expected to be fully complete, and it is expected to break
things (The perl module for instance). More testing will be required
before this goes mainline.
2014-01-19 14:18:47 -05:00
Jan Wagner
a387120182 check_ssh: Get rid of sshd: Read from socket failed: Connection reset by peer
This fix was grabbed from FreeBSD downstream and provided by Dmitry Sivachenko.
Fixes Debian Bug #734811
2014-01-10 15:56:30 +01:00
Holger Weiss
3c90a370ea Update URLs and mailing list addresses
Now that we moved our infrastructure away from SourceForge, update the
URLs and mailing list addresses accordingly.
2013-10-28 23:58:36 +01:00
Jan Wagner
97349ae13d check_ssh: check protocol
It would be useful to be able to detect the protocols supported by the remote
ssh server to locate any using the insecure ssh v1 protocol. This patch
attempts to match against the protocol string in the ssh response.

Example:

check_ssh -H my.host.com -P 2.0
--
Just turning attached patch of github issue #780 into a push request.
(Closes #780)
2013-10-01 14:50:04 +02:00
Sven Nierlein
24772e755e unified ipv4/6 usage and help text 2012-11-28 11:03:11 +01:00
Anders Kaseorg
028d50d6f9 Die when asprintf fails
Fixes many instances of
warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Thomas Guyot-Sionnest
1bc7a4a198 Add perfdata to check_ssh (#3244097 - Marco Beck) 2011-03-26 15:44:38 -04:00
Thomas Guyot-Sionnest
eaf3cb27f4 Add newline after "Usage:" in --help 2010-04-22 08:57:14 -04:00
Thomas Guyot-Sionnest
884aee0667 Standardize the extra-opts notes 2010-04-21 23:29:18 -04:00
Thomas Guyot-Sionnest
25d1ee331d Fix translations when extra-opts aren't enabled
Bug #2832884 reported problem with translations outputting pot file
headers. This is caused by "" matching the header of the translation
files.

This patch moves gettext macros inside utils macros and update some
french translations.
2010-04-14 08:33:06 -04:00
Thomas Guyot-Sionnest
6fbd14fea5 Removing CVS/SVN tags and replacing with git-based versioning
For contrib/, full tags have been imported from subversion


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-23 05:38:47 +00:00
Thomas Guyot-Sionnest
caa8bd6423 Bulk EOL cleanup
$ git diff --ignore-space-change|diffstat
 0 files changed


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2087 f882894a-f735-0410-b71e-b25c423dba1c
2008-11-19 06:45:18 +00:00
Thomas Guyot-Sionnest
44f8455b2c Added support for --extra-opts in all C plugins (disabled by default, see configure --help)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07 10:02:42 +00:00
Thomas Guyot-Sionnest
6c4468a728 Bump plugin/ to GPLv3 (check_overcr to check_users)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1917 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-31 10:44:26 +00:00
Thomas Guyot-Sionnest
2562434648 Close the socket on all exits (not just the OK one)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1813 f882894a-f735-0410-b71e-b25c423dba1c
2007-11-09 13:08:43 +00:00
Holger Weiss
fd329a1e91 Don't try to print `optarg' (which will be a NULL pointer) if an unknown
command line option was used, as this leads to a segfault on some
systems.  The unknown option will be printed by getopt(3) anyway.  So,
simply call print_usage() and exit UNKNOWN via the new usage5() instead.


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1590 f882894a-f735-0410-b71e-b25c423dba1c
2007-01-28 21:46:41 +00:00
Holger Weiss
210f39bc84 Support check_ssh --hostname=ADDRESS' (but keep --host=ADDRESS' for backward
compatibility) (Ville Mattila - 1642780)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1579 f882894a-f735-0410-b71e-b25c423dba1c
2007-01-23 18:34:45 +00:00
Benoit Mortier
d8ecf6bfc2 another round of localization cleaning
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1509 f882894a-f735-0410-b71e-b25c423dba1c
2006-10-19 23:53:28 +00:00
Benoit Mortier
679f03fbee cleaning help and usage
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1437 f882894a-f735-0410-b71e-b25c423dba1c
2006-06-21 11:05:00 +00:00
Benoit Mortier
f2d66913f9 cleaning help and usage + license
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1435 f882894a-f735-0410-b71e-b25c423dba1c
2006-06-20 11:17:03 +00:00
M. Sean Finney
afca8db23e properly call close() on the ssh connection before exiting.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1160 f882894a-f735-0410-b71e-b25c423dba1c
2005-04-11 18:02:40 +00:00
Benoit Mortier
e9ccc6b21a various fixes for localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-25 23:17:46 +00:00
Benoit Mortier
30a4266a3a reverting my changes from !=TRUE to == ERROR, that's not good ;-( sorry
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@998 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 23:55:29 +00:00
Benoit Mortier
edf60f6dce remove UT_HLP_VRS from print_usage
this was not a good idea ;-)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@994 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 20:28:53 +00:00
Benoit Mortier
c1af46b890 correcting parenthesis error
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@991 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 17:15:27 +00:00
Benoit Mortier
2ad398d2e0 fixes for internationalization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@990 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 16:56:27 +00:00
Benoit Mortier
016d33230e bump copyright year
initialize result to STATE_UNKNOW in place of STATE_OK


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@982 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 00:55:28 +00:00
Benoit Mortier
234481163f More internationalization work
new usage4 function to permit localisation of think like check_ssh: xxxxx


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@979 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02 16:51:25 +00:00
Benoit Mortier
df1bd0c89f return of process_arguments() is TRUE not OK !
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@978 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02 14:54:36 +00:00
Benoit Mortier
230d67e18a changed Error: by CRITICAL -
more localization fixes


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@971 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02 01:11:01 +00:00
Benoit Mortier
d19edd4043 standardize localization string
standardize unknow arguments


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01 23:54:51 +00:00
Benoit Mortier
54c21eba62 first pass at standardization of messages for the localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@962 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01 19:33:45 +00:00