pyivia 0.2.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.
- pyivia-0.2.0/AUTHORS.md +14 -0
- pyivia-0.2.0/LICENSE.txt +21 -0
- pyivia-0.2.0/PKG-INFO +86 -0
- pyivia-0.2.0/README.md +62 -0
- pyivia-0.2.0/pyivia/__init__.py +1 -0
- pyivia-0.2.0/pyivia/core/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/access/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/access/accesscontrol.py +463 -0
- pyivia-0.2.0/pyivia/core/access/advancedconfig.py +78 -0
- pyivia-0.2.0/pyivia/core/access/apiprotection.py +552 -0
- pyivia-0.2.0/pyivia/core/access/attributes.py +263 -0
- pyivia-0.2.0/pyivia/core/access/authentication.py +507 -0
- pyivia-0.2.0/pyivia/core/access/fido2config.py +906 -0
- pyivia-0.2.0/pyivia/core/access/fido2registrations.py +111 -0
- pyivia-0.2.0/pyivia/core/access/mappingrules.py +196 -0
- pyivia-0.2.0/pyivia/core/access/mmfaconfig.py +130 -0
- pyivia-0.2.0/pyivia/core/access/pip.py +153 -0
- pyivia-0.2.0/pyivia/core/access/pushnotification.py +264 -0
- pyivia-0.2.0/pyivia/core/access/riskprofiles.py +170 -0
- pyivia-0.2.0/pyivia/core/access/runtimeparameters.py +143 -0
- pyivia-0.2.0/pyivia/core/access/scimconfig.py +246 -0
- pyivia-0.2.0/pyivia/core/access/serverconnections.py +660 -0
- pyivia-0.2.0/pyivia/core/access/templatefiles.py +265 -0
- pyivia-0.2.0/pyivia/core/access/userregistry.py +286 -0
- pyivia-0.2.0/pyivia/core/accesscontrol.py +205 -0
- pyivia-0.2.0/pyivia/core/analysis/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/analysis/applicationlog.py +98 -0
- pyivia-0.2.0/pyivia/core/analysis/remotesyslog.py +154 -0
- pyivia-0.2.0/pyivia/core/analysisdiagnostics.py +153 -0
- pyivia-0.2.0/pyivia/core/federation/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/federation/accesspolicy.py +140 -0
- pyivia-0.2.0/pyivia/core/federation/aliasservice.py +159 -0
- pyivia-0.2.0/pyivia/core/federation/attributesources.py +139 -0
- pyivia-0.2.0/pyivia/core/federation/federations.py +1702 -0
- pyivia-0.2.0/pyivia/core/federation/pointofcontact.py +366 -0
- pyivia-0.2.0/pyivia/core/federation/securitytokenservice.py +502 -0
- pyivia-0.2.0/pyivia/core/federationsettings.py +160 -0
- pyivia-0.2.0/pyivia/core/system/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/system/adminsettings.py +175 -0
- pyivia-0.2.0/pyivia/core/system/advancedtuning.py +111 -0
- pyivia-0.2.0/pyivia/core/system/clicommands.py +45 -0
- pyivia-0.2.0/pyivia/core/system/cluster.py +282 -0
- pyivia-0.2.0/pyivia/core/system/configuration.py +142 -0
- pyivia-0.2.0/pyivia/core/system/containermanagement.py +37 -0
- pyivia-0.2.0/pyivia/core/system/containers/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/system/containers/deployments.py +161 -0
- pyivia-0.2.0/pyivia/core/system/containers/healthcheck.py +62 -0
- pyivia-0.2.0/pyivia/core/system/containers/images.py +130 -0
- pyivia-0.2.0/pyivia/core/system/containers/metadata.py +65 -0
- pyivia-0.2.0/pyivia/core/system/containers/registry.py +161 -0
- pyivia-0.2.0/pyivia/core/system/containers/volumes.py +132 -0
- pyivia-0.2.0/pyivia/core/system/datetime.py +49 -0
- pyivia-0.2.0/pyivia/core/system/dns.py +68 -0
- pyivia-0.2.0/pyivia/core/system/docker.py +57 -0
- pyivia-0.2.0/pyivia/core/system/extensions.py +125 -0
- pyivia-0.2.0/pyivia/core/system/filedownloads.py +81 -0
- pyivia-0.2.0/pyivia/core/system/fips.py +68 -0
- pyivia-0.2.0/pyivia/core/system/firststeps.py +89 -0
- pyivia-0.2.0/pyivia/core/system/fixpacks.py +106 -0
- pyivia-0.2.0/pyivia/core/system/general.py +58 -0
- pyivia-0.2.0/pyivia/core/system/hostsfile.py +151 -0
- pyivia-0.2.0/pyivia/core/system/interfaces.py +291 -0
- pyivia-0.2.0/pyivia/core/system/licensing.py +118 -0
- pyivia-0.2.0/pyivia/core/system/managementauthentication.py +164 -0
- pyivia-0.2.0/pyivia/core/system/managementauthorization.py +241 -0
- pyivia-0.2.0/pyivia/core/system/restartshutdown.py +192 -0
- pyivia-0.2.0/pyivia/core/system/runtimedb.py +82 -0
- pyivia-0.2.0/pyivia/core/system/snapshot.py +128 -0
- pyivia-0.2.0/pyivia/core/system/sslcertificates.py +316 -0
- pyivia-0.2.0/pyivia/core/system/staticroutes.py +151 -0
- pyivia-0.2.0/pyivia/core/system/sysaccount.py +289 -0
- pyivia-0.2.0/pyivia/core/systemsettings.py +224 -0
- pyivia-0.2.0/pyivia/core/web/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/web/api_access_control.py +32 -0
- pyivia-0.2.0/pyivia/core/web/apiac/__init__.py +0 -0
- pyivia-0.2.0/pyivia/core/web/apiac/authorization_server.py +318 -0
- pyivia-0.2.0/pyivia/core/web/apiac/cors.py +160 -0
- pyivia-0.2.0/pyivia/core/web/apiac/document_root.py +157 -0
- pyivia-0.2.0/pyivia/core/web/apiac/policies.py +132 -0
- pyivia-0.2.0/pyivia/core/web/apiac/resource_server.py +716 -0
- pyivia-0.2.0/pyivia/core/web/apiac/utilities.py +100 -0
- pyivia-0.2.0/pyivia/core/web/clientcertmapping.py +151 -0
- pyivia-0.2.0/pyivia/core/web/dscadmin.py +138 -0
- pyivia-0.2.0/pyivia/core/web/fsso.py +129 -0
- pyivia-0.2.0/pyivia/core/web/httptransform.py +135 -0
- pyivia-0.2.0/pyivia/core/web/junctionmapping.py +145 -0
- pyivia-0.2.0/pyivia/core/web/kerberos.py +241 -0
- pyivia-0.2.0/pyivia/core/web/passwordstrength.py +139 -0
- pyivia-0.2.0/pyivia/core/web/policyadmin.py +47 -0
- pyivia-0.2.0/pyivia/core/web/ratelimit.py +128 -0
- pyivia-0.2.0/pyivia/core/web/reverseproxy.py +898 -0
- pyivia-0.2.0/pyivia/core/web/rsa.py +125 -0
- pyivia-0.2.0/pyivia/core/web/runtimecomponent.py +380 -0
- pyivia-0.2.0/pyivia/core/web/urlmapping.py +143 -0
- pyivia-0.2.0/pyivia/core/web/usermapping.py +148 -0
- pyivia-0.2.0/pyivia/core/websettings.py +179 -0
- pyivia-0.2.0/pyivia/factory.py +199 -0
- pyivia-0.2.0/pyivia/util/__init__.py +0 -0
- pyivia-0.2.0/pyivia/util/model.py +56 -0
- pyivia-0.2.0/pyivia/util/policies.py +145 -0
- pyivia-0.2.0/pyivia/util/restclient.py +241 -0
- pyivia-0.2.0/pyivia.egg-info/PKG-INFO +86 -0
- pyivia-0.2.0/pyivia.egg-info/SOURCES.txt +107 -0
- pyivia-0.2.0/pyivia.egg-info/dependency_links.txt +1 -0
- pyivia-0.2.0/pyivia.egg-info/not-zip-safe +1 -0
- pyivia-0.2.0/pyivia.egg-info/requires.txt +1 -0
- pyivia-0.2.0/pyivia.egg-info/top_level.txt +1 -0
- pyivia-0.2.0/setup.cfg +4 -0
- pyivia-0.2.0/setup.py +51 -0
pyivia-0.2.0/AUTHORS.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
PyISAM (now called PyIVIA) was originally developed by Benjamin Martin. It is now actively being extended and maintained with the help of various collaborators.
|
|
2
|
+
|
|
3
|
+
## Moderators
|
|
4
|
+
- Benjamin Martin
|
|
5
|
+
- Lachlan Gleeson
|
|
6
|
+
|
|
7
|
+
## Bug Fixes and Enhancements
|
|
8
|
+
- Charles Wang \<charleswang@au1.ibm.com\>
|
|
9
|
+
- Jasmine Smith \<jasmsmit@au1.ibm.com\>
|
|
10
|
+
- Peter Calvert \<pcalvert@us.ibm.com\>
|
|
11
|
+
- John Sedgmen \<jsedgmen@au1.ibm.com\>
|
|
12
|
+
- Alex Jansons \<alexjans@au1.ibm.com\>
|
|
13
|
+
- Jared Page \<jaredpa@au1.ibm.com\>
|
|
14
|
+
- Leo Farrell \<lfarrell@au1.ibm.com\>
|
pyivia-0.2.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2022 IBM
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
a copy of this software and associated documentation files (the
|
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
pyivia-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: pyivia
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python API for IBM Verify Identity Access
|
|
5
|
+
Author: Lachlan Gleeson
|
|
6
|
+
Author-email: lgleeson@au1.ibm.com
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/lachlan-ibm/pyivia
|
|
9
|
+
Project-URL: Documentation, https://lachlan-ibm.github.io/pyivia
|
|
10
|
+
Project-URL: Source, https://github.com/lachlan-ibm/pyivia
|
|
11
|
+
Project-URL: Tracker, https://github.com/lachlan-ibm/pyivia/issues
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE.txt
|
|
14
|
+
License-File: AUTHORS.md
|
|
15
|
+
Requires-Dist: requests
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: project-url
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
# PyIVIA
|
|
26
|
+
|
|
27
|
+
PyIVIA is a Python library that wraps the IBM Verify Identity Access RESTful Web services to provide a
|
|
28
|
+
quick and easy way to construct configuration scripts for appliances.
|
|
29
|
+
|
|
30
|
+
**Supported Versions**
|
|
31
|
+
|
|
32
|
+
- IBM Verify Identity Access 11.0.0.0
|
|
33
|
+
- IBM Security Verify Access 10.0.9.0
|
|
34
|
+
- IBM Security Verify Access 10.0.8.0
|
|
35
|
+
- IBM Security Verify Access 10.0.7.0
|
|
36
|
+
- IBM Security Verify Access 10.0.6.0
|
|
37
|
+
- IBM Security Verify Access 10.0.5.0
|
|
38
|
+
- IBM Security Verify Access 10.0.4.0
|
|
39
|
+
- IBM Security Verify Access 10.0.3.1
|
|
40
|
+
- IBM Security Verify Access 10.0.3.0
|
|
41
|
+
- IBM Security Verify Access 10.0.2.0
|
|
42
|
+
- IBM Security Verify Access 10.0.1.0
|
|
43
|
+
- IBM Security Verify Access 10.0.0.0
|
|
44
|
+
- IBM Security Access Manager 9.0.7.3
|
|
45
|
+
- IBM Security Access Manager 9.0.7.2
|
|
46
|
+
- IBM Security Access Manager 9.0.7.1
|
|
47
|
+
- IBM Security Access Manager 9.0.7.0
|
|
48
|
+
- IBM Security Access Manager 9.0.6.0
|
|
49
|
+
- IBM Security Access Manager 9.0.5.0
|
|
50
|
+
- IBM Security Access Manager 9.0.4.0
|
|
51
|
+
- IBM Security Access Manager 9.0.3.0
|
|
52
|
+
- IBM Security Access Manager 9.0.2.1
|
|
53
|
+
- IBM Security Access Manager 9.0.2.0
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
For Linux/macOS: if you clone the library to `~/repos/pyivia`, add this to `~/.profile`:
|
|
58
|
+
```sh
|
|
59
|
+
# add pyivia library to Python's search path
|
|
60
|
+
export PYTHONPATH="${PYTHONPATH}:${HOME}/repos/pyivia"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## From IBM Security Verify Access 10.0.0.0 onwards:
|
|
64
|
+
Module has been build into a package Currently hosted on PyPi that can be installed using pip:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
pip install pyivia
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
>>> import pyivia
|
|
74
|
+
>>> factory = pyivia.Factory("https://isam.mmfa.ibm.com", "admin", "Passw0rd")
|
|
75
|
+
>>> web = factory.get_web_settings()
|
|
76
|
+
>>> resp = web.reverse_proxy.restart_instance("default")
|
|
77
|
+
>>> if resp.success:
|
|
78
|
+
... print("Successfully restarted the default instance.")
|
|
79
|
+
... else:
|
|
80
|
+
... print("Failed to restart the default instance. status_code: %s, data: %s" % (resp.status_code, resp.data))
|
|
81
|
+
...
|
|
82
|
+
Successfully restarted the default instance.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Documentation
|
|
86
|
+
Documentation for using this library can be found on [pyivia GitHub pages](https://lachlan-ibm.github.io/pyivia/index.html).
|
pyivia-0.2.0/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# PyIVIA
|
|
2
|
+
|
|
3
|
+
PyIVIA is a Python library that wraps the IBM Verify Identity Access RESTful Web services to provide a
|
|
4
|
+
quick and easy way to construct configuration scripts for appliances.
|
|
5
|
+
|
|
6
|
+
**Supported Versions**
|
|
7
|
+
|
|
8
|
+
- IBM Verify Identity Access 11.0.0.0
|
|
9
|
+
- IBM Security Verify Access 10.0.9.0
|
|
10
|
+
- IBM Security Verify Access 10.0.8.0
|
|
11
|
+
- IBM Security Verify Access 10.0.7.0
|
|
12
|
+
- IBM Security Verify Access 10.0.6.0
|
|
13
|
+
- IBM Security Verify Access 10.0.5.0
|
|
14
|
+
- IBM Security Verify Access 10.0.4.0
|
|
15
|
+
- IBM Security Verify Access 10.0.3.1
|
|
16
|
+
- IBM Security Verify Access 10.0.3.0
|
|
17
|
+
- IBM Security Verify Access 10.0.2.0
|
|
18
|
+
- IBM Security Verify Access 10.0.1.0
|
|
19
|
+
- IBM Security Verify Access 10.0.0.0
|
|
20
|
+
- IBM Security Access Manager 9.0.7.3
|
|
21
|
+
- IBM Security Access Manager 9.0.7.2
|
|
22
|
+
- IBM Security Access Manager 9.0.7.1
|
|
23
|
+
- IBM Security Access Manager 9.0.7.0
|
|
24
|
+
- IBM Security Access Manager 9.0.6.0
|
|
25
|
+
- IBM Security Access Manager 9.0.5.0
|
|
26
|
+
- IBM Security Access Manager 9.0.4.0
|
|
27
|
+
- IBM Security Access Manager 9.0.3.0
|
|
28
|
+
- IBM Security Access Manager 9.0.2.1
|
|
29
|
+
- IBM Security Access Manager 9.0.2.0
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
For Linux/macOS: if you clone the library to `~/repos/pyivia`, add this to `~/.profile`:
|
|
34
|
+
```sh
|
|
35
|
+
# add pyivia library to Python's search path
|
|
36
|
+
export PYTHONPATH="${PYTHONPATH}:${HOME}/repos/pyivia"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## From IBM Security Verify Access 10.0.0.0 onwards:
|
|
40
|
+
Module has been build into a package Currently hosted on PyPi that can be installed using pip:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
pip install pyivia
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
>>> import pyivia
|
|
50
|
+
>>> factory = pyivia.Factory("https://isam.mmfa.ibm.com", "admin", "Passw0rd")
|
|
51
|
+
>>> web = factory.get_web_settings()
|
|
52
|
+
>>> resp = web.reverse_proxy.restart_instance("default")
|
|
53
|
+
>>> if resp.success:
|
|
54
|
+
... print("Successfully restarted the default instance.")
|
|
55
|
+
... else:
|
|
56
|
+
... print("Failed to restart the default instance. status_code: %s, data: %s" % (resp.status_code, resp.data))
|
|
57
|
+
...
|
|
58
|
+
Successfully restarted the default instance.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Documentation
|
|
62
|
+
Documentation for using this library can be found on [pyivia GitHub pages](https://lachlan-ibm.github.io/pyivia/index.html).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .factory import AuthenticationError, Factory
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
"""
|
|
2
|
+
@copyright: IBM
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
from pyivia.util.model import DataObject
|
|
8
|
+
from pyivia.util.restclient import RESTClient
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
POLICIES = "/iam/access/v8/policies"
|
|
12
|
+
POLICY_ATTACHMENTS = "/iam/access/v8/policyattachments"
|
|
13
|
+
POLICY_ATTACHMENTS_PDADMIN = "/iam/access/v8/policyattachments/pdadmin"
|
|
14
|
+
OBLIGATIONS = "/iam/access/v8/obligations"
|
|
15
|
+
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AccessControl(object):
|
|
20
|
+
|
|
21
|
+
def __init__(self, base_url, username, password):
|
|
22
|
+
super(AccessControl, self).__init__()
|
|
23
|
+
self.client = RESTClient(base_url, username, password)
|
|
24
|
+
|
|
25
|
+
def create_policy(self, name=None, description=None, dialect="urn:oasis:names:tc:xacml:2.0:policy:schema:os",
|
|
26
|
+
policy=None, attributes_required=False):
|
|
27
|
+
'''
|
|
28
|
+
Create an AAC Access Policy.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
name (:obj:`str`): Name of policy to be created.
|
|
32
|
+
description (:obj:`str`, optional): Description of policy to be created
|
|
33
|
+
dialect (:obj:`str`, optional): Format of policy XML. Only "urn:oasis:names:tc:xacml:2.0:policy:schema:os" is supported
|
|
34
|
+
policy (:obj:`str`, optional): XML of policy steps.
|
|
35
|
+
attributes_required (:obj:`list` of :obj:`str`, optional): Additional attribute mappings used by the policy
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
39
|
+
|
|
40
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
41
|
+
|
|
42
|
+
If the request is successful the id of the created policy can be access from the
|
|
43
|
+
response.id_from_location attribute.
|
|
44
|
+
|
|
45
|
+
'''
|
|
46
|
+
data = DataObject()
|
|
47
|
+
data.add_value_string("name", name)
|
|
48
|
+
data.add_value_string("description", description)
|
|
49
|
+
data.add_value_string("dialect", dialect)
|
|
50
|
+
data.add_value_string("policy", policy)
|
|
51
|
+
data.add_value_boolean("attributesRequired", attributes_required)
|
|
52
|
+
data.add_value_boolean("predefined", False)
|
|
53
|
+
|
|
54
|
+
response = self.client.post_json(POLICIES, data.data)
|
|
55
|
+
response.success = response.status_code == 201
|
|
56
|
+
|
|
57
|
+
return response
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def delete_policy(self, id=None):
|
|
61
|
+
'''
|
|
62
|
+
Delete an AAC Access Policy.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
id (:obj:`str`): Policy id to be removed.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
69
|
+
|
|
70
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
71
|
+
|
|
72
|
+
'''
|
|
73
|
+
endpoint = "%s/%s" % (POLICIES, id)
|
|
74
|
+
response = self.client.delete_json(endpoint)
|
|
75
|
+
response.success = response.status_code == 204
|
|
76
|
+
|
|
77
|
+
return response
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def list_policies(self, sort_by=None, filter=None):
|
|
81
|
+
'''
|
|
82
|
+
List all of the configured AAC Access Policies.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
sort_by (:obj:`str`, optional): Optional sorting of returned policies
|
|
86
|
+
filter (:obj:`str`, optional): Optional filter for returned policies
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
90
|
+
|
|
91
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
92
|
+
|
|
93
|
+
If the request is successful the policies are returned as JSON and can be accessed from
|
|
94
|
+
the response.json attribute.
|
|
95
|
+
|
|
96
|
+
'''
|
|
97
|
+
parameters = DataObject()
|
|
98
|
+
parameters.add_value_string("sortBy", sort_by)
|
|
99
|
+
parameters.add_value_string("filter", filter)
|
|
100
|
+
|
|
101
|
+
response = self.client.get_json(POLICIES, parameters.data)
|
|
102
|
+
response.success = response.status_code == 200
|
|
103
|
+
|
|
104
|
+
return response
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def authenticate_security_access_manager(self, username=None, password=None, domain=None):
|
|
108
|
+
'''
|
|
109
|
+
Authenticate to the Verify Identity Access policy server. This is required before an administrator can modify
|
|
110
|
+
mapping from policies to resources.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
username (:obj:`str`): Username used to authenticate to the policy server.
|
|
114
|
+
password (:obj:`str`): Password used to authenticate to the policy server.
|
|
115
|
+
domain (:obj:`str`): Security domain to authenticate to.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
119
|
+
|
|
120
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
121
|
+
|
|
122
|
+
'''
|
|
123
|
+
data = DataObject()
|
|
124
|
+
data.add_value_string("username", username)
|
|
125
|
+
data.add_value_string("password", password)
|
|
126
|
+
data.add_value_string("domain", domain)
|
|
127
|
+
data.add_value_string("command", "setCredential")
|
|
128
|
+
|
|
129
|
+
response = self.client.post_json(POLICY_ATTACHMENTS_PDADMIN, data.data)
|
|
130
|
+
response.success = response.status_code == 200
|
|
131
|
+
|
|
132
|
+
return response
|
|
133
|
+
|
|
134
|
+
def configure_resource(
|
|
135
|
+
self, server=None, resource_uri=None,
|
|
136
|
+
policy_combining_algorithm=None, policies=None):
|
|
137
|
+
'''
|
|
138
|
+
Create a new resource in the policy server which can be attached to an authentication policy.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
server (:obj:`str`): Name of WebSEAL instance in the policy server where resource will be created.
|
|
142
|
+
resource_uri (:obj:`str`): URI of resource to be created.
|
|
143
|
+
policy_combining_algorithm (:obj:`str`): Algorithm to use: "denyOverrides" or "permitOverrides".
|
|
144
|
+
policies (:obj:`list` of :obj:`str`): List of policies, policy sets or API protection clients.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
148
|
+
|
|
149
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
150
|
+
|
|
151
|
+
If the request is successful the id of the created policy can be accessed from the
|
|
152
|
+
response.id_from_location attribute.
|
|
153
|
+
|
|
154
|
+
'''
|
|
155
|
+
data = DataObject()
|
|
156
|
+
data.add_value_string("server", server)
|
|
157
|
+
data.add_value_string("resourceUri", resource_uri)
|
|
158
|
+
data.add_value_string("policyCombiningAlgorithm", policy_combining_algorithm)
|
|
159
|
+
data.add_value("policies", policies)
|
|
160
|
+
|
|
161
|
+
response = self.client.post_json(POLICY_ATTACHMENTS, data.data)
|
|
162
|
+
response.success = response.status_code == 201
|
|
163
|
+
|
|
164
|
+
return response
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def remove_resource(self, id):
|
|
168
|
+
'''
|
|
169
|
+
Delete a resource from the policy server.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
id (:obj:`str`): The id of the resource to be removed.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
176
|
+
|
|
177
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
178
|
+
|
|
179
|
+
'''
|
|
180
|
+
endpoint = "%s/%s" % (POLICY_ATTACHMENTS, id)
|
|
181
|
+
response = self.client.delete_json(endpoint)
|
|
182
|
+
response.success = response.status_code == 204
|
|
183
|
+
|
|
184
|
+
return response
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def list_resources(self, sort_by=None, filter=None):
|
|
188
|
+
'''
|
|
189
|
+
Return the list of configured resources.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
sort_by (:obj:`str`, optional): Optionally specify the attribute to sort the returned list by.
|
|
193
|
+
filter (:obj:`str`): Optionally specify whether the returned list shouldb e filtered based on an attribute.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
197
|
+
|
|
198
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
199
|
+
|
|
200
|
+
'''
|
|
201
|
+
parameters = DataObject()
|
|
202
|
+
parameters.add_value_string("sortBy", sort_by)
|
|
203
|
+
parameters.add_value_string("filter", filter)
|
|
204
|
+
|
|
205
|
+
response = self.client.get_json(POLICY_ATTACHMENTS, parameters.data)
|
|
206
|
+
response.success = response.status_code == 200
|
|
207
|
+
|
|
208
|
+
return response
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def publish_policy_attachment(self, id):
|
|
212
|
+
'''
|
|
213
|
+
Publish the changes to the policy server. This will require a restart of the corresponding WebSEAL instance.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
id (:obj:`str`): The id of the resource to publish.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
220
|
+
|
|
221
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
222
|
+
|
|
223
|
+
'''
|
|
224
|
+
endpoint = "%s/deployment/%s" % (POLICY_ATTACHMENTS, id)
|
|
225
|
+
|
|
226
|
+
response = self.client.put_json(endpoint)
|
|
227
|
+
response.success = response.status_code == 204
|
|
228
|
+
|
|
229
|
+
return response
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def publish_multiple_policy_attachments(self, ids=[]):
|
|
233
|
+
'''
|
|
234
|
+
Publish the changes to the policy server for one or more resources. This will require a restart of the
|
|
235
|
+
corresponding WebSEAL instance.
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
ids (:obj:`list` of :obj:`str`): List of resource ids to publish.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
242
|
+
|
|
243
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
244
|
+
|
|
245
|
+
'''
|
|
246
|
+
id_string = ""
|
|
247
|
+
for id in ids:
|
|
248
|
+
|
|
249
|
+
if len(id_string) > 0:
|
|
250
|
+
id_string += ", "
|
|
251
|
+
id_string += str(id)
|
|
252
|
+
|
|
253
|
+
data = DataObject()
|
|
254
|
+
data.add_value_string("policyAttachmentIds", id_string)
|
|
255
|
+
|
|
256
|
+
endpoint = "%s/deployment" % POLICY_ATTACHMENTS
|
|
257
|
+
|
|
258
|
+
response = self.client.put_json(endpoint, data.data)
|
|
259
|
+
response.success = response.status_code == 204
|
|
260
|
+
|
|
261
|
+
return response
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def list_obligations(self, sort_by=None, filter=None):
|
|
265
|
+
'''
|
|
266
|
+
Return the list of configured obligations for AAC.
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
sort_by (:obj:`str`, optional): Optional sorting of returned policies.
|
|
270
|
+
filter (:obj:`str`, optional): Optional filter for returned policies.
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
274
|
+
|
|
275
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
276
|
+
|
|
277
|
+
If the request is successful the obligations are returned as JSON and can be accessed from
|
|
278
|
+
the response.json attribute.
|
|
279
|
+
|
|
280
|
+
'''
|
|
281
|
+
parameters = DataObject()
|
|
282
|
+
parameters.add_value_string("sortBy", sort_by)
|
|
283
|
+
parameters.add_value_string("filter", filter)
|
|
284
|
+
|
|
285
|
+
response = self.client.get_json(OBLIGATIONS, parameters.data)
|
|
286
|
+
response.success = response.status_code == 200
|
|
287
|
+
|
|
288
|
+
return response
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def create_obligation(self, name=None, description=None, obligation_uri=None,
|
|
292
|
+
type="Obligation", type_id="1", parameters=None, properties=None):
|
|
293
|
+
'''
|
|
294
|
+
Create a new obligation for use with RBA.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
name (:obj:`str`): Name of obligation.
|
|
298
|
+
description (:obj:`str`, optional): Description of the obligation.
|
|
299
|
+
obligation_uri (:obj:`str`): URI of the obligation.
|
|
300
|
+
type (:obj:`str`): The obligation type, "Obligation".
|
|
301
|
+
type_id (:obj:`str`, optional): The obligation type id. If not provided, the value will be set to "1", which is the "Enforcement Point" type.
|
|
302
|
+
parameters (:obj:`list` of :obj:`str`, optional): List of parameters used by the obligation when making a decision.
|
|
303
|
+
properties (:obj:`list` of :obj:`str`, optional): Properties used by the obligation.
|
|
304
|
+
|
|
305
|
+
Returns:
|
|
306
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
307
|
+
|
|
308
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
309
|
+
|
|
310
|
+
If the request is successful the id of the created obligation can be accessed from the
|
|
311
|
+
response.id_from_location attribute.
|
|
312
|
+
|
|
313
|
+
'''
|
|
314
|
+
data = DataObject()
|
|
315
|
+
data.add_value_string("name", name)
|
|
316
|
+
data.add_value_string("description", description)
|
|
317
|
+
data.add_value_string("obligationURI", obligation_uri)
|
|
318
|
+
data.add_value_string("type", type)
|
|
319
|
+
data.add_value("parameters", parameters)
|
|
320
|
+
data.add_value_string("typeId", type_id)
|
|
321
|
+
data.add_value("properties", properties)
|
|
322
|
+
|
|
323
|
+
response = self.client.post_json(OBLIGATIONS, data.data)
|
|
324
|
+
response.success = response.status_code == 201
|
|
325
|
+
|
|
326
|
+
return response
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def update_obligation(self, id, name=None, description=None, obligation_uri=None,
|
|
330
|
+
type="Obligation", type_id=None, parameters=None, properties=None):
|
|
331
|
+
'''
|
|
332
|
+
Update an existing obligation for use with RBA
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
id (:obj:`str`): The generated unique id of the obligation to update.
|
|
336
|
+
name (:obj:`str`): Name of obligation.
|
|
337
|
+
description (:obj:`str`, optional): Description of the obligation.
|
|
338
|
+
obligationURI (:obj:`str`): URI of the obligation.
|
|
339
|
+
type (:obj:`str`, optional): The obligation type, "Obligation".
|
|
340
|
+
parameters (:obj:`list` of :obj:`str`, optional): List of parameters used by the obligation when making a decision.
|
|
341
|
+
properties (:obj:`list` of :obj:`str`, optional): Properties used by the obligation.
|
|
342
|
+
|
|
343
|
+
Returns:
|
|
344
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
345
|
+
|
|
346
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
347
|
+
|
|
348
|
+
If the request is successful the id of the created obligation can be accessed from the
|
|
349
|
+
response.id_from_location attribute.
|
|
350
|
+
|
|
351
|
+
'''
|
|
352
|
+
data = DataObject()
|
|
353
|
+
data.add_value_string("name", name)
|
|
354
|
+
data.add_value_string("description", description)
|
|
355
|
+
data.add_value_string("obligationURI", obligation_uri)
|
|
356
|
+
data.add_value_string("type", type)
|
|
357
|
+
data.add_value("parameters", parameters)
|
|
358
|
+
data.add_value_string("typeId", type_id)
|
|
359
|
+
data.add_value("properties", properties)
|
|
360
|
+
|
|
361
|
+
response = self.client.post_json(OBLIGATIONS, data.data)
|
|
362
|
+
response.success = response.status_code == 201
|
|
363
|
+
|
|
364
|
+
return response
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def delete_obligation(self, id):
|
|
368
|
+
'''
|
|
369
|
+
Delete an existing obligation from the policy server
|
|
370
|
+
|
|
371
|
+
Args:
|
|
372
|
+
id (:obj:`str`): The id of the obligation to be removed.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
376
|
+
|
|
377
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
378
|
+
|
|
379
|
+
'''
|
|
380
|
+
endpoint = "%s/%s" % (OBLIGATIONS, id)
|
|
381
|
+
response = self.client.delete_json(endpoint)
|
|
382
|
+
response.success = response.status_code == 204
|
|
383
|
+
|
|
384
|
+
return response
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
class AccessControl9030(AccessControl):
|
|
388
|
+
|
|
389
|
+
def __init__(self, base_url, username, password):
|
|
390
|
+
super(AccessControl9030, self).__init__(base_url, username, password)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def configure_resource(self, server=None, resource_uri=None, policy_combining_algorithm=None,
|
|
394
|
+
policies=None, type="reverse_proxy"):
|
|
395
|
+
'''
|
|
396
|
+
Create a new resource in the policy server which can be attached to an authentication policy.
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
server (:obj:`str`): Name of WebSEAL instance in the policy server where resource will be created.
|
|
400
|
+
resource_uri (:obj:`str`): URI of resource to be created.
|
|
401
|
+
policy_combining_algorithm (:obj:`str`): Algorithm to use: "denyOverrides" or "permitOverrides".
|
|
402
|
+
policies (:obj:`list` of :obj:`str`): List of policies, policy sets or API protection clients.
|
|
403
|
+
type (:obj:`str`, optional): Resource type to be created. Default is "reverse_proxy".
|
|
404
|
+
|
|
405
|
+
Returns:
|
|
406
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
407
|
+
|
|
408
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
409
|
+
|
|
410
|
+
'''
|
|
411
|
+
data = DataObject()
|
|
412
|
+
data.add_value_string("server", server)
|
|
413
|
+
data.add_value_string("resourceUri", resource_uri)
|
|
414
|
+
data.add_value_string(
|
|
415
|
+
"policyCombiningAlgorithm", policy_combining_algorithm)
|
|
416
|
+
data.add_value("policies", policies)
|
|
417
|
+
data.add_value_string("type", type)
|
|
418
|
+
|
|
419
|
+
response = self.client.post_json(POLICY_ATTACHMENTS, data.data)
|
|
420
|
+
response.success = response.status_code == 201
|
|
421
|
+
|
|
422
|
+
return response
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
class AccessControl10000(AccessControl9030):
|
|
426
|
+
|
|
427
|
+
def __init__(self, base_url, username, password):
|
|
428
|
+
super(AccessControl10000, self).__init__(base_url, username, password)
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def configure_resource(self, server=None, resource_uri=None, policy_combining_algorithm=None,
|
|
432
|
+
policies=None, cache=None):
|
|
433
|
+
'''
|
|
434
|
+
Create a new resource in the policy server which can be attached to an authentication policy.
|
|
435
|
+
|
|
436
|
+
Args:
|
|
437
|
+
server (:obj:`str`): Name of WebSEAL instance in the policy server where resource will be created.
|
|
438
|
+
resource_uri (:obj:`str`): URI of resource to be created.
|
|
439
|
+
policy_combining_algorithm (:obj:`str`): Algorithm to use: "denyOverrides" or "permitOverrides".
|
|
440
|
+
policies (:obj:`list` of :obj:`str`): List of policies, policy sets or API protection clients.
|
|
441
|
+
cache (`int`, optional): 0 to disable the cache for this resource, -1 to cache the decision for
|
|
442
|
+
the lifetime of the session or any number greater than 1 to set a
|
|
443
|
+
specific timeout (in seconds) for the cached decision. If not specified
|
|
444
|
+
a default of 0 will be used.
|
|
445
|
+
|
|
446
|
+
Returns:
|
|
447
|
+
:obj:`~requests.Response`: The response from verify identity access.
|
|
448
|
+
|
|
449
|
+
Success can be checked by examining the response.success boolean attribute.
|
|
450
|
+
|
|
451
|
+
'''
|
|
452
|
+
data = DataObject()
|
|
453
|
+
data.add_value_string("server", server)
|
|
454
|
+
data.add_value_string("resourceUri", resource_uri)
|
|
455
|
+
data.add_value_string(
|
|
456
|
+
"policyCombiningAlgorithm", policy_combining_algorithm)
|
|
457
|
+
data.add_value("policies", policies)
|
|
458
|
+
data.add_value("cache", cache)
|
|
459
|
+
|
|
460
|
+
response = self.client.post_json(POLICY_ATTACHMENTS, data.data)
|
|
461
|
+
response.success = response.status_code == 201
|
|
462
|
+
|
|
463
|
+
return response
|