# Nextcloud (Docker) - Crowdsec (Docker)

**URL:** <https://discourse.crowdsec.net/t/nextcloud-docker-crowdsec-docker/2052>\
**Category:** Uncategorized\
**Created:** [October 7, 2024, 8:42pm UTC](https://discourse.crowdsec.net/t/nextcloud-docker-crowdsec-docker/2052 "2024-10-07T20:42:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CK1](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@CK1](https://discourse.crowdsec.net/u/CK1)\
**Post date:** [October 7, 2024, 8:42pm UTC](https://discourse.crowdsec.net/t/nextcloud-docker-crowdsec-docker/2052/1 "2024-10-07T20:42:09Z")

</div>

Hi guys,

I have a small problem with my Nexcloud (Docker) and Crowdsec (Docker).

I want to protect my Nextcloud, which is publicly available over the internet (for sharing files with friends. No persistent data), using Crowdsec.

To do this, I have installed Crowdsec in a Docker (see docker-compose)

```auto
version: "3"                                                                                                                                                                                 
services:
   crowdsec:
	image: crowdsecurity/crowdsec
	container_name: crowdsec
	environment:
		PGID: "1000"
		COLLECTIONS: "crowdsecurity/traefik crowdsecurity/http-cve"
	expose:
		- "8080"
	volumes:
		- ./log/crowdsec:/var/log/crowdsec:ro
		- ./crowdsec-db:/var/lib/crowdsec/data ## Data Directory
		- ./log/auth.log:/var/log/auth.log:ro
		- ./crowdsec:/etc/crowdsec ## Configuration Directory
	restart: unless-stopped
	labels:
	- traefik.enable=false
	networks:
	- proxy-network

networks:
  proxy-network:
    driver: bridge

```

I then did an enroll:  
`sudo docker exec crowdsec cscli console enroll KEY_ABCDEFGHIJKLMNOPQRSTUVWXYZ`

Now I would like to install the following plugin:

> **[Threat Detection & Blocklist | CrowdSec Console](https://app.crowdsec.net/hub/author/crowdsecurity/configurations/nextcloud-logs)**
>
> Use CrowdSec Console to visualize security data, manage dynamic blocklists, and gain real-time intelligence on IPs. Enhance your threat response capabilities.

I have done the following according to the instructions:

Installation Plugin:` sudo docker exec crowdsec cscli parsers install crowdsecurity/nextcloud-logs`

Now I have to import the configuration somehow, but there is a problem.

Where do I write this code, which is described in the description ([Hub configuration](https://app.crowdsec.net/hub/author/crowdsecurity/configurations/nextcloud-logs)):

```auto
filenames:
 - /var/www/nextcloud/data/nextcloud.log
labels:
  type: Nextcloud

```

This is the location of the Nexcloud Docker log file (access only via root):  
`/mydata/nextcloud-docker/nextcloud/data/nextcloud.log`

extract docker-compose.yml from the Nextcloud:

```auto
volumes:
		- ./nextcloud:/var/www/html

```

Thank you in advance.

Best regards  
CK

###########German##############

Hallo Leute,

ich habe ein kleines Problem mit meiner Nexcloud (Docker) und Crowdsec (Docker).

Ich möchte meine Nextcloud, die öffentlich über das Internet verfügbar ist (zum Austausch von Dateien mit Freunden. Keine Persistenten Daten), mittels Crowdsec schützen.

Dazu habe ich Crowdsec in einem Docker installiert (siehe docker-compose)

docker-compose.yml (Crowdsec)

```auto
version: "3"                                                                                                                                                                                 
services:
   crowdsec:
	image: crowdsecurity/crowdsec
	container_name: crowdsec
	environment:
		PGID: "1000"
		COLLECTIONS: "crowdsecurity/traefik crowdsecurity/http-cve"
	expose:
		- "8080"
	volumes:
		- ./log/crowdsec:/var/log/crowdsec:ro
		- ./crowdsec-db:/var/lib/crowdsec/data ## Data Directory
		- ./log/auth.log:/var/log/auth.log:ro
		- ./crowdsec:/etc/crowdsec ## Configuration Directory
	restart: unless-stopped
	labels:
	- traefik.enable=false
	networks:
	- proxy-network

networks:
  proxy-network:
    driver: bridge

```

Im Anschluss habe ich einen Enroll gemacht  
`sudo docker exec crowdsec cscli console enroll KEY_ABCDEFGHIJKLMNOPQRSTUVWXYZ`

Nun möchte ich das folgende Plugin installieren: crowdsec: nextcloud-logs

Folgendes habe ich laut Anleitung durchgeführt:

Installation Plugin:` sudo docker exec crowdsec cscli parsers install crowdsecurity/nextcloud-logs`

Nun muss ich irgendwie die Konfiguration einspielen, da aber hakte es bei mir.

Wo schreibe ich diesen Code hin, der in der Description von nextcloud-logs) beschrieben ist:

```auto
filenames:
 - /var/www/nextcloud/data/nextcloud.log
labels:
  type: Nextcloud

```

Das ist der Ort der Nexcloud Docker Logfile (Zugriff nur über Root)  
`/mydata/nextcloud-docker/nextcloud/data/nextcloud.log`

Auszug docker-compose.yml von der Nextcloud:

```auto
 volumes:
		- ./nextcloud:/var/www/html

```

Danke schon im Voraus.

Viele Grüße  
CK

---

<div class="post-metadata">

**Author:** ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)\
**Post date:** [October 9, 2024, 7:31am UTC](https://discourse.crowdsec.net/t/nextcloud-docker-crowdsec-docker/2052/2 "2024-10-09T07:31:14Z")

</div>

> [@CK1](#):
>
> Where do I write this code, which is described in the description ([Hub configuration](https://app.crowdsec.net/hub/author/crowdsecurity/configurations/nextcloud-logs)):

You can mount a custom file into the directly for example at the root of the docker-compose directory you can have `nextcloud.yaml` and mount it like so

```auto
	volumes:
		- ./log/crowdsec:/var/log/crowdsec:ro
		- ./crowdsec-db:/var/lib/crowdsec/data ## Data Directory
		- ./log/auth.log:/var/log/auth.log:ro
		- ./crowdsec:/etc/crowdsec ## Configuration Directory
        - ./nextcloud.yaml:/etc/crowdsec/acquis.d/nextcloud.yaml ## Nextcloud acquisition

```

or you can go into `./crowdsec` relative to the compose directory and find the `acquis.d` folder within there and manually created it here instead of mounting an additional file.
