Simplify installing packages for image building

This commit is contained in:
Bob Mottram 2016-09-22 16:52:07 +01:00
parent 4c5ea23ed6
commit a9de4c96c5
5 changed files with 160 additions and 88 deletions

View File

@ -29,13 +29,13 @@ Install the freedombone commands onto your laptop/desktop:
cd freedombone
sudo make install
Then install packages needed for building images:
Then install the necessary packages for building images, on a debian based system using:
freedombone-image --setup debian
sudo apt-get -y install build-essential git python-docutils mktorrent
sudo apt-get -y install vmdebootstrap xz-utils dosfstools btrfs-tools extlinux
sudo apt-get -y install python-distro-info mbr qemu-user-static binfmt-support
sudo apt-get -y install u-boot-tools qemu
or on Parabola/Arch
freedombone-image --setup parabola
A typical use case to build an 8GB image for a Beaglebone Black is as follows. You can change the size depending upon the capacity of your microSD card.

View File

@ -41,9 +41,13 @@ sudo make install
Then install packages needed for building images:
#+BEGIN_SRC bash
sudo apt-get -y install python-docutils mktorrent vmdebootstrap xz-utils
sudo apt-get -y install dosfstools btrfs-tools extlinux python-distro-info mbr
sudo apt-get -y install qemu-user-static binfmt-support u-boot-tools qemu
freedombone-image --setup debian
#+END_SRC
or on an Arch/Parabola system:
#+BEGIN_SRC bash
freedombone-image --setup parabola
#+END_SRC
A typical use case to build an 8GB image for a Beaglebone Black is as follows. You can change the size depending upon the capacity of your microSD card.

Binary file not shown.

View File

