-
Notifications
You must be signed in to change notification settings - Fork 41
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
Experimental: Use zfs permissions instead of zfs shell and sudo #32
Open
MichaelHierweck
wants to merge
3
commits into
Rudd-O:master
Choose a base branch
from
MichaelHierweck:experimental-zfs-permissions-instead-of-zfs-shell
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
zfs-tools (0.6.2) wily; urgency=low | ||
|
||
* remove zfs-shell, zfs user and sudoers rules; use zfs permissions instead | ||
|
||
-- Michael Hierweck <[email protected]> Thu, 3 Dec 2020 10:14:26 +0000 | ||
|
||
zfs-tools (0.6.1) wily; urgency=low | ||
|
||
* depend on zfsutils-linux | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,25 +59,25 @@ def __init__(self,host="localhost", trust=False, sshcipher=None, properties=None | |
def _get_poolset(self): | ||
if self._dirty: | ||
properties = [ 'creation' ] + self._properties | ||
stdout2 = subprocess.check_output(self.command + ["zfs", "list", "-Hpr", "-o", ",".join( ['name'] + properties ), "-t", "all"]) | ||
stdout2 = subprocess.check_output(self.command + ["/sbin/zfs", "list", "-Hpr", "-o", ",".join( ['name'] + properties ), "-t", "all"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should not encode the path to |
||
self._poolset.parse_zfs_r_output(stdout2,properties) | ||
self._dirty = False | ||
return self._poolset | ||
pools = property(_get_poolset) | ||
|
||
def create_dataset(self,name): | ||
subprocess.check_call(self.command + ["zfs", "create", name]) | ||
subprocess.check_call(self.command + ["/sbin/zfs", "create", name]) | ||
self._dirty = True | ||
return self.pools.lookup(name) | ||
|
||
def destroy_dataset(self, name): | ||
subprocess.check_call(self.command + ["zfs", "destroy", name]) | ||
subprocess.check_call(self.command + ["/sbin/zfs", "destroy", name]) | ||
self._dirty = True | ||
|
||
def destroy_recursively(self, name, returnok=False): | ||
"""If returnok, then simply return success as a boolean.""" | ||
ok = True | ||
cmd = self.command + ["zfs", "destroy", '-r', name] | ||
cmd = self.command + ["/sbin/zfs", "destroy", '-r', name] | ||
if returnok: | ||
ok = subprocess.call(cmd) == 0 | ||
else: | ||
|
@@ -87,7 +87,7 @@ def destroy_recursively(self, name, returnok=False): | |
|
||
def snapshot_recursively(self,name,snapshotname,properties={}): | ||
plist = sum( map( lambda x: ['-o', '%s=%s' % x ], properties.items() ), [] ) | ||
subprocess.check_call(self.command + ["zfs", "snapshot", "-r" ] + plist + [ "%s@%s" % (name, snapshotname)]) | ||
subprocess.check_call(self.command + ["/sbin/zfs", "snapshot", "-r" ] + plist + [ "%s@%s" % (name, snapshotname)]) | ||
self._dirty = True | ||
|
||
def send(self,name,opts=None,bufsize=-1,compression=False,lockdataset=None): | ||
|
@@ -99,8 +99,8 @@ def send(self,name,opts=None,bufsize=-1,compression=False,lockdataset=None): | |
if self.verbose: | ||
cmd += ["-v"] | ||
cmd += [lockdataset, "--"] | ||
cmd += ["zfs", "send"] + opts + [name] | ||
p = SpecialPopen(cmd,stdin=file(os.devnull),stdout=subprocess.PIPE,bufsize=bufsize) | ||
cmd += ["/sbin/zfs", "send"] + opts + [name] | ||
p = SpecialPopen(cmd,stdin=open(os.devnull),stdout=subprocess.PIPE,bufsize=bufsize) | ||
return p | ||
|
||
def receive(self,name,pipe,opts=None,bufsize=-1,compression=False,lockdataset=None): | ||
|
@@ -112,7 +112,7 @@ def receive(self,name,pipe,opts=None,bufsize=-1,compression=False,lockdataset=No | |
if self.verbose: | ||
cmd += ["-v"] | ||
cmd += [lockdataset, "--"] | ||
cmd = cmd + ["zfs", "receive"] + opts + [name] | ||
cmd = cmd + ["/sbin/zfs", "receive"] + opts + [name] | ||
p = SpecialPopen(cmd,stdin=pipe,bufsize=bufsize) | ||
return p | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to maintain support for
zfs-shell
since not everyone is ready to migrate to ZFS permissions, and people deploy from this repo.If needed, we can add to
zfs-shell
some sort of canary command that the client can then query, and if that fails, revert back to usingzfs-shell
instead of ZFS permissions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, sorry, the last weeks I was too busy with other things .
I wonder how we could make zfs-shell optional.
Case "zfs-shell":
zfs-shell should be installed and registered as a shell. We might even need the sudo rules.
ztools should invoke zfs-shell as a helper script.
Case "zfs-permissions":
zfs-shell should not be installed (or at least) not registered. Sudo rules should not be installed or at least not activated.
ztools should invoke zpool and zfs directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about creating two Debian packages out of a single source package, e.g. "zfs-tools" and optional "zfs-shell" (providing zfs-shell and sudo rules). zfs-tools could suggest or even recommend zfs-shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attempt to split the binary packages