# pwndocImportAutomator

To clone repo with submodules:

```sh
git clone --recurse-submodules git@gitlab.fi.muni.cz:cybersec/tns/pwndocimportautomator.git
cd pwndocimportautomator

```

## Deployment - Docker-compose

The recommended deployment process is using Docker-compose.

```sh
# MANUAL STEP: Fill in docker.env file (use .env.dist as a template)

# Setup TLS Client Auth:
# Option 1: Keep it disabled.
    # touch nginx/trusted_client_certs.pem
# Option 2: Set it up.
    # MANUAL STEP: create file nginx/trusted_client_certs.pem and put certificate(s) (CA or individual) there
    # sed -i 's/ssl_verify_client off;/ssl_verify_client on;/' nginx/nginx.conf

docker-compose up --build -d
```

How to stop the containers:
```
docker-compose down --remove-orphans
# note: flag -v would also remove the docker volume with the database (DANGEROUS)
```

HTTPS on port 8443
- Pwndoc: `/`
- ImportAutomator: `/import_automator` 

### DEV mode

Dev mode exposes ports of (most) containers. NEVER use it in production - it would leak sensitive information.

```sh
docker-compose -f docker-compose.yml -f docker-compose.dev-override.yml up --build -d
```

## First run setup steps

- Import Scan2Report templates using the web interface (they are no longer autoimported from ./scan2report/plugins/)

## How to backup

Before first run:
`sudo apt update && sudo apt install zip`

To run backup:
`./backup.sh`

## How to update

```sh
./backup.sh
git pull --recurse-submodules -X ours
./backup.sh
docker-compose up --build -d
```

#### Version 2022-09-29

This version needs a manual step - TLS Client Auth. See the first-run section above.

#### Version 2022-10-27

This version introduces more strict PwnDoc password requirements, so it might require change of password and related modification of files `.env` and `docker.env`.
- _Password must be at least 8 characters with minimum 1 Uppercase, Lowercase and Number_

## How to export scan2report plugins folder

HTTP request to `:5001/templates/export_as_scan2report_native` returns it as zip
