Comments (1)
Doing a little bit of local debug to try to get it working. In practice we'll just need to set an auth method that defaults to token
in the plugin settings. And then have the provider code that sets up the Vault client to choose the auth method based on the one specified in the plugins config.
Plugin config
Pseudo code for processing the plugin settings for token (default) vs approle:
if auth_method == "token":
required_fields = ("url", "token")
elif auth_method == "approle":
required_fields = ("url", "role_id", "secret_id")
Plugin config for token:
PLUGINS_CONFIG = {
"nautobot_secrets_providers": {
"url": "http://localhost:8200",
"auth_method": "token",
"token": "nautobot",
},
}
Plugin config for approle
:
PLUGINS_CONFIG = {
"nautobot_secrets_providers": {
"url": "http://localhost:8200",
"auth_method": "approle",
"role_id": "e4a3a05a-b83b-ad2f-89f6-4c84edd9ec0b",
"secret_id": "5b59651c-2687-d14d-ab61-7275b4c39cf4",
},
}
AppRole testing
For testing we'll need to set this all of this stuff up.
enable_auth_method
client = hvac.Client(url="http://localhost:8200", token="nautobot"
# POST http://localhost:8200/v1/sys/auth/approle
r = client.sys.enable_auth_method(
method_type='approle',
)
Authentication
Create Policy
policy = """
path "secret/*" {
capabilities = ["read", "list"]
}
"""
client.sys.create_or_update_policy(name="read-only", policy=policy)
Create AppRole
# POST http://localhost:8200/v1/auth/approle/role/test-role
resp = client.auth.approle.create_or_update_approle(
role_name="test-role",
token_policies=["test-policy"], # <= Needs to be created first
token_type="service",
)
role_id = resp["data"]["role_id"]
Generate Secret ID
resp = client.auth.approle.generate_secret_id(
role_name="test-role",
cidr_list=["127.0.0.1/32", "172.18.0.1/32"],
)
secret_id = resp["data"]["secret_id"]
Login
role_name = "test-role"
role_id = "e4a3a05a-b83b-ad2f-89f6-4c84edd9ec0b"
secret_id = "5b59651c-2687-d14d-ab61-7275b4c39cf4"
r3 = client2.auth.approle.login(role_id=role_id, secret_id=secret_id)
s = client2.secrets.kv.read_secret("hello")
print(s["data"]["data"]["hello"])
from nautobot-app-secrets-providers.
Related Issues (20)
- Delinea login error misleading HOT 2
- Nautobot Worker fails to start if SecretValueNotFoundError from AWS HOT 3
- The documentation and README for the nautobot-plugin-secrets-providers do not reflect the newer 2.x version requirements
- Add support for python-tss-sdk version v1.2 HOT 1
- Thycotic/Delinea doesn't support Token secret type choice HOT 1
- `inv build` results in errors
- Add AWS SSM Parameter Store HOT 1
- Plugin `home_view_name` view is out of date
- Change Links on Homepage to Reference Delinea
- invoke build --no-cache failed
- Check that secret data is correct HOT 1
- `secret_value` in AWS provider not getting set HOT 1
- Allow multiple configurations of the same provider
- Update Secrets Provider `next-2.0` to Use Apps API
- Create `next-2.0` branch for Secrets Provider, Updates to Install on 2.0 Alpha HOT 1
- Prometheus metrics
- 1Password secrets Provider HOT 2
- Hashicorp Vault AWS Authentication broken
- Delinea - Returns HTTP403 for Rate Limited Users/Keys, Need to Add Workaround
- Access Token Authorization Fails Incorrectly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nautobot-app-secrets-providers.