wazuh-ruby-client 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c784d3be1a47e0998b2f79b9a63141d20162b49279bfb176b9ec659802984f45
4
- data.tar.gz: e6d43cead09b6a4e4f272634b7152e436005b6e1eec54711a0e54ff20592dbaf
3
+ metadata.gz: d9ab93da31cf3dc939abb42a61a420cb79c69af263379e8cc767561c3ea362af
4
+ data.tar.gz: 74f160e980af447a6787779508d65afc533aadfb4edcae2d28452549b714c11d
5
5
  SHA512:
6
- metadata.gz: 1db95d93c43c7c76ac7904485d66e2e95613f20aae2612bcc8702f2a18c75d91b04c340f55814bde739a7b12b2152a9b8a8f263529a78af08a641abcb9096409
7
- data.tar.gz: 96df2d2cba6391f2f4850d15d6326a400f2d46654b5e040a1078019e5397f0690a7acbb260be5a5ffcf649e7bf237eb258339d943f928ade5f6b4e555f94e60f
6
+ metadata.gz: b57ab4847326df1aa8ec9015a432c0d3dbaacce88ff7b126fdeee138d919f0a8af045b94d5fb9976fd317a0f0b7e2f87571dfd1f73a3a169e04aeee15ea0e69f
7
+ data.tar.gz: 4be2a974e6b9575de9cc33cc8b85ae938c7fc08041ef17705006262b7069cb65f5225e1f365b24bedec1fc7daf22b44ed5c03f11f6e242a44a531d459f9bdfec
data/CHANGELOG.md CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2019-02-18
11
+
12
+ - Added some methods for agents and groups
13
+ - `delete_agent()`
14
+ - `agent_config()`
15
+ - `delete_agent_by_group()`
16
+ - `agent_sync_status()`
17
+ - `add_agents_to_group()`
18
+ - `add_agent_to_group()`
19
+ - `create_group()`
20
+ - `get_file_in_group()`
21
+ - `agents_by_group()`
22
+ - `agents_by_no_group()`
23
+ - `group_configuration()`
24
+ - `group_files()`
25
+ - `groups()`
26
+ - `update_group_ossec_configuration()`
27
+ - `remove_agent_of_group()`
28
+ - `remvoe_agents_of_group()`
29
+ - `remove_all_agent_of_group()`
30
+ - `remove_group()`
31
+ - `agent_os_summary()`
32
+ - `agent_summary()`
33
+
10
34
  ## [0.2.2] - 2019-02-18
11
35
 
12
36
  - Added options to `syscheck_files()`
@@ -159,6 +159,20 @@ module Wazuh
159
159
  delete "/agents/#{agent_id}", options
160
160
  end
161
161
 
162
+ # Delete agents
163
+ # Removes agents, using a list of them or a criterion based on the status or time of the last connection.
164
+ # @option options [String] ids
165
+ # Agent IDs separated by commas.
166
+ # @option options [Bool] purge
167
+ # Delete an agent from the key store. This parameter is only valid if purge is set to no in the manager’s ossec.conf.
168
+ # @option options [String] status
169
+ # Filters by agent status. Use commas to enter multiple statuses. Allowed values: active, pending, neverconnected, disconnected
170
+ # @option options [String] older_than
171
+ # Filters out disconnected agents for longer than specified. Time in seconds, ‘[n_days]d’, ‘[n_hours]h’, ‘[n_minutes]m’ or ‘[n_seconds]s’. For never connected agents, uses the register date. Default value: 7d.
172
+ def delete_agents(options = {})
173
+ delete '/agents', options
174
+ end
175
+
162
176
  # Adds a new agent with name :agent_name. This agent will use ANY as IP.
163
177
  #
164
178
  # @param [String] agent_name
@@ -184,6 +198,223 @@ module Wazuh
184
198
  def insert_agent(options = {})
185
199
  post '/agents/insert', options
186
200
  end
