nbdkit-protect-filter(1)
π nbdkit-protect-filter(1) π
okay bestie, welcome to the NBDKIT manual, this one's all about nbdkit-protect-filter, and honestly? it's giving bodyguard energy. let's get into it π«Ά
β¨ NAME β¨
nbdkit-protect-filter β write-protect parts of a plugin π‘οΈ
β¨ SYNOPSIS β¨
nbdkit --filter=protect plugin protect=START-END [protect=...]
β¨ DESCRIPTION β¨
so nbdkit-protect-filter is a filter for nbdkit(1) and what it does is let you write-protect parts of the underlying plugin. like, clients can't modify certain ranges of the plugin, but the NBD connection as a whole can still be writable. best of both worlds, no cap π
one use for this? keeping clients from slapping a phony header onto the data so it looks like a non-raw disk format (think: adding a qcow2 header). because apparently that can be used in some exploits. not today, babes π
if you want the whole plugin to be readonly, use the nbdkit -r option on the command line, or nbdkit-readonly-filter(1). if you want to give selective access to the server, that's nbdkit-ip-filter(1). and if you only wanna serve a subset of the plugin, go hang out with nbdkit-offset-filter(1) or nbdkit-partition-filter(1). pick your fighter β¨
β¨ EXAMPLES β¨
π Protect the boot sector
protect the first part of the boot sector from writes, but let the MBR partition table still get updated. iconic:
nbdkit --filter=protect file disk.img protect=0-0x1bd
π Protect everything except a single partition
let clients write to one partition on the disk, but block modifications to the partition table, boot sector, other partitions, or literally any other metadata outside that partition:
$ fdisk -l disk.img
Device Boot Start End Sectors Size Id Type
disk.img1 * 2048 12580863 12578816 6G 83 Linux
$ start=$((2048*512))
$ end=$((12580863*512+511))
$ nbdkit --filter=protect file disk.img protect=~$start-$end
Notes, bestie, don't skip these:
- data in other partitions and other parts of the disk is still readable. reading is free, writing is not π
- the
~character complements the range protected. you might need to escape it from the shell using quotes or a backslash. the shell is dramatic like that π - this is different from
nbdkit-partition-filter(1)β that filter exposes the partition as a whole device. two different vibes, two different filters π
β¨ PARAMETERS β¨
protect=START-ENDβ protects the bytes starting at offsetSTARTthrough to offsetEND(inclusive). reads are permitted. writes to the protected range are only permitted if they don't change the content. if an attempt is made to change the content, then the errorNBD_EPERM(Operation not permitted) gets returned to the client. periodt, no touching π
START and END can be expressed in decimal, octal (0NN) or hexadecimal (0xNN). if omitted then they default to the start and end of the underlying plugin respectively. so chill of them β¨
this parameter can be given multiple times to protect several ranges. stack 'em up, queen π
protect=~START-ENDβ this protects the complement of the rangeSTARTtoEND. everything except that range, basically the inverse slay π¦
β¨ FILES β¨
$filterdir/nbdkit-protect-filter.soβ the filter itself. the whole moment.
use nbdkit --dump-config to find the location of $filterdir. it's right there, go look π
β¨ VERSION β¨
nbdkit-protect-filter first appeared in nbdkit 1.30. a true icon of its era π
β¨ SEE ALSO β¨
nbdkit(1), nbdkit-file-plugin(1), nbdkit-ip-filter(1), nbdkit-map-filter(1), nbdkit-offset-filter(1), nbdkit-partition-filter(1), nbdkit-readonly-filter(1), nbdkit-filter(3).
the whole friend group, fr fr π
β¨ AUTHORS β¨
Richard W.M. Jones πΈ
β¨ COPYRIGHT β¨
Copyright Red Hat
β¨ LICENSE β¨
redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
k bye bestie, this page came from nbdkit-1.48.1 and it was dated 2026-08-29. go protect those ranges π β¨π
π¦ where this page comes from
- fedora 44: nbdkit-basic-filters 1.48.1-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms