aboutsummaryrefslogtreecommitdiff
path: root/sbin
Commit message (Collapse)AuthorAgeFilesLines
* Consistently use NULL to terminate the argv; no functional changes.Edward Tomasz Napierala2018-08-171-7/+7
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=337968
* bectl(8): Add batch mode to jail subcommandKyle Evans2018-08-173-10/+27
| | | | | | | | | | | Adding batch mode to the jail `bectl(8)` subcommand enables jailing of ZFS Boot Environments in a scriptable fashion. Submitted by: Shawn Webb Obtained from: HardenedBSD (9e72d1c59a and ef7b6d9e1c with minor edit) Notes: svn path=/head/; revision=337947
* bectl(8): Kit-kat barKyle Evans2018-08-161-1/+2
| | | | Notes: svn path=/head/; revision=337918
* bectl(8): Implement the 'create a snapshot' variant of createKyle Evans2018-08-161-5/+19
| | | | Notes: svn path=/head/; revision=337917
* bectl(8): Appease clang-scanKyle Evans2018-08-161-1/+1
| | | | | | | Use strlcpy instead of a plain strcpy Notes: svn path=/head/; revision=337916
* libbe(3)/bectl(8): Hit rewind on a bunch of off-by-onesKyle Evans2018-08-161-5/+5
| | | | | | | | While here, use sizeof() in some places that it makes sense to reduce room for error and prefer strlcpy to strncpy Notes: svn path=/head/; revision=337915
* Add SECURITY section to loader(8).Edward Tomasz Napierala2018-08-151-1/+10
| | | | | | | | | | Reviewed by: bcr, jilles, imp (earlier version) MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16700 Notes: svn path=/head/; revision=337834
* bectl(8): Check jailparam_* return valuesKyle Evans2018-08-141-13/+28
| | | | | | | | | | | | | | | Previous iteration of this assumed that these won't fail because we've already setup the jail param to this point, but the allocations could still fail in pretty bad conditions. Admit that it's possible and return (ENOENT, EINVAL, ENOMEM, or 0) when deleting arguments. EINVAL shouldn't happen since we're passing optarg; which may satisfy *optarg == '\0' but never optarg == NULL. CID: 1394885, 1394901 Notes: svn path=/head/; revision=337805
* Add init_exec kenv(1) variable, to make init(8) execute a fileEdward Tomasz Napierala2018-08-142-1/+33
| | | | | | | | | | | | | | | | | after opening the console, replacing init as PID 1. From the user point of view, it makes it possible to run eg the shell as PID 1, using 'set init_exec=/bin/sh' at the loader(8) prompt. Reviewed by: kib MFC after: 2 weeks Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16625 Notes: svn path=/head/; revision=337740
* libbe(3)/bectl(8): Remove now-redundant include pathsKyle Evans2018-08-131-1/+0
| | | | | | | | | | | | These were previously necessary because the libnvpair and libzfs_core includes were not installed into the SYSROOT, being a part of the copies target in include/Makefile rather than being installed with the library. This was fixed in r337696 and the headers are now installed properly, so we may let go of the cruft. Notes: svn path=/head/; revision=337699
* libbe(3): Fix be_import to delete temp snapshotKyle Evans2018-08-131-7/+1
| | | | | | | | | | | | Deleting the temp snapshot isn't immediately possible because it's the origin of the newly imported boot environment. However, this is trivially solved by opening the new boot environment and promoting it. The roles are now reversed and the temp snapshot/dataset may be completely destroyed. Remove the BUGS from libbe(3) and bectl(8). Notes: svn path=/head/; revision=337697
* bectl(8): Use strcmp, rather than trying to directly compareKyle Evans2018-08-121-1/+1
| | | | Notes: svn path=/head/; revision=337667
* bectl(8): Rename "index" variable, which shadows a global in some landsKyle Evans2018-08-121-2/+2
| | | | Notes: svn path=/head/; revision=337664
* Merge libbe(3)/bectl(8) from projects/bectl into headKyle Evans2018-08-117-0/+1636
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bectl(8) is an administrative interface for working with ZFS boot environments, intended to provide a superset of the functionality provided by sysutils/beadm. libbe(3) is the back-end library that the required functionality has been pulled out into for later reuse. These were originally written for GSoC 2017 under the mentorship of allanjude@. bectl(8) has proven pretty stable in my testing, with the known bug documented in the man page. Relnotes: yes Notes: svn path=/head/; revision=337663
| * libbe(3)/bectl(8): More SYSROOT/GCC build fixesKyle Evans2018-08-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | - Missing include path - Fully specify libzfs's dependencies (except for deps pulled in by other deps) in Makefile.inc1 - Drop WARNS back down to 2 for libbe(3). I do this with much hesitation, but the libzfs headers are apparently a hot warning-filled mess as far as GCC 4.2 is concerned. Notes: svn path=/projects/bectl/; revision=337662
| * bectl(8): Add missing include pathKyle Evans2018-08-111-0/+1
| | | | | | | | Notes: svn path=/projects/bectl/; revision=337657
| * MFH @ r337607, in preparation for boardingKyle Evans2018-08-11194-138/+17364
| |\ | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337608
| * | bectl(8): Also document the import bug.Kyle Evans2018-08-111-0/+6
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337606
| * | bectl(8): Swap the order of ujail/umount documentation...Kyle Evans2018-08-111-3/+3
| | | | | | | | | | | | | | | | | | | | | "Despite my inconsistency, consistency is king." -Anonymous Notes: svn path=/projects/bectl/; revision=337603
| * | bectl(8): Document export/importKyle Evans2018-08-111-6/+25
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337602
| * | libbe(3)/bectl(8): Make igor and mandoc -Tlint a little happierKyle Evans2018-08-111-19/+11
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337598
| * | libbe(3)/bectl(8): Kill off the 'add' functionality for nowKyle Evans2018-08-111-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mostly-undocumented 'add' functionality, from initial read-through, is intended for construction of deep ("bdrewery style") boot environments. However, it's mostly broken at this point. `#if SOON` it out on both sides so that we're not exposing a broken API/feature. Work will resume on it in due time. Notes: svn path=/projects/bectl/; revision=337596
| * | libbe(3)/bectl(8): Standardize $FreeBSD$ IDsKyle Evans2018-08-074-4/+10
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337416
| * | libbe(3)/bectl(8): Standardize copyright headersKyle Evans2018-08-072-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - File names don't necessarily need to be repeated - Add SPDX tags - Add a missing copyright for Kyle Kneitinger in bectl.8, originally written by him in GSoC 2017; his standard copyright notice has been copied from other files within the same directory to remain consistent with how he clearly wished to portray it Notes: svn path=/projects/bectl/; revision=337414
| * | libbe(3): Check that dataset is to be mounted at / for be_existsKyle Evans2018-08-071-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the be_exists behavior match the comments that assert that we've already checked that the dataset derived from the BE name is set to mount at /. Other changes of note: - bectl_list sees another change; changing mountpoint based on mount status turns out to be a bad idea, so instead make the mounted property of the returned nvlist the path that it's mounted at - Always return the "mountpoint" property in "mountpoint" if it's ste Notes: svn path=/projects/bectl/; revision=337406
| * | bectl(8): Only show mountpoint if the dataset is actually mountedKyle Evans2018-08-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is to accomodate a later change in libbe(3) that will always return the mountpoint, whether it be the directory the dataset is actively mounted at or the "mountpoint" property. Notes: svn path=/projects/bectl/; revision=337405
| * | bectl(8): Provide -u option to unset jail parametersKyle Evans2018-08-063-7/+78
| | | | | | | | | | | | | | | | | | | | | All but name, host.hostname, and path may be completely unset. Notes: svn path=/projects/bectl/; revision=337380
| * | bectl(8): Split list functionality out into its own file as wellKyle Evans2018-08-064-380/+421
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337369
| * | bectl(8): bectl jail improvementsKyle Evans2018-08-065-161/+378
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Support passing arbitrary jail arguments via -o - Split the related (and rewritten since the GSoC) jail bits out into a new bectl_jail.c file, to reduce clutter in bectl.c - Don't use RFC 1918 IP space [0]; we'll instead set no default IPv4 and let the user pass in any address options they wish via -o Reported by: rgrimes [0], Shawn Webb [0] Notes: svn path=/projects/bectl/; revision=337368
| * | bectl(8): Some light cleanup and commentingKyle Evans2018-08-051-5/+23
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337359
| * | bectl(8): Implement `bectl list -s`Kyle Evans2018-08-051-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | be_get_dataset_snapshots has been added to libbe(3), effectively returning the same information as be_get_bootenv_props but for snapshots of the given dataset. The assumption is that one will have the BE dataset name before wanting to grab snapshots. Notes: svn path=/projects/bectl/; revision=337358
| * | bectl: Implement -D ("space if origin datasets were deleted")Kyle Evans2018-08-051-4/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also accomplishes the following: - Proxy through zfs_nicenum as be_nicenum, because it looks better than humanize_number and would presumably be useful to other libbe consumers. - Rename be_get_snapshot_props to be_get_dataset_props, make it more useful Notes: svn path=/projects/bectl/; revision=337343
| * | bectl(8): Take -H parameter to list into accountKyle Evans2018-08-051-20/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -H is for a scripted format, where all fields are tab-delimited and the headers go away. We accomplish this by splitting out pad printing to a separate function that'll take into account whether we're supposed to be scripted or not. This has the nice side effect of maintaining positive column sizes again. Notes: svn path=/projects/bectl/; revision=337341
| * | bectl(8): Sort BEs lightly by active (now or later) BE, then othersKyle Evans2018-08-041-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While it could be preferred to do this at insert in libbe(3), there's no convenient way to insert at the head of an nvlist. Instead, we'll make two passes over- once to print anything active either now or at nextboot, and another to print everything else. This doesn't actually impact performance in a significant way here, so we'll worry about further optimizations if the need actually arises. Notes: svn path=/projects/bectl/; revision=337284
| * | bectl(8): Add some relevant `bectl list -a` informationKyle Evans2018-08-041-50/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bectl list -a should show the boot environment, its relevant dataset, and the snapshot it was created from. The header also changes to indicate the rough order in which these things will show. While here, start doing a little bit of spring cleaning and splitting different bits out. Notes: svn path=/projects/bectl/; revision=337283
| * | bectl(8): Take origin snapshot into account when calculating used spaceKyle Evans2018-08-031-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | This more closely matches the behavior for beadm. The associated libbe(3) API is still getting worked out a little bit. Notes: svn path=/projects/bectl/; revision=337228
| * | bectl(8): Just use a single pointer for all string propsKyle Evans2018-08-031-10/+10
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=337226
| * | bectl(8): Move dataset printing out into its own functionKyle Evans2018-08-031-55/+77
| | | | | | | | | | | | | | | | | | | | | | | | This may later get reused for printing snapshot and/or origin snapshot information. Notes: svn path=/projects/bectl/; revision=337225
| * | bectl(8): Remove sneaky commentKyle Evans2018-07-261-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336748
| * | bectl(8): Hack together a more proper `bectl list`Kyle Evans2018-07-262-3/+77
| | | | | | | | | | | | | | | | | | | | | Note that the space is currently just the 'used' property of the dataset. Notes: svn path=/projects/bectl/; revision=336747
| * | bectl(8): Remove the jail mount point with unjailKyle Evans2018-07-261-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336732
| * | bectl(8): Redo jail using jail(3) APIKyle Evans2018-07-261-32/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The jail is created with allow.mount, allow.mount.devfs, and enforce_statfs=1. Upon creation, we immediately attach, chdir to "/", and drop the user into a shell inside the jail. The default IP for this is arbitrarily 10.20.30.40. Notes: svn path=/projects/bectl/; revision=336731
| * | bectl(8): Support unjailing a boot environmentKyle Evans2018-07-263-25/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The given parameter may either be a jid, jail name, or a BE name. In all cases, the parameter will be resolved to a jid and bectl(8) will sanity-check that there's actually a BE mounted at the requested jail root before invoking jail_remove(2). Notes: svn path=/projects/bectl/; revision=336730
| * | libbe(3)/bectl(8): Provide and use proper alloc/free for property listsKyle Evans2018-07-251-3/+3
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336715
| * | libbe(3)/be(8): Drop WARNS overrides, fix all falloutKyle Evans2018-07-252-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on the idea that we shouldn't have all-new library and utility going into base that need WARNS=1... - Decent amount of constification - Lots of parentheses - Minor other nits Notes: svn path=/projects/bectl/; revision=336710
| * | bectl(8): Start dumping out BE information with `bectl list`Kyle Evans2018-07-252-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | For the moment, this is a primitive nvlist dump of what we get back from be_get_bootenv_props as a proof-of-concept and to make sure that we're getting back the kind of information we want to see from list. Notes: svn path=/projects/bectl/; revision=336708
| * | bectl(8): Consistent styleKyle Evans2018-07-251-63/+51
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336703
| * | bectl(8): Rename error messagesKyle Evans2018-07-251-26/+25
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336702
| * | bectl.c: Chase renameKyle Evans2018-07-251-50/+50
| | | | | | | | | | | | Notes: svn path=/projects/bectl/; revision=336694
| * | Normalize bectl(8)/libbe(3) Makefiles, remove Makefile copyright/licenseKyle Evans2018-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | Approved by: hselaskey Notes: svn path=/projects/bectl/; revision=336684