myldapsync 1.0.6__tar.gz → 1.0.7__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.
Potentially problematic release.
This version of myldapsync might be problematic. Click here for more details.
- {myldapsync-1.0.6/myldapsync.egg-info → myldapsync-1.0.7}/PKG-INFO +1 -1
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/__init__.py +34 -34
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/config.ini.example +1 -1
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/ldaputils/connection.py +4 -3
- {myldapsync-1.0.6 → myldapsync-1.0.7/myldapsync.egg-info}/PKG-INFO +1 -1
- {myldapsync-1.0.6 → myldapsync-1.0.7}/setup.py +1 -1
- {myldapsync-1.0.6 → myldapsync-1.0.7}/LICENSE +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/MANIFEST.in +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/README.md +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/config_default.ini +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/ldaputils/__init__.py +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/ldaputils/users.py +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/myutils/__init__.py +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync/myutils/users.py +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync.egg-info/SOURCES.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync.egg-info/dependency_links.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync.egg-info/entry_points.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync.egg-info/requires.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/myldapsync.egg-info/top_level.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/requirements.txt +0 -0
- {myldapsync-1.0.6 → myldapsync-1.0.7}/setup.cfg +0 -0
|
@@ -112,7 +112,8 @@ def main():
|
|
|
112
112
|
connection_string_params = dict(connection_string_params, ssl_key=ssl_key)
|
|
113
113
|
|
|
114
114
|
if (ssl_verify_identity := config.get('mysql', 'ssl_verify_identity')) != '':
|
|
115
|
-
connection_string_params = dict(connection_string_params,
|
|
115
|
+
connection_string_params = dict(connection_string_params,
|
|
116
|
+
ssl_verify_identity=ssl_verify_identity)
|
|
116
117
|
|
|
117
118
|
if (ssl_verify_cert := config.get('mysql', 'ssl_verify_cert')) != '':
|
|
118
119
|
connection_string_params = dict(connection_string_params, ssl_verify_cert=ssl_verify_cert)
|
|
@@ -120,16 +121,16 @@ def main():
|
|
|
120
121
|
if (use_pure := config.get('mysql', 'use_pure')) != '':
|
|
121
122
|
connection_string_params = dict(connection_string_params, use_pure=use_pure)
|
|
122
123
|
|
|
123
|
-
if (
|
|
124
|
-
|
|
124
|
+
if (service_name := config.get('mysql', 'SERVICE_NAME')) and \
|
|
125
|
+
(ldap_server_ip := config.get('mysql', 'LDAP_SERVER_IP')) != '':
|
|
126
|
+
connection_string_params = dict(connection_string_params,
|
|
127
|
+
krb_service_principal=f"{service_name}/{ldap_server_ip}")
|
|
125
128
|
|
|
126
129
|
# Connect to LDAP and get the users we care about
|
|
127
|
-
ldap_conn
|
|
128
|
-
if ldap_conn is None:
|
|
130
|
+
if (ldap_conn := connect_ldap_server(config)) is None:
|
|
129
131
|
sys.exit(1)
|
|
130
132
|
|
|
131
|
-
ldap_users
|
|
132
|
-
if ldap_users is None:
|
|
133
|
+
if (ldap_users := get_filtered_ldap_users(config, ldap_conn, False)) is None:
|
|
133
134
|
sys.exit(1)
|
|
134
135
|
|
|
135
136
|
# Get the LDAP admin users, if the base DN and filter are configured
|
|
@@ -142,12 +143,10 @@ def main():
|
|
|
142
143
|
sys.exit(1)
|
|
143
144
|
|
|
144
145
|
# Connect to MySQL and get the users we care about
|
|
145
|
-
my_conn
|
|
146
|
-
if my_conn is None:
|
|
146
|
+
if (my_conn := mysql.connector.connect(**connection_string_params)) is None:
|
|
147
147
|
sys.exit(1)
|
|
148
148
|
|
|
149
|
-
my_users
|
|
150
|
-
if my_users is None:
|
|
149
|
+
if (my_users := get_filtered_my_users(config, my_conn)) is None:
|
|
151
150
|
sys.exit(1)
|
|
152
151
|
|
|
153
152
|
# Compare the LDAP and MySQL users and get the lists of users
|
|
@@ -185,23 +184,26 @@ def main():
|
|
|
185
184
|
cur.execute("START TRANSACTION;")
|
|
186
185
|
|
|
187
186
|
# Set authentication plugin
|
|
188
|
-
|
|
189
|
-
if auth_plugin
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
187
|
+
identified = ''
|
|
188
|
+
if (auth_plugin := config.get('general', 'auth_plugin')) != '':
|
|
189
|
+
if auth_plugin == 'simple':
|
|
190
|
+
identified = 'WITH authentication_ldap_simple'
|
|
191
|
+
elif auth_plugin == 'sasl':
|
|
192
|
+
identified = 'WITH authentication_ldap_sasl'
|
|
193
|
+
elif auth_plugin == 'pam':
|
|
194
|
+
dbms = config.get('general', 'dbms')
|
|
195
|
+
if dbms == 'mysql':
|
|
196
|
+
identified = 'WITH authentication_pam'
|
|
197
|
+
elif dbms == 'psms':
|
|
198
|
+
compat = config.get('general', 'compat')
|
|
199
|
+
if compat:
|
|
200
|
+
identified = 'WITH auth_pam_compat'
|
|
201
|
+
else:
|
|
202
|
+
identified = 'WITH auth_pam'
|
|
203
|
+
elif dbms == 'mariadb':
|
|
204
|
+
identified = 'VIA pam'
|
|
205
|
+
else:
|
|
206
|
+
sys.exit(1)
|
|
205
207
|
|
|
206
208
|
# If we need to add users to MySQL, then do so
|
|
207
209
|
if config.getboolean('general', 'add_ldap_users_to_mysql'):
|
|
@@ -234,12 +236,10 @@ def main():
|
|
|
234
236
|
cur.execute('%s' % privilege_list)
|
|
235
237
|
cur.execute('%s' % user_grants)
|
|
236
238
|
cur.execute('%s' % user_admin_grants)
|
|
237
|
-
if (filter_string := config.get('mysql', 'filter_string')) != ''
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if "(objectClass=group)" in admin_filter_string or "(objectClass=groupOfNames)" in admin_filter_string:
|
|
242
|
-
cur.execute('GRANT PROXY ON "%s" TO ''@'';' % user_name)
|
|
239
|
+
if (filter_string := config.get('mysql', 'filter_string')) != '' and \
|
|
240
|
+
("(objectClass=group)" in filter_string or \
|
|
241
|
+
"(objectClass=groupOfNames)" in filter_string):
|
|
242
|
+
cur.execute('GRANT PROXY ON "%s" TO ''@'';' % user_name)
|
|
243
243
|
users_added = users_added + 1
|
|
244
244
|
except mysql.connector.Error as exception:
|
|
245
245
|
sys.stderr.write("Error creating user %s: %s" % (user,
|
|
@@ -53,7 +53,7 @@ admin_base_dn = CN=Users,dc=example,dc=com
|
|
|
53
53
|
# for roles and privileges.
|
|
54
54
|
# With AD you might use a filter
|
|
55
55
|
# such as: (&(objectClass=user)(memberof=CN=MYGROUP,CN=Users,dc=example,dc=com))
|
|
56
|
-
# '(objectClass=group)' or '(objectClass=groupOfNames)' should be used for groups
|
|
56
|
+
# '(objectClass=group)' or '(objectClass=groupOfNames)' should be used for groups synchronization with AD or
|
|
57
57
|
# OpenLdap accordingly.
|
|
58
58
|
# If, for example on OpenLDAP, your admin users are members of an alternate OU,
|
|
59
59
|
# then a filter of (cn=*) may suffice.
|
|
@@ -84,9 +84,10 @@ def connect_ldap_server(config):
|
|
|
84
84
|
if config.get('ldap', 'bind_username') == '' and config.get('ldap', 'use_krb') == '':
|
|
85
85
|
conn = Connection(server, auto_bind=True)
|
|
86
86
|
elif config.get('ldap', 'use_krb') != '':
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
if (service_name := config.get('ldap', 'SERVICE_NAME')) and \
|
|
88
|
+
(ldap_server_ip := config.get('ldap', 'LDAP_SERVER_IP')) != '':
|
|
89
|
+
spn = f"{service_name}/{ldap_server_ip}"
|
|
90
|
+
conn = Connection(server, user=spn, authentication=SASL, sasl_mechanism=KERBEROS)
|
|
90
91
|
else:
|
|
91
92
|
conn = Connection(server, authentication=SASL, sasl_mechanism=KERBEROS)
|
|
92
93
|
else:
|
|
@@ -19,7 +19,7 @@ with open('README.md', 'r', encoding='utf-8') as fh:
|
|
|
19
19
|
|
|
20
20
|
setuptools.setup(
|
|
21
21
|
name="myldapsync",
|
|
22
|
-
version="1.0.
|
|
22
|
+
version="1.0.7",
|
|
23
23
|
author="Artur Lebedev",
|
|
24
24
|
author_email="ras_atari@mail.ru",
|
|
25
25
|
description="Synchronise LDAP users to MySQL and MariaDB",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|