> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/f/foreman.md).

# Foreman

Foreman is an open-source lifecycle management tool for provisioning, configuring and monitoring physical and virtual servers. OctoXLabs reads its host and user lists and, optionally, the installed packages of each Linux host.

## Use cases

* List all hosts managed by Foreman.

```
Adapters = foreman
```

* Find Foreman hosts that are not known to the EDR.

```
Adapters = foreman AND NOT Adapters = falcon-crowdstrike
```

## Before you begin

### Network

| Source              | Destination    | Port                        | Protocol                           |
| ------------------- | -------------- | --------------------------- | ---------------------------------- |
| OctoXLabs connector | Foreman server | 443 (default, configurable) | HTTPS (HTTP when Is secure is off) |

### Required permissions

| Scope or role                        | Permission                                                              | Needed for                    |
| ------------------------------------ | ----------------------------------------------------------------------- | ----------------------------- |
| Foreman role                         | `view_hosts`                                                            | Devices                       |
| Organization and location assignment | The organizations and locations to read must be assigned to the account | Devices                       |
| Katello plugin                       | Hosts registered as content hosts                                       | Installed packages (optional) |

Permissions for the users list are Not verified.

## Create credentials in Foreman

{% stepper %}
{% step %}

### Select a user

In the Foreman web UI, go to **Administer** > **Users** and select the user OctoXLabs will use. Make sure the user has the `view_hosts` permission and the needed organizations and locations.
{% endstep %}

{% step %}

### Create a Personal Access Token

1. Open the **Personal Access Tokens** tab of the user.
2. Click **Add Personal Access Token**.
3. Enter a name and click **Submit**.
4. Copy the token.

{% hint style="danger" %}
The token cannot be shown again after you leave the page. Store it securely.
{% endhint %}
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter      | Required | Type             | Default | Description                                                                                                                                                               |
| -------------- | -------- | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ip             | Yes      | Text             | None    | IP address or host name of Foreman.                                                                                                                                       |
| Port           | No       | Integer          | 443     | Port number.                                                                                                                                                              |
| Username       | Yes      | Text             | None    | Foreman user name.                                                                                                                                                        |
| Access token   | Yes      | Text (sensitive) | None    | Personal Access Token.                                                                                                                                                    |
| Is secure      | No       | Boolean          | True    | Use HTTPS. Advanced.                                                                                                                                                      |
| Timeout        | No       | Integer          | 30      | Seconds to wait for API responses. Advanced.                                                                                                                              |
| Fetch packages | No       | Boolean          | False   | Fetch RPM and DEB packages of each host as installed software. Needs Katello and content host registration. Adds API calls per host and can lengthen discovery. Advanced. |
| Thread count   | No       | Integer          | 32      | Parallel threads for package requests. Minimum 1, maximum 32. Advanced.                                                                                                   |

## Troubleshooting

| Error message                                                                                              | Cause                                                           | Fix                                                                                   |
| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| `fetch_packages is enabled but no host is registered to Katello as a content host` (log warning)           | Fetch packages is on but no host has Katello subscription data. | Register hosts as content hosts, or turn Fetch packages off.                          |
| `Packages could not be fetched for <n> host(s); they are listed without installed software.` (log warning) | A package request failed for some hosts.                        | Check Katello on the host and the account permissions. The hosts are still collected. |

## Change history

{% hint style="info" %}
Available starting from version 5.4.2.
{% endhint %}
