Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 420165 - Add init scripts for encrypted swap and jails
Summary: Add init scripts for encrypted swap and jails
Status: CONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All FreeBSD
: Normal enhancement (vote)
Assignee: OpenRC Team
URL: http://www.freebsd.org/doc/en/books/h...
Whiteboard:
Keywords: Inclusion, PATCH, REVIEWED
Depends on:
Blocks: fbsd-hardening-doc
  Show dependency tree
 
Reported: 2012-06-07 23:51 UTC by Richard Yao (RETIRED)
Modified: 2013-12-15 19:36 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/init.d/encswap (encswap,1002 bytes, text/plain)
2012-06-08 14:31 UTC, Richard Yao (RETIRED)
Details
Patch to add jail and encswap init scripts to OpenRC for FreeBSD (openrc-fbsd-jail-encswap-scripts.patch,23.04 KB, patch)
2012-07-14 19:23 UTC, Richard Yao (RETIRED)
Details | Diff
Patch to add encswap script to OpenRC (openrc-fbsd-jail-encswap-scripts.patch,23.04 KB, patch)
2012-07-14 23:47 UTC, Richard Yao (RETIRED)
Details | Diff
Patch to import jail init script from FreeBSD into OpenRC (openrc-fbsd-jail-script.patch,21.98 KB, patch)
2012-07-14 23:48 UTC, Richard Yao (RETIRED)
Details | Diff
Patch to fix savecore script to play nicely with encswap (openrc-fbsd-fix-savecore.patch,670 bytes, patch)
2012-07-15 00:43 UTC, Richard Yao (RETIRED)
Details | Diff
Patch to add encswap script to OpenRC (openrc-fbsd-encswap-script.patch,2.15 KB, patch)
2012-07-15 02:38 UTC, Richard Yao (RETIRED)
Details | Diff
0001-Import-jail-init-script-from-FreeBSD.patch (0001-Import-jail-init-script-from-FreeBSD.patch,24.62 KB, patch)
2013-12-15 19:36 UTC, William Hubbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Yao (RETIRED) gentoo-dev 2012-06-07 23:51:51 UTC
FreeBSD uses /etc/rc.d/encswap and /etc/rc.d/jail to mount encrypted swap partitions and start jails.

http://www.freebsd.org/doc/en/books/handbook/swap-encrypting.html
http://www.freebsd.org/doc/en/books/handbook/jails.html

We should write OpenRC scripts to support this.
Comment 1 Richard Yao (RETIRED) gentoo-dev 2012-06-08 14:31:51 UTC
Created attachment 314689 [details]
/etc/init.d/encswap

I am attaching an init script for encswap. It is a derivative of the FreeBSD encswap init script to work on Gentoo FreeBSD. Conversion was trivial.
Comment 2 Naohiro Aota gentoo-dev 2012-06-13 06:42:27 UTC
The code seems fine. Is the copyright notice just forgotten to change?
Comment 3 Richard Yao (RETIRED) gentoo-dev 2012-06-13 13:13:16 UTC
(In reply to comment #2)
> The code seems fine. Is the copyright notice just forgotten to change?

The original code lacked a copyright notice, but it belongs to the FreeBSD foundation. If a copyright notice is placed on it, then it should state that the FreeBSD Project owns it. We could add an additional line for the Gentoo Foundation, but our changes are trivial.
Comment 4 Naohiro Aota gentoo-dev 2012-06-13 20:24:45 UTC
I'm not sure how we should handle this file's copyright notice.
aballier, could you give us some comment on this?
Comment 5 Alexis Ballier gentoo-dev 2012-06-13 22:11:05 UTC
(In reply to comment #4)
> I'm not sure how we should handle this file's copyright notice.
> aballier, could you give us some comment on this?

to be honest, i dont consider 20 lines of shell to be copyrightable material.

if we want to nitpick: if the non comment contents are 100% equal, this is fine imho; otherwise, you should say its based on a file from freebsd, with a link to it and its license statement, and state that the modifications you made are under the same license as the pointed file.


where did you get that init script from ?
Comment 6 Richard Yao (RETIRED) gentoo-dev 2012-06-13 22:31:53 UTC
The init script is based on the script used in FreeBSD. You can find it here:

http://svnweb.freebsd.org/base/release/9.0.0/etc/rc.d/encswap
Comment 7 Richard Yao (RETIRED) gentoo-dev 2012-06-13 22:34:45 UTC
Are there any objections to the following header?

#!/sbin/runscript
# Copyright 1992-2012 FreeBSD Project
# Copyright 1999-2012 Gentoo Foundation
# Released under the 2-clause BSD license
# $Header: $
Comment 8 Richard Yao (RETIRED) gentoo-dev 2012-07-14 19:23:39 UTC
Created attachment 318174 [details, diff]
Patch to add jail and encswap init scripts to OpenRC for FreeBSD

After William Hubbs and I decided that these scripts belong in OpenRC, so I have produced a patch for OpenRC to provide them.

Note that the jail script lacks the ability to start and stop individual jails. I hope to add that ability in the future by improving to OpenRC to support arguments to commands.
Comment 9 William Hubbs gentoo-dev 2012-07-14 20:54:26 UTC
I rerecommend separating this patch so that each script is added in its
own commit. Also, you don't need the 'signed-off-by' line in the commit
message.

Another concern I have is that the jail init script doesn't have a
depend() function.

Thanks,

William
Comment 10 Richard Yao (RETIRED) gentoo-dev 2012-07-14 23:47:30 UTC
Created attachment 318194 [details, diff]
Patch to add encswap script to OpenRC

The patch is being split into two patches as per a discussion with William Hubbs in IRC.
Comment 11 Richard Yao (RETIRED) gentoo-dev 2012-07-14 23:48:51 UTC
Created attachment 318196 [details, diff]
Patch to import jail init script from FreeBSD into OpenRC

I made some minor tweaks to this since the previous patch. debug statements are now off by default and can be toggled on by setting DEBUG=yes. I also added depend() so that the script starts after networking.
Comment 12 Richard Yao (RETIRED) gentoo-dev 2012-07-15 00:43:50 UTC
Created attachment 318198 [details, diff]
Patch to fix savecore script to play nicely with encswap

Currently, it is possible to savecore to run before dumpon, which will prevent saved kernel dumps from being found. With encswap, it is possible for encswap to run before savecore, which will corrupt a stored kernel dump. This patch fixes both issues.
Comment 13 Richard Yao (RETIRED) gentoo-dev 2012-07-15 02:38:53 UTC
Created attachment 318206 [details, diff]
Patch to add encswap script to OpenRC

I attached the previous patch by mistake. This corrects that mistake.
Comment 14 William Hubbs gentoo-dev 2013-12-15 19:36:13 UTC
Created attachment 365436 [details, diff]
0001-Import-jail-init-script-from-FreeBSD.patch

All,

This is what I currently have as the patch that would add the Jail init
script; I'm sorry this apparently got lost in the shuffel.

Do you still want this added to OpenRC?

Thanks,

William