Page MenuHomeFreeBSD

bectl(8): change jail command to execute jail(8)
ClosedPublic

Authored by jwmaag_gmail.com on Feb 21 2019, 3:39 PM.
Tags
None
Referenced Files
F87460540: D19282.id54416.diff
Wed, Jul 3, 10:24 AM
F87460433: D19282.id54329.diff
Wed, Jul 3, 10:21 AM
F87460291: D19282.id54330.diff
Wed, Jul 3, 10:18 AM
F87459682: D19282.id55239.diff
Wed, Jul 3, 10:04 AM
F87458987: D19282.id54184.diff
Wed, Jul 3, 9:47 AM
F87458838: D19282.id54328.diff
Wed, Jul 3, 9:44 AM
F87458103: D19282.id54482.diff
Wed, Jul 3, 9:26 AM
Unknown Object (File)
Mon, Jul 1, 11:11 AM
Subscribers

Details

Summary

Change bectl to read in -o flags and put them in a nvlist
then depending on whether we are interactive or not, use libjail
or the jail command to initalize our jail.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

As we discussed, I no longer have any qualms with dropping jail(3) completely and proxying it all through to jail(8).

sbin/bectl/bectl_jail.c
65 ↗(On Diff #54184)

style(9) nit: there should be a blank line following any declarations, or simply a blank line at the beginning if there are no declarations.

72 ↗(On Diff #54184)

Same as above: blank line before nvlist_remove_all.

89 ↗(On Diff #54184)

This looks like an accidental trailing space crawled in

227 ↗(On Diff #54184)

No spaces around these and a space after the parentheses before the opening brace.; if (nvlist_exists(...) || nvlist_exists(...)) { (with wrapping, of course)

261 ↗(On Diff #54184)

Space before the opening brace here

286 ↗(On Diff #54184)

Spacing

310 ↗(On Diff #54184)

Take a look at sbuf(9) for this; you can drop all of the argument tracking in favor of sbuf_new_auto() and a series of sbuf_cat()/sbuf_printf() depending on whether you need formatting or you're just appending /usr/sbin/jail.

sbin/bectl/bectl_jail.c
232 ↗(On Diff #54184)

Don't do this

236 ↗(On Diff #54184)

argv++, argc--

261 ↗(On Diff #54184)

Pass argc/argv through to bectl_cmd_jail_* as needed and tack those on at the end, after all parameters

Remove mounts created by the jail(8) command. prevent unwanted param arguments.
Clean up jail assets on effort basis.

  • handle multiple arguments passed in command
  • noticed a few more style issues
  • clean up allocated jail command arguments
This revision was not accepted when it landed; it landed in state Needs Review.Mar 19 2019, 5:39 PM
This revision was automatically updated to reflect the committed changes.