Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntacls backup and restore #198

Conversation

catalyst-joe-guo
Copy link
Contributor

@catalyst-joe-guo catalyst-joe-guo commented Jun 14, 2018

Add following functions to samba.ntacls.py:

  • backup_online: backup files and ntacls for a service/share to a tarfile via smb connection with pysmb API
  • backup_offline: backup files and ntacls for a service/share to a tarfile via disk path with pysmbd API
  • backup_restore: restore either of the above backup from a tarfile with pysmbd API
    20180619 update:
  • Compare ntacl sddl str before and after restore.

To make these work, extended pysmb.c and pysmbd.c.

Tests added in samba.tests.ntacls.py.

gitlab ci passed at:
https://gitlab.com/catalyst-samba/samba/pipelines/24028523

@catalyst-joe-guo catalyst-joe-guo force-pushed the ntacls_backup_and_restore branch 3 times, most recently from c8ec5c3 to b01db43 Compare June 22, 2018 03:13
@catalyst-joe-guo catalyst-joe-guo force-pushed the ntacls_backup_and_restore branch 3 times, most recently from 42b932a to 9d597ec Compare June 26, 2018 22:54
Add unlink api to delete a file with a smb connection.
Test added.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Add mkdir for smbd API.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Extract initialization code from set_nt_acl_conn for reuse.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Add create_file function to smbd API.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
1. backup a share online from a smb connection with ntacls using pysmb API.
2. backup a share offline from service path with ntacls using pysmbd API.
3. restore from tarfile with pysmdb API.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
@catalyst-joe-guo catalyst-joe-guo force-pushed the ntacls_backup_and_restore branch 4 times, most recently from de2d317 to b7a7d51 Compare June 28, 2018 00:31
The ntacls backup tests have to run in ad_dc:local env, which is
different from existing ntacls tests. Add a separate file for backup
tests.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Move acl and dommain_sid to global vars so we don't repeat them in every
test.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
@abartlet
Copy link
Member

abartlet commented Jul 2, 2018

Merged into master as 975b751 for Samba 4.9

@abartlet abartlet closed this Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants