Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new tutorial to set up OpenTAXII server in Docker with TAXII2 #262

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
118 changes: 118 additions & 0 deletions docs/user-manual.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
=====================
How to use OpenTAXII?
=====================

Requirements
============

* `Docker Engine and Docker Compose <https://docs.docker.com/engine/install/>`__
* `taxii2-client <https://taxii2client.readthedocs.io/en/latest/>`__ (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:////data/auth.db
create_tables: yes
secret: <secret_password1>

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: admin
password: <secret_password2>
is_admin: yes

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='admin',
password='<same-password-set-in-data-configuration')

#. Print your server's information.

.. code-block:: python

print(server.title)
Loading