Skip to content

Commit 8a1e65d

Browse files
authored
Merge pull request #493 from href/main
Add support for token_bound_cidrs to hashivault_auth_ldap
2 parents aacd050 + c308bb0 commit 8a1e65d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ansible/modules/hashivault/hashivault_auth_ldap.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@
102102
userfilter:
103103
description:
104104
- LDAP filter that will determine if a user has permission to authenticate to Vault
105+
token_bound_cidrs:
106+
description:
107+
- List of CIDR blocks; if set, specifies blocks of IP addresses which can authenticate successfully, and
108+
ties the resulting token to these blocks as well.
105109
extends_documentation_fragment: hashivault
106110
'''
107111
EXAMPLES = '''
@@ -157,6 +161,7 @@ def main():
157161
argspec['use_token_groups'] = dict(required=False, type='bool', default=False)
158162
argspec['token_ttl'] = dict(required=False, type='int', default=0)
159163
argspec['token_max_ttl'] = dict(required=False, type='int', default=0)
164+
argspec['token_bound_cidrs'] = dict(required=False, type='list', default=[])
160165

161166
module = hashivault_init(argspec, supports_check_mode=True)
162167
result = hashivault_auth_ldap(module)
@@ -194,6 +199,7 @@ def hashivault_auth_ldap(module):
194199
desired_state['use_token_groups'] = params.get('use_token_groups')
195200
desired_state['token_ttl'] = params.get('token_ttl')
196201
desired_state['token_max_ttl'] = params.get('token_max_ttl')
202+
desired_state['token_bound_cidrs'] = params.get('token_bound_cidrs')
197203

198204
# if bind pass is None, remove it from desired state since we can't compare
199205
if desired_state['bind_pass'] is None:
@@ -225,6 +231,7 @@ def hashivault_auth_ldap(module):
225231
current_state['starttls'] = result['starttls']
226232
current_state['token_ttl'] = result['token_ttl']
227233
current_state['token_max_ttl'] = result['token_max_ttl']
234+
current_state['token_bound_cidrs'] = result['token_bound_cidrs']
228235
except InvalidPath:
229236
pass
230237

0 commit comments

Comments
 (0)