diff --git a/Netdisco/Changes b/Netdisco/Changes index 45edf259..e1eb8094 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -6,6 +6,7 @@ * Add device/node/vlan/port specific search from Navbar * [#3] [#47] Device Neighbor Map can have max depth and VLAN filter * [#31] get_community now supported + * [#19] Ask for Reason when changing Port up/down Status, or VLAN [ENHANCEMENTS] diff --git a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod index 1bff8bbf..b4119802 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Configuration.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Configuration.pod @@ -662,6 +662,26 @@ Set to false to disable the periodic AJAX check for completed entries in the job queue for this user. Mainly useful for development to suppress noisy web frontend activity. +=head3 C + +Value: Hash of Strings. Default: + + port_control_reasons: + address: 'Address Allocation Abuse' + copyright: 'Copyright Violation' + dos: 'Denial of Service' + bandwidth: 'Excessive Bandwidth' + polling: 'Excessive Polling of DNS/DHCP/SNMP' + noserv: 'Not In Service' + exploit: 'Remote Exploit Possible' + compromised: 'System Compromised' + other: 'Other' + resolved: 'Issue Resolved' + +When a user has Port Control rights and shuts down a port, they are asked for +a reason. This configuration lists those reasons, and can be overridden to add +or remove any entries. + =head2 Backend Daemon =head3 C diff --git a/Netdisco/lib/App/Netdisco/Web/PortControl.pm b/Netdisco/lib/App/Netdisco/Web/PortControl.pm index beb3d590..4dea3385 100644 --- a/Netdisco/lib/App/Netdisco/Web/PortControl.pm +++ b/Netdisco/lib/App/Netdisco/Web/PortControl.pm @@ -37,9 +37,9 @@ ajax '/ajax/portcontrol' => require_role port_control => sub { ip => param('device'), port => param('port'), action => $a, - reason => 'other', username => session('logged_in_user'), userip => request->remote_address, + reason => (param('reason') || 'other'), log => param('log'), }); } diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index d739c705..b93aabc7 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -75,6 +75,8 @@ extra_web_plugins: [] # mibdirs defaults to contents of mibhome community: ['public'] community_rw: ['private'] +snmp_auth: [] +get_community: '' bulkwalk_off: false bulkwalk_no: [] bulkwalk_repeaters: 20 @@ -122,6 +124,17 @@ portctl_nophones: false portctl_vlans: false portctl_uplinks: false check_userlog: true +port_control_reasons: + address: 'Address Allocation Abuse' + copyright: 'Copyright Violation' + dos: 'Denial of Service' + bandwidth: 'Excessive Bandwidth' + polling: 'Excessive Polling of DNS/DHCP/SNMP' + noserv: 'Not In Service' + exploit: 'Remote Exploit Possible' + compromised: 'System Compromised' + other: 'Other' + resolved: 'Issue Resolved' # -------------- # BACKEND DAEMON diff --git a/Netdisco/share/public/javascripts/netdisco_portcontrol.js b/Netdisco/share/public/javascripts/netdisco_portcontrol.js index 545c4733..eeab2485 100644 --- a/Netdisco/share/public/javascripts/netdisco_portcontrol.js +++ b/Netdisco/share/public/javascripts/netdisco_portcontrol.js @@ -4,6 +4,7 @@ var nd_save_ok = false; // user clicked or asked for port changes to be submitted via ajax function port_control (e) { var td = $(e).closest('td'), + reason = $('#nd_portlog-reason').val(), logmessage = $('#nd_portlog-log').val(); $('#nd_portlog-log').val(''); @@ -23,7 +24,8 @@ function port_control (e) { ,field: td.data('field') ,action: td.data('action') ,value: td.text().trim() - ,log: logmessage, + ,reason: reason + ,log: logmessage } ,success: function() { toastr.info('Submitted change request'); @@ -119,6 +121,12 @@ $(document).ready(function() { $('#nd_portlog').one('hidden', function() { port_control(clicked); // save }); + if ($(this).hasClass('icon-hand-up')) { + $('#nd_portlog-reason').val('resolved'); + } + else { + $('#nd_portlog-reason').val('other'); + } $('#nd_portlog').modal('show'); }); diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index dd0eeb13..f4075bb5 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -279,6 +279,15 @@