Skip to content

Commit

Permalink
Merge pull request #31 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
PRVB
  • Loading branch information
abhi1693 authored Jan 30, 2023
2 parents 26a68b9 + 6bf97b0 commit c58d0a8
Show file tree
Hide file tree
Showing 82 changed files with 851 additions and 681 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
max-line-length = 160
extend-ignore = E203
extend-ignore = E203
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ body:
description: What happened instead?
placeholder: A TypeError exception was raised
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation_change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ body:
label: Proposed Changes
description: Describe the proposed changes and why they are necessary.
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ body:
description: >
List any new dependencies on external libraries or services that this new feature would
introduce. For example, does the proposal require the installation of a new Python package?
(Not all new features introduce new dependencies.)
(Not all new features introduce new dependencies.)
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/housekeeping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ body:
label: Justification
description: Please provide justification for the proposed change(s).
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ Please put an x into the brackets (like `[x]`) if you've completed that task.

* [ ] I have explained my PR according to the information in the comments
or in a linked issue.
* [ ] My PR targets the `dev` branch.
* [ ] My PR targets the `dev` branch.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
uses: actions/dependency-review-action@v2
22 changes: 1 addition & 21 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,7 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries
.idea/

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
Expand Down
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

26 changes: 0 additions & 26 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/netbox-secrets.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ profile = black
multi_line_output = 3

; necessary because black expect the trailing comma
include_trailing_comma = true
include_trailing_comma = true
2 changes: 1 addition & 1 deletion .jscpd.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore": ["**/tests/**"]
}
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [Unreleased](https://github.com/Onemind-Services-LLC/netbox-secrets/tree/HEAD)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-secrets/compare/v1.7.3...HEAD)

**Closed issues:**

- \[Bug\]: Secret role secrets count is always 0 [\#24](https://github.com/Onemind-Services-LLC/netbox-secrets/issues/24)

## [v1.7.3](https://github.com/Onemind-Services-LLC/netbox-secrets/tree/v1.7.3) (2023-01-23)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-secrets/compare/v1.7.2...v1.7.3)

**Merged pull requests:**

- Prepare for Pypi [\#23](https://github.com/Onemind-Services-LLC/netbox-secrets/pull/23) ([abhi1693](https://github.com/abhi1693))

## [v1.7.2](https://github.com/Onemind-Services-LLC/netbox-secrets/tree/v1.7.2) (2023-01-19)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-secrets/compare/v1.7.1...v1.7.2)
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
https://www.contributor-covenant.org/faq
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.md
include LICENSE
recursive-include netbox_secrets/templates *
recursive-include netbox_secrets/static *
recursive-include netbox_secrets/static *
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Netbox Secrets

This is the continuation of the [NetBox Secretstore](https://github.com/DanSheps/netbox-secretstore) app.
This is the continuation of the [NetBox Secretstore](https://github.com/DanSheps/netbox-secretstore) app. The original plugin
is minimally maintained and has a lot of issues. This plugin is a complete rewrite of the original plugin. It is more generic
and flexible than the original plugin. It is also regularly tested with the latest NetBox releases to ensure compatibility
and stability.

# Features

* Store secrets in the database encrypted with a public key (RSA)
* More generic and flexible than the original plugin (e.g. secrets can be assigned to any object in NetBox)
* Secrets can be assigned to contacts to associate them with a secret (e.g. SSH key)
* Updated user interface to make it easier to use and more intuitive to navigate
* Regularly tested with the latest NetBox releases to ensure compatibility and stability

# Compatibility

Expand Down Expand Up @@ -51,6 +62,28 @@ The following options are available in the configuration file:
- __Default__: `2048`
- __Options__: `2048`, `4096`, `8192`

## Screenshots

### User key (Without Session)

![user-key.png](./assets/user-key.png)

### User key (With Session)

![user-key-session.png](./assets/user-key-session.png)

### Secret Object View

![secret.png](./assets/secret.png)

### Secret Panel on Device

![secret-panel.png](./assets/secret-panel.png)

### Secret Role Object View

![role.png](./assets/role.png)

## FAQ

1. How can I migrate the data from `netbox-secretstore`?
Expand All @@ -75,9 +108,9 @@ python manage.py migrate
Finally, readjust the indices for the `netbox-secrets` plugin

```shell
python manage.py sqlsequencereset netbox_secrets
python manage.py sqlsequencereset netbox_secrets
```

Run the output of the previous command in the database.

You can now remove `netbox-secretstore` from the application.
You can now remove `netbox-secretstore` from the application.
Binary file added assets/role.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/secret-panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/secret.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/user-key-session.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/user-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions configuration/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# Read secret from file
def _read_secret(secret_name, default=None):
try:
f = open('/run/secrets/' + secret_name, 'r', encoding='utf-8')
except EnvironmentError:
f = open('/run/secrets/' + secret_name, encoding='utf-8')
except OSError:
return default
else:
with f:
Expand Down Expand Up @@ -68,12 +68,14 @@ def _read_secret(secret_name, default=None):
'HOST': environ.get('REDIS_CACHE_HOST', environ.get('REDIS_HOST', 'localhost')),
'PORT': int(environ.get('REDIS_CACHE_PORT', environ.get('REDIS_PORT', 6379))),
'PASSWORD': _read_secret(
'redis_cache_password', environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', ''))
'redis_cache_password',
environ.get('REDIS_CACHE_PASSWORD', environ.get('REDIS_PASSWORD', '')),
),
'DATABASE': int(environ.get('REDIS_CACHE_DATABASE', 1)),
'SSL': environ.get('REDIS_CACHE_SSL', environ.get('REDIS_SSL', 'False')).lower() == 'true',
'INSECURE_SKIP_TLS_VERIFY': environ.get(
'REDIS_CACHE_INSECURE_SKIP_TLS_VERIFY', environ.get('REDIS_INSECURE_SKIP_TLS_VERIFY', 'False')
'REDIS_CACHE_INSECURE_SKIP_TLS_VERIFY',
environ.get('REDIS_INSECURE_SKIP_TLS_VERIFY', 'False'),
).lower()
== 'true',
},
Expand All @@ -84,3 +86,5 @@ def _read_secret(secret_name, default=None):
# symbols. NetBox will not run without this defined. For more information, see
# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY
SECRET_KEY = _read_secret('secret_key', environ.get('SECRET_KEY', ''))

DEVELOPER = True
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ services:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis.env
env_file: env/redis.env
6 changes: 3 additions & 3 deletions docs/models/secret.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Secrets

A secret represents a single credential or other sensitive string of characters which must be stored securely. Each
secret is assigned to a device within NetBox. The plaintext value of a secret is encrypted to a ciphertext
immediately prior to storage within the database using a 256-bit AES master key. A SHA256 hash of the plaintext is also
A secret represents a single credential or other sensitive string of characters which must be stored securely. Each
secret is assigned to a device within NetBox. The plaintext value of a secret is encrypted to a ciphertext
immediately prior to storage within the database using a 256-bit AES master key. A SHA256 hash of the plaintext is also
stored along with each ciphertext to validate the decrypted plaintext.

Each secret can also store an optional name parameter, which is not encrypted. This may be useful for storing usernames.
2 changes: 1 addition & 1 deletion docs/models/secretrole.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Secret Roles

Each secret is assigned a functional role which indicates what it is used for. Secret roles are customizable.
Each secret is assigned a functional role which indicates what it is used for. Secret roles are customizable.

Typical roles might include:

Expand Down
Loading

0 comments on commit c58d0a8

Please sign in to comment.