Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ dist
venv
nitrokey-sdk-py*
*.pyc

# editor detritus
.*sw?
*~
111 changes: 102 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,143 @@
NITROKEY_SDK_PY_VERSION ?= v0.4.1
NITROKEY_SDK_PY_CHECKSUM ?= 3e6410a037c95d14fce1a5021422f510b47d1b2f0a78cf88d07798b9d24974ea

NITROKEY_SDK_PY_URL := https://github.com/Nitrokey/nitrokey-sdk-py/archive/refs/tags/$(NITROKEY_SDK_PY_VERSION).tar.gz
NITROKEY_SDK_PY := nitrokey-sdk-py-$(NITROKEY_SDK_PY_VERSION)
NITROKEY_SDK_PY_ARCHIVE := $(NITROKEY_SDK_PY).tar.gz
NITROKEY_SDK_PY_LINK := source/components/software/nitrokey-sdk-py

FMT ?= html
EDITOR ?= vim
BUILD_LANG = en
ACCEPTED_WORD_LIST = wordlist.txt
CANDIDATE_WORD_LIST = build/$(BUILD_LANG)/spelling/candidates.txt
VIM_SPELLFILE = spellfile.utf-8.add

.PHONY: docs
docs: venv
venv/bin/sphinx-build -j auto -b $(FMT) -D language=en -d build/en/doctrees source dist/en
venv/bin/sphinx-build -j auto -b $(FMT) -D language=en -d build/$(BUILD_LANG)/doctrees source dist/$(BUILD_LANG)

.PHONY: venv
venv: $(NITROKEY_SDK_PY)
python -m venv venv
venv: venv/lib/python*/site-packages/nitrokey/__init__.py
venv/lib/python*/site-packages/nitrokey/__init__.py: $(NITROKEY_SDK_PY)
python3 -m venv venv
venv/bin/pip3 install -r requirements.txt
venv/bin/pip3 install ./$(NITROKEY_SDK_PY)

define CLEAN_WORD_LIST
sort -u $(1) | sed -e '/^[[:space:]][[:space:]]*$$/d' -e '/^#/d'
endef
.PHONY: spell check-spelling
spell: check-spelling
check-spelling: venv
@# sphinxcontrib-spelling doesn't seem to overwrite its previous .spelling
@# files (which could be a bug), so clean those up now…
-find build/$(BUILD_LANG)/spelling -name "*.spelling" -delete

# building a list of candidate words to add to '$(CANDIDATE_WORD_LIST)'
venv/bin/sphinx-build -b spelling source build/$(BUILD_LANG)/spelling
@echo '# lines KEPT in this file will be treated as CORRECT spellings' \
> $(CANDIDATE_WORD_LIST)
find . -name "*.spelling" -exec cat {} \; | awk -F '[()]' '{print $$2}' \
| sort -u >> $(CANDIDATE_WORD_LIST)

ifneq ($(SKIP_ADD_SPELLINGS),1)
@printf '\nEdit the candidate word list to add new spellings now? [y/N] '; \
read REPLY; \
if [ -z "$$REPLY" ] || ! echo "$$REPLY" | grep -qi ^y; then \
printf '\nOK, not updating the word list.\n'; \
printf "You can run 'make fix-spelling' to fix misspellings in your editor.\n\n"; \
exit 1; \
fi
$(EDITOR) $(CANDIDATE_WORD_LIST)

# cleaning and re-sorting the wordlists…
$(call CLEAN_WORD_LIST,$(ACCEPTED_WORD_LIST)) > $(ACCEPTED_WORD_LIST).new
mv $(ACCEPTED_WORD_LIST).new $(ACCEPTED_WORD_LIST)
$(call CLEAN_WORD_LIST,$(CANDIDATE_WORD_LIST)) > $(CANDIDATE_WORD_LIST).new
mv $(CANDIDATE_WORD_LIST).new $(CANDIDATE_WORD_LIST)

