### Run OpenTAXII with Mounted Volumes Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md Starts a detached OpenTAXII instance, mapping local example data to the container's input directory. This allows pre-loading services, collections, or accounts by placing configuration files like 'data-configuration.yml' or 'opentaxii.yml' in the local '/some/path/examples' directory. ```shell $ pwd /some/path/examples $ ls /some/path/examples data-configuration.yml $ docker run -d -p 9000:9000 -v /some/path/examples:/input eclecticiq/opentaxii ``` -------------------------------- ### Install OpenTAXII from Source Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Install OpenTAXII manually from downloaded source files using the setup.py script. ```sh $ python setup.py install ``` -------------------------------- ### Install OpenTAXII from Source Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/contribute/developer.md Use this command to install OpenTAXII after cloning the repository. Ensure you are in a virtual environment. ```bash (venv) $ python setup.py install ``` -------------------------------- ### Example Custom Configuration Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/configuration.md An example of a custom YAML configuration file for OpenTAXII, demonstrating settings for domain, authentication, TAXII 1 hooks, and persistence API. ```yaml --- domain: taxii.mydomain.com support_basic_auth: no auth_api: class: opentaxii.auth.sqldb.SQLDatabaseAPI parameters: db_connection: postgresql://scott:tiger@localhost:5432/mydatabase create_tables: yes secret: aueHenjitweridUcviapEbsJocdiDrelHonsyorl taxii1: xml_parser_supports_huge_tree: no hooks: mypackage.opentaxii.custom_hooks persistence_api: class: mypackage.opentaxii.CustomPersistenceAPI parameters: rest_api: http://rest.mydomain.com/api ``` -------------------------------- ### Supervisord Configuration for OpenTAXII Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/running.md Example supervisord configuration file to manage the OpenTAXII Gunicorn process. This setup includes logging, binding, and environment variable configuration for production. ```ini [program:opentaxii] command = /opt/eclecticiq/opentaxii-venv/bin/gunicorn opentaxii.http:app --workers 2 --log-level info --log-file - --timeout 300 --bind localhost:9000 --config python:opentaxii.http environment = OPENTAXII_CONFIG="/opt/eclecticiq/custom-opentaxii-configuration.yml" stdout_logfile = /var/log/opentaxii.log redirect_stderr = true autostart = true autorestart = true ``` -------------------------------- ### Run OpenTAXII with Gunicorn Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/running.md Execute this command to start OpenTAXII using the Gunicorn WSGI server. Ensure you have Gunicorn installed and are in the correct virtual environment. ```bash (venv) $ gunicorn opentaxii.http:app \ --bind localhost:9000 --config python:opentaxii.http ``` -------------------------------- ### Install Cabby Library Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md Install the Cabby library using pip. This is the first step to using the CLI tools. ```bash (venv) $ pip install cabby ``` -------------------------------- ### Verify Python Installation Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Check if Python is installed and its version by running the python3 command in your shell. ```sh $ python3 Python 3.10.1 (main, Dec 11 2021, 17:22:55) [GCC 11.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> ``` -------------------------------- ### Start OpenTAXII Instance with Docker Compose Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md Starts the OpenTAXII service using a Docker Compose file. This command assumes the compose file is located at 'examples/docker-compose-taxii2.yml'. ```shell # Start docker compose -f examples/docker-compose-taxii2.yml up ``` -------------------------------- ### Install OpenTAXII from PyPI (globally) Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Install OpenTAXII directly using pip without a virtual environment. This is generally not recommended. ```sh $ pip install opentaxii ``` -------------------------------- ### Dockerfile for Extending OpenTAXII Image Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md An example Dockerfile to extend the official OpenTAXII image. It installs additional Python packages (mysql-python, custom-package) and copies a custom configuration file into the container. ```dockerfile FROM eclecticiq/opentaxii:latest MAINTAINER EclecticIQ RUN pip install mysql-python \ && pip install custom-package COPY opentaxii.yml /input/opentaxii.yml ``` -------------------------------- ### Run OpenTAXII with Docker Source: https://github.com/eclecticiq/opentaxii/blob/master/README.md This command starts a default development instance of OpenTAXII using Docker. The server will be accessible on port 9000. ```bash docker run -d -p 9000:9000 eclecticiq/opentaxii ``` -------------------------------- ### Install OpenTAXII from PyPI (within venv) Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Install the latest OpenTAXII release from the Python Package Index using pip while inside a virtual environment. ```sh (venv) $ pip install opentaxii ``` -------------------------------- ### PostgreSQL Configuration for OpenTAXII Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/configuration.md An example of a custom YAML configuration for OpenTAXII to connect to a PostgreSQL database. This is recommended for production environments. ```yaml --- auth_api: class: opentaxii.auth.sqldb.SQLDatabaseAPI parameters: db_connection: postgresql://username:P@ssword@db.example.com:5432/databasename create_tables: yes secret: SECRET-STRING-NEEDS-TO-BE-CHANGED taxii1: persistence_api: class: opentaxii.persistence.sqldb.SQLDatabaseAPI parameters: db_connection: postgresql://username:P@ssword@db.example.com:5432/databasename create_tables: yes ``` -------------------------------- ### Run OpenTAXII in Development Mode Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/contribute/running.md Use this command to start the OpenTAXII server in development mode. This mode activates Flask debug mode and simplifies logging for easier human readability. The server will bind to localhost:9000. ```sh (venv) $ opentaxii-run-dev ``` -------------------------------- ### Authentication Token Response Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/auth.md Example JSON response from the authentication service containing the JWT token. ```json { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoxLCJleHAiOjE0Mjc2MzgyMjN9.oKd43j4KR1Ovu8zOtwFdeaKILys_kpl3fAiECclP7_4" } ``` -------------------------------- ### Run Default OpenTAXII Docker Instance Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md Starts a default OpenTAXII instance in detached mode, exposing port 9000. This instance uses a local SQLite database for data storage. ```shell $ docker run -d -p 9000:9000 eclecticiq/opentaxii ``` -------------------------------- ### Discover TAXII Services Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md Use the 'taxii-discovery' command to get a list of advertised services from a TAXII endpoint. Ensure OpenTAXII is running and accessible. ```bash (venv) $ taxii-discovery --path http://localhost:9000/services/discovery-a ``` -------------------------------- ### Poll Service with JWT Authentication Support Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/auth.md Example of using the `taxii-poll` CLI command with username, password, and JWT authentication path for service access. ```sh # using JWT support in Cabby (venv) $ taxii-poll \ --host localhost \ --port 9000 \ --path /services/poll-a \ --collection collection-a \ --username test \ --password test \ --jwt-auth /management/auth ``` -------------------------------- ### Poll Service with Raw Authorization Header Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/auth.md Example of using the `taxii-poll` CLI command with a raw JWT Authorization header to query a service. ```sh # using raw HTTP header (venv) $ taxii-poll \ --path http://localhost:9000/services/poll-a \ --collection collection-a \ --header Authorization:'Bearer eyJleHAiOjE0MjY3OTMwOTYsImFsZyI6IkhTMjU2IiwiaWF0IjoxNDI2Nzg1ODk2fQ.eyJ1c2VyX2lkIjoxfQ.YsZIdbrU92dL8j5G8ydVAsdWHXtx371vC0POmXrS3W8' ``` -------------------------------- ### Get TAXII Collections List Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md Use the 'taxii-collections' command to retrieve the list of available collections from a Collection Management Service. This requires the service path. ```bash (venv) $ taxii-collections --path http://localhost:9000/services/collection-management-a ``` -------------------------------- ### Create Account CLI Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/accounts.md Use this command to create a new account with specified username, password, and admin privileges. ```shell opentaxii-create-account --username --password --admin ``` -------------------------------- ### OpenTAXII Sync Data CLI Help Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/taxii1_services_collections.md Displays the usage help for the `opentaxii-sync-data` command, outlining its arguments and options for configuration. ```bash (venv) $ opentaxii-sync-data --help usage: opentaxii-sync-data [-h] [-f] config Create services/collections/accounts positional arguments: config YAML file with data configuration optional arguments: -h, --help show this help message and exit -f, --force-delete force deletion of collections and their content blocks if collection is not defined in configuration file (default: False) ``` -------------------------------- ### Add Dummy Data to Running Docker Compose Instance Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md Executes a script to add dummy data to a running OpenTAXII instance managed by Docker Compose. The script 'examples/taxii2/data-setup.sh' is piped into the container named 'examples-opentaxii-1'. ```shell # To add dummy data, run this while the compose project is running docker exec -i examples-opentaxii-1 bash < examples/taxii2/data-setup.sh ``` -------------------------------- ### Activate Virtual Environment Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Activate the created virtual environment. The prompt will change to indicate the active environment. ```sh $ . venv/bin/activate (venv) $ ``` -------------------------------- ### Create Virtual Environment Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/installation.md Create a new virtual environment named 'venv' to isolate project dependencies. ```sh $ virtualenv venv ``` -------------------------------- ### Synchronize Data Configuration with CLI Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/taxii1_services_collections.md Command to synchronize the data configuration defined in a YAML file with the OpenTAXII database. ```bash (venv) $ opentaxii-sync-data examples/data-configuration.yml ``` -------------------------------- ### View Discovered Services Output Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md The output of the 'taxii-discovery' command lists details for each discovered service, including its type, address, and supported message bindings. ```text 2018-06-03 21:26:32,188 INFO: Sending Discovery_Request to http://localhost:9000/services/discovery-a 2018-06-03 21:26:32,207 INFO: 7 services discovered === Service Instance === Service Type: INBOX Service Version: urn:taxii.mitre.org:services:1.1 Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Service Address: http://localhost:9000/services/inbox-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 Inbox Service AC: [] Available: True Message: Custom Inbox Service Description A === Service Instance === Service Type: INBOX Service Version: urn:taxii.mitre.org:services:1.1 Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Service Address: http://localhost:9000/services/inbox-b Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 Inbox Service AC: ['urn:stix.mitre.org:xml:1.1.1', 'urn:custom.example.com:json:0.0.1'] Available: True Message: Custom Inbox Service Description B === Service Instance === Service Type: DISCOVERY Service Version: urn:taxii.mitre.org:services:1.1 Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Service Address: http://localhost:9000/services/discovery-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 Available: True Message: Custom Discovery Service description ..... snip ..... ``` -------------------------------- ### Sync Account Data Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/accounts.md YAML configuration for synchronizing account data, including username, password, and admin status. ```yaml accounts: - username: admin password: admin is_admin: yes ``` -------------------------------- ### Build Extended OpenTAXII Docker Image Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md Builds a new Docker image tagged 'eclecticiq/opentaxii-mysql' from a Dockerfile that extends the base OpenTAXII image. ```shell $ docker build -t eclecticiq/opentaxii-mysql . ``` -------------------------------- ### Docker Compose Configuration for OpenTAXII and PostgreSQL Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/docker.md A Docker Compose configuration file defining two services: 'db' for PostgreSQL and 'opentaxii' for the OpenTAXII application. It specifies environment variables for database connection and authentication, volume mounts for configuration, and port mappings. ```yaml db: image: postgres:9.4 environment: POSTGRES_USER: user POSTGRES_PASSWORD: password POSTGRES_DB: opentaxii opentaxii: image: eclecticiq/opentaxii environment: DOCKER_OPENTAXII_AUTH_SECRET: secret OPENTAXII_DOMAIN: 192.168.59.103:9000 DATABASE_HOST: db DATABASE_NAME: opentaxii DATABASE_USER: user DATABASE_PASS: password volumes: - ./:/input:ro ports: - 9000:9000 links: - db:db ``` -------------------------------- ### Update Account CLI Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/accounts.md Commands to update an existing account's password or admin status. ```shell opentaxii-update-account --username --field password --value ``` ```shell opentaxii-update-account --username --field admin --value yes ``` ```shell opentaxii-update-account --username --field admin --value no ``` -------------------------------- ### Python TAXII 2 Client - Server Discovery and API Roots Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md Use the taxii2client library to connect to a TAXII 2 server and retrieve its title and available API roots. Ensure the server URL includes the trailing '/taxii2/'. ```python import taxii2client # With public discovery server = taxii2client.Server(url="http://localhost:9000/taxii2/") print(server.title) for root in server.api_roots: print(root.url) # With authentication api_root = taxii2client.ApiRoot( root.url, user="", password="" ) ``` -------------------------------- ### Set OpenTAXII Configuration Environment Variables Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/configuration.md Define various OpenTAXII configuration options using environment variables. This is useful for overriding default settings or settings from other configuration files. ```bash export OPENTAXII_DOMAIN='taxii.mydomain.com' export OPENTAXII_SUPPORT_BASIC_AUTH='no' export OPENTAXII__PERSISTENCE_API__CLASS='mypackage.opentaxii.CustomPersistenceAPI' export OPENTAXII__AUTH_API__PARAMETERS__SECRET='aueHenjitweridUcviapEbsJocdiDrelHonsyorl' ``` -------------------------------- ### Default OpenTAXII Configuration Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/configuration.md This is the default YAML configuration for OpenTAXII. It uses SQLite for both authentication and persistence APIs and is suitable for development environments. ```yaml --- domain: "localhost:9000" support_basic_auth: yes return_server_error_details: no auth_api: class: opentaxii.auth.sqldb.SQLDatabaseAPI parameters: db_connection: sqlite:////tmp/auth.db create_tables: yes secret: SECRET-STRING-NEEDS-TO-BE-CHANGED token_ttl_secs: 3600 taxii1: save_raw_inbox_messages: yes xml_parser_supports_huge_tree: yes count_blocks_in_poll_responses: no unauthorized_status: UNAUTHORIZED hooks: persistence_api: class: opentaxii.persistence.sqldb.SQLDatabaseAPI parameters: db_connection: sqlite:////tmp/data.db create_tables: yes taxii2: logging: opentaxii: info root: info ``` -------------------------------- ### Obtain Token with Form-Encoded Data Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/auth.md Use this cURL command to obtain an authentication token by sending username and password as form-encoded data to the authentication service. ```sh (venv) $ curl -d 'username=test&password=test' http://localhost:9000/management/auth ``` -------------------------------- ### Set Custom Configuration Path Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/installation/configuration.md Set the OPENTAXII_CONFIG environment variable to specify the absolute path to your custom YAML configuration file. ```sh export OPENTAXII_CONFIG=/path/to/configuration/file.yml ``` -------------------------------- ### Obtain Token with JSON Data Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/auth.md Use this cURL command to obtain an authentication token by sending username and password in a JSON payload to the authentication service. ```sh (venv) $ curl -H "Content-Type: application/json" -d '{"username":"test","password":"test"}' http://localhost:9000/management/auth ``` -------------------------------- ### Add Default API Root Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/taxii2_apiroot_collections.md Creates a default API root for TAXII 2. This command is used to establish the base endpoint for TAXII services. ```shell opentaxii-add-api-root --title default --description "The default API root" --default ``` -------------------------------- ### View Collections Information Output Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/sending_requests.md The output details each data collection, including its name, type, availability, supported content types, and associated polling, subscription, and inbox services. ```text 2018-06-03 21:30:03,315 INFO: Sending Collection_Information_Request to http://localhost:9000/services/collection-management-a === Data Collection Information === Collection Name: collection-a Collection Type: DATA_SET Available: True Collection Description: None Supported Content: All === Polling Service Instance === Poll Protocol: urn:taxii.mitre.org:protocol:http:1.0 Poll Address: http://localhost:9000/services/poll-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Subscription Service === Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Address: http://localhost:9000/services/collection-management-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Subscription Service === Protocol Binding: urn:taxii.mitre.org:protocol:https:1.0 Address: https://localhost:9000/services/collection-management-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Receiving Inbox Service === Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Address: http://localhost:9000/services/inbox-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 Supported Contents: All ================================== === Data Collection Information === Collection Name: collection-b Collection Type: DATA_FEED Available: True Collection Description: None Supported Content: urn:stix.mitre.org:xml:1.1.1 === Polling Service Instance === Poll Protocol: urn:taxii.mitre.org:protocol:http:1.0 Poll Address: http://localhost:9000/services/poll-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Subscription Service === Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Address: http://localhost:9000/services/collection-management-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Subscription Service === Protocol Binding: urn:taxii.mitre.org:protocol:https:1.0 Address: https://localhost:9000/services/collection-management-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 === Receiving Inbox Service === Protocol Binding: urn:taxii.mitre.org:protocol:http:1.0 Address: http://localhost:9000/services/inbox-a Message Binding: urn:taxii.mitre.org:message:xml:1.0 Message Binding: urn:taxii.mitre.org:message:xml:1.1 ``` -------------------------------- ### Check OpenTAXII Service Health Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/health_check.md Use this command to check if the OpenTAXII service is running and alive. The endpoint returns a JSON object indicating the service's status. ```shell $ curl http://localhost:9000/management/health { "alive": true } ``` -------------------------------- ### Add Public Collection to API Root Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/taxii2_apiroot_collections.md Adds a public collection to a specified API root. This allows for the organization and access of TAXII data within an API root. ```shell opentaxii-add-collection --rootid --title "A collection" --public ``` -------------------------------- ### Health Check Endpoint Source: https://github.com/eclecticiq/opentaxii/blob/master/docs/usage/health_check.md The OpenTAXII service provides a health check endpoint to verify its operational status. This endpoint returns a simple JSON object indicating whether the service is alive. ```APIDOC ## GET /management/health ### Description Checks the health status of the OpenTAXII service. ### Method GET ### Endpoint /management/health ### Response #### Success Response (200) - **alive** (boolean) - Indicates if the service is alive. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.