GitXplorerGitXplorer
L

samba_gsync

public
6 stars
1 forks
3 issues

Commits

List of commits on branch master.
Verified
eed3b788b17189b92d9cd1dc789c7a7874310ddb

Update README.md

LLapin-Blanc committed 7 years ago
Unverified
afc077071e665178f5c087ee2069005c289702a7

Add systemd startup script, use absolute path and full debug by default

committed 7 years ago
Verified
065e674ea386d1284f9b5494cb06efadbaf9b6b6

Acquire credentials through command line

LLapin-Blanc committed 7 years ago
Unverified
73fc0bffc20085053a59215c4c3a852a50baeb29

Make sure the script never fails and manage http connexion not ready

committed 7 years ago
Unverified
5d384d6897fcaf64b3f1edbc737d55dd4ac719e0

Protected users are only protected agains deletion, can be updated

LLapin-Blanc committed 7 years ago
Unverified
d0e592b1be44e0455f7c4c3bd8ba7b79e1ffc7d6

Add protection for some accounts and basic config file

LLapin-Blanc committed 7 years ago

README

The README file for this repository.

samba_gsync

Simple one way password synchronization from samba 4 (>=4.7) to G Suite

installation & run

I've tested this with a fresh Centos 7 Samba 4.8.2 built from sources and configured as explained described there :

  1. Go to /usr/local/ and clone this repo, cd to the repo
  2. Edit the config.json file with :
{
    "domain" : "yourdomain.com",
    "protected_accounts" : [ "administrator", "super.user"]
}
  1. Go to your G Suite console, start or use an existing project, create credentials and get the OAuth 2.0 'client_secret_XXX.json' file and rename it to 'client_secret.json',
  2. Put this file in the 'ggl' dir and chmod it to 600
  3. Get Google API client and ldif3:
pip install --upgrade google-api-python-client
pip install ldif3
  1. First, launch ./initialize_credentials.py
  2. Add password hash userPassword schemes = CryptSHA512 to smb.conf
  3. Get sure samba is up and running, and you should be able to ./start_syncing.sh and ./stop_syncing
  4. You can check logs at /var/log/samba_sync/sync.log and /var/log/samba_sync/user-syncpasswords.log
  5. Once everything is fine, you can copy, start and enable the startup script :
    • cp samba-gsync.service /etc/systemd/system/
    • chmod +x /etc/systemd/system/samba-gsync.service
    • systemctl start samba-gsync.service
    • systemctl enable samba-gsync.service
  6. The sync.py script should not be called directly (meant to be called by samba directly)

Behaviour

Whenever you create a local domain user account, either from RSAT or from samba-tool, this account is also created on the G Suite domain. Synced attributes are primaryEmail, givenName and familyName and G Suite email is build with username@domain.com

If you don't provide a givenName and/or familyName, username will be used instead.

If you modify the password, it gets updated (that's the whole point...).

If you delete a local user account it is also deleted on the G Suite domain.

Accounts mentionned in the config file are protected though.