diff --git a/opencti-documentation/docs/development/installation.md b/opencti-documentation/docs/development/installation.md index 3114ee5bdfb4..dd32b803e4c4 100644 --- a/opencti-documentation/docs/development/installation.md +++ b/opencti-documentation/docs/development/installation.md @@ -7,7 +7,7 @@ sidebar_label: Development environment ## Prerequisites - Docker -- Node.JS (>= 12) +- Node.JS (>= 12.* < 13.0.0) - Python (>= 3) - Yarn (>= 1.16) diff --git a/opencti-documentation/docs/installation/manual.md b/opencti-documentation/docs/installation/manual.md index 9dbc1675520d..c299c76834ea 100644 --- a/opencti-documentation/docs/installation/manual.md +++ b/opencti-documentation/docs/installation/manual.md @@ -6,8 +6,8 @@ sidebar_label: Manual deployment ## Prerequisites -- Node.JS (>= 12) -- Grakn (>= 1.5.9) +- Node.JS (>= 12.* < 13.0.0) +- Grakn (== 1.5.9) - Redis (>= 3.0) - ElasticSearch (>= 7.5) - Minio (>= 20191012) diff --git a/opencti-documentation/website/versioned_docs/version-2.1.1/clients/python/overview.md b/opencti-documentation/website/versioned_docs/version-2.1.1/clients/python/overview.md new file mode 100644 index 000000000000..813380fc5f85 --- /dev/null +++ b/opencti-documentation/website/versioned_docs/version-2.1.1/clients/python/overview.md @@ -0,0 +1,36 @@ +--- +id: version-2.1.1-overview +title: OpenCTI Python client +sidebar_label: Overview +original_id: overview +--- + +The `pycti` library is designed to help OpenCTI users and developers to programatically interact with the GraphQL API. It has been architectured to be easy to use and easy to maintain. The Python library requires Python >= 3. Let's get started. + +## Installation + +```bash +$ pip install pycti +``` + +## Getting started + +### Initialization + +The main class contains all what you need to interact with the platform, you just have to initialize it: + +```python +# coding: utf-8 + +from pycti import OpenCTIApiClient + +# OpenCTI initialization +opencti_api_client = OpenCTIApiClient(api_url, api_token, log_level, ssl_verify) +``` + +| Argument | Type | Description | +| -------------------------- | ------------------ | --------------------------------------------------------------------| +| api_url (*required*) | String | The URL of the OpenCTI instance | +| api_token (*required*) | String | The OpenCTI token | +| log_level (*optional*) | String | Log level, could be 'debug', 'info', 'warning' or 'error' | +| ssl_verify (*optional*) | Boolean | Enable or disable the SSL certificate verification | \ No newline at end of file diff --git a/opencti-documentation/website/versioned_docs/version-2.1.1/development/installation.md b/opencti-documentation/website/versioned_docs/version-2.1.1/development/installation.md new file mode 100644 index 000000000000..6a1819f22a4d --- /dev/null +++ b/opencti-documentation/website/versioned_docs/version-2.1.1/development/installation.md @@ -0,0 +1,137 @@ +--- +id: version-2.1.1-installation +title: Development environment installation +sidebar_label: Development environment +original_id: installation +--- + +## Prerequisites + +- Docker +- Node.JS (>= 12.* < 13.0.0) +- Python (>= 3) +- Yarn (>= 1.16) + +### Installation of dependencies (Ubuntu 18.04) + +```bash +$ sudo apt-get install nodejs python3 python3-pip +$ sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +$ sudo echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +$ sudo apt-get update && sudo apt-get install yarn +``` + +### Docker stack + +As OpenCTI has a dependency to ElasticSearch, you have to set the *vm.max_map_count* before running the containers, as mentioned in the [ElasticSearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode). + +```bash +$ sysctl -w vm.max_map_count=262144 +``` + +Clone the latest version of the dev docker compose and start + +```bash +$ git clone https://github.com/OpenCTI-Platform/docker.git +$ cd docker +$ docker-compose -f ./docker-compose-dev.yml up -d +``` + +## Clone the project + +```bash +$ git clone https://github.com/OpenCTI-Platform/opencti.git +$ cd opencti +``` + +## Application dependencies + +### Install the API dependencies + +```bash +$ cd opencti-platform/sopencti-graphql +$ yarn install +``` + +### Install the frontend dependencies +```bash +$ cd ../opencti-front +$ yarn install +``` + +### Install the worker dependencies + +```bash +$ cd ../../opencti-worker +$ pip3 install -r requirements.txt +``` + +## Config and run + +### GraphQL API + +#### Configure + +```bash +$ cp config/default.json config/development.json +``` +By default the configuration match the docker stack configuration. +You just need to change the user part: +```bash +"admin": { + "email": "admin@opencti.io", + "password": "ChangeMe", + "token": "ChangeMe" +} +``` + +#### Start + +```bash +$ cd opencti-graphql +$ yarn start +``` + +The first execution will create and migrate the schema. + +### Worker + +#### Configure + +```bash +$ cd opencti-worker +$ cp config.yml.sample config.yml +``` +Change the *config.yml* file according to your + +#### Start + +```bash +$ python3 worker.py & +``` + +### Frontend + +#### Start + +```bash +$ cd opencti-frontend +$ yarn start +``` + +## Build for production use + +### Build the application + +```bash +$ cd opencti-frontend +$ yarn build +$ cd ../opencti-graphql +$ yarn build +``` + +### Start the production package + +```bash +$ yarn serv +``` diff --git a/opencti-documentation/website/versioned_docs/version-2.1.1/installation/manual.md b/opencti-documentation/website/versioned_docs/version-2.1.1/installation/manual.md new file mode 100644 index 000000000000..e8e6d75fb88a --- /dev/null +++ b/opencti-documentation/website/versioned_docs/version-2.1.1/installation/manual.md @@ -0,0 +1,89 @@ +--- +id: version-2.1.1-manual +title: Manual installation +sidebar_label: Manual deployment +original_id: manual +--- + +## Prerequisites + +- Node.JS (>= 12.* < 13.0.0) +- Grakn (== 1.5.9) +- Redis (>= 3.0) +- ElasticSearch (>= 7.5) +- Minio (>= 20191012) +- RabbitMQ (>= 3.7) + +## Prepare the installation + +### Installation of dependencies + +You have to install all the needed dependencies for the main application and the workers. The example below if for Ubuntu: + +```bash +$ sudo apt-get install nodejs npm python3 python3-pip +``` + +### Download the application files + +Download and extract the latest release file. + +```bash +$ mkdir /path/to/your/app && cd /path/to/your/app +$ wget https://github.com/OpenCTI-Platform/opencti/releases/download/{RELEASE_VERSION}/opencti-release-{RELEASE_VERSION}.tar.gz +$ tar xvfz opencti-release-{RELEASE_VERSION}.tar.gz +``` + +## Install the main platform + +### Configure the application + +The main application has just one JSON configuration file to change. + +```bash +$ cd opencti +$ cp config/default.json config/production.json +``` + +Change the *config/production.json* file according to your configuration of Grakn, Redis, ElasticSearch, RabbitMQ and default credentials (the `ADMIN_TOKEN` must be a [valid UUID](https://www.uuidgenerator.net/)). + +### Start the application + +The application is just a NodeJS process, the creation of the database schema and the migration will be done at starting. + +```bash +$ node dist/server.js & +``` + +The default username and password are those you put in the `config/production.json` file. + +## Install the worker + +The OpenCTI worker is used to write the data coming from the RabbitMQ messages broker. + +#### Configure the worker + +```bash +$ cd worker +$ pip3 install -r requirements.txt +$ cp config.yml.sample config.yml +``` + +Change the *config.yml* file according to your OpenCTI token. + +#### Start as many workers as you need +```bash +$ python3 worker.py & +$ python3 worker.py & +``` + +## Upgrade the platform + +When upgrading the platform, you have to replace all files and run the migrations and the schema commands to get updates: + +```bash +$ npm run schema +$ npm run migrate +``` + +Then start the platform. \ No newline at end of file diff --git a/opencti-documentation/website/versions.json b/opencti-documentation/website/versions.json index 74b27f9744c0..946faf855a93 100644 --- a/opencti-documentation/website/versions.json +++ b/opencti-documentation/website/versions.json @@ -1,4 +1,5 @@ [ + "2.1.1", "2.1.0", "2.0.0", "1.1.2", diff --git a/opencti-platform/opencti-front/package.json b/opencti-platform/opencti-front/package.json index 56bf29d013d4..89e6fd74c1c5 100644 --- a/opencti-platform/opencti-front/package.json +++ b/opencti-platform/opencti-front/package.json @@ -84,7 +84,7 @@ "**/lodash": "4.17.15" }, "engines": { - "node": ">= 12.*" + "node": ">= 12.* < 13.0.0" }, "scripts": { "start": "yarn relay && react-app-rewired start", diff --git a/opencti-platform/opencti-graphql/package.json b/opencti-platform/opencti-graphql/package.json index 92bf1d3d2e7a..58e781a2b752 100644 --- a/opencti-platform/opencti-graphql/package.json +++ b/opencti-platform/opencti-graphql/package.json @@ -25,7 +25,7 @@ ] }, "engines": { - "node": ">= 12.*" + "node": ">= 12.* < 13.0.0" }, "dependencies": { "@babel/core": "^7.6.4", diff --git a/opencti-platform/opencti-graphql/src/domain/file.js b/opencti-platform/opencti-graphql/src/domain/file.js index 306caea0d284..0dc6b28de037 100644 --- a/opencti-platform/opencti-graphql/src/domain/file.js +++ b/opencti-platform/opencti-graphql/src/domain/file.js @@ -28,7 +28,8 @@ const uploadJobImport = async (fileId, fileMime) => { work_id: work.internal_id_key, // work(id) job_id: job.internal_id_key, // job(id) file_mime: fileMime, // Ex. application/json - file_path: `/storage/get/${fileId}` // Path to get the file + file_path: `/storage/get/${fileId}`, // Path to get the file + update: true }; return pushToConnector(connector, message); }, workList)