Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
isgphys
python
Commits
b3e8fd0d
Commit
b3e8fd0d
authored
6 years ago
by
Sven Mäder
Browse files
Options
Downloads
Patches
Plain Diff
Add output list, add auto.home base
parent
2e94cf8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/check-home-permissions.py
+55
-2
55 additions, 2 deletions
bin/check-home-permissions.py
with
55 additions
and
2 deletions
bin/check-home-permissions.py
+
55
−
2
View file @
b3e8fd0d
...
@@ -65,16 +65,17 @@ def search_ldap():
...
@@ -65,16 +65,17 @@ def search_ldap():
ldap
=
dphysldap
.
Ldap
()
ldap
=
dphysldap
.
Ldap
()
ldap_users
=
dphysldap
.
Users
(
ldap
,
[
'
uid
'
,
'
uidNumber
'
,
'
gidNumber
'
,
'
homeDirectory
'
])
ldap_users
=
dphysldap
.
Users
(
ldap
,
[
'
uid
'
,
'
uidNumber
'
,
'
gidNumber
'
,
'
homeDirectory
'
])
entries
=
dphysldap
.
Entries
(
ldap
,
[
'
cn
'
,
'
nisMapEntry
'
])
entries
=
dphysldap
.
Entries
(
ldap
,
[
'
cn
'
,
'
nisMapEntry
'
])
auto_home
=
'
nisMapName=auto.home,ou=automount,dc=phys,dc=ethz,dc=ch
'
ldap_users
.
search
(
'
*
'
)
ldap_users
.
search
(
'
*
'
)
for
user
in
ldap_users
:
for
user
in
ldap_users
:
users
[
user
[
'
uid
'
][
0
]]
=
user
[
'
homeDirectory
'
][
0
]
users
[
user
[
'
uid
'
][
0
]]
=
user
[
'
homeDirectory
'
][
0
]
entries
.
search
(
'
cn: *, nisMapEntry: phd-home*
'
,
[
'
nisObject
'
])
entries
.
search
(
'
cn: *, nisMapEntry: phd-home*
'
,
[
'
nisObject
'
]
,
base
=
auto_home
)
for
entry
in
entries
:
for
entry
in
entries
:
nis_homes
[
entry
[
'
cn
'
][
0
]]
=
entry
[
'
nisMapEntry
'
][
0
]
nis_homes
[
entry
[
'
cn
'
][
0
]]
=
entry
[
'
nisMapEntry
'
][
0
]
entries
.
search
(
'
cn: *, nisMapEntry: != phd-home*
'
,
[
'
nisObject
'
])
entries
.
search
(
'
cn: *, nisMapEntry: != phd-home*
'
,
[
'
nisObject
'
]
,
base
=
auto_home
)
for
entry
in
entries
:
for
entry
in
entries
:
nis_shares
[
entry
[
'
cn
'
][
0
]]
=
entry
[
'
nisMapEntry
'
][
0
]
nis_shares
[
entry
[
'
cn
'
][
0
]]
=
entry
[
'
nisMapEntry
'
][
0
]
...
@@ -150,6 +151,8 @@ if __name__ == '__main__':
...
@@ -150,6 +151,8 @@ if __name__ == '__main__':
search_ldap
()
search_ldap
()
print
(
'
statistics
'
)
print
(
'
----------
'
)
print
(
'
ldap users:
'
+
str
(
len
(
users
)))
print
(
'
ldap users:
'
+
str
(
len
(
users
)))
print
(
'
ldap nismaps (home):
'
+
str
(
len
(
nis_homes
)))
print
(
'
ldap nismaps (home):
'
+
str
(
len
(
nis_homes
)))
print
(
'
ldap nismaps (share):
'
+
str
(
len
(
nis_shares
)))
print
(
'
ldap nismaps (share):
'
+
str
(
len
(
nis_shares
)))
...
@@ -193,3 +196,53 @@ if __name__ == '__main__':
...
@@ -193,3 +196,53 @@ if __name__ == '__main__':
print
(
home
.
path
)
print
(
home
.
path
)
print
(
extacl
)
print
(
extacl
)
print
()
print
()
if
users
:
print
(
'
strange ldap users:
'
)
print
(
'
-------------------
'
)
for
k
,
v
in
users
.
items
():
print
(
'
:
'
.
join
([
k
,
v
]))
print
()
if
nis_homes
:
print
(
'
orphaned nis homes:
'
)
print
(
'
-------------------
'
)
for
k
,
v
in
nis_homes
.
items
():
print
(
'
:
'
.
join
([
k
,
v
]))
print
()
if
nis_shares
:
print
(
'
orphaned nis shares:
'
)
print
(
'
--------------------
'
)
for
k
,
v
in
nis_shares
.
items
():
print
(
'
:
'
.
join
([
k
,
v
]))
print
()
if
bad_home_directory
:
print
(
'
bad homeDirectory:
'
)
print
(
'
------------------
'
)
for
home
in
bad_home_directory
:
print
(
home
)
print
()
if
no_ldap_user
:
print
(
'
no user for home:
'
)
print
(
'
-----------------
'
)
for
home
in
no_ldap_user
:
print
(
home
)
print
()
if
bad_nis_map
:
print
(
'
bad nismaps (home):
'
)
print
(
'
-------------------
'
)
for
home
in
bad_nis_map
:
print
(
home
)
print
()
if
no_nis_map
:
print
(
'
no nismap for home:
'
)
print
(
'
-------------------
'
)
for
home
in
no_nis_map
:
print
(
home
)
print
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment