From b25faec1593a35b84034fe98f98e28ef3ee1adda Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 10 Oct 2019 12:42:57 -0400 Subject: [PATCH 01/41] Post-release version bump --- netbox/netbox/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 0175d89f2..f49387482 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ from django.core.exceptions import ImproperlyConfigured # Environment setup # -VERSION = '2.6.6-dev' +VERSION = '2.6.7-dev' # Hostname HOSTNAME = platform.node() From 4cc29729f98afe2f4271b2ee1c0ff34c1c1e8f60 Mon Sep 17 00:00:00 2001 From: Damien Garros Date: Fri, 11 Oct 2019 13:45:37 -0400 Subject: [PATCH 02/41] Update pillow version to 6.2.0 A new CVE just got reporter regarding Pillow http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-16865 it's affecting all version prior to 6.2.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3ad165a4b..b467651cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,7 @@ graphviz==0.10.1 Jinja2==2.10.1 Markdown==2.6.11 netaddr==0.7.19 -Pillow==6.0.0 +Pillow==6.2.0 psycopg2-binary==2.8.3 py-gfm==0.1.4 pycryptodome==3.8.2 From 09d7d38b0430ca6252efb63fd57aa6adc711e475 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Sun, 13 Oct 2019 01:43:08 -0400 Subject: [PATCH 03/41] implemented #3499 - Add to Webhook model to support user supplied CA certificate verrification of webhook requests --- docs/release-notes/version-2.6.md | 12 ++++++++++++ .../migrations/0026_webhook_ca_file_path.py | 18 ++++++++++++++++++ netbox/extras/models.py | 13 +++++++++++++ netbox/extras/webhooks_worker.py | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 netbox/extras/migrations/0026_webhook_ca_file_path.py diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 2b9b3b765..54b701911 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -1,3 +1,15 @@ +# v2.6.7 (FUTURE) + +## Enhancements + +* [#3499](https://github.com/netbox-community/netbox/issues/3499) - Add `ca_file_path` to Webhook model to support user supplied CA certificate verrification of webhook requests + +## Bug Fixes + + + +--- + # v2.6.6 (2019-10-10) ## Notes diff --git a/netbox/extras/migrations/0026_webhook_ca_file_path.py b/netbox/extras/migrations/0026_webhook_ca_file_path.py new file mode 100644 index 000000000..07b5267f2 --- /dev/null +++ b/netbox/extras/migrations/0026_webhook_ca_file_path.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2 on 2019-10-13 05:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('extras', '0025_objectchange_time_index'), + ] + + operations = [ + migrations.AddField( + model_name='webhook', + name='ca_file_path', + field=models.CharField(blank=True, max_length=4096, null=True), + ), + ] diff --git a/netbox/extras/models.py b/netbox/extras/models.py index d4125c327..4e8a56b34 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -86,6 +86,14 @@ class Webhook(models.Model): verbose_name='SSL verification', help_text="Enable SSL certificate verification. Disable with caution!" ) + ca_file_path = models.CharField( + max_length=4096, + null=True, + blank=True, + verbose_name='CA File Path', + help_text='The specific CA certificate file to use for SSL verification. ' + 'Leave blank to use the system defaults.' + ) class Meta: unique_together = ('payload_url', 'type_create', 'type_update', 'type_delete',) @@ -102,6 +110,11 @@ class Webhook(models.Model): "You must select at least one type: create, update, and/or delete." ) + if not self.ssl_verification and self.ca_file_path: + raise ValidationError({ + 'ca_file_path': 'Do not specify a CA certificate file if SSL verification is dissabled.' + }) + # # Custom fields diff --git a/netbox/extras/webhooks_worker.py b/netbox/extras/webhooks_worker.py index 8712092d4..c50a0a368 100644 --- a/netbox/extras/webhooks_worker.py +++ b/netbox/extras/webhooks_worker.py @@ -49,6 +49,8 @@ def process_webhook(webhook, data, model_name, event, timestamp, username, reque with requests.Session() as session: session.verify = webhook.ssl_verification + if webhook.ca_file_path: + session.verify = webhook.ca_file_path response = session.send(prepared_request) if response.status_code >= 200 and response.status_code <= 299: From 5e88313276fabf379fca637978338cd8ff438ba0 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Sun, 13 Oct 2019 01:45:20 -0400 Subject: [PATCH 04/41] typo in change log --- docs/release-notes/version-2.6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 54b701911..4badcfedf 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -2,7 +2,7 @@ ## Enhancements -* [#3499](https://github.com/netbox-community/netbox/issues/3499) - Add `ca_file_path` to Webhook model to support user supplied CA certificate verrification of webhook requests +* [#3499](https://github.com/netbox-community/netbox/issues/3499) - Add `ca_file_path` to Webhook model to support user supplied CA certificate verification of webhook requests ## Bug Fixes From c7d9bf839ee6cf977525bc3378b21b0544431773 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Sun, 13 Oct 2019 03:09:58 -0400 Subject: [PATCH 05/41] implemented #3445 - Add support for additional user defined headers to be added to webhook requests --- docs/release-notes/version-2.6.md | 3 +-- .../0027_webhook_additional_headers.py | 19 +++++++++++++++++++ netbox/extras/models.py | 12 ++++++++++++ netbox/extras/webhooks_worker.py | 3 +++ 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 netbox/extras/migrations/0027_webhook_additional_headers.py diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 4badcfedf..fe72331a7 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -2,12 +2,11 @@ ## Enhancements +* [#3445](https://github.com/netbox-community/netbox/issues/3445) - Add support for additional user defined headers to be added to webhook requests * [#3499](https://github.com/netbox-community/netbox/issues/3499) - Add `ca_file_path` to Webhook model to support user supplied CA certificate verification of webhook requests ## Bug Fixes - - --- # v2.6.6 (2019-10-10) diff --git a/netbox/extras/migrations/0027_webhook_additional_headers.py b/netbox/extras/migrations/0027_webhook_additional_headers.py new file mode 100644 index 000000000..8b1f04f19 --- /dev/null +++ b/netbox/extras/migrations/0027_webhook_additional_headers.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2 on 2019-10-13 07:06 + +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('extras', '0026_webhook_ca_file_path'), + ] + + operations = [ + migrations.AddField( + model_name='webhook', + name='additional_headers', + field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True), + ), + ] diff --git a/netbox/extras/models.py b/netbox/extras/models.py index 4e8a56b34..ea71cf95e 100644 --- a/netbox/extras/models.py +++ b/netbox/extras/models.py @@ -70,6 +70,12 @@ class Webhook(models.Model): default=WEBHOOK_CT_JSON, verbose_name='HTTP content type' ) + additional_headers = JSONField( + null=True, + blank=True, + help_text="User supplied headers which should be added to the request in addition to the HTTP content type. " + "Headers are supplied as key/value pairs in a JSON object." + ) secret = models.CharField( max_length=255, blank=True, @@ -115,6 +121,12 @@ class Webhook(models.Model): 'ca_file_path': 'Do not specify a CA certificate file if SSL verification is dissabled.' }) + # Verify that JSON data is provided as an object + if self.additional_headers and type(self.additional_headers) is not dict: + raise ValidationError({ + 'additional_headers': 'Header JSON data must be in object form. Example: {"X-API-KEY": "abc123"}' + }) + # # Custom fields diff --git a/netbox/extras/webhooks_worker.py b/netbox/extras/webhooks_worker.py index c50a0a368..9a637e852 100644 --- a/netbox/extras/webhooks_worker.py +++ b/netbox/extras/webhooks_worker.py @@ -25,6 +25,9 @@ def process_webhook(webhook, data, model_name, event, timestamp, username, reque headers = { 'Content-Type': webhook.get_http_content_type_display(), } + if webhook.additional_headers: + headers.update(webhook.additional_headers) + params = { 'method': 'POST', 'url': webhook.payload_url, From b8feba107065585f11d0da2adcb8911e541fec03 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Sun, 13 Oct 2019 04:12:58 -0400 Subject: [PATCH 06/41] implemented #3606 - added stale bot config --- .github/stale.yaml | 22 ++++++++++++++++++++++ CONTRIBUTING.md | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/stale.yaml diff --git a/.github/stale.yaml b/.github/stale.yaml new file mode 100644 index 000000000..3f309b0ca --- /dev/null +++ b/.github/stale.yaml @@ -0,0 +1,22 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 14 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - "status: accepted" + - "status: gathering feedback" +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. NetBox + is governed by a small group of core maintainers which means not all opened + issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md). +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + This issue has been automatically closed due to lack of activity. In an + effort to reduce noise, please do not comment any further. Note that the + core maintainers may elect to reopen this issue at a later date if deemed + necessary. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a688be9b3..1ecdbf1ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,6 +118,29 @@ feedback. **Do not** comment on an issue just to show your support (give the top post a :+1: instead) or ask for an ETA. These comments will be deleted to reduce noise in the discussion. +## Issue Lifecycle + +When a correctly formatted issue is submitted it is evaluated by a moderator +who may elect to immediately label the issue as accepted in addition to another +issue type label. In other cases, the issue may be labeled as "status: gathering feedback" +which will often be accompanied by a comment from a moderator asking for further dialog from the community. +If an issue is labeled as "status: revisions needed" a moderator has identified a problem with +the issue itself and is asking for the submitter himself to update the original post with +the requested information. If the original post is not updated in a reasonable amount of time, +the issue will be closed as invalid. + +The core maintainers group has chosen to make use of the GitHub Stale bot to aid in issue management. + +* Issues will be marked as stale after 14 days of no activity. + +* Then after 7 more days of inactivity, the issue will be closed. + +* Any issue with either the "status: accepted" or "status: gathering feedback" labels applied will be exempt from all Stale bot actions. + +It is natural that some new issues get more attention than others. Often this is a metric of an issues's +overall usefulness to the project. In other cases in which issues merely get lost in the shuffle, +notifications from Stale bot can bring renewed attention to potentially meaningful issues. + ## Maintainer Guidance * Maintainers are expected to contribute at least four hours per week to the From a7380ba353bd6587713e113e21044b109bfb1db0 Mon Sep 17 00:00:00 2001 From: Tobias Genannt Date: Mon, 14 Oct 2019 09:29:04 +0200 Subject: [PATCH 07/41] Add SCRIPTS_ROOT to configuration.example.py Fixes #3608 by adding the new variable to the example configuration. --- netbox/netbox/configuration.example.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netbox/netbox/configuration.example.py b/netbox/netbox/configuration.example.py index ebc3d4540..16316bb66 100644 --- a/netbox/netbox/configuration.example.py +++ b/netbox/netbox/configuration.example.py @@ -154,6 +154,10 @@ PREFER_IPV4 = False # this setting is derived from the installed location. # REPORTS_ROOT = '/opt/netbox/netbox/reports' +# The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of +# this setting is derived from the installed location. +# SCRIPTS_ROOT = '/opt/netbox/netbox/scripts' + # By default, NetBox will store session data in the database. Alternatively, a file path can be specified here to use # local file storage instead. (This can be useful for enabling authentication on a standby instance with read-only # database access.) Note that the user as which NetBox runs must have read and write permissions to this path. From 91f045a2e47a818fa7ec95ef77523d65ed0c6a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markku=20Leini=C3=B6?= Date: Tue, 15 Oct 2019 20:51:57 +0300 Subject: [PATCH 08/41] Update examples in webhooks.md --- docs/additional-features/webhooks.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/additional-features/webhooks.md b/docs/additional-features/webhooks.md index 0e74640fa..9a02449f8 100644 --- a/docs/additional-features/webhooks.md +++ b/docs/additional-features/webhooks.md @@ -11,8 +11,10 @@ The webhook POST request is structured as so (assuming `application/json` as the ```no-highlight { "event": "created", - "signal_received_timestamp": 1508769597, - "model": "Site" + "timestamp": "2019-10-12 12:51:29.746944", + "username": "admin", + "model": "site", + "request_id": "43d8e212-94c7-4f67-b544-0dcde4fc0f43", "data": { ... } @@ -24,8 +26,10 @@ The webhook POST request is structured as so (assuming `application/json` as the ```no-highlight { "event": "deleted", - "signal_received_timestamp": 1508781858.544069, - "model": "Site", + "timestamp": "2019-10-12 12:55:44.030750", + "username": "johnsmith", + "model": "site", + "request_id": "e9bb83b2-ebe4-4346-b13f-07144b1a00b4", "data": { "asn": None, "comments": "", From f08968da494ff4bbe341075622c26df3e9c113c4 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 17 Oct 2019 14:28:27 -0400 Subject: [PATCH 09/41] Exempt issues tagged with "status: blocked" --- .github/stale.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/stale.yaml b/.github/stale.yaml index 3f309b0ca..7c8d03f12 100644 --- a/.github/stale.yaml +++ b/.github/stale.yaml @@ -6,6 +6,7 @@ daysUntilClose: 7 exemptLabels: - "status: accepted" - "status: gathering feedback" + - "status: blocked" # Label to use when marking an issue as stale staleLabel: wontfix # Comment to post when marking an issue as stale. Set to `false` to disable From 1df6713ad584ea6e14563da3a4e8a0baf5853ba2 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 17 Oct 2019 20:56:37 -0400 Subject: [PATCH 10/41] Minor improvements pertaining to CII best practices --- CONTRIBUTING.md | 17 ++++++++++------- README.md | 12 +++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ecdbf1ac..55a979eef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ already been fixed. to see if the bug you've found has already been reported. If you think you may be experiencing a reported issue that hasn't already been resolved, please click "add a reaction" in the top right corner of the issue and add a thumbs -up (+1). You mightalso want to add a comment describing how it's affecting your +up (+1). You might also want to add a comment describing how it's affecting your installation. This will allow us to prioritize bugs based on how many users are affected. @@ -99,6 +99,8 @@ any work that's already in progress. * Any pull request which does _not_ relate to an accepted issue will be closed. +* All major new functionality must include relevant tests where applicable. + * When submitting a pull request, please be sure to work off of the `develop` branch, rather than `master`. The `develop` branch is used for ongoing development, while `master` is used for tagging new stable releases. @@ -128,15 +130,16 @@ If an issue is labeled as "status: revisions needed" a moderator has identified the issue itself and is asking for the submitter himself to update the original post with the requested information. If the original post is not updated in a reasonable amount of time, the issue will be closed as invalid. - + The core maintainers group has chosen to make use of the GitHub Stale bot to aid in issue management. - + * Issues will be marked as stale after 14 days of no activity. - * Then after 7 more days of inactivity, the issue will be closed. - -* Any issue with either the "status: accepted" or "status: gathering feedback" labels applied will be exempt from all Stale bot actions. - +* Any issue bearing one of the following labels will be exempt from all Stale bot actions: + * `status: accepted` + * `status: gathering feedback` + * `status: blocked` + It is natural that some new issues get more attention than others. Often this is a metric of an issues's overall usefulness to the project. In other cases in which issues merely get lost in the shuffle, notifications from Stale bot can bring renewed attention to potentially meaningful issues. diff --git a/README.md b/README.md index e915c8662..996f26332 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ NetBox is an IP address management (IPAM) and data center infrastructure management (DCIM) tool. Initially conceived by the network engineering team at [DigitalOcean](https://www.digitalocean.com/), NetBox was developed specifically -to address the needs of network and infrastructure engineers. +to address the needs of network and infrastructure engineers. It is intended to +function as a domain-specific source of truth for network operations. NetBox runs as a web application atop the [Django](https://www.djangoproject.com/) Python framework with a [PostgreSQL](http://www.postgresql.org/) database. For a @@ -42,6 +43,15 @@ and run `upgrade.sh`. * [Ansible deployment](https://github.com/lae/ansible-role-netbox) (via [@lae](https://github.com/lae)) * [Kubernetes deployment](https://github.com/CENGN/netbox-kubernetes) (via [@CENGN](https://github.com/CENGN)) +# Providing Feedback + +Feature requests and bug reports must be submitted as GiHub issues. (Please be +sure to use the [appropriate template](https://github.com/netbox-community/netbox/issues/new/choose).) +For general discussion, please consider joining our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss). + +If you are interested in contributing to the development of NetBox, please read +our [contributing guide](CONTRIBUTING.md) prior to beginning any work. + # Related projects Please see [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions) for a list of relevant community projects. From 244e85e8366c4790d6c23bcb088ce909129a0911 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Mon, 14 Oct 2019 17:30:29 -0400 Subject: [PATCH 11/41] modify patch panel port connection type list --- netbox/templates/dcim/inc/frontport.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/netbox/templates/dcim/inc/frontport.html b/netbox/templates/dcim/inc/frontport.html index ae86a36b4..1b7f85e2c 100644 --- a/netbox/templates/dcim/inc/frontport.html +++ b/netbox/templates/dcim/inc/frontport.html @@ -64,6 +64,8 @@