Code Monkey home page Code Monkey logo

btrfs-progs-btrbk's Introduction

Btrfs-progs-btrbk

This is a patchset on top of btrfs-progs, allowing to build distinct binaries for specific btrfs subcommands, e.g. "btrfs-subvolume-show" which would be identical to "btrfs subvolume show".

This is especially useful for btrbk, using the backend btrbk-progs-btrbk configuration option.

License: GPLv2.

Motivation

While btrfs-progs offer the all-inclusive "btrfs" command, it gets pretty cumbersome to restrict privileges to the subcommands. Common approaches are to either setuid root for "/sbin/btrfs" (which is not recommended at all), or to write sudo rules for each subcommand.

Separating the subcommands into distinct binaries makes it easy to set elevated privileges using capabilities(7) or setuid. A typical use case where this is needed is when it comes to automated scripts, e.g. btrbk creating snapshots and send/receive them via ssh.

Installation

This is a short overview for the cmds-separated-fscaps patchset, please refer to the INSTALL documentation for more information.

$ ./autogen.sh
$ ./configure --enable-btrfs-separated --enable-setcap-install
$ make separated

This will build all separated binaries btrfs-*.separated. If you want to install the binaries with setuid, use --enable-setuid-install instead.

If you want to install all separated binaries, type:

$ make SETCAP_GROUP=btrfs install-separated

This will install the binaries along with elevated file capabilities (setcap) for users in the btrfs group.

Alternatively, select specific binaries to install:

$ make SETCAP_GROUP=btrfs \
       install-btrfs-subvolume-show.separated \
       install-btrfs-subvolume-list.separated \
       install-btrfs-send.separated \
       [...]

The result should be something like this:

$ sudo getcap -r /usr/local/bin/
/usr/local/bin/btrfs-send = cap_dac_read_search,cap_fowner,cap_sys_admin+ep
/usr/local/bin/btrfs-receive = cap_chown,cap_dac_override,cap_dac_read_search,cap_fowner,cap_sys_admin,cap_mknod+ep
/usr/local/bin/btrfs-subvolume-delete = cap_dac_override,cap_sys_admin+ep
/usr/local/bin/btrfs-subvolume-list = cap_dac_read_search,cap_fowner,cap_sys_admin+ep
/usr/local/bin/btrfs-subvolume-show = cap_dac_read_search,cap_fowner,cap_sys_admin+ep
/usr/local/bin/btrfs-subvolume-snapshot = cap_dac_override,cap_dac_read_search,cap_fowner,cap_sys_admin+ep

Note that for btrbk, you will need:

Purpose Binaries
always btrfs-subvolume-show, btrfs-subvolume-list
source btrfs-subvolume-snapshot, btrfs-send
target btrfs-receive
delete btrfs-subvolume-delete
info btrfs-filesystem-usage

Gentoo Linux

If you're on gentoo, grab the digint portage overlay from: https://dev.tty0.ch/portage/digint-overlay.git

Install selected binaries, e.g. for backup source:

$ echo sys-fs/btrfs-progs-btrbk filecaps btrbk-source >> /etc/portage/package.use
$ emerge sys-fs/btrfs-progs-btrbk

Development

If you would like to contribute or have found bugs:

References

btrfs-progs-btrbk's People

Contributors

kdave avatar adam900710 avatar chrismason-xx avatar asj avatar lorddoskias avatar zhaoleidd avatar osandov avatar jeffmahoney avatar fdmanana avatar t-msn avatar kreijack avatar marcosps avatar rakeshpandit avatar morbidrsa avatar idryomov avatar goldwynr avatar lakshmipathi avatar ukernel avatar adambuchbinder avatar guaneryu avatar karelzak avatar kilobyte avatar josefbacik avatar jsoref avatar naota avatar fougner avatar darkling avatar knorrie avatar digint avatar sten0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.