@echo
# showing differences between existing wordlist (left) and candidates (right)…
# these two files will be merged together if you continue
@if type sdiff >/dev/null 2>&1; then \
sdiff --suppress-common-lines $(ACCEPTED_WORD_LIST) $(CANDIDATE_WORD_LIST); \
else \
diff -u $(ACCEPTED_WORD_LIST) $(CANDIDATE_WORD_LIST); \
fi; \
printf '\nAbout to update '$(ACCEPTED_WORD_LIST)'. Do the above changes look okay? [Y/n] '; \
read REPLY; \
if [ -n "$$REPLY" ] && ! echo "$$REPLY" | grep -qi ^y; then \
printf '\nOK, not updating the word list.\n\n'; \
printf "You can run 'make fix-spelling' to fix misspellings in your editor.\n\n"; \
exit 1; \
fi

@echo
# updating wordlist with the new spellings…
cat $(ACCEPTED_WORD_LIST) $(CANDIDATE_WORD_LIST) \
| $(CLEAN_WORD_LIST) > $(ACCEPTED_WORD_LIST).new
mv $(ACCEPTED_WORD_LIST).new $(ACCEPTED_WORD_LIST)
endif
@printf "\nYou can now run 'make fix-spelling' to correct any identified misspellings.\n\n"

.PHONY: fix correct fix-spelling
fix: fix-spelling
correct: fix-spelling
fix-spelling:
# opening your $$EDITOR to correct spelling in all misspelled files…
@exec 3</dev/tty || exec 3<&0; \
find build/$(BUILD_LANG)/spelling -depth -name "*.spelling" | while read misspelled; do \
dirname=`dirname "$$misspelled" | sed 's|^build/$(BUILD_LANG)/spelling|source|'`; \
source=`basename "$$misspelled" .spelling`.rst; \
printf "\nThe file '$$dirname/$$source' contains spelling mistakes.\n"; \
printf "Press 's' to skip, Ctrl+C to quit, or [Enter] to open in your editor… "; \
read REPLY <&3; \
if [ "$$REPLY" = s -o "$$REPLY" = S ]; then continue; fi; \
if [ "$(EDITOR)" = vim -o "$(EDITOR)" = nvim ]; then \
patterns=`mktemp fix-spelling.XXXXXX`; \
awk -F '[()]' '{print $$2}' "$$misspelled" > "$$patterns"; \
rm $(VIM_SPELLFILE)* 2>/dev/null || true; \
ln -s $(ACCEPTED_WORD_LIST) $(VIM_SPELLFILE); \
$(EDITOR) \
-c 'set spellfile=$(VIM_SPELLFILE)' -c 'silent mkspell $(VIM_SPELLFILE)' \
-c 'set spelllang=$(BUILD_LANG)' -c 'setlocal spell' \
-c "let patterns=readfile('$$patterns')" \
-c "let @/=join(patterns, '\\|')" \
-c "let &errorformat='%f:%l: %m'" -c "cfile $$misspelled" \
-c 'set hlsearch' -c copen "$$dirname/$$source" <&3; \
rm $(VIM_SPELLFILE)* "$$patterns" 2>/dev/null || true; \
else \
$(EDITOR) "$$dirname/$$source" "$$misspelled" <&3; \
fi; \
done; \
exec 3<&-

.PHONY: check-syntax
check-syntax: venv
venv/bin/rstcheck --config rstcheck.toml --recursive source

.PHONY: check-hyperlinks
check-hyperlinks: venv docs
venv/bin/linkchecker -f linkcheckerrc dist/en/index.html
venv/bin/linkchecker -f linkcheckerrc dist/$(BUILD_LANG)/index.html

.PHONE: check-hyperlinks-nightly
check-hyperlinks-nightly: venv docs
venv/bin/linkchecker -f linkcheckerrc_nightly dist/en/index.html
venv/bin/linkchecker -f linkcheckerrc_nightly dist/$(BUILD_LANG)/index.html

