|
1 | | -Migrating/backing up the manager |
2 | | --------------------------------- |
| 1 | +.. _manager_backup: |
3 | 2 |
|
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 | +============================ |
5 | 5 |
|
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 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
7 | 31 |
|
8 | 32 | .. code-block:: console |
9 | 33 |
|
10 | | - /var/ossec/etc/client.keys |
11 | | - /var/ossec/queue/rids/ |
| 34 | + /var/ossec/etc/client.keys |
| 35 | + /var/ossec/queue/rids/ |
12 | 36 |
|
13 | | -These are the configuration files you may want to keep |
| 37 | +Configuration and rules |
| 38 | +^^^^^^^^^^^^^^^^^^^^^^^ |
14 | 39 |
|
15 | 40 | .. code-block:: console |
16 | 41 |
|
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/ |
21 | 49 |
|
| 50 | +Agent state databases (optional but recommended) |
| 51 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
22 | 52 |
|
23 | | -These are the databases where we store data for the agents. |
| 53 | +Preserves FIM baselines, rootcheck state, and similar per-agent data: |
24 | 54 |
|
25 | 55 | .. code-block:: console |
26 | 56 |
|
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/ |
31 | 62 |
|
32 | | -Logs stored if they are needed. |
| 63 | +Logs (optional) |
| 64 | +^^^^^^^^^^^^^^^ |
33 | 65 |
|
34 | 66 | .. code-block:: console |
35 | 67 |
|
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