1) 进入OSSEC的安装目录并添加agent
#cd /var/ossec/bin
#./manage_agents
2) 选择添加一个Agent
****************************************
* OSSEC HIDS v2.4.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: A
3) 填写Agent的名称、ip地址及序号
- Adding a new agent (use '\q' to return to the main menu).
  Please provide the following:
   * A name for the new agent: zzt
   * The IP Address of the new agent: 10.16.26.199
   * An ID for the new agent[001]: 001
Agent information:
   ID:001
   Name:zzt
   IP Address:10.16.26.199

Confirm adding it?(y/n): y
Agent added.


5 生成key在服务器端生成key
****************************************
* OSSEC HIDS v2.4.1 Agent manager.     *
* The following options are available: *
****************************************
   (A)dd an agent (A).
   (E)xtract key for an agent (E).
   (L)ist already added agents (L).
   (R)emove an agent (R).
   (Q)uit.
Choose your action: A,E,L,R or Q: E

Available agents:
   ID: 001, Name: zzt, IP: 10.16.26.199
Provide the ID of the agent to extract the key (or '\q' to quit): 001

Agent key information for '001' is:
MDAxIHp6dCAxMC4xNi4yNi4xOTkgOWI4YTY1NWI3ZjhkY2Y5MDJmZmI2ZGQxZmY4YzgyOGY4YzA5ZmQ3ZTBmMDY4NTVlNDI4Y2VkZDI4OTUzOTBhMQ==

** Press ENTER to return to the main menu.