.PHONY: pkg
pkg: venv docs
mv dist/en/_images dist/_images
mv dist/$(BUILD_LANG)/_images dist/_images
rm -rf dist/*/_sources dist/*/_images
cp redirects/.htaccess dist


clean:
rm -rf dist build nitrokey-sdk-py* $(NITROKEY_SDK_PY_LINK)

cleaner: clean
rm -rf venv

$(NITROKEY_SDK_PY): $(NITROKEY_SDK_PY_ARCHIVE)
mkdir "$@"
if [ ! -d "$@" ]; then mkdir "$@"; fi
tar --directory "$@" --extract --strip-components 1 --file "$<"
rm -f $(NITROKEY_SDK_PY_LINK)
ln -s ../../../$(NITROKEY_SDK_PY)/docs $(NITROKEY_SDK_PY_LINK)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ setuptools==75.6.0
docutils==0.21.2
sphinx-design==0.6.1
LinkChecker==10.5.0
sphinxcontrib-spelling==8.0.2
16 changes: 8 additions & 8 deletions source/components/nethsm/administration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,13 @@ Set the network configuration as follows.

**Optional Options**

+---------------------------+-----------------------------------------------+
| Option | Description |
+===========================+===============================================+
| ``--ipv6-cidr`` ``TEXT`` | The IPv6 address in CIDR notation (optional) |
+---------------------------+-----------------------------------------------+
| ``--ipv6-gateway`` ``TEXT`` | The IPv6 gateway address (optional) |
+---------------------------+-----------------------------------------------+
+-----------------------------+-----------------------------------------------+
| Option | Description |
+=============================+===============================================+
| ``--ipv6-cidr`` ``TEXT`` | The IPv6 address in CIDR notation (optional) |
+-----------------------------+-----------------------------------------------+
| ``--ipv6-gateway`` ``TEXT`` | The IPv6 gateway address (optional) |
+-----------------------------+-----------------------------------------------+

**Example**

Expand Down Expand Up @@ -1040,7 +1040,7 @@ Each user account configured on the NetHSM has one of the following *Roles* assi
| | required to initiate a system backup only. |
+-----------------+-------------------------------------------------------------+

See `Namespaces <administration.html#namespaces>`__ and `Tags <administration.html#tags-for-users>`__ for more fine-grained access restricions.
See `Namespaces <administration.html#namespaces>`__ and `Tags <administration.html#tags-for-users>`__ for more fine-grained access restrictions.

.. note::
In a future release, additional *Roles* may be introduced.
Expand Down
4 changes: 4 additions & 0 deletions source/components/nethsm/compatible/apache.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Apache
======

.. spelling:word-list::

libnethsm_pkcs11

You can configure `Apache httpd <https://httpd.apache.org/>`__ to use NetHSM via the OpenSSL engine which then uses NetHSM's PKCS#11 module.

The certificate file has to be on the disk but the private key can be used from the NetHSM.
Expand Down
4 changes: 4 additions & 0 deletions source/components/nethsm/compatible/ejbca.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
EJBCA
=====

.. spelling:word-list::
EJBCA
ng

.. note::
EJBCA requires at least NetHSM v3 and nethsm-pkcs11 v2.

Expand Down
8 changes: 6 additions & 2 deletions source/components/nethsm/compatible/knotdns.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Knot DNS
========

`Knot DNS <https://www.knot-dns.cz/>`__ is an open source authoritative DNS server that can be used for DNSSEC. To use KnotDNS with the NetHSM please install and configure the PKCS#11 module as `described here <../pkcs11-setup.html>`__.
.. spelling:word-list::

Knot

`Knot DNS <https://www.knot-dns.cz/>`__ is an open source authoritative DNS server that can be used for DNSSEC. To use Knot DNS with the NetHSM please install and configure the PKCS#11 module as `described here <../pkcs11-setup.html>`__.

Manual Mode
-----------
Expand All @@ -10,7 +14,7 @@ In manual mode the keys have to be generated and managed manually.