@ -118,7 +118,81 @@ INSECURE='no'
# a new identity at every shutdown/boot
AMNESIC='no'
mesh_router_setup_script() {
# Versions used for Arch/Parabola setup
MBR_VERSION='1.1.11'
DEBOOTSTRAP_VERSION='1.0.83'
function image_setup {
setup_type=$1
case $setup_type in
debian|ubuntu|trisquel|mint)
sudo apt-get -y install build-essential libc6-dev-i386 gcc-multilib g++-multilib
sudo apt-get -y install git python-docutils mktorrent vmdebootstrap xz-utils
sudo apt-get -y install dosfstools btrfs-tools extlinux python-distro-info mbr
sudo apt-get -y install qemu-user-static binfmt-support u-boot-tools qemu
;;
parabola|arch)
sudo pacman -S --noconfirm libc++ git gcc gcc-libs python-docutils mktorrent patch
sudo pacman -S --noconfirm debootstrap xz dosfstools btrfs-progs syslinux python-pip
sudo pacman -S --noconfirm qemu-static binfmt-qemu-static uboot-tools qemu parted
sudo pacman -S --noconfirm dpkg-devtools bin86
mkdir ~/develop
if [ ! -d ~/develop/python-cliapp ]; then
git clone git://git.liw.fi/cliapp ~/develop/python-cliapp
fi
sudo pacman -S --noconfirm python2-coverage python2-pytest-cov python2-sphinx
sudo pacman -S --noconfirm autopep8 python2-pylint python2-yaml python2-xdg python2-pip
cd ~/develop/python-cliapp
sudo python2 setup.py install
sudo pip2 install distro-info logging
if [ ! -d ~/develop/mbr ]; then
git clone https://aur.archlinux.org/mbr.git ~/develop/mbr
fi
cd ~/develop/mbr
makepkg
tar -xzvf mbr-${MBR_VERSION}.tar.gz
cd ~/develop/mbr/mbr-${MBR_VERSION}
cp ../*.patch .
patch -p0 < *.patch
./configure
make
sudo make install
if [ ! -f /usr/local/sbin/install-mbr ]; then
echo $'Failed to install mbr'
return
fi
sudo cp /usr/local/sbin/install-mbr /sbin
if [ ! -d ~/develop/multipath-tools ]; then
git clone https://aur.archlinux.org/multipath-tools.git ~/develop/multipath-tools
fi
sudo pacman -S device-mapper libaio liburcu fakeroot
cd ~/develop/multipath-tools
makepkg
makepkg -i
cd ~/develop
if [ ! -f ~/develop/debootstrap_${DEBOOTSTRAP_VERSION}.tar.gz ]; then
wget http://http.debian.net/debian/pool/main/d/debootstrap/debootstrap_${DEBOOTSTRAP_VERSION}.tar.gz
fi
if [ ! -f ~/develop/debootstrap_${DEBOOTSTRAP_VERSION}.tar.gz ]; then
echo $'Failed to download debootstrap code'
return
fi
if [ ! -d ~/develop/debootstrap/scripts ]; then
tar -xzvf debootstrap_${DEBOOTSTRAP_VERSION}.tar.gz
fi
sudo mv ~/develop/debootstrap/scripts/* /usr/share/debootstrap/scripts
;;
*)
echo $'Unkown operating system'
return
;;
esac
echo $'Setup complete'
}
function mesh_router_setup_script {
# create a setup script for a mesh router
mesh_script_filename=$1
echo "MY_USERNAME=${USERNAME}" > $mesh_script_filename
@ -273,6 +347,11 @@ do
shift
INSECURE="$1"
;;
--setup)
shift
image_setup "$1"
exit 0
;;
*)
# unknown option
;;

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2016-08-08 Mon 17:50 -->
<!-- 2016-09-22 Thu 16:51 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title></title>
@ -77,6 +77,7 @@
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
@ -254,11 +255,11 @@ for the JavaScript code in this tag.
</colgroup>
<tbody>
<tr>
<td class="org-left"><a href="#org23d16e3">Building an image for a Single Board Computer or Virtual Machine</a></td>
<td class="org-left"><a href="#orgd79c22b">Building an image for a Single Board Computer or Virtual Machine</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org623c1a8">Checklist</a></td>
<td class="org-left"><a href="#org55bbed6">Checklist</a></td>
</tr>
<tr>
@ -266,34 +267,34 @@ for the JavaScript code in this tag.
</tr>
<tr>
<td class="org-left"><a href="#org9a7912d">Installation</a></td>
<td class="org-left"><a href="#org017cb16">Installation</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org0f3e01c">Social Key Management - the 'Unforgettable Key'</a></td>
<td class="org-left"><a href="#org11c44aa">Social Key Management - the 'Unforgettable Key'</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org75a19aa">Final Setup</a></td>
<td class="org-left"><a href="#org90d37f2">Final Setup</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org31ec356">Keydrives</a></td>
<td class="org-left"><a href="#orge4309c7">Keydrives</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org098f31b">On Client Machines</a></td>
<td class="org-left"><a href="#org0b60a26">On Client Machines</a></td>
</tr>
<tr>
<td class="org-left"><a href="#org77ebb5b">Administering the system</a></td>
<td class="org-left"><a href="#org9c63345">Administering the system</a></td>
</tr>
</tbody>
</table>
<div id="outline-container-org23d16e3" class="outline-2">
<h2 id="org23d16e3">Building an image for a Single Board Computer or Virtual Machine</h2>
<div class="outline-text-2" id="text-org23d16e3">
<div id="outline-container-orgd79c22b" class="outline-2">
<h2 id="orgd79c22b">Building an image for a Single Board Computer or Virtual Machine</h2>
<div class="outline-text-2" id="text-orgd79c22b">
<p>
You don't have to trust images downloaded from random internet locations signed with untrusted keys. You can build one from scratch yourself, and this is the recommended procedure for maximum security. For guidance on how to build images see the manpage for the <b>freedombone-image</b> command.
</p>
@ -303,7 +304,6 @@ Install the freedombone commands onto your laptop/desktop:
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo apt-get install git build-essential dialog
git clone https://github.com/bashrc/freedombone
<span class="org-builtin">cd</span> freedombone
@ -316,10 +316,16 @@ Then install packages needed for building images:
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image --setup debian
</pre>
</div>
<pre class="src src-bash">sudo apt-get -y install python-docutils mktorrent vmdebootstrap xz-utils
sudo apt-get -y install dosfstools btrfs-tools extlinux python-distro-info mbr
sudo apt-get -y install qemu-user-static binfmt-support u-boot-tools qemu
<p>
or on an Arch/Parabola system:
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image --setup parabola
</pre>
</div>
@ -328,7 +334,6 @@ A typical use case to build an 8GB image for a Beaglebone Black is as follows. Y
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image -t beaglebone -s 8G
</pre>
</div>
@ -338,7 +343,6 @@ If you prefer an advanced installation with all of the options available then us
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image -t beaglebone -s 8G --minimal no
</pre>
</div>
@ -348,7 +352,6 @@ To build a 64bit Virtualbox image:
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image -t virtualbox-amd64 -s 8G
</pre>
</div>
@ -358,7 +361,6 @@ To build a 64bit Qemu image:
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image -t qemu-x86_64 -s 8G
</pre>
</div>
@ -372,16 +374,15 @@ If the image build fails with an error such as "<i>Error reading from server. Re
</p>
<div class="org-src-container">
<pre class="src src-bash">freedombone-image -t beaglebone -s 8G -m http://ftp.de.debian.org/debian
</pre>
</div>
</div>
</div>
<div id="outline-container-org623c1a8" class="outline-2">
<h2 id="org623c1a8">Checklist</h2>
<div class="outline-text-2" id="text-org623c1a8">
<div id="outline-container-org55bbed6" class="outline-2">
<h2 id="org55bbed6">Checklist</h2>
<div class="outline-text-2" id="text-org55bbed6">
<p>
Before installing Freedombone you will need a few things.
</p>
@ -395,23 +396,22 @@ Before installing Freedombone you will need a few things.
</ul>
</div>
</div>
<div id="outline-container-org9a7912d" class="outline-2">
<h2 id="org9a7912d">Installation</h2>
<div class="outline-text-2" id="text-org9a7912d">
<div id="outline-container-org017cb16" class="outline-2">
<h2 id="org017cb16">Installation</h2>
<div class="outline-text-2" id="text-org017cb16">
<p>
There are three install options: Laptop/Desktop/Netbook, SBC and Virtual Machine.
</p>
</div>
<div id="outline-container-org61e782a" class="outline-3">
<h3 id="org61e782a">On a Laptop, Netbook or Desktop machine</h3>
<div class="outline-text-3" id="text-org61e782a">
<div id="outline-container-orgba36f85" class="outline-3">
<h3 id="orgba36f85">On a Laptop, Netbook or Desktop machine</h3>
<div class="outline-text-3" id="text-orgba36f85">
<p>
If you have an existing system, such as an old laptop or netbook which you can leave running as a server, then install a new version of Debian Jessie onto it. During the Debian install you won't need the print server or the desktop environment, and unchecking those will reduce the attack surface. Once Debian enter the following commands:
</p>
<div class="org-src-container">
<pre class="src src-bash">su
apt-get update
apt-get -y install git dialog build-essential
@ -424,9 +424,9 @@ freedombone menuconfig
</div>
</div>
<div id="outline-container-orge952622" class="outline-3">
<h3 id="orge952622">On a single board computer (SBC)</h3>
<div class="outline-text-3" id="text-orge952622">
<div id="outline-container-org7010e61" class="outline-3">
<h3 id="org7010e61">On a single board computer (SBC)</h3>
<div class="outline-text-3" id="text-org7010e61">
<p>
Currently the following boards are supported:
</p>
@ -445,7 +445,6 @@ If there is no existing image available then you can build one from scratch. See
</p>
<div class="org-src-container">
<pre class="src src-bash">gpg --verify filename.img.asc
</pre>
</div>
@ -455,7 +454,6 @@ And the hash with:
</p>
<div class="org-src-container">
<pre class="src src-bash">sha256sum filename.img
</pre>
</div>
@ -465,7 +463,6 @@ If the image is compressed then decompress it with:
</p>
<div class="org-src-container">
<pre class="src src-bash">unxz filename.img.xz
</pre>
</div>
@ -475,7 +472,6 @@ Then copy it to a microSD card. Depending on your system you may need an adaptor
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo dd <span class="org-variable-name">bs</span>=1M <span class="org-variable-name">if</span>=filename.img <span class="org-variable-name">of</span>=/dev/sdX <span class="org-variable-name">conv</span>=fdatasync
</pre>
</div>
@ -485,7 +481,6 @@ Where <b>sdX</b> is the microSD drive. You can check which drive is the microSD
</p>
<div class="org-src-container">
<pre class="src src-bash">ls /dev/sd*
</pre>
</div>
@ -499,7 +494,6 @@ With the board connected and running you can ssh into the system with:
</p>
<div class="org-src-container">
<pre class="src src-bash">ssh fbone@freedombone.local -p 2222
</pre>
</div>
@ -510,15 +504,14 @@ Using the password 'freedombone'. Take a note of the new login password and then
</div>
</div>
<div id="outline-container-orgffa792a" class="outline-3">
<h3 id="orgffa792a">As a Virtual Machine</h3>
<div class="outline-text-3" id="text-orgffa792a">
<div id="outline-container-org9eb1542" class="outline-3">
<h3 id="org9eb1542">As a Virtual Machine</h3>
<div class="outline-text-3" id="text-org9eb1542">
<p>
Virtualbox and Qemu are supported. You can run a 64 bit Qemu image with:
</p>
<div class="org-src-container">
<pre class="src src-bash">qemu-system-x86_64 -m 1G filename.img
</pre>
</div>
@ -534,42 +527,42 @@ The default login will be username 'fbone' and password 'freedombone'. Take a no
</div>
</div>
<div id="outline-container-org0f3e01c" class="outline-2">
<h2 id="org0f3e01c">Social Key Management - the 'Unforgettable Key'</h2>
<div class="outline-text-2" id="text-org0f3e01c">
<div id="outline-container-org11c44aa" class="outline-2">
<h2 id="org11c44aa">Social Key Management - the 'Unforgettable Key'</h2>
<div class="outline-text-2" id="text-org11c44aa">
<p>
During the install procedure you will be asked if you wish to import GPG keys. If you don't already possess GPG keys then just select "Ok" and they will be generated during the install. If you do already have GPG keys then there are a few possibilities
</p>
</div>
<div id="outline-container-orgae3b8ca" class="outline-3">
<h3 id="orgae3b8ca">You have the gnupg keyring on an encrypted USB drive</h3>
<div class="outline-text-3" id="text-orgae3b8ca">
<div id="outline-container-orgbf3c5bf" class="outline-3">
<h3 id="orgbf3c5bf">You have the gnupg keyring on an encrypted USB drive</h3>
<div class="outline-text-3" id="text-orgbf3c5bf">
<p>
If you previously made a master keydrive containing the full keyring (the .gnupg directory). This is the most straightforward case, but not as secure as splitting the key into fragments.
</p>
</div>
</div>
<div id="outline-container-org873fe08" class="outline-3">
<h3 id="org873fe08">You have a number of key fragments on USB drives retrieved from friends</h3>
<div class="outline-text-3" id="text-org873fe08">
<div id="outline-container-org17a4ad3" class="outline-3">
<h3 id="org17a4ad3">You have a number of key fragments on USB drives retrieved from friends</h3>
<div class="outline-text-3" id="text-org17a4ad3">
<p>
If you previously made some USB drives containing key fragments then retrieve them from your friends and plug them in one after the other. After the last drive has been read then remove it and just select "Ok". The system will then try to reconstruct the key. For this to work you will need to have previously made three or more <a href="#org31ec356">Keydrives</a>.
If you previously made some USB drives containing key fragments then retrieve them from your friends and plug them in one after the other. After the last drive has been read then remove it and just select "Ok". The system will then try to reconstruct the key. For this to work you will need to have previously made three or more <a href="#orge4309c7">Keydrives</a>.
</p>
</div>
</div>
<div id="outline-container-org1562fd4" class="outline-3">
<h3 id="org1562fd4">You can specify some ssh login details for friends servers containing key fragments</h3>
<div class="outline-text-3" id="text-org1562fd4">
<div id="outline-container-orgd982332" class="outline-3">
<h3 id="orgd982332">You can specify some ssh login details for friends servers containing key fragments</h3>
<div class="outline-text-3" id="text-orgd982332">
<p>
Enter three or more sets of login details and the installer will try to retrieve key fragments and then assemble them into the full key. This only works if you previously were using remote backups and had social key management enabled.
</p>
</div>
</div>
</div>
<div id="outline-container-org75a19aa" class="outline-2">
<h2 id="org75a19aa">Final Setup</h2>
<div class="outline-text-2" id="text-org75a19aa">
<div id="outline-container-org90d37f2" class="outline-2">
<h2 id="org90d37f2">Final Setup</h2>
<div class="outline-text-2" id="text-org90d37f2">
<p>
Any manual post-installation setup instructions or passwords can be found in /home/username/README. You should remove any passwords from that file and store them within a password manager such as KeepassX.
</p>
@ -687,22 +680,21 @@ On your internet router, typically under firewall settings, open the following p
</div>
</div>
<div id="outline-container-org31ec356" class="outline-2">
<h2 id="org31ec356">Keydrives</h2>
<div class="outline-text-2" id="text-org31ec356">
<div id="outline-container-orge4309c7" class="outline-2">
<h2 id="orge4309c7">Keydrives</h2>
<div class="outline-text-2" id="text-orge4309c7">
<p>
After installing for the first time it's a good idea to create some keydrives. These will store your gpg key so that if all else fails you will still be able to restore from backup. There are two ways to do this:
</p>
</div>
<div id="outline-container-org712e9bf" class="outline-3">
<h3 id="org712e9bf">Master Keydrive</h3>
<div class="outline-text-3" id="text-org712e9bf">
<div id="outline-container-org3f9bab9" class="outline-3">
<h3 id="org3f9bab9">Master Keydrive</h3>
<div class="outline-text-3" id="text-org3f9bab9">
<p>
This is the traditional security model in which you carry your full keyring on an encrypted USB drive. To make a master keydrive first format a USB drive as a LUKS encrypted drive. In Ubuntu this can be <a href="https://help.ubuntu.com/community/EncryptedFilesystemsOnRemovableStorage">done from the <i>Disk Utility</i> application</a>. Then plug it into the Freedombone system, then from your local machine run:
</p>
<div class="org-src-container">
<pre class="src src-bash">ssh myusername@mydomainname -p 2222
</pre>
</div>
@ -712,15 +704,14 @@ Select <i>Administrator controls</i> then <i>Backup and Restore</i> then <i>Back
</p>
</div>
</div>
<div id="outline-container-org0d7ec4e" class="outline-3">
<h3 id="org0d7ec4e">Fragment keydrives</h3>
<div class="outline-text-3" id="text-org0d7ec4e">
<div id="outline-container-orgad83839" class="outline-3">
<h3 id="orgad83839">Fragment keydrives</h3>
<div class="outline-text-3" id="text-orgad83839">
<p>
This breaks your GPG key into a number of fragments and randomly selects one to add to the USB drive. First format a USB drive as a LUKS encrypted drive. In Ubuntu this <a href="https://help.ubuntu.com/community/EncryptedFilesystemsOnRemovableStorage">can be done from the <i>Disk Utility</i> application</a>. Plug it into the Freedombone system then from your local machine run the following commands:
</p>
<div class="org-src-container">
<pre class="src src-bash">ssh myusername@mydomainname -p 2222
</pre>
</div>
@ -735,15 +726,14 @@ Fragments are randomly assigned and so you will need at least three or four keyd
</div>
</div>
</div>
<div id="outline-container-org098f31b" class="outline-2">
<h2 id="org098f31b">On Client Machines</h2>
<div class="outline-text-2" id="text-org098f31b">
<div id="outline-container-org0b60a26" class="outline-2">
<h2 id="org0b60a26">On Client Machines</h2>
<div class="outline-text-2" id="text-org0b60a26">
<p>
You can configure laptops or desktop machines which connect to the Freedombone server in the following way. This alters encryption settings to improve overall security.
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo apt-get update
sudo apt-get install git dialog haveged build-essential
git clone https://github.com/bashrc/freedombone
@ -755,15 +745,14 @@ freedombone-client
</div>
</div>
<div id="outline-container-org77ebb5b" class="outline-2">
<h2 id="org77ebb5b">Administering the system</h2>
<div class="outline-text-2" id="text-org77ebb5b">
<div id="outline-container-org9c63345" class="outline-2">
<h2 id="org9c63345">Administering the system</h2>
<div class="outline-text-2" id="text-org9c63345">
<p>
To administer the system after installation log in via ssh, become the root user and then launch the control panel.
</p>
<div class="org-src-container">
<pre class="src src-bash">ssh myusername@freedombone.local -p 2222
</pre>
</div>