Skip to content

Commit b4178bf

Browse files
authored
Merge pull request #345 from atomicturtle/docs/issue-154
Expand manager backup and migration guide (#154)
2 parents 7538cf0 + a457330 commit b4178bf

2 files changed

Lines changed: 76 additions & 20 deletions

File tree

docs/manual/installation/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ The best installation tutorial is available in the `OSSEC book <http://www.amazo
2222
upgrade-migration
2323
systemd-deployment
2424

25-
26-
25+
See also :ref:`manager_backup` for backing up or migrating a manager to new hardware.
Lines changed: 75 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,93 @@
1-
Migrating/backing up the manager
2-
--------------------------------
1+
.. _manager_backup:
32

4-
If you need to migrate the manager to another system (or just want to backup the current setup), these are the files you need:
3+
Manager backup and migration
4+
============================
55

6-
These are the two locations where the keys are saved for all the agents.
6+
Use this guide to back up an OSSEC manager or migrate it to new hardware.
7+
For **version upgrades** (for example 3.8 to 4.x), see :ref:`upgrade-migration`
8+
instead — crypto and agent compatibility differ from a like-for-like host move.
9+
10+
When to use this guide
11+
----------------------
12+
13+
* **Backup** — periodic snapshot before major changes
14+
* **Hardware migration** — move the manager to a new server at the **same OSSEC version**
15+
* **Disaster recovery** — restore from backup after failure
16+
17+
Pre-migration checklist
18+
-----------------------
19+
20+
1. Record the installed OSSEC version: ``/var/ossec/bin/ossec-control info``
21+
2. Note the agent count: ``/var/ossec/bin/agent_control -l``
22+
3. Stop OSSEC cleanly: ``/var/ossec/bin/ossec-control stop``
23+
4. Ensure no package upgrade is pending on the destination unless you also follow
24+
:ref:`upgrade-migration`
25+
26+
Files to copy
27+
-------------
28+
29+
Agent keys and registration
30+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
731

832
.. code-block:: console
933
10-
/var/ossec/etc/client.keys
11-
/var/ossec/queue/rids/
34+
/var/ossec/etc/client.keys
35+
/var/ossec/queue/rids/
1236
13-
These are the configuration files you may want to keep
37+
Configuration and rules
38+
^^^^^^^^^^^^^^^^^^^^^^^
1439

1540
.. code-block:: console
1641
17-
/var/ossec/etc/*.conf
18-
/var/ossec/rules
19-
/var/ossec/etc/*.xml
20-
/var/ossec/etc/shared/agent.conf
42+
/var/ossec/etc/ossec.conf
43+
/var/ossec/etc/internal_options.conf
44+
/var/ossec/etc/local_internal_options.conf
45+
/var/ossec/etc/shared/
46+
/var/ossec/rules/
47+
/var/ossec/etc/decoders/
48+
/var/ossec/etc/lists/
2149
50+
Agent state databases (optional but recommended)
51+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2252

23-
These are the databases where we store data for the agents.
53+
Preserves FIM baselines, rootcheck state, and similar per-agent data:
2454

2555
.. code-block:: console
2656
27-
/var/ossec/queue/syscheck
28-
/var/ossec/queue/rootcheck
29-
/var/ossec/queue/fts
30-
/var/ossec/queue/agentless
57+
/var/ossec/queue/syscheck/
58+
/var/ossec/queue/rootcheck/
59+
/var/ossec/queue/fts/
60+
/var/ossec/queue/agentless/
61+
/var/ossec/queue/agents/
3162
32-
Logs stored if they are needed.
63+
Logs (optional)
64+
^^^^^^^^^^^^^^^
3365

3466
.. code-block:: console
3567
36-
/var/ossec/logs
68+
/var/ossec/logs/
69+
70+
Restore procedure
71+
-----------------
72+
73+
1. Install the **same OSSEC version** on the destination host (see :ref:`install`).
74+
2. Stop OSSEC on the destination: ``/var/ossec/bin/ossec-control stop``
75+
3. Copy backed-up files into ``/var/ossec/``, preserving ownership (``ossec:ossec``
76+
or your platform's equivalent).
77+
4. If the manager IP or hostname changed, update agent ``<server-ip>`` or
78+
``<server-hostname>`` on each agent, or use DNS that resolves to the new host.
79+
5. Start OSSEC: ``/var/ossec/bin/ossec-control start``
80+
6. Verify agents reconnect: ``/var/ossec/bin/agent_control -l`` — agents should
81+
show as **Active** within a few minutes.
82+
83+
.. note::
84+
85+
You do not need to re-enroll agents if ``client.keys`` and ``queue/rids/`` were
86+
copied intact and the manager identity is unchanged.
87+
88+
Verification
89+
------------
90+
91+
* ``/var/ossec/bin/ossec-control status`` — all required daemons running
92+
* ``/var/ossec/bin/agent_control -l`` — expected agents active
93+
* Review ``/var/ossec/logs/ossec.log`` for authentication or rule errors

0 commit comments

Comments
 (0)