Only the Operator user is needed in the PKCS#11 module configuration file. The password can be specified using the ``pin-value`` in the `PKCS#11 URI <https://www.rfc-editor.org/rfc/rfc7512>`__ in knot.conf.

Add the following lines to the KnotDNS configuration file ``/etc/knot/knot.conf``:
Add the following lines to the Knot DNS configuration file ``/etc/knot/knot.conf``:

.. code-block:: ini

Expand Down
6 changes: 3 additions & 3 deletions source/components/nethsm/integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PKCS#11

The NetHSM supports the PKCS#11 standard.
The required driver is available from the `repository <https://github.com/Nitrokey/nethsm-pkcs11>`__.
The repository containes the source code and libraries, for different operating systems.
The repository contains the source code and libraries, for different operating systems.
The `PKCS#11 guide <pkcs11-setup.html>`_ describes the usage in detail.

Development and Testing
Expand All @@ -27,7 +27,7 @@ Demo Instance
^^^^^^^^^^^^^

A public NetHSM demo instance is available at `nethsmdemo.nitrokey.com <https://nethsmdemo.nitrokey.com/api/v1/info>`_.
It will be reset every eight hours (CET 6:00, 14:00, 22:00). User "admin", password "adminadmin", unlock password "unlockunlock".
It will be reset every eight hours (CET 6:00, 14:00, 22:00). User ``admin`", password ``adminadmin``, unlock password ``unlockunlock``.

Container Image
^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -72,7 +72,7 @@ This folder also contains the necessary documentation how to use it.
If Podman is used with enforcing SELinux, a labeling to the volume mount might be required.
The mode of SELinux can be requested with ``sestatus |grep "Current mode"``.
If the mode is set to ``enforcing``, a change to the context is required.
In this case the volume mount must be postfixed with ``:z``, resulting in ``-v "${PWD}/out:/out:z"``.
In this case the volume mount must be suffixed with ``:z``, resulting in ``-v "${PWD}/out:/out:z"``.

Command-line interface
----------------------
Expand Down
7 changes: 7 additions & 0 deletions source/components/nethsm/metrics.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.. spelling:word-list::

kv
gc
compactions
rcvd

:orphan:

Metrics
Expand Down
6 changes: 3 additions & 3 deletions source/components/nethsm/pkcs11-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ By default the module searches for configuration files in:

If multiple files are present the configurations will be merged so that the slots of all the config files will be used by the module.

You can manually set the config file location (only this one will be read) with the env variable ``P11NETHSM_CONFIG_FILE`` (e.g. ``P11NETHSM_CONFIG_FILE=./p11nethsm.conf``).
You can manually set the config file location (only this one will be read) with the environment variable ``P11NETHSM_CONFIG_FILE`` (e.g. ``P11NETHSM_CONFIG_FILE=./p11nethsm.conf``).

Configuration File Format
~~~~~~~~~~~~~~~~~~~~~~~~~

The configuration is yaml-formatted:
The configuration is YAML-formatted:

.. tabs::
.. tab:: All platforms
Expand Down Expand Up @@ -196,7 +196,7 @@ The password can be provided by multiple means:
- In plain text in the configuration ``password: "mypassword"``
- In an environment variable read by the module with the ``env:`` prefix: ``env:ENV_STORING_THE_PASSWORD``
- Via the login function of pkcs11, example for pcks11-tool: ``pkcs11-tool --module libnethsm_pkcs11.so -p opPassphrase``
To provide the the admin password you need to use ``--so-pin`` instead: ``pkcs11-tool --module libnethsm_pkcs11.so --login --login-type so --so-pin Administrator``
To provide the admin password you need to use ``--so-pin`` instead: ``pkcs11-tool --module libnethsm_pkcs11.so --login --login-type so --so-pin Administrator``

If the password of an user is not set in the configuration file a login will be required to provide the password (3rd method).

Expand Down
2 changes: 1 addition & 1 deletion source/components/nethsm/pkcs11-tool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Generate a Key
Generate a key-pair and store it on the NetHSM.

.. note::
The slot you want to use needs to have an andministrator user in the configuration file. Otherwise you will get a `CKR_USER_NOT_LOGGED_IN` error.
The slot you want to use needs to have an administrator user in the configuration file. Otherwise you will get a `CKR_USER_NOT_LOGGED_IN` error.

RSA
~~~
Expand Down
6 changes: 3 additions & 3 deletions source/components/nethsm/pkiproxy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Possible use cases of this setup are:
.. tip::
Please also refer to the official `PKI Proxy documentation <https://cdn.nsoftware.com/help/PK1/app/default.htm>`__ for more information.

