Qubes-Community-Content/docs/customization/mirage-firewall.md

79 lines
2.5 KiB
Markdown
Raw Normal View History

Mirage Firewall
===============
A unikernel firewall for Qubes OS.
This site will help collecting information about the mirage firewall, an interesting project from "talex5".
To learn more about the Mirage Firewall, please make sure to read
- https://github.com/mirage/qubes-mirage-firewall
- https://github.com/mirage/qubes-mirage-firewall/blob/master/README.md
The Mirage Firewall for Qubes OS is a low ressource firewall, which uses a much smaller footprint
compared to the default ("fat") sys-firewall.
This page is only to write down how to build the mirage firewall for Qubes OS.
Please make sure to read the above links to understand more about it.
Most information from here has been put together reading the original docs above and following the discussion in the Qubes OS User Mailinglist / Google Groups:
https://groups.google.com/forum/#!topic/qubes-users/xfnVdd1Plvk
Build process on Qubes 4
========================
```
2019-04-18 22:15:31 +00:00
MirageFWBuildVM=my-mirage-buildvm
TemplateVM=fedora-29
2019-04-18 22:15:31 +00:00
MirageFWAppVM=sys-mirage-fw2
# create a new VM
qvm-create $MirageFWBuildVM --class=AppVM --label=red --template=$TemplateVM
# Resize private disk to 10 GB
2019-04-18 22:15:31 +00:00
qvm-volume resize $MirageFWBuildVM:private 10GB
# Create a symbolic link to safe docker into the home directory
2019-04-18 22:15:31 +00:00
qvm-run --auto --pass-io --no-gui $MirageFWBuildVM \
'sudo mkdir /home/user/var_lib_docker && \
sudo ln -s /var/lib/docker /home/user/var_lib_docker'
2019-04-18 22:15:31 +00:00
# Install docker and git ~2min
qvm-run --pass-io --no-gui $MirageFWBuildVM \
'sudo qvm-sync-clock && \
sudo dnf -y install docker git'
# Launch docker
2019-04-18 22:15:31 +00:00
qvm-run --pass-io --no-gui $MirageFWBuildVM \
'sudo systemctl start docker'
2019-04-18 22:15:31 +00:00
# Download and build mirage for qubes ~11min
qvm-run --pass-io --no-gui $MirageFWBuildVM \
'git clone https://github.com/mirage/qubes-mirage-firewall.git && \
cd qubes-mirage-firewall && \
git pull origin pull/52/head && \
sudo ./build-with-docker.sh'
# Copy the new kernel to dom0
cd /var/lib/qubes/vm-kernels
2019-04-18 22:15:31 +00:00
qvm-run --pass-io $MirageFWBuildVM 'cat qubes-mirage-firewall/mirage-firewall.tar.bz2' | tar xjf -
2019-04-08 21:26:02 +00:00
2019-04-18 22:15:31 +00:00
# create a new mirage fw appvm
qvm-create \
--property kernel=mirage-firewall \
--property kernelopts=None \
--property memory=32 \
--property maxmem=32 \
--property netvm=sys-net \
--property provides_network=True \
--property vcpus=1 \
--property virt_mode=pv \
--label=green \
--class StandaloneVM \
$MirageFWAppVM
2019-04-08 21:26:02 +00:00
2019-04-18 22:15:31 +00:00
# Change default NetVM to Mirage FW
qvm-start $MirageFWAppVM
2019-04-18 22:15:31 +00:00
qubes-prefs --set default_netvm $MirageFWAppVM
2019-04-09 07:07:23 +00:00
```