dexus-vault 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dexus-vault-0.1.0/LICENSE +201 -0
- dexus-vault-0.1.0/PKG-INFO +141 -0
- dexus-vault-0.1.0/README.md +114 -0
- dexus-vault-0.1.0/dexus_vault/__init__.py +1 -0
- dexus-vault-0.1.0/dexus_vault/__main__.py +31 -0
- dexus-vault-0.1.0/dexus_vault/__version__.py +11 -0
- dexus-vault-0.1.0/dexus_vault/client.py +59 -0
- dexus-vault-0.1.0/dexus_vault/src/__init__.py +0 -0
- dexus-vault-0.1.0/dexus_vault/src/dex_processor.py +122 -0
- dexus-vault-0.1.0/dexus_vault/src/vault_processor.py +141 -0
- dexus-vault-0.1.0/dexus_vault/utils/__init__.py +0 -0
- dexus-vault-0.1.0/dexus_vault/utils/client_parser.py +59 -0
- dexus-vault-0.1.0/dexus_vault/utils/config.py +56 -0
- dexus-vault-0.1.0/dexus_vault/utils/files.py +18 -0
- dexus-vault-0.1.0/dexus_vault/utils/logger.py +28 -0
- dexus-vault-0.1.0/dexus_vault/utils/types.py +15 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/PKG-INFO +141 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/SOURCES.txt +22 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/dependency_links.txt +1 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/entry_points.txt +2 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/requires.txt +5 -0
- dexus-vault-0.1.0/dexus_vault.egg-info/top_level.txt +1 -0
- dexus-vault-0.1.0/setup.cfg +4 -0
- dexus-vault-0.1.0/setup.py +52 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dexus-vault
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Synchronizer of Dex clients with secrets in Vault
|
|
5
|
+
Home-page: https://github.com/ifurs/dexus-vault
|
|
6
|
+
Author: ifurs
|
|
7
|
+
License: Apache License 2.0
|
|
8
|
+
Project-URL: Source, https://github.com/ifurs/dexus-vault
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: grpcio~=1.62.0
|
|
23
|
+
Requires-Dist: grpcio-tools~=1.60.1
|
|
24
|
+
Requires-Dist: googleapis-common-protos>=1.62.0
|
|
25
|
+
Requires-Dist: protobuf~=4.25.3
|
|
26
|
+
Requires-Dist: hvac~=2.1.0
|
|
27
|
+
|
|
28
|
+
# DEXUS VAULT
|
|
29
|
+
Synchronizer of Dex clients with secrets in Vault
|
|
30
|
+
|
|
31
|
+
[](https://github.com/ifurs/dexus-vault/releases/latest)
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
## Intro
|
|
36
|
+
Dexus Vault is utility designed to synchronize Dex client configurations with secrets stored in Hashicorp Vault.
|
|
37
|
+
This tool simplifies the management of Dex clients by automating the process of keeping them in sync with Vault secrets.
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
when you run dexus_vault, it will connects to provided Vault via `hvac` library and collets secrets by provided path, then dexus_vault conncets to Dex Idp over GRPC and create/update clients.
|
|
41
|
+
|
|
42
|
+
Currently Dex don't have native "Update" method, so dexus_vault will recreate client(keep in mind)
|
|
43
|
+
|
|
44
|
+
## How to install
|
|
45
|
+
### from source
|
|
46
|
+
For VMs or local running recommended to create isolated env using `python-venv` or whatever you use
|
|
47
|
+
1. Clone the project
|
|
48
|
+
```sh
|
|
49
|
+
git clone https://github.com/ifurs/dexus-vault.git
|
|
50
|
+
```
|
|
51
|
+
2. Install package
|
|
52
|
+
```sh
|
|
53
|
+
python -m pip install --upgrade setuptools wheel
|
|
54
|
+
python3 -m pip install .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### from PyPi
|
|
58
|
+
Not this time:)
|
|
59
|
+
|
|
60
|
+
## Run dexus_vault
|
|
61
|
+
simply run
|
|
62
|
+
```sh
|
|
63
|
+
python3 -m dexus_vault
|
|
64
|
+
```
|
|
65
|
+
and it will start worker that syncs Dex clients with Vault secrets
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
### General
|
|
69
|
+
| variable | required | default | description |
|
|
70
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
71
|
+
| SYNC_INTERVAL | false | 60 | interval in seconds, dexus_vault will refresh in |
|
|
72
|
+
|
|
73
|
+
### Dex client configuration
|
|
74
|
+
| variable | required | default | description |
|
|
75
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
76
|
+
| DEX_GRPC_URL | false | 127.0.0.1:5557 | url, with your dex grpc |
|
|
77
|
+
| CLIENT_CRT | false | - | path to Dex GRPC client certificate |
|
|
78
|
+
| CLIENT_KEY | false | - | path to Dex GRPC client certificate key |
|
|
79
|
+
| CA_CRT | false | - | path to Dex GRPC client certificate autority |
|
|
80
|
+
|
|
81
|
+
#### About Dex auth
|
|
82
|
+
if you not specified in dex certificates, simply skip them, and client will start insecure connection, also it is not required to use certificate authority when you specify client crt and client key.
|
|
83
|
+
|
|
84
|
+
### Vault client configuration
|
|
85
|
+
| variable | required | default | description |
|
|
86
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
87
|
+
| VAULT_ADDR | false | http://127.0.0.1:8200 | vault adress |
|
|
88
|
+
| VAULT_CLIENTS_PATHS | true | - | path in vault where clients could be found |
|
|
89
|
+
| VAULT_MOUNT_POINT | false | - | vault [mount point](https://developer.hashicorp.com/vault/tutorials/enterprise/namespace-structure#understand-vault-s-mount-points) |
|
|
90
|
+
| VAULT_TOKEN | false | - | used to auth to Vault via token |
|
|
91
|
+
| VAULT_CERT | false | - | Vault client certificate path |
|
|
92
|
+
| VAULT_CERT_KEY | false | - | Vault client certificate key path |
|
|
93
|
+
| VAULT_CERT_CA | false | - | Vault certficate authority path or bool, `false` - do not validate, `true` - validate with internal trustore |
|
|
94
|
+
| VAULT_LDAP_USERNAME | false | - | LDAP username used to auth to Vault |
|
|
95
|
+
| VAULT_LDAP_PASSWORD | false | - | LDAP password used to auth to Vault |
|
|
96
|
+
| VAULT_APPROLE | false | - | bool value, used to identify to use APPROLE auth |
|
|
97
|
+
| VAULT_APPROLE_ROLE_ID | false | - | Vault approle role id |
|
|
98
|
+
| VAULT_APPROLE_SECRET_ID | false | - | Vault approle secret id |
|
|
99
|
+
| VAULT_APPROLE_PATH | false | - | Vault approle path, use it if agent mount approle file in other than default directory |
|
|
100
|
+
| VAULT_MAX_RETRIES | false | 20 | How many retries need to mark Vault unreacheble |
|
|
101
|
+
| VAULT_RETRY_WAIT | false | 3 | How many seconds need to wait before next retry |
|
|
102
|
+
|
|
103
|
+
#### About Vault auth
|
|
104
|
+
You can choose any of:
|
|
105
|
+
- token based
|
|
106
|
+
- ldap
|
|
107
|
+
- with cert
|
|
108
|
+
- using approle, for that you need simply set `VAULT_APPROLE` to true, and when start, hvac will login to Vault via default maunted file by vault agent
|
|
109
|
+
|
|
110
|
+
## Vault secret structure
|
|
111
|
+
This example shows all available params for client(same as proto message)
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"id": "my-first-client",
|
|
115
|
+
"secret": "", // put here your client secret
|
|
116
|
+
"logo_url": "https://picsum.photos/200/300", // example logo, not recommended
|
|
117
|
+
"name": "My First Client",
|
|
118
|
+
"public": false,
|
|
119
|
+
"redirect_uris": ["http://127.0.0.1:5000/callback"],
|
|
120
|
+
"trusted_peers": ["my-second-client"]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
In Vault config `id` and `secret` are required, and `public` has default value `False` that enforced on dexus_vault level.
|
|
124
|
+
Also you may ask, how to define lists for `redirect_uris` and `trusted_peers`, you can do it in 2 ways:
|
|
125
|
+
- native json list `["value1", "value2"]` but this will disale in Vault UI non-json view for that secret
|
|
126
|
+
- using string with comma as delimeter `"value1,value2"` but it's not recommended and would be removed in future iterations
|
|
127
|
+
|
|
128
|
+
## Local Testing
|
|
129
|
+
The `docker/tests` directory contains a `docker-compose.yaml` file. This file is configured to run Vault and Dex locally for testing purposes. Please note that this setup is not intended for production use.
|
|
130
|
+
|
|
131
|
+
For additional information, refer to the [README](docker/tests/README.md) in the `docker/tests` directory.
|
|
132
|
+
|
|
133
|
+
## About Dex GRPC
|
|
134
|
+
All GRPC API methods dexus_vault use, defined in [api.proto](https://github.com/dexidp/dex/blob/v2.38.0/api/v2/api.proto)
|
|
135
|
+
and compiled with `grpc_tools.protoc`
|
|
136
|
+
|
|
137
|
+
## Other notes
|
|
138
|
+
This projects uses pre-commit: https://pre-commit.com/
|
|
139
|
+
|
|
140
|
+
# THANKS
|
|
141
|
+
- [Hurlenko](https://github.com/hurlenko) for references copied from your repos
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# DEXUS VAULT
|
|
2
|
+
Synchronizer of Dex clients with secrets in Vault
|
|
3
|
+
|
|
4
|
+
[](https://github.com/ifurs/dexus-vault/releases/latest)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## Intro
|
|
9
|
+
Dexus Vault is utility designed to synchronize Dex client configurations with secrets stored in Hashicorp Vault.
|
|
10
|
+
This tool simplifies the management of Dex clients by automating the process of keeping them in sync with Vault secrets.
|
|
11
|
+
|
|
12
|
+
## How it works
|
|
13
|
+
when you run dexus_vault, it will connects to provided Vault via `hvac` library and collets secrets by provided path, then dexus_vault conncets to Dex Idp over GRPC and create/update clients.
|
|
14
|
+
|
|
15
|
+
Currently Dex don't have native "Update" method, so dexus_vault will recreate client(keep in mind)
|
|
16
|
+
|
|
17
|
+
## How to install
|
|
18
|
+
### from source
|
|
19
|
+
For VMs or local running recommended to create isolated env using `python-venv` or whatever you use
|
|
20
|
+
1. Clone the project
|
|
21
|
+
```sh
|
|
22
|
+
git clone https://github.com/ifurs/dexus-vault.git
|
|
23
|
+
```
|
|
24
|
+
2. Install package
|
|
25
|
+
```sh
|
|
26
|
+
python -m pip install --upgrade setuptools wheel
|
|
27
|
+
python3 -m pip install .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### from PyPi
|
|
31
|
+
Not this time:)
|
|
32
|
+
|
|
33
|
+
## Run dexus_vault
|
|
34
|
+
simply run
|
|
35
|
+
```sh
|
|
36
|
+
python3 -m dexus_vault
|
|
37
|
+
```
|
|
38
|
+
and it will start worker that syncs Dex clients with Vault secrets
|
|
39
|
+
|
|
40
|
+
## Configuration
|
|
41
|
+
### General
|
|
42
|
+
| variable | required | default | description |
|
|
43
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
44
|
+
| SYNC_INTERVAL | false | 60 | interval in seconds, dexus_vault will refresh in |
|
|
45
|
+
|
|
46
|
+
### Dex client configuration
|
|
47
|
+
| variable | required | default | description |
|
|
48
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
49
|
+
| DEX_GRPC_URL | false | 127.0.0.1:5557 | url, with your dex grpc |
|
|
50
|
+
| CLIENT_CRT | false | - | path to Dex GRPC client certificate |
|
|
51
|
+
| CLIENT_KEY | false | - | path to Dex GRPC client certificate key |
|
|
52
|
+
| CA_CRT | false | - | path to Dex GRPC client certificate autority |
|
|
53
|
+
|
|
54
|
+
#### About Dex auth
|
|
55
|
+
if you not specified in dex certificates, simply skip them, and client will start insecure connection, also it is not required to use certificate authority when you specify client crt and client key.
|
|
56
|
+
|
|
57
|
+
### Vault client configuration
|
|
58
|
+
| variable | required | default | description |
|
|
59
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
60
|
+
| VAULT_ADDR | false | http://127.0.0.1:8200 | vault adress |
|
|
61
|
+
| VAULT_CLIENTS_PATHS | true | - | path in vault where clients could be found |
|
|
62
|
+
| VAULT_MOUNT_POINT | false | - | vault [mount point](https://developer.hashicorp.com/vault/tutorials/enterprise/namespace-structure#understand-vault-s-mount-points) |
|
|
63
|
+
| VAULT_TOKEN | false | - | used to auth to Vault via token |
|
|
64
|
+
| VAULT_CERT | false | - | Vault client certificate path |
|
|
65
|
+
| VAULT_CERT_KEY | false | - | Vault client certificate key path |
|
|
66
|
+
| VAULT_CERT_CA | false | - | Vault certficate authority path or bool, `false` - do not validate, `true` - validate with internal trustore |
|
|
67
|
+
| VAULT_LDAP_USERNAME | false | - | LDAP username used to auth to Vault |
|
|
68
|
+
| VAULT_LDAP_PASSWORD | false | - | LDAP password used to auth to Vault |
|
|
69
|
+
| VAULT_APPROLE | false | - | bool value, used to identify to use APPROLE auth |
|
|
70
|
+
| VAULT_APPROLE_ROLE_ID | false | - | Vault approle role id |
|
|
71
|
+
| VAULT_APPROLE_SECRET_ID | false | - | Vault approle secret id |
|
|
72
|
+
| VAULT_APPROLE_PATH | false | - | Vault approle path, use it if agent mount approle file in other than default directory |
|
|
73
|
+
| VAULT_MAX_RETRIES | false | 20 | How many retries need to mark Vault unreacheble |
|
|
74
|
+
| VAULT_RETRY_WAIT | false | 3 | How many seconds need to wait before next retry |
|
|
75
|
+
|
|
76
|
+
#### About Vault auth
|
|
77
|
+
You can choose any of:
|
|
78
|
+
- token based
|
|
79
|
+
- ldap
|
|
80
|
+
- with cert
|
|
81
|
+
- using approle, for that you need simply set `VAULT_APPROLE` to true, and when start, hvac will login to Vault via default maunted file by vault agent
|
|
82
|
+
|
|
83
|
+
## Vault secret structure
|
|
84
|
+
This example shows all available params for client(same as proto message)
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"id": "my-first-client",
|
|
88
|
+
"secret": "", // put here your client secret
|
|
89
|
+
"logo_url": "https://picsum.photos/200/300", // example logo, not recommended
|
|
90
|
+
"name": "My First Client",
|
|
91
|
+
"public": false,
|
|
92
|
+
"redirect_uris": ["http://127.0.0.1:5000/callback"],
|
|
93
|
+
"trusted_peers": ["my-second-client"]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
In Vault config `id` and `secret` are required, and `public` has default value `False` that enforced on dexus_vault level.
|
|
97
|
+
Also you may ask, how to define lists for `redirect_uris` and `trusted_peers`, you can do it in 2 ways:
|
|
98
|
+
- native json list `["value1", "value2"]` but this will disale in Vault UI non-json view for that secret
|
|
99
|
+
- using string with comma as delimeter `"value1,value2"` but it's not recommended and would be removed in future iterations
|
|
100
|
+
|
|
101
|
+
## Local Testing
|
|
102
|
+
The `docker/tests` directory contains a `docker-compose.yaml` file. This file is configured to run Vault and Dex locally for testing purposes. Please note that this setup is not intended for production use.
|
|
103
|
+
|
|
104
|
+
For additional information, refer to the [README](docker/tests/README.md) in the `docker/tests` directory.
|
|
105
|
+
|
|
106
|
+
## About Dex GRPC
|
|
107
|
+
All GRPC API methods dexus_vault use, defined in [api.proto](https://github.com/dexidp/dex/blob/v2.38.0/api/v2/api.proto)
|
|
108
|
+
and compiled with `grpc_tools.protoc`
|
|
109
|
+
|
|
110
|
+
## Other notes
|
|
111
|
+
This projects uses pre-commit: https://pre-commit.com/
|
|
112
|
+
|
|
113
|
+
# THANKS
|
|
114
|
+
- [Hurlenko](https://github.com/hurlenko) for references copied from your repos
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
name = "dexus_vault"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import threading
|
|
2
|
+
|
|
3
|
+
from client import run
|
|
4
|
+
from utils.logger import logger
|
|
5
|
+
|
|
6
|
+
# Try to import dotenv, if it's installed
|
|
7
|
+
try:
|
|
8
|
+
from dotenv import load_dotenv, find_dotenv
|
|
9
|
+
|
|
10
|
+
load_dotenv(find_dotenv())
|
|
11
|
+
except ImportError:
|
|
12
|
+
logger.debug(f"if you want to use .env file, please install python-dotenv")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
"""
|
|
17
|
+
Start a new thread to run the synchronization process.
|
|
18
|
+
"""
|
|
19
|
+
try:
|
|
20
|
+
sync_thread = threading.Thread(target=run)
|
|
21
|
+
sync_thread.start()
|
|
22
|
+
sync_thread.join() # Wait for the thread to finish
|
|
23
|
+
except (KeyboardInterrupt, SystemExit):
|
|
24
|
+
logger.info("Interrupt received, stopping...")
|
|
25
|
+
except Exception as e:
|
|
26
|
+
logger.error(f"An error occurred: {e}")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
logger.info("Starting dexus_vault...")
|
|
31
|
+
main()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""
|
|
2
|
+
___ ____ _ _ _ _ ____ _ _ ____ _ _ _ ___
|
|
3
|
+
| \ |___ \/ | | [__ | | |__| | | | |
|
|
4
|
+
|__/ |___ _/\_ |__| ___] \/ | | |__| |___ |
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__title__ = "dexus-vault"
|
|
8
|
+
__description__ = "Synchronizer of Dex clients with secrets in Vault"
|
|
9
|
+
__url__ = "https://github.com/ifurs/dexus-vault"
|
|
10
|
+
__version__ = "0.1.0"
|
|
11
|
+
__license__ = "Apache License 2.0"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from src.dex_processor import DexClient
|
|
5
|
+
from src.vault_processor import VaultClient
|
|
6
|
+
|
|
7
|
+
from utils.logger import logger
|
|
8
|
+
from utils.config import get_vault_config, get_dex_config
|
|
9
|
+
from utils.client_parser import normalize_config
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
SYNC_INTERVAL = os.getenv("SYNC_INTERVAL", 60)
|
|
13
|
+
VAULT_TIMEOUT = os.getenv("VAULT_TIMEOUT", 300)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def sync_dex_clients(dex_client: object, vault_clients: list) -> set:
|
|
17
|
+
"""
|
|
18
|
+
Synchronize Dex clients with Vault clients.
|
|
19
|
+
"""
|
|
20
|
+
logger.debug(f"Target clients {[x.get('id') for x in vault_clients]}")
|
|
21
|
+
for client in vault_clients:
|
|
22
|
+
dex_get_client = dex_client.get_dex_client(client_id=client.get("id"))
|
|
23
|
+
|
|
24
|
+
if dex_get_client is not None:
|
|
25
|
+
client_from_dex = normalize_config(
|
|
26
|
+
dex_get_client.get("client", {})
|
|
27
|
+
) # TODO: move that logic to dex_processor
|
|
28
|
+
if client.get("id") == client_from_dex.get("id"):
|
|
29
|
+
|
|
30
|
+
if client == client_from_dex:
|
|
31
|
+
logger.debug(f"CLIENT {client_from_dex.get('id')} already exist.")
|
|
32
|
+
|
|
33
|
+
else:
|
|
34
|
+
logger.info(
|
|
35
|
+
f"Detected changes in {client_from_dex.get('id')} client configuration, will be recreated"
|
|
36
|
+
)
|
|
37
|
+
dex_client.delete_dex_client(client_from_dex.get("id"))
|
|
38
|
+
dex_client.create_dex_client(client)
|
|
39
|
+
else:
|
|
40
|
+
logger.info(f"CLIENT {client.get('id')} not found, will be created")
|
|
41
|
+
print(client)
|
|
42
|
+
dex_client.create_dex_client(client)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def run():
|
|
46
|
+
"""
|
|
47
|
+
Main function to run the Dex client and Vault client synchronization.
|
|
48
|
+
"""
|
|
49
|
+
dex_client = DexClient(config=get_dex_config())
|
|
50
|
+
logger.info(f"Dex server version {dex_client.get_dex_version()}")
|
|
51
|
+
|
|
52
|
+
while True:
|
|
53
|
+
dex_client = DexClient(config=get_dex_config())
|
|
54
|
+
vault_client = VaultClient(config=get_vault_config())
|
|
55
|
+
client_configs = vault_client.vault_read_secrets()
|
|
56
|
+
|
|
57
|
+
sync_dex_clients(dex_client, client_configs)
|
|
58
|
+
logger.info(f"Sync completed, next sync after {SYNC_INTERVAL} seconds")
|
|
59
|
+
time.sleep(SYNC_INTERVAL)
|
|
File without changes
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import grpc
|
|
2
|
+
import logging
|
|
3
|
+
|
|
4
|
+
# Import function that transform GRPC Message into Python dict
|
|
5
|
+
from google.protobuf.json_format import MessageToDict
|
|
6
|
+
|
|
7
|
+
# Load GRPC Stub and Methods from pb2 defined using protobuf builder
|
|
8
|
+
from grpc_dexidp.dexidp.api_pb2_grpc import DexStub
|
|
9
|
+
import grpc_dexidp.dexidp.api_pb2 as pb2
|
|
10
|
+
|
|
11
|
+
from utils.logger import logger
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DexClient:
|
|
15
|
+
"""
|
|
16
|
+
This class defines all logic for operating with Dex GRPC API
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, config):
|
|
20
|
+
# credentials used for Dex connection including GRPC URL
|
|
21
|
+
self.config = config
|
|
22
|
+
|
|
23
|
+
# channel credentials obj placeholder
|
|
24
|
+
self.channel = self.dex_grpc_connect()
|
|
25
|
+
|
|
26
|
+
# crete grpc connection to Dex
|
|
27
|
+
def dex_grpc_connect(self) -> object:
|
|
28
|
+
"""
|
|
29
|
+
Open connection to Dex GRPC
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
if self.config["CLIENT_CRT"]:
|
|
33
|
+
self.creds = grpc.ssl_channel_credentials(
|
|
34
|
+
root_certificates=self.config["CA_CRT"],
|
|
35
|
+
private_key=self.config["CLIENT_KEY"],
|
|
36
|
+
certificate_chain=self.config["CLIENT_CRT"],
|
|
37
|
+
)
|
|
38
|
+
return grpc.secure_channel(
|
|
39
|
+
target=self.config["DEX_GRPC_URL"], credentials=self.creds
|
|
40
|
+
)
|
|
41
|
+
else:
|
|
42
|
+
logger.debug(f"Dex client started in insecure channel")
|
|
43
|
+
return grpc.insecure_channel(target=self.config["DEX_GRPC_URL"])
|
|
44
|
+
|
|
45
|
+
def dex_grpc_close_connection(self):
|
|
46
|
+
"""
|
|
47
|
+
Close connection to Dex GRPC
|
|
48
|
+
"""
|
|
49
|
+
if self.channel:
|
|
50
|
+
self.channel.close()
|
|
51
|
+
|
|
52
|
+
def get_dex_version(self) -> dict:
|
|
53
|
+
"""
|
|
54
|
+
Get Dex version
|
|
55
|
+
"""
|
|
56
|
+
dex_request = pb2.VersionReq()
|
|
57
|
+
response = DexStub(self.channel).GetVersion(dex_request)
|
|
58
|
+
|
|
59
|
+
return MessageToDict(response)
|
|
60
|
+
|
|
61
|
+
def get_dex_client(self, client_id: str) -> dict | None:
|
|
62
|
+
"""
|
|
63
|
+
Call Get Dex Client with by client id
|
|
64
|
+
"""
|
|
65
|
+
dex_request = pb2.GetClientReq()
|
|
66
|
+
dex_request.id = client_id
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
response = DexStub(self.channel).GetClient(dex_request)
|
|
70
|
+
return MessageToDict(response)
|
|
71
|
+
|
|
72
|
+
except grpc.RpcError as rpc_error:
|
|
73
|
+
if rpc_error.code() == grpc.StatusCode.UNKNOWN:
|
|
74
|
+
logger.debug(
|
|
75
|
+
f"RESPONSE FROM GRPC: {rpc_error.details()}, client {client_id}"
|
|
76
|
+
)
|
|
77
|
+
else:
|
|
78
|
+
logger.warning(
|
|
79
|
+
f"GRPC CALL CODE: {rpc_error.code()} with details {rpc_error.details()}"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def create_dex_client(self, client: dict) -> dict | None:
|
|
83
|
+
"""
|
|
84
|
+
Create OIDC client in Dex
|
|
85
|
+
"""
|
|
86
|
+
request = pb2.CreateClientReq()
|
|
87
|
+
request.client.id = client.get("id")
|
|
88
|
+
request.client.secret = client.get("secret")
|
|
89
|
+
request.client.redirect_uris.extend(client.get("redirect_uris", ""))
|
|
90
|
+
request.client.trusted_peers.extend(client.get("trusted_peers", ""))
|
|
91
|
+
request.client.public = client.get("public", 0)
|
|
92
|
+
request.client.name = client.get("name", "")
|
|
93
|
+
request.client.logo_url = client.get("logo_url", "")
|
|
94
|
+
|
|
95
|
+
response = MessageToDict(DexStub(self.channel).CreateClient(request))
|
|
96
|
+
if response.get("client", None) is not None:
|
|
97
|
+
client_id = response.get("client").get("id")
|
|
98
|
+
logger.info(f"Created new Dex client '{client_id}'")
|
|
99
|
+
return client_id
|
|
100
|
+
|
|
101
|
+
def delete_dex_client(self, client_id: str) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Delete OIDC client in Dex
|
|
104
|
+
"""
|
|
105
|
+
dex_request = pb2.DeleteClientReq()
|
|
106
|
+
dex_request.id = client_id
|
|
107
|
+
|
|
108
|
+
# Because of Dex implementation, this request returns None
|
|
109
|
+
# Or simple dict {'notFound': True} so it need to be processed
|
|
110
|
+
response = MessageToDict(DexStub(self.channel).DeleteClient(dex_request))
|
|
111
|
+
|
|
112
|
+
if response.get("notFound", None) is not None:
|
|
113
|
+
logger.warning(f"Client '{client_id}' not found")
|
|
114
|
+
else:
|
|
115
|
+
logger.info(f"client {client_id} was deleted")
|
|
116
|
+
|
|
117
|
+
def __del__(self):
|
|
118
|
+
"""
|
|
119
|
+
Everytime DexClient object delets, this will close GRPC connection
|
|
120
|
+
"""
|
|
121
|
+
self.dex_grpc_close_connection()
|
|
122
|
+
logger.debug(f"Dex connection closed")
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import hvac
|
|
2
|
+
import time
|
|
3
|
+
import requests
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from utils.client_parser import normalize_config
|
|
7
|
+
from utils.logger import logger
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VaultClient:
|
|
11
|
+
"""
|
|
12
|
+
This Class represents methods we used inside dexus_vault, nothing new, just wrap hvac
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, config: dict):
|
|
16
|
+
self.config = config
|
|
17
|
+
self.client = self.login_to_client()
|
|
18
|
+
|
|
19
|
+
def _check_vault_status(self, client: object) -> None:
|
|
20
|
+
"""
|
|
21
|
+
Function validates if Vault is up and running
|
|
22
|
+
"""
|
|
23
|
+
for _ in range(self.config["VAULT_MAX_RETRIES"]):
|
|
24
|
+
try:
|
|
25
|
+
response = client.sys.read_health_status(method="GET")
|
|
26
|
+
if isinstance(response, requests.Response):
|
|
27
|
+
status = response.json()
|
|
28
|
+
else:
|
|
29
|
+
status = response
|
|
30
|
+
if status["initialized"]:
|
|
31
|
+
logger.debug(f"Vault {self.config['VAULT_ADDR']} is initialized")
|
|
32
|
+
return True
|
|
33
|
+
else:
|
|
34
|
+
logger.warning(
|
|
35
|
+
f"Vault {self.config['VAULT_ADDR']} is not initialized {status}"
|
|
36
|
+
)
|
|
37
|
+
except requests.exceptions.ConnectionError:
|
|
38
|
+
logger.warning(f"Vault {self.config['VAULT_ADDR']} connection failed")
|
|
39
|
+
time.sleep(self.config["VAULT_RETRY_WAIT"])
|
|
40
|
+
logger.error(f"Vault {self.config['VAULT_ADDR']} unreachable, exiting...")
|
|
41
|
+
sys.exit(1)
|
|
42
|
+
|
|
43
|
+
def _check_if_vault_auth(self, client: object, auth_method: str) -> None:
|
|
44
|
+
"""
|
|
45
|
+
Function validates if we sucessfuly authentificated to Vault
|
|
46
|
+
"""
|
|
47
|
+
if client.is_authenticated():
|
|
48
|
+
logger.debug(
|
|
49
|
+
f"Authentificated to Vault {self.config['VAULT_ADDR']} via {auth_method} auth method"
|
|
50
|
+
)
|
|
51
|
+
else:
|
|
52
|
+
raise RuntimeError(
|
|
53
|
+
f"Failed to authentificate to Vault {self.config['VAULT_ADDR']} via {auth_method} auth method "
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
def login_to_client(self) -> object:
|
|
57
|
+
"""
|
|
58
|
+
Define auth method for Vault and authentificate
|
|
59
|
+
"""
|
|
60
|
+
client = hvac.Client(url=self.config["VAULT_ADDR"])
|
|
61
|
+
self._check_vault_status(client)
|
|
62
|
+
|
|
63
|
+
if self.config["VAULT_APPROLE"] is not None:
|
|
64
|
+
auth_method = "approle"
|
|
65
|
+
client.sys.enable_auth_method(
|
|
66
|
+
method_type=self.auth_method,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if self.config["VAULT_APPROLE_ROLE_ID"]:
|
|
70
|
+
client.auth.approle.login(
|
|
71
|
+
role_id=self.config["VAULT_APPROLE_ROLE_ID"],
|
|
72
|
+
secret_id=self.config["VAULT_APPROLE_SECRET_ID"],
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
elif self.config["VAULT_APPROLE_PATH"]:
|
|
76
|
+
client.sys.enable_auth_method(
|
|
77
|
+
method_type=self.auth_method,
|
|
78
|
+
path=self.config["VAULT_APPROLE_PATH"],
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
elif self.config["VAULT_LDAP_USERNAME"] is not None:
|
|
82
|
+
auth_method = "LDAP"
|
|
83
|
+
client.auth.ldap.login(
|
|
84
|
+
username=self.config["VAULT_LDAP_USERNAME"],
|
|
85
|
+
password=self.config["VAULT_LDAP_PASSWORD"],
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
elif self.config["VAULT_CERT"] is not None:
|
|
89
|
+
auth_method = "Client cert"
|
|
90
|
+
client = hvac.Client(
|
|
91
|
+
url=self.config["VAULT_ADDR"],
|
|
92
|
+
token=self.config["VAULT_TOKEN"],
|
|
93
|
+
cert=(self.config["VAULT_CERT"], self.config["VAULT_CERT_KEY"]),
|
|
94
|
+
verify=(self.config["VAULT_CERT_CA"]),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
elif self.config["VAULT_TOKEN"] is not None:
|
|
98
|
+
auth_method = "Vault token"
|
|
99
|
+
client.token = self.config["VAULT_TOKEN"]
|
|
100
|
+
|
|
101
|
+
else:
|
|
102
|
+
raise KeyError(f"AUTH method not specified!")
|
|
103
|
+
|
|
104
|
+
self._check_if_vault_auth(client, auth_method)
|
|
105
|
+
return client
|
|
106
|
+
|
|
107
|
+
def vault_list_secrets(self) -> list:
|
|
108
|
+
"""
|
|
109
|
+
List secrets from Vault by path
|
|
110
|
+
"""
|
|
111
|
+
response = self.client.secrets.kv.v2.list_secrets(
|
|
112
|
+
self.config["VAULT_CLIENTS_PATHS"],
|
|
113
|
+
mount_point=self.config["VAULT_MOUNT_POINT"],
|
|
114
|
+
)
|
|
115
|
+
return response["data"]["keys"]
|
|
116
|
+
|
|
117
|
+
def vault_read_secret(self, secret_path: str):
|
|
118
|
+
"""
|
|
119
|
+
Read specified secret from Vault
|
|
120
|
+
"""
|
|
121
|
+
response = self.client.secrets.kv.read_secret_version(
|
|
122
|
+
path=f"{self.config['VAULT_CLIENTS_PATHS']}/{secret_path}",
|
|
123
|
+
mount_point=self.config["VAULT_MOUNT_POINT"],
|
|
124
|
+
)
|
|
125
|
+
return response["data"]["data"]
|
|
126
|
+
|
|
127
|
+
def vault_read_secrets(self) -> list:
|
|
128
|
+
"""
|
|
129
|
+
Combine list_secrets with read_secret
|
|
130
|
+
"""
|
|
131
|
+
_client_config = []
|
|
132
|
+
for secret in self.vault_list_secrets():
|
|
133
|
+
config = normalize_config(self.vault_read_secret(secret_path=secret))
|
|
134
|
+
if config is not None:
|
|
135
|
+
_client_config.append(config)
|
|
136
|
+
|
|
137
|
+
else:
|
|
138
|
+
logger.warning(
|
|
139
|
+
f"Secret '{secret}' in Vault, missing 'id' and 'secret' keys, or have incorrect structure"
|
|
140
|
+
)
|
|
141
|
+
return _client_config
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# General Dex GRPC Message for Client
|
|
2
|
+
## Need to be refactored to use the same logic as config.py
|
|
3
|
+
_config_keys = [
|
|
4
|
+
"id",
|
|
5
|
+
"secret",
|
|
6
|
+
"redirect_uris",
|
|
7
|
+
"trusted_peers",
|
|
8
|
+
"public",
|
|
9
|
+
"name",
|
|
10
|
+
"logo_url",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def parse_list(list_from_vault: str | list) -> list:
|
|
15
|
+
"""
|
|
16
|
+
Nativly Vault can't support lists in UI(except json view), omg Hashicop:)
|
|
17
|
+
"""
|
|
18
|
+
if isinstance(list_from_vault, list):
|
|
19
|
+
return list_from_vault
|
|
20
|
+
|
|
21
|
+
if isinstance(list_from_vault, str):
|
|
22
|
+
return list_from_vault.split(",")
|
|
23
|
+
else:
|
|
24
|
+
return []
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def parse_bool(bool_from_vault: bool | str) -> bool:
|
|
28
|
+
if isinstance(bool_from_vault, bool):
|
|
29
|
+
return bool_from_vault
|
|
30
|
+
return False
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _fill_missing_keys(config: dict) -> dict:
|
|
34
|
+
for key in _config_keys:
|
|
35
|
+
if key in ["redirect_uris", "trusted_peers"]:
|
|
36
|
+
config[key] = parse_list(config.get(key))
|
|
37
|
+
config["public"] = parse_bool(config.get("public", False))
|
|
38
|
+
return config
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _camel_case_to_undercore(config: dict) -> dict:
|
|
42
|
+
"""
|
|
43
|
+
Tranform camel case response from Dex GRPC
|
|
44
|
+
"""
|
|
45
|
+
return {
|
|
46
|
+
"".join(["_" + i.lower() if i.isupper() else i for i in key]).lstrip("_"): value
|
|
47
|
+
for key, value in config.items()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def normalize_config(client_config: dict) -> dict | None:
|
|
52
|
+
"""
|
|
53
|
+
Normilize Dex config to one standart.
|
|
54
|
+
I know, re is better, but I don't like it
|
|
55
|
+
"""
|
|
56
|
+
if {"id", "secret"}.issubset(client_config.keys()):
|
|
57
|
+
config = _camel_case_to_undercore(client_config)
|
|
58
|
+
return _fill_missing_keys(config)
|
|
59
|
+
return None
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from utils.files import load_file
|
|
3
|
+
from utils.types import check_var_type
|
|
4
|
+
from typing import Any, Dict, Optional
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _get_config_value(
|
|
8
|
+
key: str, target_type: type, default: Optional[Any] = None
|
|
9
|
+
) -> Any:
|
|
10
|
+
"""
|
|
11
|
+
Get the configuration value for the given key, cast it to the specified target type,
|
|
12
|
+
and return the default value if the environment variable is not set.
|
|
13
|
+
"""
|
|
14
|
+
env_value = os.getenv(key, default)
|
|
15
|
+
return check_var_type(env_value, target_type)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_dex_config() -> Dict[str, Any]:
|
|
19
|
+
"""
|
|
20
|
+
Get the configuration as a dictionary, with type-checked values.
|
|
21
|
+
"""
|
|
22
|
+
config = {
|
|
23
|
+
"CLIENT_CRT": load_file(_get_config_value("CLIENT_CRT", str)),
|
|
24
|
+
"CLIENT_KEY": load_file(_get_config_value("CLIENT_KEY", str)),
|
|
25
|
+
"CA_CRT": load_file(_get_config_value("CA_CRT", str)),
|
|
26
|
+
"DEX_GRPC_URL": _get_config_value("DEX_GRPC_URL", str, "127.0.0.1:5557"),
|
|
27
|
+
}
|
|
28
|
+
return config
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_vault_config() -> Dict[str, Any]:
|
|
32
|
+
"""
|
|
33
|
+
Get the configuration as a dictionary, with type-checked values.
|
|
34
|
+
"""
|
|
35
|
+
config = {
|
|
36
|
+
"VAULT_ADDR": _get_config_value("VAULT_ADDR", str, "http://127.0.0.1:8200"),
|
|
37
|
+
"VAULT_APPROLE": _get_config_value("VAULT_APPROLE", str),
|
|
38
|
+
"VAULT_APPROLE_ROLE_ID": _get_config_value("VAULT_APPROLE_ROLE_ID", str),
|
|
39
|
+
"VAULT_APPROLE_SECRET_ID": _get_config_value("VAULT_APPROLE_SECRET_ID", str),
|
|
40
|
+
"VAULT_APPROLE_PATH": _get_config_value("VAULT_APPROLE_PATH", str),
|
|
41
|
+
"VAULT_TOKEN": _get_config_value("VAULT_TOKEN", str),
|
|
42
|
+
"VAULT_CERT": _get_config_value("VAULT_CERT", str),
|
|
43
|
+
"VAULT_CERT_KEY": _get_config_value("VAULT_CERT_KEY", str),
|
|
44
|
+
"VAULT_CERT_CA": _get_config_value("VAULT_CERT_CA", bool | str, False),
|
|
45
|
+
"VAULT_LDAP_USERNAME": _get_config_value("VAULT_LDAP_USERNAME", str),
|
|
46
|
+
"VAULT_LDAP_PASSWORD": _get_config_value("VAULT_LDAP_PASSWORD", str),
|
|
47
|
+
"VAULT_REQUEST_TIMEOUT": _get_config_value("VAULT_REQUEST_TIMEOUT", int, 5),
|
|
48
|
+
"VAULT_MAX_RETRIES": _get_config_value("VAULT_MAX_RETRIES", int, 20),
|
|
49
|
+
"VAULT_RETRY_WAIT": _get_config_value("VAULT_RETRY_WAIT", int, 3),
|
|
50
|
+
"VAULT_ALLOW_REDIRECT": _get_config_value("VAULT_ALLOW_REDIRECT", bool, False),
|
|
51
|
+
"VAULT_NAMESPACE": _get_config_value("VAULT_NAMESPACE", str),
|
|
52
|
+
"VAULT_PROXIES": _get_config_value("VAULT_PROXIES", dict),
|
|
53
|
+
"VAULT_MOUNT_POINT": _get_config_value("VAULT_MOUNT_POINT", str),
|
|
54
|
+
"VAULT_CLIENTS_PATHS": _get_config_value("VAULT_CLIENTS_PATHS", str),
|
|
55
|
+
}
|
|
56
|
+
return config
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def load_file(filepath: str) -> bytes:
|
|
5
|
+
"""
|
|
6
|
+
Loads file from filepath(preffered absolute path)
|
|
7
|
+
"""
|
|
8
|
+
if filepath is not None:
|
|
9
|
+
real_path = os.path.join(os.getcwd(), filepath)
|
|
10
|
+
try:
|
|
11
|
+
with open(real_path, "rb") as f:
|
|
12
|
+
return f.read()
|
|
13
|
+
|
|
14
|
+
except FileNotFoundError:
|
|
15
|
+
raise FileNotFoundError(
|
|
16
|
+
f"File {filepath} path is incorrect or file does not exist!"
|
|
17
|
+
)
|
|
18
|
+
return None
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
log_level = os.getenv("LOG_LEVEL", "INFO")
|
|
6
|
+
# Define a format for your logs
|
|
7
|
+
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
|
8
|
+
|
|
9
|
+
# Create a stream handler
|
|
10
|
+
stream_handler = logging.StreamHandler(sys.stdout)
|
|
11
|
+
stream_handler.setLevel(log_level)
|
|
12
|
+
stream_handler.setFormatter(logging.Formatter(log_format))
|
|
13
|
+
|
|
14
|
+
## Create a file handler
|
|
15
|
+
# file_handler = logging.FileHandler('dexus_vault.log')
|
|
16
|
+
# file_handler.setLevel(log_level)
|
|
17
|
+
# file_handler.setFormatter(logging.Formatter(log_format))
|
|
18
|
+
|
|
19
|
+
# Get a logger
|
|
20
|
+
logger = logging.getLogger("dexus_vault")
|
|
21
|
+
logger.setLevel(log_level)
|
|
22
|
+
|
|
23
|
+
# Add the handlers to the logger
|
|
24
|
+
logger.addHandler(stream_handler)
|
|
25
|
+
# logger.addHandler(file_handler)
|
|
26
|
+
|
|
27
|
+
# Set log level for external libraries
|
|
28
|
+
logging.getLogger("httpx").setLevel(logging.WARNING)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Any, TypeVar, Type
|
|
2
|
+
|
|
3
|
+
T = TypeVar("T")
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def check_var_type(value: Any, target_type: Type[T]) -> T:
|
|
7
|
+
"""
|
|
8
|
+
Cast the given value to the specified target type.
|
|
9
|
+
"""
|
|
10
|
+
try:
|
|
11
|
+
if value and isinstance(value, target_type):
|
|
12
|
+
return value
|
|
13
|
+
except (ValueError, TypeError):
|
|
14
|
+
# If the cast fails, return the original value
|
|
15
|
+
return None
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: dexus-vault
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Synchronizer of Dex clients with secrets in Vault
|
|
5
|
+
Home-page: https://github.com/ifurs/dexus-vault
|
|
6
|
+
Author: ifurs
|
|
7
|
+
License: Apache License 2.0
|
|
8
|
+
Project-URL: Source, https://github.com/ifurs/dexus-vault
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: grpcio~=1.62.0
|
|
23
|
+
Requires-Dist: grpcio-tools~=1.60.1
|
|
24
|
+
Requires-Dist: googleapis-common-protos>=1.62.0
|
|
25
|
+
Requires-Dist: protobuf~=4.25.3
|
|
26
|
+
Requires-Dist: hvac~=2.1.0
|
|
27
|
+
|
|
28
|
+
# DEXUS VAULT
|
|
29
|
+
Synchronizer of Dex clients with secrets in Vault
|
|
30
|
+
|
|
31
|
+
[](https://github.com/ifurs/dexus-vault/releases/latest)
|
|
32
|
+

|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
## Intro
|
|
36
|
+
Dexus Vault is utility designed to synchronize Dex client configurations with secrets stored in Hashicorp Vault.
|
|
37
|
+
This tool simplifies the management of Dex clients by automating the process of keeping them in sync with Vault secrets.
|
|
38
|
+
|
|
39
|
+
## How it works
|
|
40
|
+
when you run dexus_vault, it will connects to provided Vault via `hvac` library and collets secrets by provided path, then dexus_vault conncets to Dex Idp over GRPC and create/update clients.
|
|
41
|
+
|
|
42
|
+
Currently Dex don't have native "Update" method, so dexus_vault will recreate client(keep in mind)
|
|
43
|
+
|
|
44
|
+
## How to install
|
|
45
|
+
### from source
|
|
46
|
+
For VMs or local running recommended to create isolated env using `python-venv` or whatever you use
|
|
47
|
+
1. Clone the project
|
|
48
|
+
```sh
|
|
49
|
+
git clone https://github.com/ifurs/dexus-vault.git
|
|
50
|
+
```
|
|
51
|
+
2. Install package
|
|
52
|
+
```sh
|
|
53
|
+
python -m pip install --upgrade setuptools wheel
|
|
54
|
+
python3 -m pip install .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### from PyPi
|
|
58
|
+
Not this time:)
|
|
59
|
+
|
|
60
|
+
## Run dexus_vault
|
|
61
|
+
simply run
|
|
62
|
+
```sh
|
|
63
|
+
python3 -m dexus_vault
|
|
64
|
+
```
|
|
65
|
+
and it will start worker that syncs Dex clients with Vault secrets
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
### General
|
|
69
|
+
| variable | required | default | description |
|
|
70
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
71
|
+
| SYNC_INTERVAL | false | 60 | interval in seconds, dexus_vault will refresh in |
|
|
72
|
+
|
|
73
|
+
### Dex client configuration
|
|
74
|
+
| variable | required | default | description |
|
|
75
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
76
|
+
| DEX_GRPC_URL | false | 127.0.0.1:5557 | url, with your dex grpc |
|
|
77
|
+
| CLIENT_CRT | false | - | path to Dex GRPC client certificate |
|
|
78
|
+
| CLIENT_KEY | false | - | path to Dex GRPC client certificate key |
|
|
79
|
+
| CA_CRT | false | - | path to Dex GRPC client certificate autority |
|
|
80
|
+
|
|
81
|
+
#### About Dex auth
|
|
82
|
+
if you not specified in dex certificates, simply skip them, and client will start insecure connection, also it is not required to use certificate authority when you specify client crt and client key.
|
|
83
|
+
|
|
84
|
+
### Vault client configuration
|
|
85
|
+
| variable | required | default | description |
|
|
86
|
+
|:---------:|:---------:|:-------:|:------------:|
|
|
87
|
+
| VAULT_ADDR | false | http://127.0.0.1:8200 | vault adress |
|
|
88
|
+
| VAULT_CLIENTS_PATHS | true | - | path in vault where clients could be found |
|
|
89
|
+
| VAULT_MOUNT_POINT | false | - | vault [mount point](https://developer.hashicorp.com/vault/tutorials/enterprise/namespace-structure#understand-vault-s-mount-points) |
|
|
90
|
+
| VAULT_TOKEN | false | - | used to auth to Vault via token |
|
|
91
|
+
| VAULT_CERT | false | - | Vault client certificate path |
|
|
92
|
+
| VAULT_CERT_KEY | false | - | Vault client certificate key path |
|
|
93
|
+
| VAULT_CERT_CA | false | - | Vault certficate authority path or bool, `false` - do not validate, `true` - validate with internal trustore |
|
|
94
|
+
| VAULT_LDAP_USERNAME | false | - | LDAP username used to auth to Vault |
|
|
95
|
+
| VAULT_LDAP_PASSWORD | false | - | LDAP password used to auth to Vault |
|
|
96
|
+
| VAULT_APPROLE | false | - | bool value, used to identify to use APPROLE auth |
|
|
97
|
+
| VAULT_APPROLE_ROLE_ID | false | - | Vault approle role id |
|
|
98
|
+
| VAULT_APPROLE_SECRET_ID | false | - | Vault approle secret id |
|
|
99
|
+
| VAULT_APPROLE_PATH | false | - | Vault approle path, use it if agent mount approle file in other than default directory |
|
|
100
|
+
| VAULT_MAX_RETRIES | false | 20 | How many retries need to mark Vault unreacheble |
|
|
101
|
+
| VAULT_RETRY_WAIT | false | 3 | How many seconds need to wait before next retry |
|
|
102
|
+
|
|
103
|
+
#### About Vault auth
|
|
104
|
+
You can choose any of:
|
|
105
|
+
- token based
|
|
106
|
+
- ldap
|
|
107
|
+
- with cert
|
|
108
|
+
- using approle, for that you need simply set `VAULT_APPROLE` to true, and when start, hvac will login to Vault via default maunted file by vault agent
|
|
109
|
+
|
|
110
|
+
## Vault secret structure
|
|
111
|
+
This example shows all available params for client(same as proto message)
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"id": "my-first-client",
|
|
115
|
+
"secret": "", // put here your client secret
|
|
116
|
+
"logo_url": "https://picsum.photos/200/300", // example logo, not recommended
|
|
117
|
+
"name": "My First Client",
|
|
118
|
+
"public": false,
|
|
119
|
+
"redirect_uris": ["http://127.0.0.1:5000/callback"],
|
|
120
|
+
"trusted_peers": ["my-second-client"]
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
In Vault config `id` and `secret` are required, and `public` has default value `False` that enforced on dexus_vault level.
|
|
124
|
+
Also you may ask, how to define lists for `redirect_uris` and `trusted_peers`, you can do it in 2 ways:
|
|
125
|
+
- native json list `["value1", "value2"]` but this will disale in Vault UI non-json view for that secret
|
|
126
|
+
- using string with comma as delimeter `"value1,value2"` but it's not recommended and would be removed in future iterations
|
|
127
|
+
|
|
128
|
+
## Local Testing
|
|
129
|
+
The `docker/tests` directory contains a `docker-compose.yaml` file. This file is configured to run Vault and Dex locally for testing purposes. Please note that this setup is not intended for production use.
|
|
130
|
+
|
|
131
|
+
For additional information, refer to the [README](docker/tests/README.md) in the `docker/tests` directory.
|
|
132
|
+
|
|
133
|
+
## About Dex GRPC
|
|
134
|
+
All GRPC API methods dexus_vault use, defined in [api.proto](https://github.com/dexidp/dex/blob/v2.38.0/api/v2/api.proto)
|
|
135
|
+
and compiled with `grpc_tools.protoc`
|
|
136
|
+
|
|
137
|
+
## Other notes
|
|
138
|
+
This projects uses pre-commit: https://pre-commit.com/
|
|
139
|
+
|
|
140
|
+
# THANKS
|
|
141
|
+
- [Hurlenko](https://github.com/hurlenko) for references copied from your repos
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
dexus_vault/__init__.py
|
|
5
|
+
dexus_vault/__main__.py
|
|
6
|
+
dexus_vault/__version__.py
|
|
7
|
+
dexus_vault/client.py
|
|
8
|
+
dexus_vault.egg-info/PKG-INFO
|
|
9
|
+
dexus_vault.egg-info/SOURCES.txt
|
|
10
|
+
dexus_vault.egg-info/dependency_links.txt
|
|
11
|
+
dexus_vault.egg-info/entry_points.txt
|
|
12
|
+
dexus_vault.egg-info/requires.txt
|
|
13
|
+
dexus_vault.egg-info/top_level.txt
|
|
14
|
+
dexus_vault/src/__init__.py
|
|
15
|
+
dexus_vault/src/dex_processor.py
|
|
16
|
+
dexus_vault/src/vault_processor.py
|
|
17
|
+
dexus_vault/utils/__init__.py
|
|
18
|
+
dexus_vault/utils/client_parser.py
|
|
19
|
+
dexus_vault/utils/config.py
|
|
20
|
+
dexus_vault/utils/files.py
|
|
21
|
+
dexus_vault/utils/logger.py
|
|
22
|
+
dexus_vault/utils/types.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dexus_vault
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from codecs import open
|
|
3
|
+
|
|
4
|
+
from setuptools import setup, find_packages
|
|
5
|
+
|
|
6
|
+
package_name = "dexus_vault"
|
|
7
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
8
|
+
|
|
9
|
+
# Read README.md for docs
|
|
10
|
+
with open("README.md", "r", "utf-8") as f:
|
|
11
|
+
long_description = f.read()
|
|
12
|
+
|
|
13
|
+
# Read __version__.py for version
|
|
14
|
+
about = {}
|
|
15
|
+
with open(os.path.join(here, package_name, "__version__.py"), "r", "utf-8") as f:
|
|
16
|
+
exec(f.read(), about)
|
|
17
|
+
|
|
18
|
+
setup(
|
|
19
|
+
name=about["__title__"],
|
|
20
|
+
version=about["__version__"],
|
|
21
|
+
author="ifurs",
|
|
22
|
+
description=about["__description__"],
|
|
23
|
+
long_description=long_description,
|
|
24
|
+
long_description_content_type="text/markdown",
|
|
25
|
+
url=about["__url__"],
|
|
26
|
+
license=about["__license__"],
|
|
27
|
+
packages=find_packages(),
|
|
28
|
+
classifiers=(
|
|
29
|
+
"License :: OSI Approved :: Apache Software License",
|
|
30
|
+
"Programming Language :: Python",
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"Programming Language :: Python :: 3.8",
|
|
33
|
+
"Programming Language :: Python :: 3.9",
|
|
34
|
+
"Programming Language :: Python :: 3.10",
|
|
35
|
+
"Programming Language :: Python :: 3.11",
|
|
36
|
+
"Programming Language :: Python :: 3.12",
|
|
37
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
38
|
+
"Operating System :: OS Independent",
|
|
39
|
+
),
|
|
40
|
+
install_requires=[
|
|
41
|
+
"grpcio~=1.62.0",
|
|
42
|
+
"grpcio-tools~=1.60.1",
|
|
43
|
+
"googleapis-common-protos>=1.62.0",
|
|
44
|
+
"protobuf~=4.25.3",
|
|
45
|
+
"hvac~=2.1.0",
|
|
46
|
+
],
|
|
47
|
+
python_requires=">=3.8",
|
|
48
|
+
project_urls={"Source": about["__url__"]},
|
|
49
|
+
entry_points={
|
|
50
|
+
"console_scripts": [f"{about['__title__']} = dexus_vault.__main__:main"]
|
|
51
|
+
},
|
|
52
|
+
)
|