From 9a92e7e2a243b485b3ef6172ca29ef3d378a73d5 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sun, 16 Jun 2019 05:27:14 +0200 Subject: [PATCH 01/62] yaml whitespace matters so at least mention that as well as how to include it in tickets. --- .github/issue_template.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/issue_template.md b/.github/issue_template.md index 869ecf2d..386b0639 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -8,6 +8,11 @@ + + + + + ## Expected Behavior From a61159deb9a383ad4626d5c6dca95c5c33498d4b Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Tue, 18 Jun 2019 13:39:19 +0200 Subject: [PATCH 02/62] Fix device_auth formatting in POD --- lib/App/Netdisco/SSHCollector/Platform/ASA.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm index 91bc3348..b12af4b2 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm @@ -16,14 +16,14 @@ C status after login: To use an C password separate from the login password, add an C under C tag in your configuration file: -device_auth: - - tag: sshasa - driver: cli - platform: ASA - only: '192.0.2.1' - username: oliver - password: letmein - enable_password: myenablepass + device_auth: + - tag: sshasa + driver: cli + platform: ASA + only: '192.0.2.1' + username: oliver + password: letmein + enable_password: myenablepass =cut From b58a62f300e17df0c34b47b983e70c744993c6e1 Mon Sep 17 00:00:00 2001 From: Christian Ramseyer Date: Tue, 18 Jun 2019 13:42:23 +0200 Subject: [PATCH 03/62] Properly escape angle brackets in C<> --- lib/App/Netdisco/SSHCollector/Platform/ASA.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm index b12af4b2..70952708 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ASA.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ASA.pm @@ -43,7 +43,7 @@ use Moo; Retrieve ARP and neighbor entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 441499f06352010d29f6413e6ec0f915b45dd337 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:39:47 +0200 Subject: [PATCH 04/62] fix pod formatting as seen in b58a62f --- lib/App/Netdisco/SSHCollector/Platform/ACE.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm index e905e479..a3bb5ed6 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm @@ -36,7 +36,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 469a9ce554825fbcefd84aa9be0b6f56666314b7 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:41:10 +0200 Subject: [PATCH 05/62] fix pod formatting as seen in b58a62f --- lib/App/Netdisco/SSHCollector/Platform/BigIP.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm b/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm index df10ff6c..17a115d1 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/BigIP.pm @@ -34,7 +34,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From ad8404739867dd572306e01893039d23deffa016 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:44:02 +0200 Subject: [PATCH 06/62] fix pod as in a61159d --- lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm b/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm index 74292a95..2307cdb7 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/CPVSX.pm @@ -12,14 +12,14 @@ This collector uses "C" as the command for the arp utility on your system. Clish "C" does not work correctly in versions prior to R77.30. Config example: -device_auth: - - tag: sshcpvsx - driver: cli - platform: CPVSX - only: '192.0.2.1' - username: oliver - password: letmein - expert_password: letmein2 + device_auth: + - tag: sshcpvsx + driver: cli + platform: CPVSX + only: '192.0.2.1' + username: oliver + password: letmein + expert_password: letmein2 =cut From 8e0e27c1499c43ce939e3116a17744e661570d20 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:45:51 +0200 Subject: [PATCH 07/62] fix pod formatting as seen in b58a62f & a61159d --- .../Netdisco/SSHCollector/Platform/FreeBSD.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm b/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm index 061c9225..1e80ed8f 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/FreeBSD.pm @@ -12,14 +12,14 @@ This collector uses "C" as the command for the arp utility on your system. If you wish to specify an absolute path, then add an C item to your configuration: -device_auth: - - tag: sshfreebsd - driver: cli - platform: FreeBSD - only: '192.0.2.1' - username: oliver - password: letmein - arp_command: '/usr/sbin/arp' + device_auth: + - tag: sshfreebsd + driver: cli + platform: FreeBSD + only: '192.0.2.1' + username: oliver + password: letmein + arp_command: '/usr/sbin/arp' =cut @@ -39,7 +39,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 9006d83989392e9e288af54b394ce2a5e45bb8e8 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:53:30 +0200 Subject: [PATCH 08/62] fix pod formatting and typos as seen in b58a62f & a61159d --- .../SSHCollector/Platform/GAIAEmbedded.pm | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm b/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm index c4e3d775..d20df0ad 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/GAIAEmbedded.pm @@ -7,21 +7,21 @@ App::Netdisco::SSHCollector::Platform::GAIAEmbedded =head1 DESCRIPTION Collect ARP entries from Checkpoint GAIA embedded Systems -To get this Plugin to work you have to add an User like 'netdisco' with -'Network admin' right in the GAIA embedded OS +To get this Plugin to work you have to add a user like 'netdisco' with +'Network admin' rights in the GAIA embedded OS. This collector uses "C" as the command for the arp utility on your -system. If you wish to specify an absolute path, then add an C +system. If you wish to specify an absolute path, then add an C item to your configuration: -device_auth: - - tag: sshgaia - driver: cli - platform: GAIAEmbedded - only: '192.0.2.1' - username: oliver - password: letmein - arp_command: 'arp' + device_auth: + - tag: sshgaia + driver: cli + platform: GAIAEmbedded + only: '192.0.2.1' + username: oliver + password: letmein + arp_command: 'arp' =cut @@ -41,7 +41,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 26ab5da1c10244f538072dee9c0109eaa8b0502b Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:56:18 +0200 Subject: [PATCH 09/62] fix pod as in b58a62 --- lib/App/Netdisco/SSHCollector/Platform/IOS.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/IOS.pm b/lib/App/Netdisco/SSHCollector/Platform/IOS.pm index 64c3be76..d68d912a 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/IOS.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/IOS.pm @@ -27,7 +27,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From da5cdeb6026a488f7526e7e00374ad84fedffe02 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:57:17 +0200 Subject: [PATCH 10/62] fix pod as in b58a62 --- lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm b/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm index a3b1210c..3bf91470 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/IOSXR.pm @@ -27,7 +27,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 1460d8864be5a23cd76ca229cc764bedb0d4a425 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 18 Jun 2019 15:58:20 +0200 Subject: [PATCH 11/62] fix pod as seen in b58a62f & a61159d --- .../Netdisco/SSHCollector/Platform/Linux.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/Linux.pm b/lib/App/Netdisco/SSHCollector/Platform/Linux.pm index b0449267..46d22e12 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/Linux.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/Linux.pm @@ -12,14 +12,14 @@ This collector uses "C" as the command for the arp utility on your system. If you wish to specify an absolute path, then add an C item to your configuration: -device_auth: - - tag: sshlinux - driver: cli - platform: Linux - only: '192.0.2.1' - username: oliver - password: letmein - arp_command: '/usr/sbin/arp' + device_auth: + - tag: sshlinux + driver: cli + platform: Linux + only: '192.0.2.1' + username: oliver + password: letmein + arp_command: '/usr/sbin/arp' =cut @@ -39,7 +39,7 @@ use Moo; Retrieve ARP entries from device. C<$host> is the hostname or IP address of the device. C<$ssh> is a Net::OpenSSH connection to the device. -Returns a list of hashrefs in the format C<{ mac => MACADDR, ip => IPADDR }>. +Returns a list of hashrefs in the format C<{ mac =E MACADDR, ip =E IPADDR }>. =back From 6f8dfabc87f14b65bfd8f87aff85b07f8f8cea11 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 25 Jun 2019 03:42:18 +0200 Subject: [PATCH 12/62] a few more files to ignore (#609) --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index ecc05a24..bb308a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,7 @@ _build blib !.docker/hooks/* .idea +node_modules/* +yarn.lock +package.json +.stylelintrc From ceeccf8901c552d5daeabb2f25c4ce548cd38025 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 30 Jun 2019 16:34:03 +0100 Subject: [PATCH 13/62] #610 better MAC addr input sanity checking --- lib/App/Netdisco/Web/Plugin/Search/Node.pm | 9 +++++++-- lib/App/Netdisco/Web/Search.pm | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 6b74c86d..54f08cf3 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -6,6 +6,7 @@ use Dancer::Plugin::DBIC; use Dancer::Plugin::Auth::Extensible; use NetAddr::IP::Lite ':lower'; +use Regexp::Common 'net'; use NetAddr::MAC (); use App::Netdisco::Web::Plugin; @@ -23,10 +24,14 @@ ajax '/ajax/content/search/node' => require_login sub { my ( $start, $end ) = param('daterange') =~ m/(\d+-\d+-\d+)/gmx; my $mac = NetAddr::MAC->new(mac => $node); - undef $mac if ($mac and $mac->as_ieee and ($mac->as_ieee eq '00:00:00:00')); - my @active = (param('archived') ? () : (-bool => 'active')); + undef $mac if + ($mac and $mac->as_ieee + and (($mac->as_ieee eq '00:00:00:00') + or ($mac->as_ieee !~ m/$RE{net}{MAC}/))); + my @active = (param('archived') ? () : (-bool => 'active')); my (@times, @wifitimes, @porttimes); + if ( $start and $end ) { $start = $start . ' 00:00:00'; $end = $end . ' 23:59:59'; diff --git a/lib/App/Netdisco/Web/Search.pm b/lib/App/Netdisco/Web/Search.pm index 2d2cb01d..73f3ac92 100644 --- a/lib/App/Netdisco/Web/Search.pm +++ b/lib/App/Netdisco/Web/Search.pm @@ -6,6 +6,7 @@ use Dancer::Plugin::DBIC; use Dancer::Plugin::Auth::Extensible; use App::Netdisco::Util::Web 'sql_match'; +use Regexp::Common 'net'; use NetAddr::MAC (); hook 'before_template' => sub { @@ -39,7 +40,11 @@ get '/search' => require_login sub { my $nd = $s->resultset('Device')->search_fuzzy($q); my ($likeval, $likeclause) = sql_match($q); my $mac = NetAddr::MAC->new($q); - undef $mac if ($mac and $mac->as_ieee and ($mac->as_ieee eq '00:00:00:00')); + + undef $mac if + ($mac and $mac->as_ieee + and (($mac->as_ieee eq '00:00:00:00') + or ($mac->as_ieee !~ m/$RE{net}{MAC}/))); if ($nd and $nd->count) { if ($nd->count == 1) { From 9ec9b1bca4cd88419fdc9c5a6491c6ebcc28d8ce Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 30 Jun 2019 18:26:46 +0100 Subject: [PATCH 14/62] if user installs Pg they should use supported version --- lib/App/Netdisco.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco.pm b/lib/App/Netdisco.pm index 088b6ab0..c1d892c2 100644 --- a/lib/App/Netdisco.pm +++ b/lib/App/Netdisco.pm @@ -100,7 +100,7 @@ will take about 250MB including MIB files. root:~# useradd -m -p x -s /bin/bash netdisco Netdisco uses the PostgreSQL database server. Install PostgreSQL (at least -version 8.4) and then change to the PostgreSQL superuser (usually +version 9.4) and then change to the PostgreSQL superuser (usually C). Create a new database and PostgreSQL user for the Netdisco application: From f1891be3075c7078485d2eeae4140c3486a247a9 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Wed, 17 Jul 2019 04:06:38 +0200 Subject: [PATCH 15/62] typo noticed when checking docker config --- share/environments/deployment.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/environments/deployment.yml b/share/environments/deployment.yml index 7a97d5e2..fcde8244 100644 --- a/share/environments/deployment.yml +++ b/share/environments/deployment.yml @@ -20,8 +20,9 @@ database: # RECOMMENDED SETTINGS # -------------------- -# SNMP community string(s) -# ```````````````````````` +# Device authentication settings +# define snmp communities and ssh credentials here +# ```````````````````````````````````````````````` device_auth: - tag: 'default_v2_readonly' community: 'public' @@ -50,7 +51,7 @@ device_auth: # SNMP, which just clogs up the job queue. # ``````````````````````````````````````````````````````````````` #discover_waps: true -#disover_phones: false +#discover_phones: false # this is the schedule for automatically keeping netdisco up-to-date; # these are good defaults, so only uncomment if needing to change. From 5b9761cbae177740f3f4cf5060ef7be56b54dd1d Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Fri, 19 Jul 2019 01:14:27 +0200 Subject: [PATCH 16/62] netdisco-docker triage point netdisco docker users to the docker issue tracker as a first step, so we can spent less time on triaging issues. netdisco docker has some quirks not present in regular netdisco, if it turns out to be non container related we can always move the issue back to this tracker. btw, seems we need to change our issue templates, but only project admins can do so: "You are using an old version of issue templates. Please update to the new issue template workflow. Learn more." -> https://help.github.com/articles/about-issue-and-pull-request-templates --- .github/issue_template.md | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 386b0639..94bdb323 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,17 +1,23 @@ - + - +STOP! If your ticket is about a device not being detected correctly, +see SNMP::Info: https://github.com/netdisco/snmp-info/issues/new - - +STOP! If you have new MIBs to submit, +see netdisco-mibs: https://github.com/netdisco/netdisco-mibs/issues/new - +STOP! If you are running a netdisco docker setup, +see netdisco-docker: https://github.com/netdisco/netdisco-docker/issues/new + +everything else about Netdisco's behaviour is good, here :-D + +when including netdisco config snippets, whitespace matters since it's a yaml file +for github issues it really helps if you include the relevant config parts in a codeblock (code fencing) +see the "code" subject on https://guides.github.com/features/mastering-markdown/ for that) +this should preserve spaces in the issue tracker and make troubleshooting quicker +--> - - - - ## Expected Behavior From d1a1235c8512c214c1521b5673e41428bea7f4fe Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Fri, 19 Jul 2019 04:16:06 +0200 Subject: [PATCH 17/62] handle row.power.power being NULL fixes this error, since device_port_power.power can be null: Argument "" isn't numeric in numeric gt (>) at /home/netdisco/perl5/lib/perl5/auto/share/dist/App-Netdisco/views/ajax/device/ports.tt line 251. currently only seen on cisco sb switches, which do have all other columns filled in ip | port | module | admin | status | class | power ---------------+------+--------+-------+------------+--------+------- 10.40.254.150 | fa2 | 1 | true | otherFault | class3 | 10.40.254.150 | fa16 | 1 | true | searching | class3 | 10.40.254.150 | fa3 | 1 | true | searching | class3 | ... --- share/views/ajax/device/ports.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/views/ajax/device/ports.tt b/share/views/ajax/device/ports.tt index d373a90b..668be5ef 100644 --- a/share/views/ajax/device/ports.tt +++ b/share/views/ajax/device/ports.tt @@ -244,7 +244,7 @@ [% END %] - [% IF row.power.power > 0 %] + [% IF row.power.power AND row.power.power > 0 %] [% row.power.power | html_entity %] mW [% ELSE %] ([% row.power.status | html_entity %]) From 4630879a1d4a5488f24cd3c997bdfbc197790862 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Fri, 19 Jul 2019 06:45:44 +0200 Subject: [PATCH 18/62] add poe on/off icons to legend inspired by the new wap icon --- share/views/sidebar/device/ports.tt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/views/sidebar/device/ports.tt b/share/views/sidebar/device/ports.tt index 9ba61e39..92a32a65 100644 --- a/share/views/sidebar/device/ports.tt +++ b/share/views/sidebar/device/ports.tt @@ -38,6 +38,8 @@
  •   Admin Disabled
  •   Error Disabled
  •   Blocking
  • +
  •   PoE Disabled
  • +
  •   PoE Enabled
  •   Manual Topology
  •   Neighbor Device
  •   Neighbor Inacessible
  • From e37a8347499e98db29aac2c87777cbc66e288663 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 3 Aug 2019 00:07:56 +0200 Subject: [PATCH 19/62] compare ieee mac against 6 iterations (#611) --- lib/App/Netdisco/Web/Plugin/Search/Node.pm | 2 +- lib/App/Netdisco/Web/Search.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 54f08cf3..965b511e 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -26,7 +26,7 @@ ajax '/ajax/content/search/node' => require_login sub { my $mac = NetAddr::MAC->new(mac => $node); undef $mac if ($mac and $mac->as_ieee - and (($mac->as_ieee eq '00:00:00:00') + and (($mac->as_ieee eq '00:00:00:00:00:00') or ($mac->as_ieee !~ m/$RE{net}{MAC}/))); my @active = (param('archived') ? () : (-bool => 'active')); diff --git a/lib/App/Netdisco/Web/Search.pm b/lib/App/Netdisco/Web/Search.pm index 73f3ac92..b447b031 100644 --- a/lib/App/Netdisco/Web/Search.pm +++ b/lib/App/Netdisco/Web/Search.pm @@ -43,7 +43,7 @@ get '/search' => require_login sub { undef $mac if ($mac and $mac->as_ieee - and (($mac->as_ieee eq '00:00:00:00') + and (($mac->as_ieee eq '00:00:00:00:00:00') or ($mac->as_ieee !~ m/$RE{net}{MAC}/))); if ($nd and $nd->count) { From 8a8deccdbe473c9d2887f314f3d92bba9408bbf1 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 3 Aug 2019 00:12:03 +0200 Subject: [PATCH 20/62] make sidebar tiny bit wider (#625) --- share/public/css/netdisco.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/public/css/netdisco.css b/share/public/css/netdisco.css index ebc913b4..71136174 100644 --- a/share/public/css/netdisco.css +++ b/share/public/css/netdisco.css @@ -359,7 +359,7 @@ td > form.nd_inline-form { .container-fluid > .nd_sidebar { position: absolute; right: 20px; - width: 200px; + width: 205px; left: auto; } From 38b800e46f9cad4c92d197eea05590f60eb7a9b4 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 6 Aug 2019 02:02:43 +0200 Subject: [PATCH 21/62] fix travis i hope, seems they switched ubuntu versions to something more recent --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 854ccb40..3db9448d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,8 @@ language: perl perl: - "5.30" - "5.10" +os: linux +dist: trusty addons: apt: packages: From 416a6939ecce3dd0c0035d5d650a1bed04b0f1b6 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Tue, 6 Aug 2019 23:51:45 +0200 Subject: [PATCH 22/62] you really need to install the packages we ask --- lib/App/Netdisco.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/App/Netdisco.pm b/lib/App/Netdisco.pm index c1d892c2..b4c2fb54 100644 --- a/lib/App/Netdisco.pm +++ b/lib/App/Netdisco.pm @@ -71,7 +71,8 @@ L. Netdisco has several Perl library dependencies which will be automatically installed. However it's required that you first install the following -operating system packages: +operating system packages, if not the installation will most likely fail +further down the road. On Ubuntu/Debian: From ad6dd2bb621bb09e8f5f3d11ae529519eea20620 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Fri, 16 Aug 2019 09:49:40 +0100 Subject: [PATCH 23/62] Change Port Free icon to be more accessible (#633) The port free icon currently only differs from the port down icon by colour, on higher resolutions with a colour vision impairment they're not very distinguishable, a slightly different icon fixes this. --- share/views/ajax/device/ports.tt | 2 +- share/views/ajax/search/port.tt | 2 +- share/views/sidebar/device/ports.tt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/views/ajax/device/ports.tt b/share/views/ajax/device/ports.tt index 668be5ef..1e96ccf4 100644 --- a/share/views/ajax/device/ports.tt +++ b/share/views/ajax/device/ports.tt @@ -39,7 +39,7 @@ [% ELSIF row.has_column_loaded('is_free') AND row.is_free %] [% ELSIF row.up_admin == 'up' AND (row.up != 'up' AND row.up != 'dormant') %] - + [% ELSE %] [% END %] diff --git a/share/views/ajax/search/port.tt b/share/views/ajax/search/port.tt index 99635b8d..8de18fd9 100644 --- a/share/views/ajax/search/port.tt +++ b/share/views/ajax/search/port.tt @@ -30,7 +30,7 @@ $(document).ready(function() { return''; } else if (row.up_admin == "up" && (row.up != "up" && row.up != "dormant")) { - return ''; + return ''; } else { return ''; diff --git a/share/views/sidebar/device/ports.tt b/share/views/sidebar/device/ports.tt index 92a32a65..9184345f 100644 --- a/share/views/sidebar/device/ports.tt +++ b/share/views/sidebar/device/ports.tt @@ -34,7 +34,7 @@
    •   Link Up
    •   Link Down
    • -
    •   Port Free
    • +
    •   Port Free
    •   Admin Disabled
    •   Error Disabled
    •   Blocking
    • From f031ae49922b0f3937f50d220e18ad098cd638fc Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:18:43 +0200 Subject: [PATCH 24/62] typo --- lib/App/Netdisco/SSHCollector/Platform/ACE.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm index a3bb5ed6..39ea3b85 100644 --- a/lib/App/Netdisco/SSHCollector/Platform/ACE.pm +++ b/lib/App/Netdisco/SSHCollector/Platform/ACE.pm @@ -1,7 +1,5 @@ package App::Netdisco::SSHCollector::Platform::ACE; -# vim: set expandtab tabstop=8 softtabstop=4 shiftwidth=4: - =head1 NAME App::Netdisco::SSHCollector::Platform::ACE @@ -13,7 +11,7 @@ virtual contexts with individual ARP tables. Contexts are enumerated with C, afterwards the commands C and C must be executed for every context. -The IOS shell does not permit to combine mulitple commands in a single +The IOS shell does not permit to combine multiple commands in a single line, and Net::OpenSSH uses individual connections for individual commands, so we need to use Expect to execute the changeto and show commands in the same context. From 92bc49f27444ff201cc2178132979e0d89c08850 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:20:22 +0200 Subject: [PATCH 25/62] typo --- lib/App/Netdisco/DB/ResultSet/Admin.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/DB/ResultSet/Admin.pm b/lib/App/Netdisco/DB/ResultSet/Admin.pm index c1323cdc..a6f15c01 100644 --- a/lib/App/Netdisco/DB/ResultSet/Admin.pm +++ b/lib/App/Netdisco/DB/ResultSet/Admin.pm @@ -12,7 +12,7 @@ __PACKAGE__->load_components(qw/ =head2 skipped( $backend?, $max_deferrals?, $retry_after? ) -Retuns a correlated subquery for the set of C entries that apply +Returns a correlated subquery for the set of C entries that apply to some jobs. They match the device IP, current backend, and job action. Pass the C FQDN (or the current host will be used as a default), the From bf789cb57b55b9e37aebe6b700a4e4239711a36c Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:25:49 +0200 Subject: [PATCH 26/62] typos --- lib/App/Netdisco/DB/ResultSet/Device.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/DB/ResultSet/Device.pm b/lib/App/Netdisco/DB/ResultSet/Device.pm index c53043b8..5520fedc 100644 --- a/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -187,11 +187,11 @@ Will match exactly the C field. =item os -Will match exactly the C field, which is the operating sytem. +Will match exactly the C field, which is the operating system. =item os_ver -Will match exactly the C field, which is the operating sytem software version. +Will match exactly the C field, which is the operating system software version. =item vendor From 26f410f9ce9cd3447b22a77bcfa543c1a110b83f Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:28:11 +0200 Subject: [PATCH 27/62] typo --- lib/App/Netdisco/Backend/Job.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Backend/Job.pm b/lib/App/Netdisco/Backend/Job.pm index bab5d036..34e97f1b 100644 --- a/lib/App/Netdisco/Backend/Job.pm +++ b/lib/App/Netdisco/Backend/Job.pm @@ -70,7 +70,7 @@ sub display_name { =head2 cancel -Log a status and prevent other stages from runnning. +Log a status and prevent other stages from running. =cut From 860985673b22f33e64a92d366b75894ba79911d5 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:30:25 +0200 Subject: [PATCH 28/62] typo --- lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm b/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm index 5ab13c60..a43ac553 100644 --- a/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm +++ b/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm @@ -189,7 +189,7 @@ email config and creating the repository with C. =head2 C The location where the rancid configuration (F and -F) is installed. It will be used to check the existance +F) is installed. It will be used to check the existence of device types before exporting the devices to the rancid configuration. If no match is found the device will not be added to rancid. From d31cae99bc291b8fb9a8f9f32c5ea21ef0477cdf Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:32:13 +0200 Subject: [PATCH 29/62] typo --- lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm index b8f0dee7..34d75c9d 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm @@ -95,7 +95,7 @@ port relationships. The Device database object can be a fresh L object which is not yet stored to the database. -A list of discovererd neighbors will be returned as [C<$ip>, C<$type>] tuples. +A list of discovered neighbors will be returned as [C<$ip>, C<$type>] tuples. =cut From 205a3932f23f4353abf59be0dae7a4cb4ba97473 Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:33:32 +0200 Subject: [PATCH 30/62] typo --- lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm index fc96e8f1..1e925c20 100644 --- a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm +++ b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm @@ -78,7 +78,7 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub { debug sprintf ' [%s] macsuck - %s updated forwarding table entries', $device->ip, $total_nodes; - # a use for $now ... need to archive dissapeared nodes + # a use for $now ... need to archive disappeared nodes my $archived = 0; if (setting('node_freshness')) { From 22cb988a8f9e92d867f3b35e3c88346d2cc48d6d Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:34:19 +0200 Subject: [PATCH 31/62] typo --- lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm index 1e925c20..029adb2a 100644 --- a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm +++ b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm @@ -105,7 +105,7 @@ All four fields in the tuple are required. If you don't know the VLAN ID, Netdisco supports using ID "0". Optionally, a fifth argument can be the literal string passed to the time_last -field of the database record. If not provided, it defauls to C. +field of the database record. If not provided, it defaults to C. =cut From 131d80c95ee582ba9db397cb02579c382b22781e Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:35:57 +0200 Subject: [PATCH 32/62] typo --- lib/App/Netdisco/Web/Plugin/Device/Ports.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index be5f98ea..51ed71ff 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -31,7 +31,7 @@ get '/ajax/content/device/ports' => require_login sub { # change wildcard chars to SQL $f =~ s/\*/%/g; $f =~ s/\?/_/g; - # set wilcards at param boundaries + # set wildcards at param boundaries if ($f !~ m/[%_]/) { $f =~ s/^\%*/%/; $f =~ s/\%*$/%/; From 8a40559115be4dc5fc26be859215585778bc6b5d Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:37:21 +0200 Subject: [PATCH 33/62] typos --- lib/App/Netdisco/DB/ResultSet.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/DB/ResultSet.pm b/lib/App/Netdisco/DB/ResultSet.pm index 22c25cf8..05fed78f 100644 --- a/lib/App/Netdisco/DB/ResultSet.pm +++ b/lib/App/Netdisco/DB/ResultSet.pm @@ -38,7 +38,7 @@ sub get_distinct_col { Returns a ResultSet for DataTables Server-side processing which populates the displayed table. Evaluates the supplied query parameters for filtering, -paging, and ordering information. Note: query paramters are expected to be +paging, and ordering information. Note: query parameters are expected to be passed as a reference to an expanded hash of hashes. Filtering if present, will generate simple LIKE matching conditions for each @@ -75,7 +75,7 @@ sub get_datatables_data { Returns the total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned for this page of data) for a datatables ResultSet and -query parameters. Note: query paramters are expected to be passed as a +query parameters. Note: query parameters are expected to be passed as a reference to an expanded hash of hashes. =cut From 2b4802d21a0903b7d6efdab5ec95a4e11818b61c Mon Sep 17 00:00:00 2001 From: nick n <39005454+inphobia@users.noreply.github.com> Date: Sat, 17 Aug 2019 10:43:30 +0200 Subject: [PATCH 34/62] typo --- lib/App/Netdisco.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/Netdisco.pm b/lib/App/Netdisco.pm index b4c2fb54..15b59415 100644 --- a/lib/App/Netdisco.pm +++ b/lib/App/Netdisco.pm @@ -252,7 +252,7 @@ Then the process below should be run for each installation: The main black navigation bar has a search box which is smart enough to work out what you're looking for in most cases. For example device names, node IP -or MAC addreses, VLAN numbers, and so on. +or MAC addresses, VLAN numbers, and so on. =head2 Command-Line Device and Port Actions From 85b73e1493753f01bc38d0024f0e345f6aad5f48 Mon Sep 17 00:00:00 2001 From: jngreene Date: Sun, 18 Aug 2019 04:01:04 -0400 Subject: [PATCH 35/62] Modified to add Radius support (#621) Lines 110-112 commented out Lines 113-124 added Lines 233-249 added match_with_radius function --- lib/App/Netdisco/Web/Auth/Provider/DBIC.pm | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/App/Netdisco/Web/Auth/Provider/DBIC.pm b/lib/App/Netdisco/Web/Auth/Provider/DBIC.pm index a35f8d19..61a2d438 100644 --- a/lib/App/Netdisco/Web/Auth/Provider/DBIC.pm +++ b/lib/App/Netdisco/Web/Auth/Provider/DBIC.pm @@ -15,6 +15,10 @@ use Digest::MD5; use Net::LDAP; use Try::Tiny; +if (setting('radius') and ref {} eq ref setting('radius')) { + use Authen::Radius; + } + sub authenticate_user { my ($self, $username, $password) = @_; return unless defined $username; @@ -103,9 +107,21 @@ sub match_password { my $settings = $self->realm_settings; my $username_column = $settings->{users_username_column} || 'username'; - return $user->ldap - ? $self->match_with_ldap($password, $user->$username_column) - : $self->match_with_local_pass($password, $user); +# return $user->ldap +# ? $self->match_with_ldap($password, $user->$username_column) +# : $self->match_with_local_pass($password, $user); + my $pwmatch_result=0; + my $username = $user->$username_column; + + if ($user->ldap) { + $pwmatch_result = $self->match_with_ldap($password, $user->$username_column); + } else { + if ( setting('radius') and ref {} eq ref setting('radius') ) { + $pwmatch_result = ( $self->match_with_radius($password, $username) || $self->match_with_local_pass($password, $user) ); + } else { + $pwmatch_result = $self->match_with_local_pass($password, $user); + } + } } sub match_with_local_pass { @@ -214,5 +230,21 @@ sub _ldap_search { return undef; } - +sub match_with_radius { + my($self, $pass, $user) = @_; + return unless setting('radius') and ref {} eq ref setting('radius'); + my $conf = setting('radius'); + my $radius = new Authen::Radius(Host => $conf->{server}, Secret => $conf->{secret}); + Authen::Radius->load_dictionary(); + $radius->add_attributes( + { Name=> 'User-Name', Value => $user }, + { Name=> 'User-Password', Value => $pass }, + { Name => 'h323-return-code', Value => '0' }, # Cisco AV pair + { Name => 'Digest-Attributes', Value => { Method => 'REGISTER' } } + ); + $radius->send_packet(ACCESS_REQUEST); + my $type = $radius->recv_packet(); + my $radius_return = ($type eq ACCESS_ACCEPT)?1:0; + return $radius_return; +} 1; From c73c3e7569fee4cdc5e70cce5bd6ce555ebdb30e Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 18 Aug 2019 09:16:57 +0100 Subject: [PATCH 36/62] improvements to radius patch --- Build.PL | 1 + lib/App/Netdisco/DB.pm | 2 +- lib/App/Netdisco/DB/Result/User.pm | 2 + .../Netdisco/DB/Result/Virtual/UserRole.pm | 3 + lib/App/Netdisco/Web/Auth/Provider/DBIC.pm | 64 ++++++++++--------- .../Netdisco/Web/Plugin/AdminTask/Users.pm | 2 + .../App-Netdisco-DB-58-59-PostgreSQL.sql | 7 ++ share/views/ajax/admintask/users.tt | 5 ++ share/views/ajax/admintask/users_csv.tt | 3 +- share/views/layouts/main.tt | 2 +- 10 files changed, 57 insertions(+), 34 deletions(-) create mode 100644 share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql diff --git a/Build.PL b/Build.PL index 3fb6f8c4..5097b335 100644 --- a/Build.PL +++ b/Build.PL @@ -26,6 +26,7 @@ Module::Build->new( 'App::cpanminus' => '1.6108', 'App::local::lib::helper' => '0.07', 'Archive::Extract' => '0', + 'Authen::Radius' => '0', 'CGI::Expand' => '2.05', 'Data::Printer' => '0', 'DBD::Pg' => '0', diff --git a/lib/App/Netdisco/DB.pm b/lib/App/Netdisco/DB.pm index baa9bd21..75040b9c 100644 --- a/lib/App/Netdisco/DB.pm +++ b/lib/App/Netdisco/DB.pm @@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces( ); our # try to hide from kwalitee - $VERSION = 58; # schema version used for upgrades, keep as integer + $VERSION = 59; # schema version used for upgrades, keep as integer use Path::Class; use File::ShareDir 'dist_dir'; diff --git a/lib/App/Netdisco/DB/Result/User.pm b/lib/App/Netdisco/DB/Result/User.pm index 612019db..6e525547 100644 --- a/lib/App/Netdisco/DB/Result/User.pm +++ b/lib/App/Netdisco/DB/Result/User.pm @@ -29,6 +29,8 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 1 }, "ldap", { data_type => "boolean", default_value => \"false", is_nullable => 1 }, + "radius", + { data_type => "boolean", default_value => \"false", is_nullable => 1 }, "admin", { data_type => "boolean", default_value => \"false", is_nullable => 1 }, "fullname", diff --git a/lib/App/Netdisco/DB/Result/Virtual/UserRole.pm b/lib/App/Netdisco/DB/Result/Virtual/UserRole.pm index af960260..7e9f2910 100644 --- a/lib/App/Netdisco/DB/Result/Virtual/UserRole.pm +++ b/lib/App/Netdisco/DB/Result/Virtual/UserRole.pm @@ -20,6 +20,9 @@ __PACKAGE__->result_source_instance->view_definition(<realm_settings; my $username_column = $settings->{users_username_column} || 'username'; -# return $user->ldap -# ? $self->match_with_ldap($password, $user->$username_column) -# : $self->match_with_local_pass($password, $user); - my $pwmatch_result=0; + my $pwmatch_result = 0; my $username = $user->$username_column; if ($user->ldap) { - $pwmatch_result = $self->match_with_ldap($password, $user->$username_column); - } else { - if ( setting('radius') and ref {} eq ref setting('radius') ) { - $pwmatch_result = ( $self->match_with_radius($password, $username) || $self->match_with_local_pass($password, $user) ); - } else { - $pwmatch_result = $self->match_with_local_pass($password, $user); - } - } + $pwmatch_result = $self->match_with_ldap($password, $username); + } + elsif ($user->raidus) { + $pwmatch_result = $self->match_with_radius($password, $username); + } + else { + $pwmatch_result = $self->match_with_local_pass($password, $user); + } + + return $pwmatch_result; } sub match_with_local_pass { @@ -230,21 +226,27 @@ sub _ldap_search { return undef; } + sub match_with_radius { - my($self, $pass, $user) = @_; - return unless setting('radius') and ref {} eq ref setting('radius'); - my $conf = setting('radius'); - my $radius = new Authen::Radius(Host => $conf->{server}, Secret => $conf->{secret}); - Authen::Radius->load_dictionary(); - $radius->add_attributes( - { Name=> 'User-Name', Value => $user }, - { Name=> 'User-Password', Value => $pass }, - { Name => 'h323-return-code', Value => '0' }, # Cisco AV pair - { Name => 'Digest-Attributes', Value => { Method => 'REGISTER' } } - ); - $radius->send_packet(ACCESS_REQUEST); - my $type = $radius->recv_packet(); - my $radius_return = ($type eq ACCESS_ACCEPT)?1:0; - return $radius_return; + my($self, $pass, $user) = @_; + return unless setting('radius') and ref {} eq ref setting('radius'); + + my $conf = setting('radius'); + my $radius = Authen::Radius->new(Host => $conf->{server}, Secret => $conf->{secret}); + Authen::Radius->load_dictionary(); + + $radius->add_attributes( + { Name => 'User-Name', Value => $user }, + { Name => 'User-Password', Value => $pass }, + { Name => 'h323-return-code', Value => '0' }, # Cisco AV pair + { Name => 'Digest-Attributes', Value => { Method => 'REGISTER' } } + ); + $radius->send_packet(ACCESS_REQUEST); + + my $type = $radius->recv_packet(); + my $radius_return = ($type eq ACCESS_ACCEPT) ? 1 : 0; + + return $radius_return; } + 1; diff --git a/lib/App/Netdisco/Web/Plugin/AdminTask/Users.pm b/lib/App/Netdisco/Web/Plugin/AdminTask/Users.pm index 94893702..712e26ca 100644 --- a/lib/App/Netdisco/Web/Plugin/AdminTask/Users.pm +++ b/lib/App/Netdisco/Web/Plugin/AdminTask/Users.pm @@ -41,6 +41,7 @@ ajax '/ajax/control/admin/users/add' => require_role setting('defanged_admin') = password => _make_password(param('password')), fullname => param('fullname'), ldap => (param('ldap') ? \'true' : \'false'), + radius => (param('radius') ? \'true' : \'false'), port_control => (param('port_control') ? \'true' : \'false'), admin => (param('admin') ? \'true' : \'false'), note => param('note'), @@ -71,6 +72,7 @@ ajax '/ajax/control/admin/users/update' => require_role setting('defanged_admin' : ()), fullname => param('fullname'), ldap => (param('ldap') ? \'true' : \'false'), + radius => (param('radius') ? \'true' : \'false'), port_control => (param('port_control') ? \'true' : \'false'), admin => (param('admin') ? \'true' : \'false'), note => param('note'), diff --git a/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql b/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql new file mode 100644 index 00000000..8262af36 --- /dev/null +++ b/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql @@ -0,0 +1,7 @@ +BEGIN; + +ALTER TABLE users ADD radius boolean; + +ALTER TABLE users ALTER radius SET DEFAULT false; + +COMMIT; diff --git a/share/views/ajax/admintask/users.tt b/share/views/ajax/admintask/users.tt index ab766b2e..7131a2a5 100644 --- a/share/views/ajax/admintask/users.tt +++ b/share/views/ajax/admintask/users.tt @@ -5,6 +5,7 @@ Username Password LDAP Auth + RADIUS Auth Port Control Administrator Created @@ -19,6 +20,7 @@ + @@ -45,6 +47,9 @@ + + + diff --git a/share/views/ajax/admintask/users_csv.tt b/share/views/ajax/admintask/users_csv.tt index 315e29c1..5005c6e8 100644 --- a/share/views/ajax/admintask/users_csv.tt +++ b/share/views/ajax/admintask/users_csv.tt @@ -1,6 +1,6 @@ [% USE CSV -%] [% CSV.dump([ 'Full Name' 'Username' - 'LDAP Auth' 'Port Control' 'Administrator' 'Created' + 'LDAP Auth' 'RADIUS Auth' 'Port Control' 'Administrator' 'Created' 'Last Login' 'Note']) %] [% FOREACH row IN results %] @@ -8,6 +8,7 @@ [% mylist.push(row.fullname) %] [% mylist.push(row.username) %] [% mylist.push(row.ldap) %] + [% mylist.push(row.radius) %] [% mylist.push(row.port_control) %] [% mylist.push(row.admin) %] [% mylist.push(row.created) %] diff --git a/share/views/layouts/main.tt b/share/views/layouts/main.tt index f1b12a34..c3ecac2f 100644 --- a/share/views/layouts/main.tt +++ b/share/views/layouts/main.tt @@ -181,7 +181,7 @@ [% session.logged_in_fullname || session.logged_in_user | html_entity %]