Prerequisits
============
Prerequisites
=============

- NetHSM (hardware or containerized)
- Provisioned
Expand Down Expand Up @@ -69,7 +69,7 @@ The instructions below configure the PKI Proxy.

1. Open the PKI Proxy main window.
2. Change to the **Settings** tab.
3. Make sure the checkbox **Enable TLS** is checked and an apropriate certificate is used.
3. Make sure the checkbox **Enable TLS** is checked and an appropriate certificate is used.
4. Change to the **Users** tab.
5. Create a new user by clicking on the **New...** button.
Choose an authentication type which is supported by all clients.
Expand Down
2 changes: 1 addition & 1 deletion source/components/nethsm/system_recovery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ System Recovery
The following describes the recovery process for the NetHSM system software.
These instructions are only applicable if the API is inoperable, e.g. not responding to API requests.
In the case of an operable API perform a `factory reset <administration.html#reset-to-factory-defaults>`__ instead.
Follow the instructions precicsely to prevent any accidential deletion of data.
Follow the instructions precisely to prevent any accidental deletion of data.

.. important::
The system recovery only works if the GUID partition table (GPT) and the partitions itself on the disk are not corrupted.
Expand Down
12 changes: 5 additions & 7 deletions source/components/nextbox/backup-restore.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Backup and Restore
==================

.. contents:: :local:
.. spelling:word-list::
Storages

.. contents:: :local:

The NextBox can be backupped and restored from within the NextBox Nextcloud App. In order to
The NextBox can be backed up and restored from within the NextBox Nextcloud App. In order to
execute a backup or restore operation you need to have a storage device attached to your NextBox.

To enable backup and restore onto a storage device please follow these steps:
Expand Down Expand Up @@ -55,15 +57,11 @@ Restore

3. Click "Start Restoring now", the restore process will begin immediately.

Depending on the backupped Nextcloud version after the restore process you will be asked to run
Depending on the backed-up Nextcloud version, after the restore process you will be asked to run
the upgrade process for Nextcloud.


.. hint::
All configurations and settings of the NextBox and the Nextcloud instance will be restored, thus
there might be changes on how you access your NextBox, if the restored Remote Access configuration
is not identical to the current one.




2 changes: 1 addition & 1 deletion source/components/nextbox/clients/android.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Connect the NextBox with your smartphone
:alt: imgsp1
:scale: 30 %

2. Cick on "Sign in".
2. Click on "Sign in".

.. figure:: /components/nextbox/images/gettingstarted/sp_2.jpg
:alt: imgsp2
Expand Down
4 changes: 2 additions & 2 deletions source/components/nextbox/clients/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Connect using the Nextcloud App
2. After starting the ``nextcloud`` application, you will find it
as a tray icon.

3. Add an account using your public server url, username and password.
3. Add an account using your public server URL, username and password.
Further you can choose the target directory the files should be synced
to.

Expand All @@ -26,7 +26,7 @@ Connect using WebDAV
managers, by adding a "remote server".

* Additionally you can mount your Nextcloud files using WebDAV via
commandline and `/etc/fstab` by installing the `davfs2` package.
the command line and `/etc/fstab` by installing the `davfs2` package.

* To mount use:

Expand Down
Loading
Loading