NETWAYS / check_interfaces

Icinga check plugin for network hardware interfaces
GNU General Public License v2.0
11 stars 14 forks source link

[Feature]: enable privacy protocol DES (using ./configure) #30

Closed mrdsam closed 7 months ago

mrdsam commented 7 months ago

Describe the feature request

I'd like to enable the privacy protocol DES. I know no one uses DES anymore when AES is available, but I don't have much influence on what some devices or customers are offering.

I didn't find a suitable --enable-FEATURE option, so I tried adding #define usmDESPrivProtocol to _checkinterfaces.c and _snmpbulkget.c, what leads to the following compile error (tested on Linux and FreeBSD)

  CC       snmp_bulkget.o
In file included from /usr/include/net-snmp/snmpv3_api.h:27,
                 from /usr/include/net-snmp/net-snmp-includes.h:35,
                 from snmp_bulkget.h:15,
                 from snmp_bulkget.c:72:
/usr/include/net-snmp/library/transform_oids.h:46:43: error: expected identifier or ‘(’ before ‘[’ token
   46 | NETSNMP_IMPORT oid      usmDESPrivProtocol[10];
      |                                           ^
snmp_bulkget.c: In function ‘start_session_v3’:
snmp_bulkget.c:214:51: error: expected expression before ‘,’ token
  214 |                                 usmDESPrivProtocol, USM_PRIV_PROTO_DES_LEN);
      |                                                   ^
make: *** [Makefile:384: snmp_bulkget.o] Error 1

Although I could get along somehow without DES, it would make my work much easier with this algo.

RincewindsHat commented 7 months ago

That's already in there https://github.com/NETWAYS/check_interfaces/blob/d203fac5d71e3a6d174b297bd759b15e09d43911/snmp_bulkget.c#L210

I guess your distro removed it from libnetsnmp (RHEL does that afaik). If netsnmp doesn't offer it, you can not use it (or have to implement a lot of stuff yourself).

mrdsam commented 7 months ago

I see. Thank you.

mrdsam commented 7 months ago

After thinking about it, your guess does not quite make sense. When I build v1.4 on the same machine (both Ubuntu 22.04 and FreeBSD 13.2), it complies with SHA/MD5 and AES/DES - without any modifications. Why does the current version build w/o DES, then?

RincewindsHat commented 7 months ago

Indeed, seems like my fix for not having DES on RedHat is faulty. Will take a look at it.

RincewindsHat commented 7 months ago

@mrdsam this might be fixed in #31. Could you test that?

mrdsam commented 7 months ago

@RincewindsHat it works! Thank you for the great support.

Tested on

This interface check is the best I ever found (v1.4 is in production here for years), hope it always finds contributors.

BTW: Would you like to change the version number to something else? It still claims to be 1.4, what can be somehow confusing.

RincewindsHat commented 7 months ago

indeed. I was planning to create a new release, but didn't want to go for one until there is a proper testing infrastructure in place and didn't find the time for it yet.

RincewindsHat commented 7 months ago

Closed by #31

RincewindsHat commented 7 months ago

well, should be good enough for a bugfix release. Added a bugfix version to the version string.

mrdsam commented 7 months ago

There is no ./configure and no Makefile anymore?! Automake doesn't work neither. Unable to build....

lbetz commented 7 months ago

@mrdsam Autoconf to create both files was forgotten. See https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#autoconf-Invocation or try to execute autoconf.

@RincewindsHat configure and Makefile are important for the package build process.

RincewindsHat commented 7 months ago

configure and Makefile are both both created by autoconf and dependent on several files in the repository. It was convenient to have them there, but IMHO it is wrong to add generated code to a repo.

Admittedly I forgot to add some note about running autoreconf then

mrdsam commented 7 months ago

@RincewindsHat I'd like to agree, but...

$ autoconf
configure.ac:7: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:9: error: possibly undefined macro: AM_SILENT_RULES
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for a BSD-compatible install... /usr/bin/install -c
./configure: line 3594: syntax error near unexpected token `1.16.5'
./configure: line 3594: `AM_INIT_AUTOMAKE(1.16.5)'
RincewindsHat commented 7 months ago

try autoreconf, that works, but don't don't ask why, autoconf is just a world of pain.

mrdsam commented 7 months ago

ACK, works. Didn't see the 're' in autoreconf ;)