201
+
202
+ # Get active configuration
203
+ # @param [String] agent_id
204
+ # @param [String] component
205
+ # Selected component. Alowed values see document
206
+ # @param [String] configuration
207
+ # Selected component. Alowed values see document
208
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-active-configuration
209
+ def agent_config(agent_id, component, configuration)
210
+ get "/agents/#{agent_id}/config/#{component}/#{configuration}"
211
+ end
212
+
213
+ # Delete a list of groups
214
+ # @param [String] ids
215
+ # @see http://documentation.wazuh.com/3.11/user-manual/api/reference.html#delete-a-list-of-groups
216
+ def delete_agent_by_group(ids)
217
+ delete '/agents/groups', {ids: ids}
218
+ end
219
+
220
+ # Get sync status of agent
221
+ # Returns the sync status in JSON format
222
+ #
223
+ # @param [String] agent_id
224
+ # Agent ID
225
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-sync-status-of-agent
226
+ def agent_sync_status(agent_id)
227
+ get "/agent/#{agent_id}/group/is_sync"
228
+ end
229
+
230
+ # Add a list of agents to a group
231
+ # Adds a list of agents to the specified group
232
+ #
233
+ # @param [Array[String]] ids
234
+ # List of agent ID
235
+ # @param [String] group_id
236
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#add-a-list-of-agents-to-a-group
237
+ def add_agents_to_group(ids, group_id)
238
+ post "/agents/group/#{group_id}", {ids: ids}
239
+ end
240
+
241
+ # Add agent group
242
+ # Adds an agent to the specified group.
243
+ #
244
+ # @param [String] agent_id
245
+ # Agent unique ID
246
+ # @param [String] group_id
247
+ # Group ID
248
+ # @option options [Bool] force_single_group
249
+ # Whether to append new group to current agent’s group or replace it.
250
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#add-agent-group
251
+ def add_agent_to_group(agent_id, group_id, options = {})
252
+ put "/agents/#{agent_id}/group/#{group_id}", options
253
+ end
254
+
255
+ # Create a group
256
+ # Creates a new group.
257
+ #
258
+ # @param [String] group_id
259
+ # Group ID
260
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#create-a-group
261
+ def create_group(group_id)
262
+ put "/agents/groups/#{group_id}"
263
+ end
264
+
265
+ # Get a file in group
266
+ # Returns the specified file belonging to the group parsed to JSON.
267
+ #
268
+ # @param [String] group_id
269
+ # Group ID
270
+ # @param [String] filename
271
+ # Filename
272
+ # @option options [String] type
273
+ # @option options [String] format
274
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#add-agent-group
275
+ def get_file_in_group(group_id, filename, options = {})
276
+ get "agents/groups/#{group_id}/files/#{filename}", options
277
+ end
278
+
279
+ # Get agents in a group
280
+ # Returns the list of agents in a group.
281
+ #
282
+ # @param [String] group_id
283
+ # Group ID
284
+ # @option options [Number] offset
285
+ # @option options [Number] limit
286
+ # @option options [String] select
287
+ # @option options [String] sort
288
+ # @option options [String] search
289
+ # @option options [String] status
290
+ # @option options [String] q
291
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-agents-in-a-group
292
+ def agents_by_group(group_id, options = {})
293
+ get "/agents/groups/#{group_id}", options
294
+ end
295
+
296
+ # Get agents without group
297
+ # Returns a list with the available agents without group.
298
+ #
299
+ # @option options [Number] offset
300
+ # @option options [Number] limit
301
+ # @option options [String] select
302
+ # @option options [String] sort
303
+ # @option options [String] search
304
+ # @option options [String] status
305
+ # @option options [String] q
306
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-agents-without-group
307
+ def agents_by_no_group(options = {})
308
+ get 'agents/no_group', options
309
+ end
310
+
311
+ # Get group configuration
312
+ #
313
+ # @param [String] group_id
314
+ # @option options [Number] offset
315
+ # @option options [Number] limit
316
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-group-configuration
317
+ def group_configuration(group_id, options = {})
318
+ get "/agents/groups/#{group_id}/configuration", options
319
+ end
320
+
321
+ # Get group files
322
+ # Returns the files belonging to the group.
323
+ #
324
+ # @param [String] group_id
325
+ # @option options [Number] offset
326
+ # @option options [Number] limit
327
+ # @option options [String] sort
328
+ # @option options [String] search
329
+ # @option options [String] hash
330
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-group-files
331
+ def group_files(group_id, options = {})
332
+ get "/agents/groups/#{group_id}/files", options
333
+ end
334
+
335
+ # Get groups
336
+ # Returns the list of existing agent groups.
337
+ #
338
+ # @option options [Number] offset
339
+ # @option options [Number] limit
340
+ # @option options [String] sort
341
+ # @option options [String] search
342
+ # @option options [String] hash
343
+ # @option options [String] q
344
+ def groups(options = {})
345
+ get '/agents/groups', options
346
+ end
347
+
348
+ # Put configuration file (agent.conf) into a group
349
+ # Upload the group configuration (agent.conf).
350
+ #
351
+ # @param [String] group_id
352
+ # @param [String] config
353
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#put-configuration-file-agent-conf-into-a-group
354
+ def update_group_ossec_configuration(group_id, config)
355
+ # post "/agents/groups/#{group_id}/configuration"
356
+ # TODO : use Content-type: application/xml
357
+ raise "This method not yet implement"
358
+ end
359
+
360
+ # Remove a single group of an agent
361
+ # Remove the group of the agent but will leave the rest of its group if it belongs to a multigroup.
362
+ #
363
+ # @param [String] agent_id
364
+ # @param [String] group_id
365
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#remove-a-single-group-of-an-agent
366
+ def remove_agent_of_group(agent_id, group_id)
367
+ delete "/agents/#{agent_id}/group/#{group_id}"
368
+ end
369
+
370
+ # Remove a single group of multiple agents
371
+ # Remove a list of agents of a group.
372
+ #
373
+ # @param [String] ids
374
+ # @param [String] group_id
375
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#remove-a-single-group-of-multiple-agents
376
+ def remove_agents_of_group(ids, groups)
377
+ delete "/agents/group/#{group_id}", {ids: ids}
378
+ end
379
+
380
+ # Remove all agent groups.
381
+ # Removes the group of the agent. The agent will automatically revert to the ‘default’ group.
382
+ #
383
+ # @param [String] agent_id
384
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#remove-all-agent-groups
385
+ def remove_all_agent_of_group(agent_id)
386
+ delete "/agents/#{agent_id}/group"
387
+ end
388
+
389
+ # Remove group
390
+ # Removes the group. Agents that were assigned to the removed group will automatically revert to the ‘default’ group.
391
+ #
392
+ # @param [String] group_id
393
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#remove-group
394
+ def remove_group(group_id)
395
+ delete "/agents/groups/#{group_id}"
396
+ end
397
+
398
+ # Get OS summary
399
+ # Returns a summary of the OS.
400
+ #
401
+ # @option options [Number] offset
402
+ # @option options [Number] limit
403
+ # @option options [String] sort
404
+ # @option options [String] search
405
+ # @option options [String] q
406
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-os-summary
407
+ def agent_os_summary(options = {})
408
+ get "/agents/summary/os"
409
+ end
410
+
411
+ # Get agents summary
412
+ # Returns a summary of the available agents.
413
+ #
414
+ # @see https://documentation.wazuh.com/3.11/user-manual/api/reference.html#get-agents-summary
415
+ def agent_summary
416
+ get "/agents/summary"
417
+ end
187
418
  end
188
419
  end
189
420
  end
data/lib/wazuh/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Wazuh
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.3'
4
4
  end
@@ -1,3 +1,3 @@
1
1
  module WazuhRubyClient
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wazuh-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mrtc0