From c93cef4196821b96bf748a99a8f19c311b4864ec Mon Sep 17 00:00:00 2001 From: Nathan van Schoote Date: Fri, 15 Dec 2023 16:27:57 +0100 Subject: [PATCH 1/2] Added new tutorial to set up OpenTAXII server in Docker with TAXII2 --- docs/user-manual.rst | 117 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 docs/user-manual.rst diff --git a/docs/user-manual.rst b/docs/user-manual.rst new file mode 100644 index 0000000..36d9495 --- /dev/null +++ b/docs/user-manual.rst @@ -0,0 +1,117 @@ +How to use OpenTAXII? +********************* + +Requirements +============ + +* `Docker Engine and Docker Compose `__ +* `taxii2-client `__ (for TAXII 2.1) + +Run OpenTAXII +================= + +#. Create the ``opentaxii.yml`` file and fill it in with the following: + + .. code-block:: yaml + + --- + domain: "localhost:9000" + support_basic_auth: yes + + auth_api: + class: opentaxii.auth.sqldb.SQLDatabaseAPI + parameters: + db_connection: sqlite:////tmp/auth.db + create_tables: yes + secret: + + taxii1: + + taxii2: + persistence_api: + class: opentaxii.persistence.sqldb.Taxii2SQLDatabaseAPI + parameters: + db_connection: sqlite:////data/data.db + create_tables: yes + title: "My OpenTAXII Server" + description: "My OpenTAXII server runs with TAXII 2" + max_content_length: 209715200 + public_discovery: true + + Change the value for the secret to a more secure value. + +#. Create a ``docker-compose.yml`` file and fill it in with the following: + + .. code-block:: yaml + + version: '3.8' + services: + opentaxii: + image: eclecticiq/opentaxii + volumes: + - ./:/input:ro + ports: + - 9000:9000 + +#. Run Docker Compose. + + .. code-block:: bash + + docker compose -f docker-compose.yml up + +#. Stop Docker Compose using ``Ctrl + C``. + + .. Note:: + + Alternatively, add the ``-d`` flag to run Docker Compose in the background. + In that case, run ``docker compose --env-file .env -f docker-compose.yml down`` to stop OpenTAXII. + +Configure OpenTAXII +=================== + +#. Create a ``data-configuration.yml`` file and fill it in with the following: + + .. code-block:: yaml + + --- + + accounts: + - username: user1 + password: + + Change the value for the passwords to more secure values. + +#. Open a shell session into your OpenTAXII container + + .. code-block:: bash + + docker exec -it test-opentaxii-1 bash + +#. Run ``opentaxii-sync-data`` with the ``data-configuration.yml`` file. + + .. code-block:: bash + + opentaxii-sync-data -f /input/data-configuration.yaml + +Interact with OpenTAXII +======================= + +#. In a Python shell, import the `taxii2client` library. + + .. code-block:: python + + import taxii2client + +#. Connect to your OpenTAXII Server. + + .. code-block:: python + + server = taxii2client.Server(url='http://localhost:9000/taxii2/', + user='user1', + password=' Date: Tue, 19 Dec 2023 10:55:17 +0100 Subject: [PATCH 2/2] Minor Content changes --- docs/user-manual.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/user-manual.rst b/docs/user-manual.rst index 36d9495..38656f5 100644 --- a/docs/user-manual.rst +++ b/docs/user-manual.rst @@ -1,5 +1,6 @@ +===================== How to use OpenTAXII? -********************* +===================== Requirements ============ @@ -21,7 +22,7 @@ Run OpenTAXII auth_api: class: opentaxii.auth.sqldb.SQLDatabaseAPI parameters: - db_connection: sqlite:////tmp/auth.db + db_connection: sqlite:////data/auth.db create_tables: yes secret: @@ -74,10 +75,10 @@ Configure OpenTAXII .. code-block:: yaml --- - accounts: - - username: user1 + - username: admin password: + is_admin: yes Change the value for the passwords to more secure values. @@ -107,7 +108,7 @@ Interact with OpenTAXII .. code-block:: python server = taxii2client.Server(url='http://localhost:9000/taxii2/', - user='user1', + user='admin', password='