> For the complete documentation index, see [llms.txt](https://kchuene.gitbook.io/data-communication-project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kchuene.gitbook.io/data-communication-project/archive/ossec-server.md).

# OSSEC Server

Wazuh alternative SIEM and Host Based IDS.

## Installation

**Docker compose configuration**

{% code overflow="wrap" lineNumbers="true" %}

```
services:
    ossec:
        container_name: ossec-server
        image: atomicorp/ossec-docker:v3.6
        ports:
            - 1514:1514/udp
            - 1515:1515/tcp
        volumes:
            - ossec-data:/var/ossec/data 
volumes:
    ossec-data:
```

{% endcode %}

{% hint style="info" %}
**Logs** and **Agent Key Data** are stored under `/var/ossec/data` in the container.
{% endhint %}

**Pull image and Create + Run container**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker compose pull
sudo docker compose up -d
```

{% endcode %}

## Access

**Attach an interactive shell to the container**

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker exec -it ossec-server bash
```

{% endcode %}

## Adding an Agent

**Automated key addition approach**

Temporarily setup an authentication listener on the server

{% code overflow="wrap" lineNumbers="true" %}

```
sudo docker exec ossec-server /var/ossec/bin/ossec-authd -p 1515 -n
```

{% endcode %}

{% hint style="info" %}
The **-n** option disables password authentication, not recommended in general (since key sharing becomes insecure), but quick setup for the purpose of this lab. An alternative yet tedious approach, **"Managing Agents",** is referenced below.
{% endhint %}

Have the agent connect to the server to receive and install an agent-key using `agent-auth`. Then restart **OSSEC** processes (if its the first agent)

{% code overflow="wrap" lineNumbers="true" %}

```
/var/ossec/bin/ossec-control restart
```

{% endcode %}

**Confirm that the agent is communicating**

Insure you have edited the `/var/ossec/etc/ossec.conf` on the agent to point to the correct `server-ip`.

{% code overflow="wrap" lineNumbers="true" %}

```
/var/ossec/bin/agent_control -lc
```

{% endcode %}

**Kill the key distribution daemon**

{% code overflow="wrap" lineNumbers="true" %}

```
ps -ef | grep ossec-authd
kill 299 # PID=299
```

{% endcode %}

{% embed url="<https://hub.docker.com/r/atomicorp/ossec-docker/>" %}

{% embed url="<https://www.ossec.net/docs/>" %}

{% embed url="<https://www.ossec.net/docs/docs/manual/agent/agent-management.html>" %}

{% embed url="<https://www.ossec.net/docs/docs/manual/agent/agent-auth.html>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kchuene.gitbook.io/data-communication-project/archive/ossec-server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
