sync Cloudshell groups with AD Groups
Project description
cloudshell-user-sync
A CLI tool to Sync LDAP / Active Directory Groups with Cloudshell groups. This package will pull LDAP data, compare state of cloudshell group, and add/remove users to sync the groups.
Important Notes
- This package does NOT import/create users from LDAP - only syncs already imported users across groups.
- Users are NOT deleted from system during sync - only add/remove to group action performed.
- Users must be first manually imported or auto-imported on login to a default group.
- Non-imported cloudshell users will NOT be evicted from a synced group.
- This tool only aims to manage the imported ldap users.
- Groups can be hybrid with "regular" users.
- This tool can be configured to manage only a subset of cloudshell groups.
- If possible, to improve performance of LDAP search, place target ldap users together under common root in LDAP Tree.
- This will allow to set a lower base root DN (distinguished name) to allow quicker ldap searches.
- Note that LDAP groups and users are not necessarily in same location of ldap tree
Installation
pip install cloudshell-user-sync
Commands
Commands:
config View or Set Config - Pass no params to view config
credential Set Credentials For Cloudshell and LDAP
mapping Set LDAP group --> Cloudshell Groups Mapping
run Pull LDAP Data and sync to Cloudshell
runscheduler Run sync on infinite scheduler
service Install Windows service to run job automatically
version Display CLI version
Basic Usage
- configure credentials (stored in OS specific credential manager)
- set config values for target cloudshell server
- Set config values for target LDAP server
- set LDAP -> Cloudshell Group Mappings
- Do manual sync run to test
- Configure service to run job automatically
Configure Credentials
Set Cloudshell Credential
usersync credential admin admin --target cloudshell
Set LDAP Credential
usersync credential CN=Administrator,CN=Users,DC=samplecorp,DC=example,DC=com LDAP_DN_Password --target ldap
- User is the full distinguished name (DN) as seen in AD explorer
Set Config Values
Credentials must be set through CLI to be stored in credential manager. The other values can be set directly in file or optionally in CLI
Default Config Path:
- Windows: C:\ProgramData\QualiSystems\CloudshellUserSync\ldap_config.json
- Linux: /opt/CloudshellUserSync/ldap_config.json
view current config state
usersync config
CLI Set config actions follows the pattern:
usersync config <target> <key> <value>
Set cloudshell server details
usersync config cloudshell server localhost
Set ldap details
usersync config ldap server 10.0.0.7
usersync config ldap base_dn DC=samplecorp,DC=example,DC=com
- base_dn is where the ldap search will start from
- Filter scheme used is:
(&(objectClass=user)(memberOf=<GROUP_DN>))
Set LDAP mappings
Can map one LDAP source group to multiple cloudshell groups (ie a list)
View only mapping config:
usersync mapping
Set mapping follows pattern:
usersync mapping <LDAP_GROUP_DN> --csgroups <CSGROUP1>,<CSGROUP2>,<CSGROUP3>
sample:
usersync mapping CN=nattigroup,DC=natticorp,DC=example,DC=com --csgroups <CSGROUP1>,<CSGROUP2>,<CSGROUP3>
Configure Windows Service
Install and run job as managed windows service.
Install service
usersync service install
Start Service
usersync service start
Notes:
- Must run with Adminsistrator CMD to install / update service
- After installation, must set service to run as same Logon user that ran install
- This is so service can access windows credential manager with same user that set the credentials
- Set startup type to auto
- Check log to ensure no errors are occuring.
- Set log level to debug to see more details on users found per LDAP request
Linux Service
No linux service generation command included. The following options are possible.
- Schedule the "run" command to a cron job
- Wrap the "runscheduler" command into a systemd service
Logs
Both manual runs and scheduled runs log to the same rotating log file.
- Windows:
C:\ProgramData\QualiSystems\CloudshellUserSync\Logs\UserSync.log
- Linux:
/opt/CloudshellUserSync/Logs/UserSync.log
Dependencies
- LDAP3 for pulling source LDAP/AD data
- Schedule as cross-platform cron-like scheduler
- Keyring to store credentials in OS
- Pywin32 - windows service installer
cloudshell-automation-api
to update cloudshell groups
License
Free Software: MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cloudshell-user-sync-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f58ee9125ae44d303cba85f34f9fef97f0f0a7b36af0c2bd175a81cc844f0f26 |
|
MD5 | fc190ca15217984526890fae96567a13 |
|
BLAKE2b-256 | 73e62fb1b5723679690d2f6a1d9d7c59ab051cd4cefc8c4a881c588cb75754c6 |
Hashes for cloudshell_user_sync-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 484a3ffb9893809f71d35e320c2135a0e0d0e0ed8629c5fdf6e77b865e4c8301 |
|
MD5 | e95996301a17ec8e17491a79acf6fbab |
|
BLAKE2b-256 | db2f5447ca79ef47e01b5dc8e599f540f92e0e4840ebf0d3472b275320cbc546 |