From owner-svn-src-head@freebsd.org Mon Jul 2 22:58:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73956FE1757; Mon, 2 Jul 2018 22:58:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48E0E7E49D; Mon, 2 Jul 2018 22:58:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2571F13D4C; Mon, 2 Jul 2018 22:58:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w62Mw4q0016281; Mon, 2 Jul 2018 22:58:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w62Mw42s016280; Mon, 2 Jul 2018 22:58:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201807022258.w62Mw42s016280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 2 Jul 2018 22:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335877 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 335877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jul 2018 22:58:05 -0000 Author: ian Date: Mon Jul 2 22:58:04 2018 New Revision: 335877 URL: https://svnweb.freebsd.org/changeset/base/335877 Log: Move the passphrase and iteration count into variables. This is purely to make it easier to tweak them locally; the machine I have for testing takes forever to do 50,000 pw strengthening iterations, and we're not testing the strength of geli's anti-pw-guessing logic here (especially given that our test passphrase is "passphrase", except that I tend to tweak that also, to 'x', because typing is hard). Some day these should be settable as cmdline args. But then, some day this whole script should probably get a rewrite. :) Modified: head/tools/boot/rootgen.sh Modified: head/tools/boot/rootgen.sh ============================================================================== --- head/tools/boot/rootgen.sh Mon Jul 2 22:51:48 2018 (r335876) +++ head/tools/boot/rootgen.sh Mon Jul 2 22:58:04 2018 (r335877) @@ -2,6 +2,9 @@ # $FreeBSD$ +passphrase=x +iterations=5000 + do_boot1_efi=0 # @@ -394,8 +397,8 @@ mk_geli_gpt_ufs_legacy() { gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k gpart add -t freebsd-ufs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p2 - echo passphrase | geli attach -j - ${md}p2 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 + echo ${passphrase} | geli attach -j - ${md}p2 newfs /dev/${md}p2.eli mount /dev/${md}p2.eli ${mntpt} cpsys ${src} ${mntpt} @@ -430,8 +433,8 @@ mk_geli_gpt_ufs_uefi() { gpart add -t efi -s 800k -a 4k ${md} gpart add -t freebsd-ufs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p2 - echo passphrase | geli attach -j - ${md}p2 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 + echo ${passphrase} | geli attach -j - ${md}p2 newfs /dev/${md}p2.eli mount /dev/${md}p2.eli ${mntpt} cpsys ${src} ${mntpt} @@ -467,8 +470,8 @@ mk_geli_gpt_ufs_both() { gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k gpart add -t freebsd-ufs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p3 - echo passphrase | geli attach -j - ${md}p3 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3 + echo ${passphrase} | geli attach -j - ${md}p3 newfs /dev/${md}p3.eli mount /dev/${md}p3.eli ${mntpt} cpsys ${src} ${mntpt} @@ -504,8 +507,8 @@ mk_geli_gpt_zfs_legacy() { gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k gpart add -t freebsd-zfs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p2 - echo passphrase | geli attach -j - ${md}p2 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 + echo ${passphrase} | geli attach -j - ${md}p2 zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2.eli zpool set bootfs=${pool} ${pool} zfs create -po mountpoint=/ ${pool}/ROOT/default @@ -547,8 +550,8 @@ mk_geli_gpt_zfs_uefi() { gpart add -t efi -s 800k -a 4k ${md} gpart add -t freebsd-zfs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p2 - echo passphrase | geli attach -j - ${md}p2 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 + echo ${passphrase} | geli attach -j - ${md}p2 zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2.eli zpool set bootfs=${pool} ${pool} zfs create -po mountpoint=/ ${pool}/ROOT/default @@ -591,8 +594,8 @@ mk_geli_gpt_zfs_both() { gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k gpart add -t freebsd-zfs -l root $md # install-boot will make this bootable - echo passphrase | geli init -bg -e AES-XTS -i 50000 -J - -l 256 -s 4096 ${md}p3 - echo passphrase | geli attach -j - ${md}p3 + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3 + echo ${passphrase} | geli attach -j - ${md}p3 zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli zpool set bootfs=${pool} ${pool} zfs create -po mountpoint=/ ${pool}/ROOT/default