Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderBand committed Dec 21, 2021
1 parent d10008e commit c0ac75c
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 94 deletions.
10 changes: 5 additions & 5 deletions source/developer/libunbound-tutorial/dnssec-validate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ signatures. The ``echo`` command is wrapped onto multiple lines on this page for
presentation, put the text onto one line. Because the key and the signatures on
the data do not match, verification fails and the result is bogus.

The program starts like in the :ref:`doc_libunbound_setup_context` section of the tutorial, creates the unbound context and
reads in ``/etc/resolv.conf`` and ``/etc/hosts``. Then it adds the contents of the keys
file from the current directory as trusted keys. It continues to resolve
www.nlnetlabs.nl and prints the result. It also prints the security status of
the result.
The program starts like in the :doc:`setup-context` section of the tutorial,
creates the unbound context and reads in ``/etc/resolv.conf`` and
``/etc/hosts``. Then it adds the contents of the keys file from the current
directory as trusted keys. It continues to resolve www.nlnetlabs.nl and prints
the result. It also prints the security status of the result.

The function ``ub_ctx_add_ta_file`` adds trusted keys. The keys file contains text
in the zone file format (output from ``dig`` or ``drill`` tools, or a copy and paste
Expand Down
147 changes: 99 additions & 48 deletions source/getting-started/installation.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
Installation
============

To install your own copy of Unbound you have two options: Use the version provided by your package manager, or download the source and building it yourself.
To install your own copy of Unbound you have two options: Use the version
provided by your package manager, or download the source and building it
yourself.

Installing via the package manager is the easiest option, and on most systems even trivial. The downside is the distributed version can be outdated for some distributions or not have all the compile-time options included that you want.
Building and compiling Unbound yourself ensures that you have the latest version and all the compile-time options you desire.
Installing via the package manager is the easiest option, and on most systems
even trivial. The downside is the distributed version can be outdated for some
distributions or not have all the compile-time options included that you want.
Building and compiling Unbound yourself ensures that you have the latest version
and all the compile-time options you desire.

If you're a first-time user we recommend installing via a package manager.

Installing with a Package Manager
---------------------------------

Most package managers maintain a version of Unbound, although this version can be outdated if this package has not been updated recently. If you like to upgrade to the latest version, we recommend :ref:`compiling Unbound yourself<Building from source/Compiling>`.

Most package managers maintain a version of Unbound, although this version can
be outdated if this package has not been updated recently. If you like to
upgrade to the latest version, we recommend :ref:`compiling Unbound
yourself<Building from source/Compiling>`.

Ubuntu 20.04.1 LTS
^^^^^^^^^^^^^^^^^^
Expand All @@ -24,35 +31,42 @@ Installing Unbound with the built-in package manager should be as easy as:
sudo apt update
sudo apt install unbound
This gives you a compiled and running version of Unbound ready to :ref:`be configured<doc_unbound_configuration>`.
This gives you a compiled and running version of Unbound ready to :doc:`be
configured<configuration>`.

macOS Big Sur
^^^^^^^^^^^^^

In this tutorial we make use of the Brew package installer for MacOS. Install ``brew`` and, if you've never used ``brew`` before, give `their website <https://brew.sh/>`_ a read.
In this tutorial we make use of the Brew package installer for MacOS. Install
``brew`` and, if you've never used ``brew`` before, give `their website
<https://brew.sh/>`_ a read.

.. code-block:: bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then use brew to install Unbound.

.. code-block:: bash
brew install unbound
This gives you a compiled and running version of Unbound ready to :ref:`be configured<doc_unbound_configuration>`.
This gives you a compiled and running version of Unbound ready to :doc:`be
configured<configuration>`.

Building from source/Compiling
------------------------------

To compile Unbound on any system you need to have the ``openssl`` and ``expat`` libraries, and their header files. To include the header files we need to get the development version, usually called ``libssl-dev`` and ``libexpat1-dev`` respectively.
To compile Unbound on any system you need to have the ``openssl`` and ``expat``
libraries, and their header files. To include the header files we need to get
the development version, usually called ``libssl-dev`` and ``libexpat1-dev``
respectively.

Ubuntu 20.04.1 LTS
^^^^^^^^^^^^^^^^^^

First of all, we need our copy of the Unbound code, so we download the tarball of the latest version and untar it.
First of all, we need our copy of the Unbound code, so we download the tarball
of the latest version and untar it.

.. code-block:: bash
Expand All @@ -67,54 +81,66 @@ We'll need some tools, such as a compiler and the :command:`make` program.
sudo apt update
sudo apt install -y build-essential
The library components Unbounds needs are: ``libssl`` ``libexpat``, of which we need the "dev" version. Unbound also uses ``libldns``, but this is included in the tarball we've already downloaded.
The library components Unbounds needs are: ``libssl`` ``libexpat``, of which we
need the "dev" version. Unbound also uses ``libldns``, but this is included in
the tarball we've already downloaded.

.. code-block:: bash
sudo apt install -y libssl-dev
sudo apt install -y libexpat1-dev
We'll also need the tools to build the actual program. For this, Unbound uses :command:`make` and internally it uses ``flex`` and ``yacc``, which we need to download as well.
We'll also need the tools to build the actual program. For this, Unbound uses
:command:`make` and internally it uses ``flex`` and ``yacc``, which we need to
download as well.

.. code-block:: bash
sudo apt-get install -y bison
sudo apt-get install -y flex
With all the requirements met, we can now start the compilation process in the Unbound directory.
The first step here is configuring. With :option:`./configure -h` you can look at the extensive list of configurables for Unbound. A nice feature is that :command:`configure` will tell you what it's missing during configuration. A common error is for the paths to the two libraries we just installed, which can be manually specified with :option:`--with-ssl=` and :option:`--with-libexpat=`.
With all the requirements met, we can now start the compilation process in the
Unbound directory. The first step here is configuring. With :option:`./configure
-h` you can look at the extensive list of configurables for Unbound. A nice
feature is that :command:`configure` will tell you what it's missing during
configuration. A common error is for the paths to the two libraries we just
installed, which can be manually specified with ``--with-ssl=`` and
``--with-libexpat=``.

.. code-block:: bash
./configure
When :command:`configure` gives no errors, we can continue to actually compiling Unbound. For this Unbound uses :command:`make`. Be warned that compiling might take a while.
When :command:`configure` gives no errors, we can continue to actually compiling
Unbound. For this Unbound uses :command:`make`. Be warned that compiling might
take a while.

.. code-block:: bash
make
When we have a successful compilation, we can install Unbound to make available for the machine.
When we have a successful compilation, we can install Unbound to make available
for the machine.

.. code-block:: bash
sudo make install
We now have fully compiled and installed version of Unbound, and :ref:`continue to testing it<Testing>`.

Please note that the default configuration file is located at ``/usr/local/etc/unbound/unbound.conf`` and created during the :command:`make` step. This file contains all possible configuration options for Unbound.
We now have fully compiled and installed version of Unbound, and :ref:`continue
to testing it<Testing>`.

.. Ref to testing
Please note that the default configuration file is located at
:file:`/usr/local/etc/unbound/unbound.conf` and created during the
:command:`make` step. This file contains all possible configuration options for
Unbound.

macOS Big Sur
^^^^^^^^^^^^^

In this tutorial we make use of the :command:`brew` package installer for MacOS. Install :command:`brew` and give `their website <https://brew.sh/>`_ a read if you've never used brew before.
In this tutorial we make use of the :command:`brew` package installer for MacOS.
Install :command:`brew` and give `their website <https://brew.sh/>`_ a read if
you've never used brew before.

.. code-block:: bash
Expand All @@ -128,81 +154,106 @@ Then we use :command:`brew` to install :command:`wget`.
brew install wget
We can the use :command:`wget` to download the latest version of Unbound from repository and unpack it.
We can the use :command:`wget` to download the latest version of Unbound from
repository and unpack it.

.. code-block:: bash
wget https://nlnetlabs.nl/downloads/unbound/unbound-latest.tar.gz
tar xzf unbound-latest.tar.gz
To compile Unbound on MacOS (or anything really), we need to install the Mac specific development tools called "Xcode". This is available on the app store and requires ~12 GB space on the hard disk. Alternatively, if you don't want multiple Gigabytes of largely unused space on your harddisk a slimmed down version also exists called the "Command Line Tools". This includes all the tools to compile on a Mac can also be installed via the terminal.
To compile Unbound on MacOS (or anything really), we need to install the Mac
specific development tools called "Xcode". This is available on the app store
and requires ~12 GB space on the hard disk. Alternatively, if you don't want
multiple Gigabytes of largely unused space on your harddisk a slimmed down
version also exists called the "Command Line Tools". This includes all the tools
to compile on a Mac can also be installed via the terminal.

.. code-block:: bash
xcode-select --install
This command will open a window where the selection can be made of what to install. If you just want the Command Line Tools select this option.
This command will open a window where the selection can be made of what to
install. If you just want the Command Line Tools select this option.

To verify that Xcode is installed correctly we check that we have the :command:`gcc` compiler by asking for the version.

.. code-block:: bash
gcc --version
.. stackoverflow answer for skipping entire Xcode: https://stackoverflow.com/questions/31043217/how-to-enable-unbound-dnssec-dns-resolver-on-mac-os-x-10-10-3-yosemite
Next we install the required libraries using :command:`brew`. Note that when installing these :command:`brew` will tell you the path to where it has installed the library. The default is the ``/opt/homebrew/Cellar/`` directory, which can become important in the :command:`configure` step.
..
stackoverflow answer for skipping entire Xcode:
https://stackoverflow.com/questions/31043217/how-to-enable-unbound-dnssec-dns-resolver-on-mac-os-x-10-10-3-yosemite
Next we install the required libraries using :command:`brew`. Note that when
installing these :command:`brew` will tell you the path to where it has
installed the library. The default is the ``/opt/homebrew/Cellar/`` directory,
which can become important in the :command:`configure` step.

.. code-block:: bash
brew install openssl@1.1
brew install expat
With all the requirements met, we can now start the compilation process in the Unbound directory. The first step here is configuring. With :option:`./configure -h` you can look at the extensive list of configurables for Unbound. A nice feature is that :command:`configure` will tell you what it's missing during configuration. A common error is for the paths to the two libraries we just installed, which can be manually specified with :option:`--with-ssl=` and :option:`--with-libexpat=`.

With all the requirements met, we can now start the compilation process in the
Unbound directory. The first step here is configuring. With :option:`./configure
-h` you can look at the extensive list of configurables for Unbound. A nice
feature is that :command:`configure` will tell you what it's missing during
configuration. A common error is for the paths to the two libraries we just
installed, which can be manually specified with ``--with-ssl=`` and
``--with-libexpat=``.

.. code-block:: bash
./configure
Or alternatively, when :command:`configure` cannot find ``libssl`` and ``libexpat`` and :command:`brew` installed them at the default directory (make sure you fill in the correct version, at the time of writing the latest version of openssl is ``1.1.1k`` and of libexapt is ``2.3.0``).
Or alternatively, when :command:`configure` cannot find ``libssl`` and
``libexpat`` and :command:`brew` installed them at the default directory (make
sure you fill in the correct version, at the time of writing the latest version
of openssl is ``1.1.1k`` and of libexapt is ``2.3.0``).

.. code-block:: bash
./configure --with-ssl=/opt/homebrew/Cellar/openssl@1.1/1.1.1k/ --with-libexpat=/opt/homebrew/Cellar/expat/2.3.0
When :command:`configure` gives no errors, we can continue to actually compiling Unbound. For this Unbound uses :command:`make`. Be warned that compiling might take a while.
When :command:`configure` gives no errors, we can continue to actually compiling
Unbound. For this Unbound uses :command:`make`. Be warned that compiling might
take a while.

.. code-block:: bash
make
When we have a successful compilation, we can install Unbound to make available for the machine.
When we have a successful compilation, we can install Unbound to make available
for the machine.

.. code-block:: bash
sudo make install
We now have fully compiled and installed version of Unbound, and can :ref:`continue to testing it<Testing>`.

.. Ref to testing
We now have fully compiled and installed version of Unbound, and can
:ref:`continue to testing it<Testing>`.

Testing
-------

A simple test to determine if the installation was successful is to invoke the :command:`unbound` command with the :option:`-V` option, which is the "version" option. This shows the version and build options used, as well as proving that the install was successful.
A simple test to determine if the installation was successful is to invoke the
:command:`unbound` command with the :option:`-V` option, which is the "version"
option. This shows the version and build options used, as well as proving that
the install was successful.

.. code-block:: bash
unbound -V
If all the previous steps were successful we can continue to configuring our Unbound instance.
If all the previous steps were successful we can continue to configuring our
Unbound instance.

Another handy trick you can use during testing is to run Unbound in the foreground using the :option:`-d` option and increase the verbosity level using the :option:`-vvv` option. This allows you to see steps Unbound takes and also where it fails.
Another handy trick you can use during testing is to run Unbound in the
foreground using the :option:`-d` option and increase the verbosity level using
the :option:`-vvv` option. This allows you to see steps Unbound takes and also
where it fails.

Now that Unbound is installed we can :doc:`continue to configuring it<configuration>`.
Now that Unbound is installed we can :doc:`continue to configuring
it<configuration>`.
2 changes: 1 addition & 1 deletion source/reference/todo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Docs To-Do List
===============

Since the first release in 2007, the documentation of Unbound has been
maintained with a heavy focus on :ref:`manual pages<doc_unbound_manpage>`. As
maintained with a heavy focus on :doc:`manual pages</manpages/unbound>`. As
the resolver has become more versatile and feature-rich over the years, the
NLnet Labs team decided to add this documention, providing installation guides
for different platforms, practical use cases, and background information.
Expand Down
20 changes: 9 additions & 11 deletions source/topics/monitoring.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.. _doc_monitoring:

Monitoring and Reporting
========================

Expand All @@ -16,7 +14,7 @@ enabled, more statistics are collected, for example what types of queries are
sent to the resolver. Otherwise, only the total number of queries is collected.

Statistics can be printed to the log file using ``statistics-interval``, but
here we'll focus on using :ref:`doc_unbound_control_manpage` to obtain
here we'll focus on using :doc:`/manpages/unbound-control` to obtain
statistics on demand. If you set a ``statistics-interval``, every interval it is
printed to the logfile.

Expand Down Expand Up @@ -45,10 +43,10 @@ In the ``contrib`` directory in the source of Unbound is the ``unbound_munin_``
plugin script. It can be used with `Munin <https://munin-monitoring.org>`_ to
monitor the health of an Unbound server.

Install ``munin`` and ``munin-node`` with the appropriate package install tool. The
plugin script for Unbound can be copied somewhere on the system (such as in the
unbound directory). Then create symbolic links from ``/etc/munin/plugins`` to that
file.
Install ``munin`` and ``munin-node`` with the appropriate package install tool.
The plugin script for Unbound can be copied somewhere on the system (such as in
the unbound directory). Then create symbolic links from ``/etc/munin/plugins``
to that file.

.. code-block:: bash
Expand All @@ -68,10 +66,10 @@ your system. The ``statefile`` is a temporary file.
and plot it with rrdtool.
Additional graphs are possible, below is a list of them, and examples. Create
(additional) symbolic links to ``unbound_munin_`` with the names (in bold) of those
graphs to enable their display. Several require that ``extended-statistics`` is
enabled in config. Pictures included are samples, your statistics may look
different :-) .
(additional) symbolic links to ``unbound_munin_`` with the names (in bold) of
those graphs to enable their display. Several require that
``extended-statistics`` is enabled in config. Pictures included are samples,
your statistics may look different :-) .

.. figure:: /img/monitoring/unbound_munin_hits-day.png

Expand Down

0 comments on commit c0ac75c

Please sign in to comment.