This installs py-fortress and runs a simple test program of how the RBAC API works._
Minimum hardware requirements:
- 1 Core
- 1 GB RAM
Minimum software requirements:
- RHEL/Debian machine
- Python >=3.6
- Installed README-LDAP-DOCKER
- python-ldap dependencies installed README-UPGRADE-PYTHON
-
Clone py-fortress-sample
git clone https://github.com/shawnmckinney/py-fortress-sample.git
-
Change folder into the project:
cd py-fortress-sample
you should now be here: py-fortress-sample
-
Prepare the config:
From the project root folder, copy sample cfg file:
cp py-fortress-cfg.json.sample py-fortress-cfg.json
sample cfg file is here: py-fortress-cfg.json.sample
- Now edit config file:
vi py-fortress-cfg.json
- Set the LDAP URI
...
"ldap": {
...
"uri": "ldap://localhost",
...
- use value obtained during LDAP setup
- if in doubt use the defaults
- Save and exit
- Prepare your terminal for execution of python3. From the main dir of the git repo:
python3 -m venv env
. env/bin/activate
from the py-fortress-sample folder
- Install py-fortress:
pip3 install py-fortress
- Change folder to where the sample program is:
cd sample/ldap
you're now here: py-fortress-sample/sample/ldap
- Prepare the Directory Information Tree:
You can think of this command as creating tables in a new database instance.
initldap
initldap is a python script, created during install of py-fortress package, that maps here: pyfortress.test.test_dit_dao
-
Examine the output, should finish almost instaneously (< 1 sec).
initldap Initialize py-fortress ldap... INFO ldap host: localhost, port:389 test_bootstrap test_bootstrap success . ---------------------------------------------------------------------- Ran 1 test in 0.004s
-
Run the test program:
python3 test_samples.py
-
View the output:
---------------------------------------------------------------------- Ran 28 tests in 0.024s OK
-
Study the APIs in test_samples.py module.