Implement __jool type.

This commit is contained in:
sparrowhawk 2021-04-18 23:28:35 +02:00
parent f181b5ddb4
commit 272e4669fe
No known key found for this signature in database
GPG key ID: 6778C9C29C02D691
5 changed files with 156 additions and 0 deletions

76
type/__jool/man.rst Normal file
View file

@ -0,0 +1,76 @@
cdist-type__jool(7)
===================
NAME
----
cdist-type__jool - Configures a NAT64 instance using jool.
DESCRIPTION
-----------
This type configures an instance of a NAT64 using jool. This type **does not**
configure anything related to the other capacities of the jool project, such as
SIIT (see the `jool_siit` daemon / `__jool_siit` type - unimplemented at this
time). See https://jool.mx
Note that this type is only implemented for the Alpine Linux operating system.
Note that this type currently does not implement running several parallel
instances of jool NAT64. Please contribute your implementation if you do so.
REQUIRED PARAMETERS
-------------------
None.
OPTIONAL PARAMETERS
-------------------
instance
The instance name, `default` if unspecified.
framework
The used translation framework, `netfilter` if unspecified.
pool6
The IPv6 prefix used to map IPv4 addresses, `64:ff9b::/96` if unspecified.
BOOLEAN PARAMETERS
------------------
vm
Wether this instance is running in a VM or not: configures the kernel
modules that will be installed.
EXAMPLES
--------
.. code-block:: sh
__jool # Everything default
# or, if you're feeling contrary
__jool --instance "prettysoup" \
--framework "iptables" \
--pool6 "2001:DB8:dead:beef::/96"
SEE ALSO
--------
`cdist-type__jool_siit(7)` - yet to be written
`cdist-type__joold(7)` - yet to be written
AUTHORS
-------
Joachim Desroches <joachim.desroches@epfl.ch>
COPYING
-------
Copyright \(C) 2021 Joachim Desroches. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

76
type/__jool/manifest Executable file
View file

@ -0,0 +1,76 @@
#!/bin/sh -e
#
# 2021 Joachim Desroches (joachim.desroches@epfl.ch)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os=$(cat "${__global:?}/explorer/os")
case "$os" in
'alpine')
:
;;
*)
printf "This type has no implementation for %s. Please contribute one if you can.\n" "$os"
exit 1
;;
esac
if [ -f "${__object:?}/parameter/vm" ];
then
kernel_modules="jool-modules-virt"
else
kernel_modules="jool-modules-lts"
fi
for pkg in jool-tools jool-tools-openrc "$kernel_modules";
do
__package "$pkg"
done
instance="default"
if [ -f "${__object:?}/parameter/instance" ];
then
instance="$(cat "${__object:?}/parameter/instance")"
fi
framework="netfilter"
if [ -f "${__object:?}/parameter/framework" ];
then
framework="$(cat "${__object:?}/parameter/framework")"
fi
pool6="64:ff9b::/96"
if [ -f "${__object:?}/parameter/pool6" ];
then
pool6="$(cat "${__object:?}/parameter/pool6")"
fi
require='__package/jool-tools' __file /etc/jool/jool.conf \
--source - <<- EOF
{
"instance": "$instance",
"framework": "$framework",
"global": {
"pool6": "$pool6"
}
}
EOF
__start_on_boot 'jool'

View file

@ -0,0 +1 @@
vm

View file

@ -0,0 +1,3 @@
instance
framework
pool6

0
type/__jool/singleton Normal file
View file