Compare commits

...

2 Commits

Author SHA1 Message Date
df18897113 updated to pull info from ini now 2022-05-23 19:23:59 -04:00
899bd59ccf updated ini file as ccnet isn't being used anymore 2022-05-23 19:23:43 -04:00
2 changed files with 25 additions and 29 deletions

View File

@@ -5,12 +5,21 @@ logLevel = INFO
logFilePath = /tmp/seafile-ldap.log
[Seafile]
# url for seafile
SERVICE_URL = 'https://cloud.seafile.com'
# token for a admin account
token = 123456789abcdef
# Path of CCENT.conf file
ccnetPath = /opt/seafile/conf/ccnet.conf
# Seafile Admin Account
# This will be the owners of the groups and will be excluded from the script
adminEmail = admin@seafile.com
# Seafile Admin Account to exclude from marking inactive
adminEmail = admin@johnhgaunt.com
[LDAP]
# LDAP host
HOST = ldap://ldap.local
# BASE OU to search
BASE = OU=Users,DC=ldap,DC=local
# User account to connect to ldap to search
USER_DN = CN=user,OU=Users,DC=ldap,DC=local
# password for bind dn user
PASSWORD = password
# ldap filter used to grant access to seafile
FILTER = memberOf=CN=Seafile,,OU=Users,DC=ldap,DC=local

View File

@@ -82,32 +82,19 @@ else:
seafileToken = config['Seafile']['token']
ccnetPath = config['Seafile']['ccnetPath']
adminEmail = config['Seafile']['adminEmail']
seafileURL = config['Seafile']['SERVICE_URL']
logger.debug("Seafile URL: {0}".format(seafileURL))
logger.debug("Seafile Token: {0}".format(seafileToken))
logger.debug("Seafile ccnet.conf File Path: {0}".format(ccnetPath))
logger.debug("Seafile Admin Email: {0}".format(adminEmail))
logger.debug("Finished reading the config.ini file.")
logger.debug("Starting to read the ccnet.conf file.")
if os.path.exists(ccnetPath):
ccnetConfig = configparser.ConfigParser()
ccnetConfig.read(ccnetPath)
else:
logger.critical("Unable to find/read ccnet.conf file. Please ensure the ccnet.conf path is correct in the config.ini.")
exit(2)
# Seafile url
seafileURL = ccnetConfig['General']['SERVICE_URL']
# ldap Config
ldapHost = ccnetConfig['LDAP']['HOST']
#ldapPort = ccnetConfig['LDAP SERVER'].getint('port')
#ldapSSL = ccnetConfig['LDAP SERVER'].getboolean('ssl')
ldapBase = ccnetConfig['LDAP']['BASE']
ldapUserDN = ccnetConfig['LDAP']['USER_DN']
ldapUserPassword = ccnetConfig['LDAP']['PASSWORD']
ldapFilter = ccnetConfig['LDAP']['FILTER']
ldapHost = config['LDAP']['HOST']
#ldapPort = config['LDAP SERVER'].getint('port')
#ldapSSL = config['LDAP SERVER'].getboolean('ssl')
ldapBase = config['LDAP']['BASE']
ldapUserDN = config['LDAP']['USER_DN']
ldapUserPassword = config['LDAP']['PASSWORD']
ldapFilter = config['LDAP']['FILTER']
logger.debug("LDAP Host: {0}, LDAP Base: {1}, LDAP User DN: {2}, LDAP Filter: {3}".format(ldapHost, ldapBase, ldapUserDN, ldapFilter))
logger.debug("Finished reading the ccnet.conf file.")
logger.debug("Finished reading the config.ini file.")
# setup the server
ldapServer = Server(ldapHost)