Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.bugs.dist > #1020405
| From | Ian Campbell <ijc@debian.org> |
|---|---|
| Newsgroups | linux.debian.bugs.dist |
| Subject | Bug#966544: Switching from extend to pass for custom endpoints |
| Date | 2020-08-03 19:00 +0200 |
| Message-ID | <AzLYB-5qp-1@gated-at.bofh.it> (permalink) |
| References | <AygtP-5Es-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi all,
I switched from pass to extend for my custom endpoint since the latter
was not disabled with the security update. It's a bit more faff but not
intractable (just lots of boilerplate really) so maybe it's useful to
post here as a sort of recipe while things get sorted out some other
way in the packaging.
I went from snmpd.conf with (nb: /var/run/qcontrol.temp simply contains
a single integer value, nothing fancy, it's updated elsewhere):
extend .1.3.6.1.4.1.65535.1 - /bin/cat /var/run/qcontrol.temp
To one with:
pass .1.3.6.1.4.1.65535.1 /bin/bash /etc/snmp/qcontrol-mib
Where /etc/snmp/qcontrol-mib is:
#!/bin/bash
# https://sourceforge.net/p/net-snmp/code/ci/master/tree/local/passtest
PLACE=".1.3.6.1.4.1.65535.1"
OP="$1"
REQ="$2"
case "$OP" in
"-s") # SET
OP="SET"
logger -p daemon.debug "qcontrol-mib: $OP $REQ: ignored"
exit 0
;;
"-n") # GETNEXT
OP="GETNEXT"
case "$REQ" in
$PLACE|$PLACE.0|$PLACE.0.*|$PLACE.1) RET="$PLACE.1.0" ;;
*) exit 0 ;; # Nothing after this
esac
;;
"-g") # GET
OP="GET"
case "$REQ" in
$PLACE.1.0) RET="$REQ" ;;
*)
logger -p daemon.warn "qcontrol-mib: $OP $REQ: unknown"
exit 0
;;
esac
;;
esac
# GET and GETNEXT
logger -p daemon.debug "qcontrol-mib: $OP $REQ: OK"
echo "$RET"
case "$RET" in
$PLACE.1.0) echo "integer" ; printf "%d\n" $(cat /var/run/qcontrol.temp);;
esac
These were moderately useful resources:
http://www.net-snmp.org/docs/man/snmpd.conf.html (see: MIB-Specific Extension Commands)
http://net-snmp.sourceforge.net/wiki/index.php/Tut:Extending_snmpd_using_shell_scripts
https://sourceforge.net/p/net-snmp/code/ci/master/tree/local/passtest
For people who want persistent_pass instead this looked like a good
resource but I didn't follow it myself since my needs were so trivial:
https://vincent.bernat.ch/en/blog/2012-extending-netsnmp
That has links to Perl and Python helper libraries which I think you'd
likely want to use if you wanted multiple values since plumbing the
GETNEXT stuff together manually in the simple shell script case as
above would be fairly tedious.
HTH someone,
Ian.
Back to linux.debian.bugs.dist | Previous | Next — Previous in thread | Find similar | Unroll thread
Bug#966544: snmpd: extend option broken after update James Greig <james@host-it.co.uk> - 2020-07-30 15:10 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: snmpd: extend option broken after update Craig Small <csmall@debian.org> - 2020-07-31 03:00 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: snmpd: extend option broken after update James Greig <James@host-it.co.uk> - 2020-07-31 10:00 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: snmpd: extend option broken after update Christian Balzer <chibi@gol.com> - 2020-07-31 05:40 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: snmpd: extend option broken after update Axel Uhl <axel.uhl@gmx.de> - 2020-08-01 18:00 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: snmpd: extend option broken after update Albertas Sileika <a.sileika@gmail.com> - 2020-07-31 06:20 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: Bug#966544: snmpd: extend option broken after update Craig Small <csmall@debian.org> - 2020-07-31 06:30 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: Bug#966544: snmpd: extend option broken after update Albertas Sileika <a.sileika@gmail.com> - 2020-07-31 06:40 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: Bug#966544: snmpd: extend option broken after update Ramon Cahenzli <rca@psy-q.ch> - 2020-07-31 09:10 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: Bug#966544: snmpd: extend option broken after update Rudi Daemen <info@kratjebierhosting.nl> - 2020-07-31 10:10 +0200
Bug#966544: [Pkg-net-snmp-devel] Bug#966544: Bug#966544: snmpd: extend option broken after update Zubrick <zubrick@number6.ch> - 2020-07-31 11:40 +0200
Bug#966544: snmpd: extend option broken after update Salvatore Bonaccorso <carnil@debian.org> - 2020-08-01 08:40 +0200
Bug#966544: snmpd: extend option broken after update James Greig <James@host-it.co.uk> - 2020-08-01 18:40 +0200
Bug#966544: snmpd: extend option broken after update Salvatore Bonaccorso <carnil@debian.org> - 2020-08-04 19:20 +0200
Bug#966544: snmpd: extend option broken after update James Greig <James@host-it.co.uk> - 2020-08-04 20:40 +0200
Bug#966544: Switching from extend to pass for custom endpoints Ian Campbell <ijc@debian.org> - 2020-08-03 19:00 +0200
csiph-web