diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-12 22:25:41 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-12 22:25:41 +0000 |
commit | 71c1466e3444d14365caa1a8b57d54a5adae7377 (patch) | |
tree | cbb66f846ccad0b34e44af4e8084859e3e6d6683 /sys-fs | |
parent | add finer USE flags and dependencies handling (diff) | |
download | historical-71c1466e3444d14365caa1a8b57d54a5adae7377.tar.gz historical-71c1466e3444d14365caa1a8b57d54a5adae7377.tar.bz2 historical-71c1466e3444d14365caa1a8b57d54a5adae7377.zip |
Adapt the timeout logic to apply to the gpg command too #357449 by Vespian. Version bump #546140 by Nikoli.
Package-Manager: portage-2.2.18/cvs/Linux x86_64
Manifest-Sign-Key: 0xD2E96200
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/cryptsetup/ChangeLog | 9 | ||||
-rw-r--r-- | sys-fs/cryptsetup/Manifest | 32 | ||||
-rw-r--r-- | sys-fs/cryptsetup/cryptsetup-1.6.7.ebuild | 103 | ||||
-rw-r--r-- | sys-fs/cryptsetup/files/1.6.7-dmcrypt.confd | 111 | ||||
-rwxr-xr-x | sys-fs/cryptsetup/files/1.6.7-dmcrypt.rc | 340 |
5 files changed, 580 insertions, 15 deletions
diff --git a/sys-fs/cryptsetup/ChangeLog b/sys-fs/cryptsetup/ChangeLog index 18b589ee43f0..77b1df50f825 100644 --- a/sys-fs/cryptsetup/ChangeLog +++ b/sys-fs/cryptsetup/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-fs/cryptsetup # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/ChangeLog,v 1.206 2015/04/12 22:04:22 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/ChangeLog,v 1.207 2015/04/12 22:25:40 vapier Exp $ + +*cryptsetup-1.6.7 (12 Apr 2015) + + 12 Apr 2015; Mike Frysinger <vapier@gentoo.org> +cryptsetup-1.6.7.ebuild, + +files/1.6.7-dmcrypt.confd, +files/1.6.7-dmcrypt.rc: + Adapt the timeout logic to apply to the gpg command too #357449 by Vespian. + Version bump #546140 by Nikoli. 12 Apr 2015; Mike Frysinger <vapier@gentoo.org> files/1.0.6-dmcrypt.confd, files/1.5.1-dmcrypt.rc: diff --git a/sys-fs/cryptsetup/Manifest b/sys-fs/cryptsetup/Manifest index 8dd671004e4e..8445488fd790 100644 --- a/sys-fs/cryptsetup/Manifest +++ b/sys-fs/cryptsetup/Manifest @@ -3,29 +3,33 @@ Hash: SHA256 AUX 1.0.6-dmcrypt.confd 3783 SHA256 4a9f3c708f2ab25f94059771b5b64f50e376f7a42ad7ec14102f492c9233ac29 SHA512 af099199b5a056676a565d9e3e0893927da67d0916aad1885f4567963f06df0b8c754a0cf76f55dfdb72c57605837e044bbe4a7e9fbcfd8c1648750f2964630a WHIRLPOOL 68f3b72f9bd567ebb333b54387014ff9c0f17e3a16933e30a08598eba57beb26427d5fe7e93978cde5676afd0928c1342156e5c39aa14f8878a7cb710135689a AUX 1.5.1-dmcrypt.rc 8831 SHA256 f67ad3401c10017506e7ccb14f8283b29154ec56fad3909b7214fc6da0b1ca1b SHA512 30ac60a955da12ebe36d734f81ffdd097bc24315762b641ae9e79a06ced4e2407ecb69ac8e03b89dfe4b9ada0f9667b161710999e4da3942b343050d1cee3264 WHIRLPOOL e35a8627a1a5c48f55f826af97e0e20cdcd7c65ab1dbccf347cec6be439ba6f9e208101829d30a227396fadc0d0c3951969a3ff57ede6ed9b2d7dc86459b1b21 +AUX 1.6.7-dmcrypt.confd 3919 SHA256 3d933a54abe62a547294b83208dbf5d7615d9c7f380d6504c91fff3620530803 SHA512 74422d5e1614b43af894ea01da1ea80d805ec7f77981cbb80a6b1a4becad737a8825d7269812499095a7f50d39fa7da5bf4e4edae63529b1fe87b9176943a733 WHIRLPOOL cdad077e6c542e93b766c023a7db9cde372609114a0d8333e94dbf281292a145dd2f96db2895dc7f6dd130ed193ebe254e13cff24e47430738e0fb4c6e38dc71 +AUX 1.6.7-dmcrypt.rc 8929 SHA256 4bec4e67e2447a4472eecdd2fb31325b4dd558e1fe283683f86707629b9d192d SHA512 357870a8dc68f85ad0a902d8589fbe5cf23776c602d41dedb9e474f03ef54f5c09c2f31f132b0dc2e6f867a0c15bcc785375420a64b7023f72726910d4b64c58 WHIRLPOOL c0b8eae5892c509964b9399875aed2c3800672151168eaa41bb336ca6130440b3e84daddd36985df69c4df0bfb12c8775ee29dfedda9c550710891ec268126c7 AUX cryptsetup-1.6.1-openssl-static.patch 472 SHA256 7029ba7870ff183b7dac3c658140c8c01286efd29e9427d1195b5b4e85fe2f4f SHA512 4292ee661b3e1a26b3c9b6fe8f360ed1df1cb416a13162ffa40d6610d5d0431c3dbdb17280fb1aa3aa6eeacb735ead3da4e6cc126d8be74121565b4c9bf6c6a2 WHIRLPOOL f0186cf9317560a480dab53c8c538f35ba5273401f2d37b4be9e3aae06203c43fcd22c4ce17c41cf80a01db5cd22877105ff2be0a8f3effd50cde8c9f42b68df DIST cryptsetup-1.6.2.tar.bz2 1189584 SHA256 15723f0198303d4bcb99d480b7a773918e2d319f0348457988c063bdd03e109a SHA512 59fb835ef8bcd6d0c704a021055032639840ef4bb7be6ade8ff91d347ae74d8e6cba4583d8ced7a4a8c6f09ebc16c4eff3549c13c4327d92fd9234db58e18c10 WHIRLPOOL 3ab24572ea42dfdd0d5176dfa4621520cd0bccda53c3a01676d400a7a841ab9643c979c4942daa774658602bd8cdf659376cbc94c553e2097c5eb3c51a7edb31 DIST cryptsetup-1.6.5.tar.xz 1136892 SHA256 267973f20be43f9d685f7193aa23954b60768c74a1d330243114d4b8bc17ca9a SHA512 c77ac590d28954e7bd430d1069b820a288c4668857a7ced7f81546ea39676f2b536abbcda06f20440e31c205b7ada68bcfa5aab220b102a2b62198a788d9b65e WHIRLPOOL 74a597abbdcc1225bb811597e53737eab2348a328f3ba30e7eb519a0621b06e6c898e320db8e24a16decfd4706b6a2e68b06894dde91124e4c089e952dbff9c1 DIST cryptsetup-1.6.6.tar.xz 1145940 SHA256 2d2ce28e4e1137dd599d87884b62ef6dbf14fd7848b2a2bf7d61cf125fbd8e6f SHA512 6ee6b4e8fe4f721bb97d1cf47c5e2d1c96001dd3ac48154d414f64d23620ac3ec3eeea2ad584a1a3111e07a086c8a4fdbfabdf4859cda58ba2bd6765b1f009a8 WHIRLPOOL 07bb6b7f5153cfcd3a585f111733a05926d1f6f0ec190e0b0dc1777591bd0fec3c8782dc79f43bafd3829da28efbdd2d8f97daef8186392787c22c7f5e454376 +DIST cryptsetup-1.6.7.tar.xz 1188876 SHA256 c23c24c8d662032da8650c1c84985221be8bbedf4737c1540bba7e4517dfe820 SHA512 d6cecd2f3f5d468d4337d4e8407c8c3315e8972c0fc72cd1f93fb67f02a632b56ad293f08f6682f24c9ad0b5ad5967be751e5679413109692ade5823aafd1d19 WHIRLPOOL 95611938ddbf3520f1a2a2891e3103f6bf1699a210f7902bd65d1e61357ed44c9b6f344f567d1d5f1b88adb40154831e34014f3e22ec141f9101b707295007a0 EBUILD cryptsetup-1.6.2.ebuild 4322 SHA256 13c975deec6ae9b7801da12e379548c7569c88cdab3bd893144cfe5cac1073fd SHA512 4cf354a17f640899bc63745c7af9ff9572cbc4adf791c00b6bc51469c1c9750731eb504be35df7db50c2646a665442c47c6101f4e2486f64e162121c5645c88c WHIRLPOOL ef3d10184827e39d4662f55137c93fd2f466f29f9dbdbcdd1eac5da2c12ac5328f0ffea833ff18d6f3cbc01b78e9f5d9d4d17006a44a75902837c4a8f90cdf32 EBUILD cryptsetup-1.6.5.ebuild 4485 SHA256 6f646bbf6096079726e477872a80b07bd96604cb224251dd4497c7eaace15161 SHA512 8101c36d38503d5b333fa3efa7d4dae8bf9edd2241f679eb1b17a0b2bb70e4d83373a24de2c6d4b16a73ee7da6882c2e5ae6eb8b29560666e753347ebeda1906 WHIRLPOOL 790f6bce1f49c83c0cbc9f486eb4331a3897bfaaa80e11dc5ea8604f5fac121defc5eb35b9cf5111d7753fa81c61290d37fde14111c950d4a19e96c9ab760b50 EBUILD cryptsetup-1.6.6.ebuild 4817 SHA256 2f4a66ec18e6d5fc5033d7fef2c126403ed395a49023263b8f8fea361d8039a9 SHA512 7c505f30ad17ca003d88ddf0aa7d2c395476a9d1521214ce858a48a9b48f52b81d6ea8647ab75f8336d2da811b1bd3a36dbe0764e397466bda8f4eb67606e574 WHIRLPOOL 029900d0fea6cde671e433bd4237c379e1be549fc1236d4ff847926419e47bbd582d86a96dca1701f1a5cc0b7a16b34172f137f7c716204cce7919f98f11e6a4 -MISC ChangeLog 31843 SHA256 223fc6b9268b5b56d04a3aa340fbbdefcf1c79901f67b4120dc82690aafb223e SHA512 7baf81a7744e41d80b91aa3b2093cbac47eb46e2eb0b5729d807db0191897ae79256051e15bfdfa323f909039440d4ba8aef0aaaacbfd67b7720f720875ebbcc WHIRLPOOL 86884055a55dbaf742968ed9dde8da44b6a67e3606fe932944b85065de9ae43b9c345d863fdd348e85a9582d6aec07e9b03fcf6be60caa30ddbb75ca3bcd8edb +EBUILD cryptsetup-1.6.7.ebuild 3521 SHA256 72baf91938f5e33e0da0088794f0a1ba11f3ba187150f83c715f84b0a13e4597 SHA512 612ed383282b0c867b14825220bfe46f781d7ad884144101c8002244c011238006ee1dda479043934a403860f4254c7d752d8987022cea0b4e1105d2bdefe893 WHIRLPOOL d260f92c4196332b30bfe8828eae30b34a22e988bf89690815b7fd3deb47f0f89f72243415dfb0f6b6848e512cbdfe7434e98a8ea40136b467af2ca452be46bd +MISC ChangeLog 32120 SHA256 4f04d04798e6b09ebc80f72f45a4841673e38e05909ccebb5d40c230db0a3272 SHA512 ebf79904c294d29fbeb42d497db5bbac85afdcaaf532ecdae863778ecd9f9c882dd0c3c28994c410611e3eef30492c9bb5696db3c2e4eb49f2e932ee9696185a WHIRLPOOL 8cfe06024e910bfbd0e547fb342ce22c837c79cb29524077272f7478edc6284ed3ef504142b52d6844fa582cd4c4cfb94163c9c40ff074716bd744d2ef039aff MISC metadata.xml 803 SHA256 ce0f5ae709246410b10cad5d04e7ebeb228009bbb3259f0e79aa693e35ff96d3 SHA512 332aa6594bfa3f07a321dd37d9c0787d7d93c77e6a380afe4793a125a58f20bde092410bb91be68e39616dc4933d9fb375ac5576c8d85c802d0227c995ae24e7 WHIRLPOOL 4811a0bc88bcf22d45de33352c85f7f6dc221d19c6cd6fe47072110dcf6e2cd0522abec94fbed99aff5be06e7ae1e4d6dcca33e20ec0b859735da2ef65e0b7a9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 -iQIcBAEBCAAGBQJVKuvnAAoJEPGu1DbS6WIA9HEQAI7S9N2QmfGKAxYKRsL1M/bh -223mCu24L1gpDpLRpTdEdP+H7B7Y5NVRfY6lfxIqw44RzxbfEI8KN04Kj2XZnqdk -dIA4YhvRl+OhI1bhPghZiLeJSCFWfXcxyYuhBSDO1MfBouIbXGN0YU3nwtMvOEYp -/duo0/vgCPYMC2rU2/yTVLvMuhlbfY5KQWmzd51HR31nmysy7Lv9dqK6ipQPwFCx -Gku1m5cp8fFHlj6sPKS8i5YrU2oeegtlwJatf0GuMYySUyJTVzwYakX9SycuGmTD -u/TkZkb5Sjq2GiKIFQHkpeAMkqyUFH8eUPBd+BQGlp/fuxHlXOydXPtaUOo5Vl9Q -09puZz+ePkbq2b/+ax6qh9wjxUG3ze4J3Jjqvw6+UM8scxmZEtXeSH2i/iSxbcMu -qSaBj75/TDWNZAKWDUI84FTzHh7vVdOnHYCMbHKuOKi4uJKzMWkSDqhlUWsMsXMY -IyGc+6rjf0bBCMuNvReulMIBzlqUePuwD8GzHOSCT5beApJ1XCGbd65IfWy/LtnW -rG53XpGd5Fqk1+rVPjdS99mWbejEk5gImqUCgKVakKACMRRoqPw5XQFoNb7/O5t5 -d7mBW0eb5cLqh8eIqBRM+kwKq+6etipp4fO2y73oscWHYbSeJcvpCrB3IM+e6WmA -TjhFj2oKgCZuNQK0e8Xf -=e+N3 +iQIcBAEBCAAGBQJVKvDkAAoJEPGu1DbS6WIA7lcQAIagdnQE+hVXv7Hd5s5hbvYT +k2mljATm5L0XhxUhI8xL+475/RqnSdnLZ4RmsfbxUmKAu581biDpfVVNLuYuW8qn +o3wQuLXgP2jIR257QWsAH+1mEOl13NZ8j1y1qkztYw9iYegkCJNaAu6LorpuOpIP +YRhn4BUdIY40VUg62gwsfQH/8dFDq7Kq9RVkiinkPfoAUuD0kEDGF2LeVsTlN1GT +Qazi2Ee3wfOTKy70EYsCI2ATEYU7aqFDkY4hBwYth2qbwG33iXx8ISMyF7LjlaxI +Ob+0ajlH3mdGnLuLoCSvfeLNheRyVWmZWdGVsEruGT/WcQEq+oaayIcQJ4ue3zI4 +QDVXfSBBUripp/9eO5OKR2vmuc/SDqC/laaWueY271hFO2lCRl7B7BemDMkVob7P +i5VyzRpEteKJ1Rqs4HHYtnY+vqv/FiP70yn4zIWz//IpC6yFkIKdWupAtECtF/BL +MvxNiaFMc+8omQ/C7qNnsXn1Lq+jJ/HQhxFyecsQnN0Y6UkeSylRcZxUXyTV1FJw +44HJHH7IMofsxxcGH1mj8cbSfGKa7M94yYacbD1QitDybImkGv6mP4hgB7e/k13F +mlHI1cUTFGpO5o3w6jYjNxsv9eid/WVYOkIs0CFsJsKlGEPAvAaq7vCQKM6mJjnz +cLMvBWPm6Ra9hGIYGflD +=BSy5 -----END PGP SIGNATURE----- diff --git a/sys-fs/cryptsetup/cryptsetup-1.6.7.ebuild b/sys-fs/cryptsetup/cryptsetup-1.6.7.ebuild new file mode 100644 index 000000000000..4d4716336403 --- /dev/null +++ b/sys-fs/cryptsetup/cryptsetup-1.6.7.ebuild @@ -0,0 +1,103 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/cryptsetup-1.6.7.ebuild,v 1.1 2015/04/12 22:25:40 vapier Exp $ + +EAPI=5 +PYTHON_COMPAT=( python{2_7,3_3,3_4} ) + +inherit autotools python-single-r1 linux-info libtool eutils versionator + +DESCRIPTION="Tool to setup encrypted devices with dm-crypt" +HOMEPAGE="https://gitlab.com/cryptsetup/cryptsetup/blob/master/README.md" +SRC_URI="mirror://kernel/linux/utils/${PN}/v$(get_version_component_range 1-2)/${P}.tar.xz" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +CRYPTO_BACKENDS="+gcrypt kernel nettle openssl" +# we don't support nss since it doesn't allow cryptsetup to be built statically +# and it's missing ripemd160 support so it can't provide full backward compatibility +IUSE="${CRYPTO_BACKENDS} nls pwquality python reencrypt static static-libs udev urandom" +REQUIRED_USE="^^ ( ${CRYPTO_BACKENDS//+/} ) + python? ( ${PYTHON_REQUIRED_USE} ) + static? ( !gcrypt )" #496612 + +LIB_DEPEND="dev-libs/libgpg-error[static-libs(+)] + dev-libs/popt[static-libs(+)] + sys-apps/util-linux[static-libs(+)] + gcrypt? ( dev-libs/libgcrypt:0=[static-libs(+)] ) + nettle? ( >=dev-libs/nettle-2.4[static-libs(+)] ) + openssl? ( dev-libs/openssl[static-libs(+)] ) + pwquality? ( dev-libs/libpwquality[static-libs(+)] ) + sys-fs/lvm2[static-libs(+)] + udev? ( virtual/libudev[static-libs(+)] )" +# We have to always depend on ${LIB_DEPEND} rather than put behind +# !static? () because we provide a shared library which links against +# these other packages. #414665 +RDEPEND="static-libs? ( ${LIB_DEPEND} ) + ${LIB_DEPEND//\[static-libs\(+\)\]} + python? ( ${PYTHON_DEPS} )" +DEPEND="${RDEPEND} + virtual/pkgconfig + static? ( ${LIB_DEPEND} )" + +pkg_setup() { + local CONFIG_CHECK="~DM_CRYPT ~CRYPTO ~CRYPTO_CBC" + local WARNING_DM_CRYPT="CONFIG_DM_CRYPT:\tis not set (required for cryptsetup)\n" + local WARNING_CRYPTO_CBC="CONFIG_CRYPTO_CBC:\tis not set (required for kernel 2.6.19)\n" + local WARNING_CRYPTO="CONFIG_CRYPTO:\tis not set (required for cryptsetup)\n" + check_extra_config + + use python && python-single-r1_pkg_setup +} + +src_prepare() { + sed -i '/^LOOPDEV=/s:$: || exit 0:' tests/{compat,mode}-test || die + epatch_user && eautoreconf +} + +src_configure() { + if use kernel ; then + ewarn "Note that kernel backend is very slow for this type of operation" + ewarn "and is provided mainly for embedded systems wanting to avoid" + ewarn "userspace crypto libraries." + fi + + econf \ + --sbindir=/sbin \ + --enable-shared \ + $(use_enable static static-cryptsetup) \ + $(use_enable static-libs static) \ + $(use_enable nls) \ + $(use_enable pwquality) \ + $(use_enable python) \ + $(use_enable reencrypt cryptsetup-reencrypt) \ + $(use_enable udev) \ + $(use_enable !urandom dev-random) \ + --with-crypto_backend=$(for x in ${CRYPTO_BACKENDS//+/} ; do usev ${x} ; done) +} + +src_test() { + if [[ ! -e /dev/mapper/control ]] ; then + ewarn "No /dev/mapper/control found -- skipping tests" + return 0 + fi + local p + for p in /dev/mapper /dev/loop* ; do + addwrite ${p} + done + default +} + +src_install() { + default + if use static ; then + mv "${ED}"/sbin/cryptsetup{.static,} || die + mv "${ED}"/sbin/veritysetup{.static,} || die + use reencrypt && { mv "${ED}"/sbin/cryptsetup-reencrypt{.static,} || die ; } + fi + prune_libtool_files --modules + + newconfd "${FILESDIR}"/1.6.7-dmcrypt.confd dmcrypt + newinitd "${FILESDIR}"/1.6.7-dmcrypt.rc dmcrypt +} diff --git a/sys-fs/cryptsetup/files/1.6.7-dmcrypt.confd b/sys-fs/cryptsetup/files/1.6.7-dmcrypt.confd new file mode 100644 index 000000000000..642ff087078b --- /dev/null +++ b/sys-fs/cryptsetup/files/1.6.7-dmcrypt.confd @@ -0,0 +1,111 @@ +# /etc/conf.d/dmcrypt + +# For people who run dmcrypt on top of some other layer (like raid), +# use rc_need to specify that requirement. See the runscript(8) man +# page for more information. + +#-------------------- +# Instructions +#-------------------- + +# Note regarding the syntax of this file. This file is *almost* bash, +# but each line is evaluated separately. Separate swaps/targets can be +# specified. The init-script which reads this file assumes that a +# swap= or target= line starts a new section, similar to lilo or grub +# configuration. + +# Note when using gpg keys and /usr on a separate partition, you will +# have to copy /usr/bin/gpg to /bin/gpg so that it will work properly +# and ensure that gpg has been compiled statically. +# See http://bugs.gentoo.org/90482 for more information. + +# Note that the init-script which reads this file detects whether your +# partition is LUKS or not. No mkfs is run unless you specify a makefs +# option. + +# Global options: +#---------------- + +# How long to wait for each timeout (in seconds). +dmcrypt_key_timeout=1 + +# Max number of checks to perform (see dmcrypt_key_timeout). +#dmcrypt_max_timeout=300 + +# Number of password retries. +dmcrypt_retries=5 + +# Arguments: +#----------- +# target=<name> == Mapping name for partition. +# swap=<name> == Mapping name for swap partition. +# source='<dev>' == Real device for partition. +# Note: You can (and should) specify a tag like UUID +# for blkid (see -t option). This is safer than using +# the full path to the device. +# key='</path/to/keyfile>[:<mode>]' == Fullpath from / or from inside removable media. +# remdev='<dev>' == Device that will be assigned to removable media. +# gpg_options='<opts>' == Default are --quiet --decrypt +# options='<opts>' == cryptsetup, for LUKS you can only use --readonly +# loop_file='<file>' == Loopback file. +# Note: If you omit $source, then a free loopback will +# be looked up automatically. +# pre_mount='cmds' == commands to execute before mounting partition. +# post_mount='cmds' == commands to execute after mounting partition. +#----------- +# Supported Modes +# gpg == decrypt and pipe key into cryptsetup. +# Note: new-line character must not be part of key. +# Command to erase \n char: 'cat key | tr -d '\n' > cleanKey' + +#-------------------- +# dm-crypt examples +#-------------------- + +## swap +# Swap partitions. These should come first so that no keys make their +# way into unencrypted swap. +# If no options are given, they will default to: -c aes -h sha1 -d /dev/urandom +# If no makefs is given then mkswap will be assumed +#swap=crypt-swap +#source='/dev/hda2' + +## /home with passphrase +#target=crypt-home +#source='/dev/hda5' + +## /home with regular keyfile +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey' + +## /home with gpg protected key +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey:gpg' + +## /home with regular keyfile on removable media(such as usb-stick) +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey' +#remdev='/dev/sda1' + +## /home with gpg protected key on removable media(such as usb-stick) +#target=crypt-home +#source='/dev/hda5' +#key='/full/path/to/homekey:gpg' +#remdev='/dev/sda1' + +## /tmp with regular keyfile +#target=crypt-tmp +#source='/dev/hda6' +#key='/full/path/to/tmpkey' +#pre_mount='/sbin/mkreiserfs -f -f ${dev}' +#post_mount='chown root:root ${mount_point}; chmod 1777 ${mount_point}' + +## Loopback file example +#target='crypt-loop-home' +#source='/dev/loop0' +#loop_file='/mnt/crypt/home' + +# The file must be terminated by a newline. Or leave this comment last. diff --git a/sys-fs/cryptsetup/files/1.6.7-dmcrypt.rc b/sys-fs/cryptsetup/files/1.6.7-dmcrypt.rc new file mode 100755 index 000000000000..cf5d228af913 --- /dev/null +++ b/sys-fs/cryptsetup/files/1.6.7-dmcrypt.rc @@ -0,0 +1,340 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/cryptsetup/files/1.6.7-dmcrypt.rc,v 1.1 2015/04/12 22:25:40 vapier Exp $ + +depend() { + before checkfs fsck + + if grep -qs ^swap= "${conf_file}" ; then + before swap + fi +} + +# We support multiple dmcrypt instances based on $SVCNAME +conf_file="/etc/conf.d/${SVCNAME}" + +# Get splash helpers if available. +if [ -e /sbin/splash-functions.sh ] ; then + . /sbin/splash-functions.sh +fi + +# Setup mappings for an individual target/swap +# Note: This relies on variables localized in the main body below. +dm_crypt_execute() { + local dev ret mode foo + + if [ -z "${target}" -a -z "${swap}" ] ; then + return + fi + + # Set up default values. + : ${dmcrypt_key_timeout:=1} + : ${dmcrypt_max_timeout:=300} + : ${dmcrypt_retries:=5} + + # Handle automatic look up of the source path. + if [ -z "${source}" -a -n "${loop_file}" ] ; then + source=$(losetup --show -f "${loop_file}") + fi + case ${source} in + *=*) + source=$(blkid -l -t "${source}" -o device) + ;; + esac + if [ -z "${source}" ] || [ ! -e "${source}" ] ; then + ewarn "source \"${source}\" for ${target} missing, skipping..." + return + fi + + if [ -n "${target}" ] ; then + # let user set options, otherwise leave empty + : ${options:=' '} + elif [ -n "${swap}" ] ; then + if cryptsetup isLuks ${source} 2>/dev/null ; then + ewarn "The swap you have defined is a LUKS partition. Aborting crypt-swap setup." + return + fi + target=${swap} + # swap contents do not need to be preserved between boots, luks not required. + # suspend2 users should have initramfs's init handling their swap partition either way. + : ${options:='-c aes -h sha1 -d /dev/urandom'} + : ${pre_mount:='mkswap ${dev}'} + fi + + if [ -n "${loop_file}" ] ; then + dev="/dev/mapper/${target}" + ebegin " Setting up loop device ${source}" + losetup ${source} ${loop_file} + fi + + # cryptsetup: + # open <device> <name> # <device> is $source + # create <name> <device> # <name> is $target + local arg1="create" arg2="${target}" arg3="${source}" + if cryptsetup isLuks ${source} 2>/dev/null ; then + arg1="open" + arg2="${source}" + arg3="${target}" + fi + + # Older versions reported: + # ${target} is active: + # Newer versions report: + # ${target} is active[ and is in use.] + if cryptsetup status ${target} | egrep -q ' is active' ; then + einfo "dm-crypt mapping ${target} is already configured" + return + fi + splash svc_input_begin ${SVCNAME} >/dev/null 2>&1 + + # Handle keys + if [ -n "${key}" ] ; then + read_abort() { + # some colors + local ans savetty resettty + [ -z "${NORMAL}" ] && eval $(eval_ecolors) + einfon " $1? (${WARN}yes${NORMAL}/${GOOD}No${NORMAL}) " + shift + # This is ugly as s**t. But POSIX doesn't provide `read -t`, so + # we end up having to implement our own crap with stty/etc... + savetty=$(stty -g) + resettty='stty ${savetty}; trap - EXIT HUP INT TERM' + trap 'eval "${resettty}"' EXIT HUP INT TERM + stty -icanon + stty min 0 time "$(( $2 * 10 ))" + ans=$(dd count=1 bs=1 2>/dev/null) || ans='' + eval "${resettty}" + if [ -z "${ans}" ] ; then + printf '\r' + else + echo + fi + case ${ans} in + [yY]) return 0;; + *) return 1;; + esac + } + + # Notes: sed not used to avoid case where /usr partition is encrypted. + mode=${key##*:} && ( [ "${mode}" = "${key}" ] || [ -z "${mode}" ] ) && mode=reg + key=${key%:*} + case "${mode}" in + gpg|reg) + # handle key on removable device + if [ -n "${remdev}" ] ; then + # temp directory to mount removable device + local mntrem="${RC_SVCDIR}/dm-crypt-remdev.$$" + if [ ! -d "${mntrem}" ] ; then + if ! mkdir -p "${mntrem}" ; then + ewarn "${source} will not be decrypted ..." + einfo "Reason: Unable to create temporary mount point '${mntrem}'" + return + fi + fi + i=0 + einfo "Please insert removable device for ${target}" + while [ ${i} -lt ${dmcrypt_max_timeout} ] ; do + foo="" + if mount -n -o ro "${remdev}" "${mntrem}" 2>/dev/null >/dev/null ; then + # keyfile exists? + if [ ! -e "${mntrem}${key}" ] ; then + umount -n "${mntrem}" + rmdir "${mntrem}" + einfo "Cannot find ${key} on removable media." + read_abort "Abort" ${dmcrypt_key_timeout} && return + else + key="${mntrem}${key}" + break + fi + else + [ -e "${remdev}" ] \ + && foo="mount failed" \ + || foo="mount source not found" + fi + : $((i += 1)) + read_abort "Stop waiting after $i attempts (${foo})" -t 1 && return + done + else # keyfile ! on removable device + if [ ! -e "${key}" ] ; then + ewarn "${source} will not be decrypted ..." + einfo "Reason: keyfile ${key} does not exist." + return + fi + fi + ;; + *) + ewarn "${source} will not be decrypted ..." + einfo "Reason: mode ${mode} is invalid." + return + ;; + esac + else + mode=none + fi + ebegin " ${target} using: ${options} ${arg1} ${arg2} ${arg3}" + if [ "${mode}" = "gpg" ] ; then + : ${gpg_options:='-q -d'} + # gpg available ? + if command -v gpg >/dev/null ; then + i=0 + while [ ${i} -lt ${dmcrypt_retries} ] ; do + # paranoid, don't store key in a variable, pipe it so it stays very little in ram unprotected. + # save stdin stdout stderr "values" + timeout ${dmcrypt_max_timeout} gpg ${gpg_options} ${key} 2>/dev/null | \ + cryptsetup --key-file - ${options} ${arg1} ${arg2} ${arg3} + ret=$? + # The timeout command exits 124 when it times out. + [ ${ret} -eq 0 -o ${ret} -eq 124 ] && break + : $(( i += 1 )) + done + eend ${ret} "failure running cryptsetup" + else + ewarn "${source} will not be decrypted ..." + einfo "Reason: cannot find gpg application." + einfo "You have to install app-crypt/gnupg first." + einfo "If you have /usr on its own partition, try copying gpg to /bin ." + fi + else + if [ "${mode}" = "reg" ] ; then + cryptsetup ${options} -d ${key} ${arg1} ${arg2} ${arg3} + ret=$? + eend ${ret} "failure running cryptsetup" + else + cryptsetup ${options} ${arg1} ${arg2} ${arg3} + ret=$? + eend ${ret} "failure running cryptsetup" + fi + fi + if [ -d "${mntrem}" ] ; then + umount -n ${mntrem} 2>/dev/null >/dev/null + rmdir ${mntrem} 2>/dev/null >/dev/null + fi + splash svc_input_end ${SVCNAME} >/dev/null 2>&1 + + if [ ${ret} -ne 0 ] ; then + cryptfs_status=1 + else + if [ -n "${pre_mount}" ] ; then + dev="/dev/mapper/${target}" + eval ebegin \"" pre_mount: ${pre_mount}"\" + eval "${pre_mount}" > /dev/null + ewend $? || cryptfs_status=1 + fi + fi +} + +# Lookup optional bootparams +get_bootparam_val() { + # We're given something like: + # foo=bar=cow + # Return the "bar=cow" part. + case $1 in + *=*) + echo "${1#*=}" + ;; + esac +} + +start() { + local header=true cryptfs_status=0 + local gpg_options key loop_file target targetline options pre_mount post_mount source swap remdev + + local x + for x in $(cat /proc/cmdline) ; do + case "${x}" in + key_timeout=*) + dmcrypt_key_timeout=$(get_bootparam_val "${x}") + ;; + esac + done + + while read targetline <&3 ; do + case ${targetline} in + # skip comments and blank lines + ""|"#"*) continue ;; + # skip service-specific openrc configs #377927 + rc_*) continue ;; + esac + + ${header} && ebegin "Setting up dm-crypt mappings" + header=false + + # check for the start of a new target/swap + case ${targetline} in + target=*|swap=*) + # If we have a target queued up, then execute it + dm_crypt_execute + + # Prepare for the next target/swap by resetting variables + unset gpg_options key loop_file target options pre_mount post_mount source swap remdev + ;; + + gpg_options=*|remdev=*|key=*|loop_file=*|options=*|pre_mount=*|post_mount=*|source=*) + if [ -z "${target}${swap}" ] ; then + ewarn "Ignoring setting outside target/swap section: ${targetline}" + continue + fi + ;; + + dmcrypt_*=*) + # ignore global options + continue + ;; + + *) + ewarn "Skipping invalid line in ${conf_file}: ${targetline}" + ;; + esac + + # Queue this setting for the next call to dm_crypt_execute + eval "${targetline}" + done 3< ${conf_file} + + # If we have a target queued up, then execute it + dm_crypt_execute + + ewend ${cryptfs_status} "Failed to setup dm-crypt devices" +} + +stop() { + local line header + + # Break down all mappings + header=true + egrep "^(target|swap)=" ${conf_file} | \ + while read line ; do + ${header} && einfo "Removing dm-crypt mappings" + header=false + + target= swap= + eval ${line} + + [ -n "${swap}" ] && target=${swap} + if [ -z "${target}" ] ; then + ewarn "invalid line in ${conf_file}: ${line}" + continue + fi + + ebegin " ${target}" + cryptsetup remove ${target} + eend $? + done + + # Break down loop devices + header=true + grep '^source=./dev/loop' ${conf_file} | \ + while read line ; do + ${header} && einfo "Detaching dm-crypt loop devices" + header=false + + source= + eval ${line} + + ebegin " ${source}" + losetup -d "${source}" + eend $? + done + + return 0 +} |