This page is a placeholder for people having difficulty configuring remote agent management when using Splunk for OSSEC.
See answer and troubleshooting steps below.
By following the steps below, you will be granting the Splunk service account access to log into your OSSEC server and run commands. Be sure you fully understand any security implications for your environment before proceeding.
In particular, enabling the
MANAGE_AGENTS option will allow anyone with sufficient access in Splunk to see and modify your OSSEC agent keys.
Examples below assume the default configuration (Splunk running as root and installed in /opt/splunk, OSSEC installed in /var/ossec), and that you will use an account named
splunk to log into the OSSEC server.
Basic familiarity with unix and OSSEC is assumed. Basic commands to log in and out, etc. are not shown.
First, you will need to make sure that the Splunk server can log into the OSSEC server to run management commands.
On the OSSEC server, create a new login account for the Splunk server to use when connecting.
root@ossec_server$ useradd splunk
On the Splunk server, create an SSH keypair for the root user (or whichever account splunkd is running as), and copy the public key to the OSSEC server.
user@splunkserver$ sudo su -
root@splunkserver# scp .ssh/idrsa.pub splunk@ossecserver:authorizedkeys
On the OSSEC server, log in as the splunk account and configure the authorizedkeys file to allow SSH logins without a password:
splunk@ossecserver$ mkdir .ssh
splunk@ossecserver$ mv authorizedkeys .ssh/
splunk@ossecserver$ chmod -R go-rwx .ssh
Verify that the Splunk server can log into the OSSEC server without a password prompt.
You MUST do this at least once and say
yes to the SSH key prompt.
The second run should not prommpt.
root@splunkserver# ssh splunk@ossec_server splunk@ossecserver$ exit root@splunkserver# ssh splunk@ossec_server splunk@ossecserver$ exit
On the OSSEC server, configure
sudo to allow the splunk login account to run agent management commands without prompting.
(Add the following two lines):
splunk ALL=NOPASSWD: /var/ossec/bin/agentcontrol -l
splunk ALL=NOPASSWD: /var/ossec/bin/manageagents
On the OSSEC server, verify that the new
splunk account can run the agent management commands without prompting. If either of the following commands prompts for a password, you may have made a mistake in the previous step:
splunk@ossecserver$ sudo /var/ossec/bin/agentcontrol -l
splunk@ossecserver$ sudo /var/ossec/bin/manageagents
On the Splunk server, verify that you can remotely run the commands without a password:
root@splunk-server$ ssh ossec-server -t -l splunk sudo /var/ossec/bin/agentcontrol -l
root@splunk-server$ ssh ossec-server -t -l splunk sudo /var/ossec/bin/manageagents
All of the following steps are performed on the Splunk server.
Check to see if you already have a local copy of ossecservers.conf:
root@splunkserver# cd /opt/splunk/etc/apps/ossec
root@splunk_server# ls -l local
local directory and
ossec_servers.conf file if they are missing:
root@splunkserver# mkdir local
root@splunkserver# cp default/ossec_servers.conf local/
local/ossec_servers.conf and disable the local machine if you do not have an OSSEC server on the local machine.
DISABLED = True
local/ossec_servers.conf, add your new server:
(If your ssh key is in the default path, the '-i' parameter used in some examples is not reuquired)
AGENTCONTROL = ssh ossec-server -t -l splunk sudo /var/ossec/bin/agentcontrol
MANAGEAGENTS = ssh ossec-server -t -l splunk sudo /var/ossec/bin/manage_agents
Optional: Restart the Splunk daemon to force the scripted inputs to run immediately.
/opt/splunk/bin/splunk restart splunkd
Optional: In the Splunk for OSSEC app, run the saved searches to regenerate lookup tables. Run each of the following searches from the menu under Searches & Reports -> Utility: