Exercise 3, Chapter 10 - Creating a configuration package from scratch.
- Create a custom package that sets up and utilizes your own package repository and GnuPG signing key, distributes a SaltStack configuration, pushes a custom background, and provides default desktop settings in a unified way to all your Kali installations.
This default package will contain a few files:
- /etc/apt/sources.list.d/offsec.list: a sources.list entry for APT, enabling the company's internal package repository
- /etc/apt/trusted.gpg.d/offsec.gpg: the GnuPG key used to sign the company's internal package repository
- /etc/salt/minion.d/offsec.conf: a SaltStack configuration file to indicate where to find the Salt master
- /usr/share/images/offsec/background.png: a nice background image with the Offensive Security logo
- /usr/share/glib-2.0/schemas/90_offsec-defaults.gschema.override: a file providing alternate default settings for the GNOME desktop
First, define these variables so you don't have to type them multiple times:
1 2 3 4 |
export EMAIL="muts@kali.org" export DEBFULLNAME="Mati Aharoni" |
Create an offsec-defaults-1.0 directory and put all the files in that directory. Then run dh_make --native (from the dh-make package) to add Debian packaging instructions, which will be stored in a debian sub-directory:
1 2 3 4 5 6 |
mkdir offsec-defaults-1.0; cd offsec-defaults-1.0 dh_make --native cd debian ls -l |
Remove example files:
1 2 3 |
rm *.ex *.EX *.docs README* |
Update information about you (the author) in copyright and have a look at compat:
1 2 3 4 |
nano copyright nano compat |
Next, edit your offsec-defaults.install file...
1 2 3 |
nano offsec-defaults.install |
... to include the offsec.list (a sources.list file), offsec.gpg (the GnuPG key used to sign the company's internal package repository), offsec.conf (the SaltStack configuration file that indicates where to find the Salt master), and a nice background image:
1 2 3 4 5 6 |
apt/offsec.list etc/apt/sources.list.d/ apt/offsec.gpg etc/apt/trusted.gpg.d/ salt/offsec.conf etc/salt/minion.d/ images/background.png usr/share/images/offsec/ |
Update the gsettings-override file ...
1 2 3 |
nano offsec-defaults.gsettings-override |
...to include:
1 2 3 4 5 |
[org.gnome.desktop.background] picture-options='zoom' picture-uri='file:///usr/share/images/offsec/background.png' |
Now we will edit
1 2 3 |
nano rules |
.. to increase the priority to the level expected for an organization override (which is 90 according to the manual page):
1 2 3 4 5 6 7 8 9 10 |
#!/usr/bin/make -f %: dh $@ override_dh_installgsettings: dh_installgsettings --priority=90 |
Create directories to account for what we put in offsec-defaults.install. This is where you put your stuff! (Do it!)
1 2 3 4 |
mkdir ../{apt,salt,images} cd .. |
At this point, the source package is ready. All that is left to do is to generate the binary package with the same method used previously for rebuilding packages: run the dpkg-buildpackage -us -uc command from within the offsec-defaults-1.0 directory:
1 2 3 |
dpkg-buildpackage -us -uc |