diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 20:03:01 +0000 |
commit | a453ac31f3428614cceb99027f8efbdb9258a40b (patch) | |
tree | f61f87408f32a8511cbd91799f9cececb53e0374 /collections-debian-merged/ansible_collections/ibm/qradar | |
parent | Initial commit. (diff) | |
download | ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.tar.xz ansible-a453ac31f3428614cceb99027f8efbdb9258a40b.zip |
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collections-debian-merged/ansible_collections/ibm/qradar')
50 files changed, 5881 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/.gitignore b/collections-debian-merged/ansible_collections/ibm/qradar/.gitignore new file mode 100644 index 00000000..651a7bc9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/.gitignore @@ -0,0 +1,111 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# mazer / ansible collections +releases/ + +*.tar.gz + +tests/output* diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/FILES.json b/collections-debian-merged/ansible_collections/ibm/qradar/FILES.json new file mode 100644 index 00000000..ff54e231 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/FILES.json @@ -0,0 +1,502 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules/offense_action.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89b0a774f075ab8442de7108f3f8056cda7eb8a0cacd4261d065fd9379b78fae", + "format": 1 + }, + { + "name": "plugins/modules/qradar_log_source_management.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2fffc2b1213b3d38f116aee566b62d852f09bb3e85573fffadd4538d134298c7", + "format": 1 + }, + { + "name": "plugins/modules/qradar_offense_note.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "08aa79cc371a1733585cbc79a2dc2932a5e065d5260d2d8e8a9fbc2aefbad1c7", + "format": 1 + }, + { + "name": "plugins/modules/rule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f9b9b83d69f87fb1e31e536bbbfc92dd3bb653bed626d88d59c5f1a44490ebf5", + "format": 1 + }, + { + "name": "plugins/modules/qradar_rule_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0daf99f95736092e83cefdf0cbcdbfc5da1b033a6ea1f18a4ba04c58d7a8195a", + "format": 1 + }, + { + "name": "plugins/modules/qradar_offense_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92a982dce8bee06dbd067b3cc07a84ab201654a17b6d661d5ba541ee41667c58", + "format": 1 + }, + { + "name": "plugins/modules/rule_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0daf99f95736092e83cefdf0cbcdbfc5da1b033a6ea1f18a4ba04c58d7a8195a", + "format": 1 + }, + { + "name": "plugins/modules/log_source_management.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2fffc2b1213b3d38f116aee566b62d852f09bb3e85573fffadd4538d134298c7", + "format": 1 + }, + { + "name": "plugins/modules/qradar_rule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f9b9b83d69f87fb1e31e536bbbfc92dd3bb653bed626d88d59c5f1a44490ebf5", + "format": 1 + }, + { + "name": "plugins/modules/offense_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "92a982dce8bee06dbd067b3cc07a84ab201654a17b6d661d5ba541ee41667c58", + "format": 1 + }, + { + "name": "plugins/modules/deploy.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a918e97277cee032f3b3810245f0bcea010ea94092ebf72cf0b90380da21c104", + "format": 1 + }, + { + "name": "plugins/modules/qradar_deploy.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a918e97277cee032f3b3810245f0bcea010ea94092ebf72cf0b90380da21c104", + "format": 1 + }, + { + "name": "plugins/modules/qradar_offense_action.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89b0a774f075ab8442de7108f3f8056cda7eb8a0cacd4261d065fd9379b78fae", + "format": 1 + }, + { + "name": "plugins/modules/offense_note.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "08aa79cc371a1733585cbc79a2dc2932a5e065d5260d2d8e8a9fbc2aefbad1c7", + "format": 1 + }, + { + "name": "plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/qradar.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "42e1f693850d1198ba1203b6f1dcf1f3be8f69a58bace446c2e60fb5ab3dcd0b", + "format": 1 + }, + { + "name": "plugins/httpapi", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/httpapi/qradar.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9d8ee3f9def2970b5344f3b350d208d2f14d9979210d45ea707f3bf60a49c16e", + "format": 1 + }, + { + "name": "tox.ini", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a7fe800766882796ca25b6dd9f23979647d00f8ab1bf9bb50c3b9d0c0e2b8c5c", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "12dc1e11e9edd4dd0ecee16a87eaf8b7aaf214055b3e71b2493d386317681dd7", + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d2c4dcbe8870d9e338d757b61e3f3cc08ab7f4535795d67a3df7b5f15e4fd6c8", + "format": 1 + }, + { + "name": "changelogs/CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3bafe7f7d33078c39e0be3550341331026ba8cfb5b65750c259d3502027b3fd4", + "format": 1 + }, + { + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "docs/ibm.qradar.rule_info_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5c723d1e6bdf5f2ad0c7a10aa94dc48387c2510413a5c3f093aa9cd03d1fa852", + "format": 1 + }, + { + "name": "docs/ibm.qradar.offense_note_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6edf5594acacaea9a630f4c9333431e0891d896a56b5193a8bc33732c926a0e2", + "format": 1 + }, + { + "name": "docs/ibm.qradar.qradar_httpapi.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "106a02861e7dbe55afc34f804645e3e999f176100ab731496b3f6177dac642b1", + "format": 1 + }, + { + "name": "docs/ibm.qradar.offense_action_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "499aa85776594aa101b48286715c4f50980807f3aeb057e05c983c2b853ae1f3", + "format": 1 + }, + { + "name": "docs/ibm.qradar.offense_info_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1b48a675adfef52229407f0e027e2b9dcc1177aa827233ab669f84a8380988bb", + "format": 1 + }, + { + "name": "docs/ibm.qradar.deploy_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "918095a028d81ffbdf59d9c4dfe521a06a4a5a252da30c50f70179d522bbe73d", + "format": 1 + }, + { + "name": "docs/ibm.qradar.log_source_management_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5cdf4e669d00cdcd2d3c625d3f0e0b43af06230f122c3585db04276a0b722610", + "format": 1 + }, + { + "name": "docs/ibm.qradar.rule_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "392235eaa7b69ea923a0b0ecba7cc33df4e59955ac9694c9f7e056b08eff56a1", + "format": 1 + }, + { + "name": "tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_deploy", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_deploy/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_rule", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_rule/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_offense", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_offense/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/offense", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/offense/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/offense/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/offense/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "985949c5779a18b1d13a05230a565e24d4edc5b8e9d87ae16ea47c07a44e3a75", + "format": 1 + }, + { + "name": "tests/integration/targets/log_source_management", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/log_source_management/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/log_source_management/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/log_source_management/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b7fef6816593f4cbf240ab9c371a86f9a20229fae339fc64fd9f492c5937d724", + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_log_source_management", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/qradar_log_source_management/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/rule", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/rule/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/rule/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/rule/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d47767a0f7a9e41ac6cfe46ae8f0184a05fa4f81f5ef7b64c0387fce1a163c1", + "format": 1 + }, + { + "name": "tests/integration/targets/deploy", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/deploy/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "format": 1 + }, + { + "name": "tests/integration/targets/deploy/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/deploy/tasks/main.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/integration/target-prefixes.network", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f4d2f34d7884174dabd0e91e1f2ae1a22499f44e634261344ad065a167f5f862", + "format": 1 + }, + { + "name": "tests/.keep", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c9581f26acacb690689389033c2f05c40ef9e5fe65a47680761cf45b2518615", + "format": 1 + }, + { + "name": "test-requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6cfd68f9160b620f26d34a82dc0f6bee28e97d6e78f61774bba63dbb143144ae", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cd2fd5a0491bdf8f81b7079d501a1c1186bde023f94ad85bdd1cc8e5cfa0041c", + "format": 1 + }, + { + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "63e02bf68769e25aba8db3f3cf2c1cd8b1e92e71ce3ef2d13e949b994e424b75", + "format": 1 + } + ], + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/LICENSE b/collections-debian-merged/ansible_collections/ibm/qradar/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/MANIFEST.json b/collections-debian-merged/ansible_collections/ibm/qradar/MANIFEST.json new file mode 100644 index 00000000..c176b6c5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/MANIFEST.json @@ -0,0 +1,33 @@ +{ + "collection_info": { + "namespace": "ibm", + "name": "qradar", + "version": "1.0.3", + "authors": [ + "Ansible Security Team (https://github.com/ansible-security)" + ], + "readme": "README.md", + "tags": [ + "security", + "qradar" + ], + "description": "Ansible Security Collection for IBM Qradar SIEM", + "license": [ + "GPL-3.0-or-later" + ], + "license_file": null, + "dependencies": {}, + "repository": "https://github.com/ansible-collections/ibm.qradar", + "documentation": "https://github.com/ansible-collections/ibm.qradar", + "homepage": "https://github.com/ansible-collections/ibm.qradar", + "issues": "https://github.com/ansible-collections/ibm.qradar/issues" + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9ed2351911ae8bdaceaa9fd6ff7d5ff38049af0a71b84ac9cb456ae6cfe8682d", + "format": 1 + }, + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/README.md b/collections-debian-merged/ansible_collections/ibm/qradar/README.md new file mode 100644 index 00000000..6c07d896 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/README.md @@ -0,0 +1,207 @@ +# IBM QRadar Ansible Collection + +[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/ibm.qradar) <!--[![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/ibm.qradar)](https://codecov.io/gh/ansible-collections/ibm.qradar)--> + +This is the [Ansible +Collection](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html) +provided by the [Ansible Security Automation +Team](https://github.com/ansible-security) for automating actions in [IBM +QRadar SIEM](https://www.ibm.com/us-en/marketplace/ibm-qradar-siem). + +This Collection is meant for distribution through +[Ansible Galaxy](https://galaxy.ansible.com/) as is available for all +[Ansible](https://github.com/ansible/ansible) users to utilize, contribute to, +and provide feedback about. + +<!--start requires_ansible--> +## Ansible version compatibility + +This collection has been tested against following Ansible versions: **>=2.9,<2.11**. + +Plugins and modules within a collection may be tested with only specific Ansible versions. +A collection may contain metadata that identifies these versions. +PEP440 is the schema used to describe the versions of Ansible. +<!--end requires_ansible--> + +## Collection Content +<!--start collection content--> +### Httpapi plugins +Name | Description +--- | --- +[ibm.qradar.qradar](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.qradar_httpapi.rst)|HttpApi Plugin for IBM QRadar + +### Modules +Name | Description +--- | --- +[ibm.qradar.deploy](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.deploy_module.rst)|Trigger a qradar configuration deployment +[ibm.qradar.log_source_management](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.log_source_management_module.rst)|Manage Log Sources in QRadar +[ibm.qradar.offense_action](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_action_module.rst)|Take action on a QRadar Offense +[ibm.qradar.offense_info](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_info_module.rst)|Obtain information about one or many QRadar Offenses, with filter options +[ibm.qradar.offense_note](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.offense_note_module.rst)|Create or update a QRadar Offense Note +[ibm.qradar.rule](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.rule_module.rst)|Manage state of QRadar Rules, with filter options +[ibm.qradar.rule_info](https://github.com/ansible-collections/ibm.qradar/blob/main/docs/ibm.qradar.rule_info_module.rst)|Obtain information about one or many QRadar Rules, with filter options + +<!--end collection content--> + +## Installing this collection + +You can install the IBM qradar collection with the Ansible Galaxy CLI: + + ansible-galaxy collection install ibm.qradar + +You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: + +```yaml +--- +collections: + - name: ibm.qradar +``` + +## Using the IBM QRadar Ansible Collection + +An example for using this collection to manage a log source with [IBM QRadar](https://www.ibm.com/security/security-intelligence/qradar) is as follows. + +`inventory.ini` (Note the password should be managed by a [Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) for a production environment. +``` +[qradar] +qradar.example.com + +[qradar:vars] +ansible_network_os=ibm.qradar.qradar +ansible_user=admin +ansible_httpapi_pass=SuperSekretPassword +ansible_httpapi_use_ssl=yes +ansible_httpapi_validate_certs=yes +ansible_connection=httpapi +``` + +**NOTE**: For Ansible 2.9, you may not see deprecation warnings when you run your playbooks with this collection. Use this documentation to track when a module is deprecated. + +### Using the modules with Fully Qualified Collection Name (FQCN) + +With [Ansible +Collections](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html) +there are various ways to utilize them either by calling specific Content from +the Collection, such as a module, by its Fully Qualified Collection Name (FQCN) +as we'll show in this example or by defining a Collection Search Path as the +examples below will display. + +I should be noted that the FQCN method is the recommended method but the +shorthand options listed below exist for convenience. + +`qradar_with_collections_example.yml` +``` +--- +- name: Testing URI manipulation of QRadar with FQCN + hosts: qradar + gather_facts: false + tasks: + - name: create log source + ibm.qradar.log_source_management: + name: "Ansible Collections Example Log Source" + type_name: "Linux OS" + state: present + description: "Ansible Collections Example Log Source Description" +``` + +### Define your collection search path at the Play level + +Below we specify our collection at the +[Play](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) +level which allows us to use the `log_source_management` module without +the need for the FQCN for each task. + +`qradar_with_collections_example.yml` +``` +--- +- name: Testing URI manipulation of QRadar + hosts: qradar + gather_facts: false + collections: + - ibm.qradar + tasks: + - name: create log source + log_source_management: + name: "Ansible Collections Example Log Source" + type_name: "Linux OS" + state: present + description: "Ansible Collections Example Log Source Description" +``` + +### Define your collection search path at the Block level + +Another option for Collection use is below. Here we use the +[`block`](https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html) +level keyword instead of [Play](https://docs.ansible.com/ansible/latest/user_guide/playbooks_intro.html) +level as with the previous example. In this scenario we are able to use the +`log_source_management` module without the need for the FQCN for each +task but with an optionally more specific scope of Collection Search Path than +specifying at the Play level. + +`qradar_with_collections_block_example.yml` +``` +--- +- name: Testing URI manipulation of QRadar + hosts: qradar + gather_facts: false + tasks: + - name: collection namespace block + block: + - name: create log source + log_source_management: + name: "Ansible Collections Example Log Source" + type_name: "Linux OS" + state: present + description: "Ansible Collections Example Log Source Description" + collections: + - ibm.qradar +``` + +### Directory Structure + +* `docs/`: local documentation for the collection +* `license.txt`: optional copy of license(s) for this collection +* `galaxy.yml`: source data for the MANIFEST.json that will be part of the collection package +* `playbooks/`: playbooks reside here + * `tasks/`: this holds 'task list files' for `include_tasks`/`import_tasks` usage +* `plugins/`: all ansible plugins and modules go here, each in its own subdir + * `modules/`: ansible modules + * `lookups/`: lookup plugins + * `filters/`: Jinja2 filter plugins + * ... rest of plugins +* `README.md`: information file (this file) +* `roles/`: directory for ansible roles +* `tests/`: tests for the collection's content + +## Contributing to this collection + +We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [IBM QRadar collection repository](https://github.com/ansible-collections/ibm.qradar). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details. + + +See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible. + +### Code of Conduct +This collection follows the Ansible project's +[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). +Please read and familiarize yourself with this document. + +## Release notes + +Release notes are available [here](https://github.com/ansible-collections/ibm.qradar/blob/main/changelogs/CHANGELOG.rst). + +## Roadmap + +<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. --> + +## More information + +- [Ansible Collection overview](https://github.com/ansible-collections/overview) +- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) +- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) +- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) + +## Licensing + +GNU General Public License v3.0 or later. + +See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/CHANGELOG.rst b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/CHANGELOG.rst new file mode 100644 index 00000000..acaa1c75 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/CHANGELOG.rst @@ -0,0 +1,43 @@ +=================================== +IBM QRadar Collection Release Notes +=================================== + +.. contents:: Topics + +v1.0.3 +====== + +Release Summary +--------------- + +- Re-releasing the 1.0.2 with updated galaxy file + +v1.0.2 +====== + +Release Summary +--------------- + +- Releasing 1.0.2 with updated changelog. + +v1.0.1 +====== + +Release Summary +--------------- + +- Releasing 1.0.2 with updated Readme file after removing tech preview description + +v1.0.0 +====== + +New Modules +----------- + +- deploy - Trigger a qradar configuration deployment +- log_source_management - Manage Log Sources in QRadar +- offense_action - Take action on a QRadar Offense +- offense_info - Obtain information about one or many QRadar Offenses, with filter options +- offense_note - Create or update a QRadar Offense Note +- rule - Manage state of QRadar Rules, with filter options +- rule_info - Obtain information about one or many QRadar Rules, with filter options diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/changelog.yaml new file mode 100644 index 00000000..bf6bea28 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/changelog.yaml @@ -0,0 +1,41 @@ +ancestor: null +releases: + 1.0.0: + modules: + - description: Trigger a qradar configuration deployment + name: ibm.qradar.deploy + namespace: '' + - description: Manage Log Sources in QRadar + name: ibm.qradar.log_source_management + namespace: '' + - description: Take action on a QRadar Offense + name: ibm.qradar.offense_action + namespace: '' + - description: Obtain information about one or many QRadar Offenses, with filter options + name: ibm.qradar.offense_info + namespace: '' + - description: Create or update a QRadar Offense Note + name: ibm.qradar.offense_note + namespace: '' + - description: Manage state of QRadar Rules, with filter options + name: ibm.qradar.rule + namespace: '' + - description: Obtain information about one or many QRadar Rules, with filter options + name: ibm.qradar.rule_info + namespace: '' + release_date: '2020-06-22' + 1.0.1: + changes: + release_summary: + - Removed tech preview from collection Readme file. + release_date: '2020-06-23' + 1.0.2: + changes: + release_summary: + - Releasing 1.0.2 with updated changelog. + release_date: '2020-08-27' + 1.0.3: + changes: + release_summary: + - Re-releasing 1.0.2 with updated galaxy file. + release_date: '2020-09-1' diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/config.yaml b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/config.yaml new file mode 100644 index 00000000..c0c71629 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/changelogs/config.yaml @@ -0,0 +1,30 @@ +changelog_filename_template: CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +flatmap: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: IBM Qradar Collection +trivial_section_name: trivial diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst new file mode 100644 index 00000000..060f6453 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.deploy_module.rst @@ -0,0 +1,86 @@ +.. _ibm.qradar.deploy_module: + + +***************** +ibm.qradar.deploy +***************** + +**Trigger a qradar configuration deployment** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module allows for INCREMENTAL or FULL deployments + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>INCREMENTAL</b> ←</div></li> + <li>FULL</li> + </ul> + </td> + <td> + <div>Type of deployment</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: run an incremental deploy + ibm.qradar.deploy: + type: INCREMENTAL + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst new file mode 100644 index 00000000..9c9bc4e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.log_source_management_module.rst @@ -0,0 +1,184 @@ +.. _ibm.qradar.log_source_management_module: + + +******************************** +ibm.qradar.log_source_management +******************************** + +**Manage Log Sources in QRadar** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module allows for addition, deletion, or modification of Log Sources in QRadar + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Description of log source</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>identifier</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Log Source Identifier (Typically IP Address or Hostname of log source)</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of Log Source</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol_type_id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Type of protocol by id, as defined in QRadar Log Source Types Documentation</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>present</li> + <li>absent</li> + </ul> + </td> + <td> + <div>Add or remove a log source.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>type_id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Type of resource by id, as defined in QRadar Log Source Types Documentation</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>type_name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Type of resource by name</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - Either ``type`` or ``type_id`` is required + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: Add a snort log source to IBM QRadar + ibm.qradar.log_source_management: + name: "Snort logs" + type_name: "Snort Open Source IDS" + state: present + description: "Snort IDS remote logs from rsyslog" + identifier: "192.168.1.101" + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst new file mode 100644 index 00000000..2fde5b4e --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_action_module.rst @@ -0,0 +1,182 @@ +.. _ibm.qradar.offense_action_module: + + +************************* +ibm.qradar.offense_action +************************* + +**Take action on a QRadar Offense** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>assigned_to</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Assign to an user, the QRadar username should be provided</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>closing_reason</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Assign a predefined closing reason here, by name.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>closing_reason_id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Assign a predefined closing reason here, by id.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>follow_up</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Set or unset the flag to follow up on a QRadar Offense</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>ID of Offense</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protected</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Set or unset the flag to protect a QRadar Offense</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>open</li> + <li>OPEN</li> + <li>hidden</li> + <li>HIDDEN</li> + <li>closed</li> + <li>CLOSED</li> + </ul> + </td> + <td> + <div>One of "open", "hidden" or "closed". (Either all lower case or all caps)</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - Requires one of ``name`` or ``id`` be provided + - Only one of ``closing_reason`` or ``closing_reason_id`` can be provided + + + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst new file mode 100644 index 00000000..a36d77dd --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_info_module.rst @@ -0,0 +1,333 @@ +.. _ibm.qradar.offense_info_module: + + +*********************** +ibm.qradar.offense_info +*********************** + +**Obtain information about one or many QRadar Offenses, with filter options** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module allows to obtain information about one or many QRadar Offenses, with filter options + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>assigned_to</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of Offenses assigned to a certain user</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>closing_reason</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of Offenses that were closed by a specific closing reason</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>closing_reason_id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of Offenses that were closed by a specific closing reason ID</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>follow_up</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Obtain only information of Offenses that are marked with the follow up flag</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of the Offense with provided ID</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of the Offense that matches the provided name</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protected</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Obtain only information of Offenses that are protected</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>open</b> ←</div></li> + <li>OPEN</li> + <li>hidden</li> + <li>HIDDEN</li> + <li>closed</li> + <li>CLOSED</li> + </ul> + </td> + <td> + <div>Obtain only information of Offenses of a certain status</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - You may provide many filters and they will all be applied, except for ``id`` as that will return only + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: Get list of all currently OPEN IBM QRadar Offenses + ibm.qradar.offense_info: + status: OPEN + register: offense_list + + - name: display offense information for debug purposes + debug: + var: offense_list + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="3">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>offenses</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td>always</td> + <td> + <div>Information</div> + <br/> + </td> + </tr> + <tr> + <td class="elbow-placeholder"> </td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>qradar_offenses</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">complex</span> + </div> + </td> + <td>always</td> + <td> + <div>IBM QRadar Offenses found based on provided filters</div> + <br/> + </td> + </tr> + <tr> + <td class="elbow-placeholder"> </td> + <td class="elbow-placeholder"> </td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Name of the service.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">arp-ethers.service</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"> </td> + <td class="elbow-placeholder"> </td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>source</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>Init system of the service. One of <code>systemd</code>, <code>sysv</code>, <code>upstart</code>.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">sysv</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"> </td> + <td class="elbow-placeholder"> </td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>State of the service. Either <code>running</code>, <code>stopped</code>, or <code>unknown</code>.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">running</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"> </td> + <td class="elbow-placeholder"> </td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>status</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>systemd systems or RedHat/SUSE flavored sysvinit/upstart</td> + <td> + <div>State of the service. Either <code>enabled</code>, <code>disabled</code>, or <code>unknown</code>.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">enabled</div> + </td> + </tr> + + + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst new file mode 100644 index 00000000..796b3fa7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.offense_note_module.rst @@ -0,0 +1,94 @@ +.. _ibm.qradar.offense_note_module: + + +*********************** +ibm.qradar.offense_note +*********************** + +**Create or update a QRadar Offense Note** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module allows to create a QRadar Offense note + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Offense ID to operate on</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>note_text</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>The note's text contents</div> + </td> + </tr> + </table> + <br/> + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: Add a note to QRadar Offense ID 1 + ibm.qradar.offense_note: + id: 1 + note_text: This an example note entry that should be made on offense id 1 + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst new file mode 100644 index 00000000..c80094b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_httpapi.rst @@ -0,0 +1,43 @@ +.. _ibm.qradar.qradar_httpapi: + + +***************** +ibm.qradar.qradar +***************** + +**HttpApi Plugin for IBM QRadar** + + +Version added: 1.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This HttpApi plugin provides methods to connect to IBM QRadar over a HTTP(S)-based api. + + + + + + + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst new file mode 100644 index 00000000..04558269 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_info_module.rst @@ -0,0 +1,158 @@ +.. _ibm.qradar.rule_info_module: + + +******************** +ibm.qradar.rule_info +******************** + +**Obtain information about one or many QRadar Rules, with filter options** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module obtains information about one or many QRadar Rules, with filter options + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of the Rule with provided ID</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of the Rule that matches the provided name</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>origin</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>SYSTEM</li> + <li>OVERRIDE</li> + <li>USER</li> + </ul> + </td> + <td> + <div>Obtain only information of Rules that are of a certain origin</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>owner</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Obtain only information of Rules owned by a certain user</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>EVENT</li> + <li>FLOW</li> + <li>COMMON</li> + <li>USER</li> + </ul> + </td> + <td> + <div>Obtain only information for the Rules of a certain type</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - You may provide many filters and they will all be applied, except for ``id`` as that will return only the Rule identified by the unique ID provided. + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: Get information about the Rule named "Custom Company DDoS Rule" + ibm.qradar.rule_info: + name: "Custom Company DDoS Rule" + register: custom_ddos_rule_info + + - name: debugging output of the custom_ddos_rule_info registered variable + debug: + var: custom_ddos_rule_info + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>" diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst new file mode 100644 index 00000000..fd127dc5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/docs/ibm.qradar.rule_module.rst @@ -0,0 +1,128 @@ +.. _ibm.qradar.rule_module: + + +*************** +ibm.qradar.rule +*************** + +**Manage state of QRadar Rules, with filter options** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Manage state of QRadar Rules, with filter options + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>id</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Manage state of a QRadar Rule by ID</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Manage state of a QRadar Rule by name</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>owner</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Manage ownership of a QRadar Rule</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>enabled</li> + <li>disabled</li> + <li>absent</li> + </ul> + </td> + <td> + <div>Manage state of a QRadar Rule</div> + </td> + </tr> + </table> + <br/> + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + - name: Enable Rule 'Ansible Example DDoS Rule' + qradar_rule: + name: 'Ansible Example DDOS Rule' + state: enabled + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/meta/runtime.yml b/collections-debian-merged/ansible_collections/ibm/qradar/meta/runtime.yml new file mode 100644 index 00000000..b8961b14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/meta/runtime.yml @@ -0,0 +1,2 @@ +--- +requires_ansible: '>=2.9,<2.11' diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py new file mode 100644 index 00000000..f8ecb6e5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py @@ -0,0 +1,72 @@ +# (c) 2019 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +author: Ansible Security Automation Team +httpapi : qradar +short_description: HttpApi Plugin for IBM QRadar +description: + - This HttpApi plugin provides methods to connect to IBM QRadar over a + HTTP(S)-based api. +version_added: "1.0" +""" + +import json + +from ansible.module_utils.basic import to_text +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible.plugins.httpapi import HttpApiBase +from ansible.module_utils.connection import ConnectionError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import BASE_HEADERS + + +class HttpApi(HttpApiBase): + def send_request(self, request_method, path, payload=None, headers=None): + headers = headers if headers else BASE_HEADERS + + try: + self._display_request(request_method) + response, response_data = self.connection.send( + path, payload, method=request_method, headers=headers + ) + value = self._get_response_value(response_data) + + return response.getcode(), self._response_to_json(value) + except HTTPError as e: + error = json.loads(e.read()) + return e.code, error + + def _display_request(self, request_method): + self.connection.queue_message( + "vvvv", "Web Services: %s %s" % (request_method, self.connection._url) + ) + + def _get_response_value(self, response_data): + return to_text(response_data.getvalue()) + + def _response_to_json(self, response_text): + try: + return json.loads(response_text) if response_text else {} + # JSONDecodeError only available on Python 3.5+ + except ValueError: + raise ConnectionError("Invalid JSON response: %s" % response_text) + + def update_auth(self, response, response_text): + cookie = response.info().get("Set-Cookie") + # Set the 'SEC' header + if "SEC" in cookie: + return {"SEC": cookie.split(";")[0].split("=")[-1]} + + return None + + def logout(self): + self.send_request("POST", "/auth/logout") + + # Clean up tokens + self.connection._auth = None diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py new file mode 100644 index 00000000..e3bab33d --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py @@ -0,0 +1,173 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible.module_utils.urls import CertificateError +from ansible.module_utils.six.moves.urllib.parse import urlencode, quote_plus +from ansible.module_utils.connection import ConnectionError +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible.module_utils.connection import Connection +from ansible.module_utils._text import to_text + +import json + +BASE_HEADERS = {"Content-Type": "application/json", "Version": "9.1"} + + +def find_dict_in_list(some_list, key, value): + text_type = False + try: + to_text(value) + text_type = True + except TypeError: + pass + for some_dict in some_list: + if key in some_dict: + if text_type: + if to_text(some_dict[key]).strip() == to_text(value).strip(): + return some_dict, some_list.index(some_dict) + else: + if some_dict[key] == value: + return some_dict, some_list.index(some_dict) + return None + + +def set_offense_values(module, qradar_request): + if module.params["closing_reason"]: + found_closing_reason = qradar_request.get_by_path( + "api/siem/offense_closing_reasons?filter={0}".format( + quote_plus('text="{0}"'.format(module.params["closing_reason"])) + ) + ) + if found_closing_reason: + module.params["closing_reason_id"] = found_closing_reason[0]["id"] + else: + module.fail_json( + "Unable to find closing_reason text: {0}".format( + module.params["closing_reason"] + ) + ) + + if module.params["status"]: + module.params["status"] = module.params["status"].upper() + + +class QRadarRequest(object): + def __init__(self, module, headers=None, not_rest_data_keys=None): + + self.module = module + self.connection = Connection(self.module._socket_path) + + # This allows us to exclude specific argspec keys from being included by + # the rest data that don't follow the qradar_* naming convention + if not_rest_data_keys: + self.not_rest_data_keys = not_rest_data_keys + else: + self.not_rest_data_keys = [] + self.not_rest_data_keys.append("validate_certs") + self.headers = headers if headers else BASE_HEADERS + + def _httpapi_error_handle(self, method, uri, payload=None): + # FIXME - make use of handle_httperror(self, exception) where applicable + # https://docs.ansible.com/ansible/latest/network/dev_guide/developing_plugins_network.html#developing-plugins-httpapi + + try: + code, response = self.connection.send_request( + method, uri, payload=payload, headers=self.headers + ) + except ConnectionError as e: + self.module.fail_json(msg="connection error occurred: {0}".format(e)) + except CertificateError as e: + self.module.fail_json(msg="certificate error occurred: {0}".format(e)) + except ValueError as e: + self.module.fail_json(msg="certificate not found: {0}".format(e)) + + if code == 404: + if ( + to_text("Object not found") in to_text(response) + or to_text("Could not find object") in to_text(response) + or to_text("No offense was found") in to_text(response) + ): + return {} + + if code == 409: + if "code" in response: + if response["code"] in [1002, 1004]: + # https://www.ibm.com/support/knowledgecenter/SS42VS_7.3.1/com.ibm.qradar.doc/9.2--staged_config-deploy_status-POST.html + # Documentation says we should get 1002, but I'm getting 1004 from QRadar + return response + else: + self.module.fail_json( + msg="qradar httpapi returned error {0} with message {1}".format( + code, response + ) + ) + elif not (code >= 200 and code < 300): + self.module.fail_json( + msg="qradar httpapi returned error {0} with message {1}".format( + code, response + ) + ) + + return response + + def get(self, url, **kwargs): + return self._httpapi_error_handle("GET", url, **kwargs) + + def put(self, url, **kwargs): + return self._httpapi_error_handle("PUT", url, **kwargs) + + def post(self, url, **kwargs): + return self._httpapi_error_handle("POST", url, **kwargs) + + def patch(self, url, **kwargs): + return self._httpapi_error_handle("PATCH", url, **kwargs) + + def delete(self, url, **kwargs): + return self._httpapi_error_handle("DELETE", url, **kwargs) + + def get_data(self): + """ + Get the valid fields that should be passed to the REST API as urlencoded + data so long as the argument specification to the module follows the + convention: + - the key to the argspec item does not start with qradar_ + - the key does not exist in the not_data_keys list + """ + try: + qradar_data = {} + for param in self.module.params: + if (self.module.params[param]) is not None and ( + param not in self.not_rest_data_keys + ): + qradar_data[param] = self.module.params[param] + return qradar_data + + except TypeError as e: + self.module.fail_json(msg="invalid data type provided: {0}".format(e)) + + def post_by_path(self, rest_path, data=None): + """ + POST with data to path + """ + if data is None: + data = json.dumps(self.get_data()) + elif data is False: + # Because for some reason some QRadar REST API endpoint use the + # query string to modify state + return self.post("/{0}".format(rest_path)) + return self.post("/{0}".format(rest_path), payload=data) + + def create_update(self, rest_path, data=None): + """ + Create or Update a file/directory monitor data input in qradar + """ + if data is None: + data = json.dumps(self.get_data()) + # return self.post("/{0}".format(rest_path), payload=data) + return self.patch("/{0}".format(rest_path), payload=data) # PATCH diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/deploy.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/deploy.py new file mode 100644 index 00000000..69baa06a --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/deploy.py @@ -0,0 +1,84 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: deploy +short_description: Trigger a qradar configuration deployment +description: + - This module allows for INCREMENTAL or FULL deployments +version_added: "1.0.0" +options: + type: + description: + - Type of deployment + required: false + type: str + choices: + - "INCREMENTAL" + - "FULL" + default: "INCREMENTAL" +notes: + - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments + +author: "Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>" +""" + +EXAMPLES = """ +- name: run an incremental deploy + ibm.qradar.deploy: + type: INCREMENTAL +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import QRadarRequest + +import json + + +def main(): + + argspec = dict( + type=dict( + choices=["INCREMENTAL", "FULL"], required=False, default="INCREMENTAL" + ) + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=False) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["state", "type_name", "identifier"], + ) + + qradar_return_data = qradar_request.post_by_path("api/staged_config/deploy_status") + + if "message" in qradar_return_data and ( + to_text("No changes to deploy") in to_text(qradar_return_data["message"]) + ): + module.exit_json( + msg="No changes to deploy", + qradar_return_data=qradar_return_data, + changed=False, + ) + else: + module.exit_json( + msg="Successfully initiated {0} deployment.".format(module.params["type"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py new file mode 100644 index 00000000..eebb9e9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py @@ -0,0 +1,251 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: log_source_management +short_description: Manage Log Sources in QRadar +description: + - This module allows for addition, deletion, or modification of Log Sources in QRadar +version_added: "1.0.0" +options: + name: + description: + - Name of Log Source + required: true + type: str + state: + description: + - Add or remove a log source. + required: true + choices: [ "present", "absent" ] + type: str + type_name: + description: + - Type of resource by name + required: false + type: str + type_id: + description: + - Type of resource by id, as defined in QRadar Log Source Types Documentation + required: false + type: int + protocol_type_id: + description: + - Type of protocol by id, as defined in QRadar Log Source Types Documentation + required: false + type: int + identifier: + description: + - Log Source Identifier (Typically IP Address or Hostname of log source) + required: true + type: str + description: + description: + - Description of log source + required: true + type: str + +notes: + - Either C(type) or C(type_id) is required + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +EXAMPLES = """ +- name: Add a snort log source to IBM QRadar + ibm.qradar.log_source_management: + name: "Snort logs" + type_name: "Snort Open Source IDS" + state: present + description: "Snort IDS remote logs from rsyslog" + identifier: "192.168.1.101" +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, +) + +import json + + +def set_log_source_values(module, qradar_request): + if module.params["type_name"]: + log_source_type_found = qradar_request.get( + "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format( + quote('name="{0}"'.format(module.params["type_name"])) + ) + )[0] + if module.params["type_id"]: + log_source_type_found = qradar_request.get( + "api/config/event_sources/log_source_management/log_source_types?filter={0}".format( + quote('id="{0}"'.format(module.params["type_id"])) + ) + )[0] + if log_source_type_found: + if not module.params["type_id"]: + module.params["type_id"] = log_source_type_found["id"] + else: + module.fail_json( + msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types" + ) + + if module.params["protocol_type_id"]: + found_dict_in_list, _fdil_index = find_dict_in_list( + log_source_type_found["protocol_types"], + "protocol_id", + module.params["protocol_type_id"], + ) + if not found_dict_in_list: + module.fail_json( + msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types" + ) + else: + # Set it to the default as provided by the QRadar Instance + module.params["protocol_type_id"] = log_source_type_found["protocol_types"][0][ + "protocol_id" + ] + + module.params["protocol_parameters"] = [ + { + "id": module.params["protocol_type_id"], + "name": "identifier", + "value": module.params["identifier"], + } + ] + + +def main(): + + argspec = dict( + name=dict(required=True, type="str"), + state=dict(choices=["present", "absent"], required=True), + type_name=dict(required=False, type="str"), + type_id=dict(required=False, type="int"), + identifier=dict(required=True, type="str"), + protocol_type_id=dict(required=False, type="int"), + description=dict(required=True, type="str"), + ) + + module = AnsibleModule( + argument_spec=argspec, + required_one_of=[("type_name", "type_id")], + mutually_exclusive=[("type_name", "type_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["state", "type_name", "identifier"], + ) + + log_source_exists = qradar_request.get( + "/api/config/event_sources/log_source_management/log_sources?filter={0}".format( + quote('name="{0}"'.format(module.params["name"])) + ) + ) + + if log_source_exists: + + if module.params["state"] == "present": + existing_log_source_protocol_identifier, _elspi_index = find_dict_in_list( + log_source_exists[0]["protocol_parameters"], "name", "identifier" + ) + + set_log_source_values(module, qradar_request) + + comparison_map = [ + existing_log_source_protocol_identifier["value"] + == module.params["identifier"], + log_source_exists[0]["name"] == module.params["name"], + log_source_exists[0]["type_id"] == module.params["type_id"], + to_text(log_source_exists[0]["description"]) + == to_text(module.params["description"]), + ] + + if all(comparison_map): + module.exit_json(changed=False, msg="Nothing to do.") + else: + log_source_exists[0]["protocol_parameters"][ + _elspi_index + ] = module.params["protocol_parameters"][0] + log_source_exists[0]["name"] = module.params["name"] + log_source_exists[0]["type_id"] = module.params["type_id"] + log_source_exists[0]["description"] = module.params["description"] + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.create_update( + "api/config/event_sources/log_source_management/log_sources", + data=json.dumps(log_source_exists), + ) + + module.exit_json( + msg="Successfully updated log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + if module.params["state"] == "absent": + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.delete( + "/api/config/event_sources/log_source_management/log_sources/{0}".format( + log_source_exists[0]["id"] + ) + ) + + module.exit_json( + msg="Successfully deleted log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["state"] == "present": + set_log_source_values(module, qradar_request) + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.create_update( + "api/config/event_sources/log_source_management/log_sources", + data=json.dumps([qradar_request.get_data()]), + ) + + module.exit_json( + msg="Successfully created log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + if module.params["state"] == "absent": + module.exit_json(changed=False, msg="Nothing to do.") + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_action.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_action.py new file mode 100644 index 00000000..37eceb16 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_action.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_action +short_description: Take action on a QRadar Offense +description: + - This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses +version_added: "1.0.0" +options: + id: + description: + - ID of Offense + required: true + type: int + status: + description: + - One of "open", "hidden" or "closed". (Either all lower case or all caps) + required: false + choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ] + type: str + assigned_to: + description: + - Assign to an user, the QRadar username should be provided + required: false + type: str + closing_reason: + description: + - Assign a predefined closing reason here, by name. + required: false + type: str + closing_reason_id: + description: + - Assign a predefined closing reason here, by id. + required: false + type: int + follow_up: + description: + - Set or unset the flag to follow up on a QRadar Offense + required: false + type: bool + protected: + description: + - Set or unset the flag to protect a QRadar Offense + required: false + type: bool + +notes: + - Requires one of C(name) or C(id) be provided + - Only one of C(closing_reason) or C(closing_reason_id) can be provided + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +""" +# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS +# name: +# description: +# - Name of Offense +# required: true +# type: str +""" + +EXAMPLES = """ +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + # name=dict(required=False, type='str'), + # id=dict(required=False, type='str'), + id=dict(required=True, type="int"), + assigned_to=dict(required=False, type="str"), + closing_reason=dict(required=False, type="str"), + closing_reason_id=dict(required=False, type="int"), + follow_up=dict(required=False, type="bool"), + protected=dict(required=False, type="bool"), + status=dict( + required=False, + choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"], + type="str", + ), + ) + + module = AnsibleModule( + argument_spec=argspec, + # required_one_of=[ + # ('name', 'id',), + # ], + mutually_exclusive=[("closing_reason", "closing_reason_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["name", "id", "assigned_to", "closing_reason"], + ) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + + found_offense = qradar_request.get( + "/api/siem/offenses/{0}".format(module.params["id"]) + ) + + if found_offense: + set_offense_values(module, qradar_request) + + post_strs = [] + + if module.params["status"] and ( + to_text(found_offense["status"]) != to_text(module.params["status"]) + ): + post_strs.append("status={0}".format(to_text(module.params["status"]))) + + if module.params["assigned_to"] and ( + to_text(found_offense["assigned_to"]) + != to_text(module.params["assigned_to"]) + ): + post_strs.append("assigned_to={0}".format(module.params["assigned_to"])) + + if module.params["closing_reason_id"] and ( + found_offense["closing_reason_id"] != module.params["closing_reason_id"] + ): + post_strs.append( + "closing_reason_id={0}".format(module.params["closing_reason_id"]) + ) + + if module.params["follow_up"] and ( + found_offense["follow_up"] != module.params["follow_up"] + ): + post_strs.append("follow_up={0}".format(module.params["follow_up"])) + + if module.params["protected"] and ( + found_offense["protected"] != module.params["protected"] + ): + post_strs.append("protected={0}".format(module.params["protected"])) + + if post_strs: + if module.check_mode: + module.exit_json( + msg="A change would have been made but was not because of Check Mode.", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}?{1}".format( + module.params["id"], "&".join(post_strs) + ) + ) + # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore + module.exit_json( + msg="Successfully updated Offense ID: {0}".format(module.params["id"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + else: + # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore + module.fail_json( + msg="Unable to find Offense ID: {0}".format(module.params["id"]) + ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_info.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_info.py new file mode 100644 index 00000000..fd9e4d90 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_info.py @@ -0,0 +1,215 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_info +short_description: Obtain information about one or many QRadar Offenses, with filter options +description: + - This module allows to obtain information about one or many QRadar Offenses, with filter options +version_added: "1.0.0" +options: + id: + description: + - Obtain only information of the Offense with provided ID + required: false + type: int + name: + description: + - Obtain only information of the Offense that matches the provided name + required: false + type: str + status: + description: + - Obtain only information of Offenses of a certain status + required: false + choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ] + default: "open" + type: str + assigned_to: + description: + - Obtain only information of Offenses assigned to a certain user + required: false + type: str + closing_reason: + description: + - Obtain only information of Offenses that were closed by a specific closing reason + required: false + type: str + closing_reason_id: + description: + - Obtain only information of Offenses that were closed by a specific closing reason ID + required: false + type: int + follow_up: + description: + - Obtain only information of Offenses that are marked with the follow up flag + required: false + type: bool + protected: + description: + - Obtain only information of Offenses that are protected + required: false + type: bool +notes: + - You may provide many filters and they will all be applied, except for C(id) + as that will return only + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + + +# FIXME - provide correct example here +RETURN = """ +offenses: + description: Information + returned: always + type: list + elements: dict + contains: + qradar_offenses: + description: IBM QRadar Offenses found based on provided filters + returned: always + type: complex + contains: + source: + description: Init system of the service. One of C(systemd), C(sysv), C(upstart). + returned: always + type: str + sample: sysv + state: + description: State of the service. Either C(running), C(stopped), or C(unknown). + returned: always + type: str + sample: running + status: + description: State of the service. Either C(enabled), C(disabled), or C(unknown). + returned: systemd systems or RedHat/SUSE flavored sysvinit/upstart + type: str + sample: enabled + name: + description: Name of the service. + returned: always + type: str + sample: arp-ethers.service +""" + + +EXAMPLES = """ +- name: Get list of all currently OPEN IBM QRadar Offenses + ibm.qradar.offense_info: + status: OPEN + register: offense_list + +- name: display offense information for debug purposes + debug: + var: offense_list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + assigned_to=dict(required=False, type="str"), + closing_reason=dict(required=False, type="str"), + closing_reason_id=dict(required=False, type="int"), + follow_up=dict(required=False, type="bool", default=None), + protected=dict(required=False, type="bool", default=None), + status=dict( + required=False, + choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"], + default="open", + type="str", + ), + ) + + module = AnsibleModule( + argument_spec=argspec, + mutually_exclusive=[("closing_reason", "closing_reason_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest(module) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + + set_offense_values(module, qradar_request) + + if module.params["id"]: + offenses = qradar_request.get( + "/api/siem/offenses/{0}".format(module.params["id"]) + ) + + else: + query_strs = [] + + if module.params["status"]: + query_strs.append( + quote("status={0}".format(to_text(module.params["status"]))) + ) + + if module.params["assigned_to"]: + query_strs.append( + quote("assigned_to={0}".format(module.params["assigned_to"])) + ) + + if module.params["closing_reason_id"]: + query_strs.append( + quote( + "closing_reason_id={0}".format(module.params["closing_reason_id"]) + ) + ) + + if module.params["follow_up"] is not None: + query_strs.append(quote("follow_up={0}".format(module.params["follow_up"]))) + + if module.params["protected"] is not None: + query_strs.append(quote("protected={0}".format(module.params["protected"]))) + + if query_strs: + offenses = qradar_request.get( + "/api/siem/offenses?filter={0}".format("&".join(query_strs)) + ) + else: + offenses = qradar_request.get("/api/siem/offenses") + + if module.params["name"]: + named_offense = find_dict_in_list( + offenses, "description", module.params["name"] + ) + if named_offense: + offenses = named_offense + else: + offenses = [] + + module.exit_json(offenses=offenses, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_note.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_note.py new file mode 100644 index 00000000..3a5fd6a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/offense_note.py @@ -0,0 +1,189 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_note +short_description: Create or update a QRadar Offense Note +description: + - This module allows to create a QRadar Offense note +version_added: "1.0.0" +options: + id: + description: + - Offense ID to operate on + required: true + type: int + note_text: + description: The note's text contents + required: true + type: str + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +""" +# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS +# offense_name: +# description: +# - Name of Offense +# required: true +# type: str + +# FIXME - WOULD LIKE TO MANAGE STATE +# state: +# description: Define state of the note: present or absent +# required: false +# choices: ["present", "absent"] +# default: "present" +""" + +EXAMPLES = """ +- name: Add a note to QRadar Offense ID 1 + ibm.qradar.offense_note: + id: 1 + note_text: This an example note entry that should be made on offense id 1 +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, +) + +import copy +import json + + +def set_offense_values(module, qradar_request): + if module.params["closing_reason"]: + found_closing_reason = qradar_request.get( + "/api/siem/offense_closing_reasons?filter={0}".format( + quote('text="{0}"'.format(module.params["closing_reason"])) + ) + ) + if found_closing_reason: + module.params["closing_reason_id"] = found_closing_reason[0]["id"] + else: + module.fail_json( + "Unable to find closing_reason text: {0}".format( + module.params["closing_reason"] + ) + ) + + if module.params["status"]: + module.params["status"] = module.params["status"].upper() + + +def main(): + + argspec = dict( + # state=dict(required=False, choices=["present", "absent"], type='str', default="present"), + id=dict(required=True, type="int"), + note_text=dict(required=True, type="str"), + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) + + qradar_request = QRadarRequest(module, not_rest_data_keys=["state", "id"],) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + # FIXME - once this is sorted, add it to module_utils + + found_notes = qradar_request.get( + "/api/siem/offenses/{0}/notes?filter={1}".format( + module.params["id"], + quote('note_text="{0}"'.format(module.params["note_text"])), + ) + ) + + # if module.params['state'] == 'present': + + if found_notes: + # The note we want exists either by ID or by text name, verify + + note = found_notes[0] + if note["note_text"] == module.params["note_text"]: + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + else: + if module.check_mode: + module.exit_json( + msg="A change would have occured but did not because Check Mode", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}/notes?note_text={1}".format( + module.params["id"], quote("{0}".format(module.params["note_text"])) + ), + data=False, + ) + module.exit_json( + msg="Successfully created Offense Note ID: {0}".format( + qradar_return_data["id"] + ), + qradar_return_data=qradar_return_data, + changed=False, + ) + + else: + if module.check_mode: + module.exit_json( + msg="A change would have occured but did not because Check Mode", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}/notes?note_text={1}".format( + module.params["id"], quote("{0}".format(module.params["note_text"])) + ), + data=False, + ) + module.exit_json( + msg="Successfully created Offense Note ID: {0}".format( + qradar_return_data["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + + # FIXME FIXME FIXME - can we actually delete these via the REST API? + # if module.params['state'] == 'absent': + # if not found_notes: + # module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + # else: + # if module.check_mode: + # module.exit_json(msg="A change would have occured but did not because Check Mode", changed=True) + # # FIXME: fix the POST here to actually delete + # qradar_return_data = qradar_request.post_by_path( + # 'api/siem/offenses/{0}/notes?note_text={1}'.format( + # module.params['id'], + # quote("{0}".format(module.params['note_text'])), + # ), + # data=False + # ) + # module.exit_json( + # msg="Successfully created Offense Note ID: {0}".format(qradar_return_data['id']), + # qradar_return_data=qradar_return_data, + # changed=True + # ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py new file mode 100644 index 00000000..69baa06a --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_deploy.py @@ -0,0 +1,84 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: deploy +short_description: Trigger a qradar configuration deployment +description: + - This module allows for INCREMENTAL or FULL deployments +version_added: "1.0.0" +options: + type: + description: + - Type of deployment + required: false + type: str + choices: + - "INCREMENTAL" + - "FULL" + default: "INCREMENTAL" +notes: + - This module does not support check mode because the QRadar REST API does not offer stateful inspection of configuration deployments + +author: "Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>" +""" + +EXAMPLES = """ +- name: run an incremental deploy + ibm.qradar.deploy: + type: INCREMENTAL +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import QRadarRequest + +import json + + +def main(): + + argspec = dict( + type=dict( + choices=["INCREMENTAL", "FULL"], required=False, default="INCREMENTAL" + ) + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=False) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["state", "type_name", "identifier"], + ) + + qradar_return_data = qradar_request.post_by_path("api/staged_config/deploy_status") + + if "message" in qradar_return_data and ( + to_text("No changes to deploy") in to_text(qradar_return_data["message"]) + ): + module.exit_json( + msg="No changes to deploy", + qradar_return_data=qradar_return_data, + changed=False, + ) + else: + module.exit_json( + msg="Successfully initiated {0} deployment.".format(module.params["type"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py new file mode 100644 index 00000000..eebb9e9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_log_source_management.py @@ -0,0 +1,251 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: log_source_management +short_description: Manage Log Sources in QRadar +description: + - This module allows for addition, deletion, or modification of Log Sources in QRadar +version_added: "1.0.0" +options: + name: + description: + - Name of Log Source + required: true + type: str + state: + description: + - Add or remove a log source. + required: true + choices: [ "present", "absent" ] + type: str + type_name: + description: + - Type of resource by name + required: false + type: str + type_id: + description: + - Type of resource by id, as defined in QRadar Log Source Types Documentation + required: false + type: int + protocol_type_id: + description: + - Type of protocol by id, as defined in QRadar Log Source Types Documentation + required: false + type: int + identifier: + description: + - Log Source Identifier (Typically IP Address or Hostname of log source) + required: true + type: str + description: + description: + - Description of log source + required: true + type: str + +notes: + - Either C(type) or C(type_id) is required + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +EXAMPLES = """ +- name: Add a snort log source to IBM QRadar + ibm.qradar.log_source_management: + name: "Snort logs" + type_name: "Snort Open Source IDS" + state: present + description: "Snort IDS remote logs from rsyslog" + identifier: "192.168.1.101" +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, +) + +import json + + +def set_log_source_values(module, qradar_request): + if module.params["type_name"]: + log_source_type_found = qradar_request.get( + "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format( + quote('name="{0}"'.format(module.params["type_name"])) + ) + )[0] + if module.params["type_id"]: + log_source_type_found = qradar_request.get( + "api/config/event_sources/log_source_management/log_source_types?filter={0}".format( + quote('id="{0}"'.format(module.params["type_id"])) + ) + )[0] + if log_source_type_found: + if not module.params["type_id"]: + module.params["type_id"] = log_source_type_found["id"] + else: + module.fail_json( + msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types" + ) + + if module.params["protocol_type_id"]: + found_dict_in_list, _fdil_index = find_dict_in_list( + log_source_type_found["protocol_types"], + "protocol_id", + module.params["protocol_type_id"], + ) + if not found_dict_in_list: + module.fail_json( + msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types" + ) + else: + # Set it to the default as provided by the QRadar Instance + module.params["protocol_type_id"] = log_source_type_found["protocol_types"][0][ + "protocol_id" + ] + + module.params["protocol_parameters"] = [ + { + "id": module.params["protocol_type_id"], + "name": "identifier", + "value": module.params["identifier"], + } + ] + + +def main(): + + argspec = dict( + name=dict(required=True, type="str"), + state=dict(choices=["present", "absent"], required=True), + type_name=dict(required=False, type="str"), + type_id=dict(required=False, type="int"), + identifier=dict(required=True, type="str"), + protocol_type_id=dict(required=False, type="int"), + description=dict(required=True, type="str"), + ) + + module = AnsibleModule( + argument_spec=argspec, + required_one_of=[("type_name", "type_id")], + mutually_exclusive=[("type_name", "type_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["state", "type_name", "identifier"], + ) + + log_source_exists = qradar_request.get( + "/api/config/event_sources/log_source_management/log_sources?filter={0}".format( + quote('name="{0}"'.format(module.params["name"])) + ) + ) + + if log_source_exists: + + if module.params["state"] == "present": + existing_log_source_protocol_identifier, _elspi_index = find_dict_in_list( + log_source_exists[0]["protocol_parameters"], "name", "identifier" + ) + + set_log_source_values(module, qradar_request) + + comparison_map = [ + existing_log_source_protocol_identifier["value"] + == module.params["identifier"], + log_source_exists[0]["name"] == module.params["name"], + log_source_exists[0]["type_id"] == module.params["type_id"], + to_text(log_source_exists[0]["description"]) + == to_text(module.params["description"]), + ] + + if all(comparison_map): + module.exit_json(changed=False, msg="Nothing to do.") + else: + log_source_exists[0]["protocol_parameters"][ + _elspi_index + ] = module.params["protocol_parameters"][0] + log_source_exists[0]["name"] = module.params["name"] + log_source_exists[0]["type_id"] = module.params["type_id"] + log_source_exists[0]["description"] = module.params["description"] + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.create_update( + "api/config/event_sources/log_source_management/log_sources", + data=json.dumps(log_source_exists), + ) + + module.exit_json( + msg="Successfully updated log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + if module.params["state"] == "absent": + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.delete( + "/api/config/event_sources/log_source_management/log_sources/{0}".format( + log_source_exists[0]["id"] + ) + ) + + module.exit_json( + msg="Successfully deleted log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["state"] == "present": + set_log_source_values(module, qradar_request) + if module.check_mode: + qradar_return_data = { + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + } + else: + qradar_return_data = qradar_request.create_update( + "api/config/event_sources/log_source_management/log_sources", + data=json.dumps([qradar_request.get_data()]), + ) + + module.exit_json( + msg="Successfully created log source: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + if module.params["state"] == "absent": + module.exit_json(changed=False, msg="Nothing to do.") + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py new file mode 100644 index 00000000..37eceb16 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_action.py @@ -0,0 +1,191 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_action +short_description: Take action on a QRadar Offense +description: + - This module allows to assign, protect, follow up, set status, and assign closing reason to QRadar Offenses +version_added: "1.0.0" +options: + id: + description: + - ID of Offense + required: true + type: int + status: + description: + - One of "open", "hidden" or "closed". (Either all lower case or all caps) + required: false + choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ] + type: str + assigned_to: + description: + - Assign to an user, the QRadar username should be provided + required: false + type: str + closing_reason: + description: + - Assign a predefined closing reason here, by name. + required: false + type: str + closing_reason_id: + description: + - Assign a predefined closing reason here, by id. + required: false + type: int + follow_up: + description: + - Set or unset the flag to follow up on a QRadar Offense + required: false + type: bool + protected: + description: + - Set or unset the flag to protect a QRadar Offense + required: false + type: bool + +notes: + - Requires one of C(name) or C(id) be provided + - Only one of C(closing_reason) or C(closing_reason_id) can be provided + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +""" +# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS +# name: +# description: +# - Name of Offense +# required: true +# type: str +""" + +EXAMPLES = """ +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + # name=dict(required=False, type='str'), + # id=dict(required=False, type='str'), + id=dict(required=True, type="int"), + assigned_to=dict(required=False, type="str"), + closing_reason=dict(required=False, type="str"), + closing_reason_id=dict(required=False, type="int"), + follow_up=dict(required=False, type="bool"), + protected=dict(required=False, type="bool"), + status=dict( + required=False, + choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"], + type="str", + ), + ) + + module = AnsibleModule( + argument_spec=argspec, + # required_one_of=[ + # ('name', 'id',), + # ], + mutually_exclusive=[("closing_reason", "closing_reason_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["name", "id", "assigned_to", "closing_reason"], + ) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + + found_offense = qradar_request.get( + "/api/siem/offenses/{0}".format(module.params["id"]) + ) + + if found_offense: + set_offense_values(module, qradar_request) + + post_strs = [] + + if module.params["status"] and ( + to_text(found_offense["status"]) != to_text(module.params["status"]) + ): + post_strs.append("status={0}".format(to_text(module.params["status"]))) + + if module.params["assigned_to"] and ( + to_text(found_offense["assigned_to"]) + != to_text(module.params["assigned_to"]) + ): + post_strs.append("assigned_to={0}".format(module.params["assigned_to"])) + + if module.params["closing_reason_id"] and ( + found_offense["closing_reason_id"] != module.params["closing_reason_id"] + ): + post_strs.append( + "closing_reason_id={0}".format(module.params["closing_reason_id"]) + ) + + if module.params["follow_up"] and ( + found_offense["follow_up"] != module.params["follow_up"] + ): + post_strs.append("follow_up={0}".format(module.params["follow_up"])) + + if module.params["protected"] and ( + found_offense["protected"] != module.params["protected"] + ): + post_strs.append("protected={0}".format(module.params["protected"])) + + if post_strs: + if module.check_mode: + module.exit_json( + msg="A change would have been made but was not because of Check Mode.", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}?{1}".format( + module.params["id"], "&".join(post_strs) + ) + ) + # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore + module.exit_json( + msg="Successfully updated Offense ID: {0}".format(module.params["id"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + else: + # FIXME - handle the scenario in which we can search by name and this isn't a required param anymore + module.fail_json( + msg="Unable to find Offense ID: {0}".format(module.params["id"]) + ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py new file mode 100644 index 00000000..fd9e4d90 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_info.py @@ -0,0 +1,215 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_info +short_description: Obtain information about one or many QRadar Offenses, with filter options +description: + - This module allows to obtain information about one or many QRadar Offenses, with filter options +version_added: "1.0.0" +options: + id: + description: + - Obtain only information of the Offense with provided ID + required: false + type: int + name: + description: + - Obtain only information of the Offense that matches the provided name + required: false + type: str + status: + description: + - Obtain only information of Offenses of a certain status + required: false + choices: [ "open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED" ] + default: "open" + type: str + assigned_to: + description: + - Obtain only information of Offenses assigned to a certain user + required: false + type: str + closing_reason: + description: + - Obtain only information of Offenses that were closed by a specific closing reason + required: false + type: str + closing_reason_id: + description: + - Obtain only information of Offenses that were closed by a specific closing reason ID + required: false + type: int + follow_up: + description: + - Obtain only information of Offenses that are marked with the follow up flag + required: false + type: bool + protected: + description: + - Obtain only information of Offenses that are protected + required: false + type: bool +notes: + - You may provide many filters and they will all be applied, except for C(id) + as that will return only + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + + +# FIXME - provide correct example here +RETURN = """ +offenses: + description: Information + returned: always + type: list + elements: dict + contains: + qradar_offenses: + description: IBM QRadar Offenses found based on provided filters + returned: always + type: complex + contains: + source: + description: Init system of the service. One of C(systemd), C(sysv), C(upstart). + returned: always + type: str + sample: sysv + state: + description: State of the service. Either C(running), C(stopped), or C(unknown). + returned: always + type: str + sample: running + status: + description: State of the service. Either C(enabled), C(disabled), or C(unknown). + returned: systemd systems or RedHat/SUSE flavored sysvinit/upstart + type: str + sample: enabled + name: + description: Name of the service. + returned: always + type: str + sample: arp-ethers.service +""" + + +EXAMPLES = """ +- name: Get list of all currently OPEN IBM QRadar Offenses + ibm.qradar.offense_info: + status: OPEN + register: offense_list + +- name: display offense information for debug purposes + debug: + var: offense_list +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + assigned_to=dict(required=False, type="str"), + closing_reason=dict(required=False, type="str"), + closing_reason_id=dict(required=False, type="int"), + follow_up=dict(required=False, type="bool", default=None), + protected=dict(required=False, type="bool", default=None), + status=dict( + required=False, + choices=["open", "OPEN", "hidden", "HIDDEN", "closed", "CLOSED"], + default="open", + type="str", + ), + ) + + module = AnsibleModule( + argument_spec=argspec, + mutually_exclusive=[("closing_reason", "closing_reason_id")], + supports_check_mode=True, + ) + + qradar_request = QRadarRequest(module) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + + set_offense_values(module, qradar_request) + + if module.params["id"]: + offenses = qradar_request.get( + "/api/siem/offenses/{0}".format(module.params["id"]) + ) + + else: + query_strs = [] + + if module.params["status"]: + query_strs.append( + quote("status={0}".format(to_text(module.params["status"]))) + ) + + if module.params["assigned_to"]: + query_strs.append( + quote("assigned_to={0}".format(module.params["assigned_to"])) + ) + + if module.params["closing_reason_id"]: + query_strs.append( + quote( + "closing_reason_id={0}".format(module.params["closing_reason_id"]) + ) + ) + + if module.params["follow_up"] is not None: + query_strs.append(quote("follow_up={0}".format(module.params["follow_up"]))) + + if module.params["protected"] is not None: + query_strs.append(quote("protected={0}".format(module.params["protected"]))) + + if query_strs: + offenses = qradar_request.get( + "/api/siem/offenses?filter={0}".format("&".join(query_strs)) + ) + else: + offenses = qradar_request.get("/api/siem/offenses") + + if module.params["name"]: + named_offense = find_dict_in_list( + offenses, "description", module.params["name"] + ) + if named_offense: + offenses = named_offense + else: + offenses = [] + + module.exit_json(offenses=offenses, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py new file mode 100644 index 00000000..3a5fd6a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_offense_note.py @@ -0,0 +1,189 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: offense_note +short_description: Create or update a QRadar Offense Note +description: + - This module allows to create a QRadar Offense note +version_added: "1.0.0" +options: + id: + description: + - Offense ID to operate on + required: true + type: int + note_text: + description: The note's text contents + required: true + type: str + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + +""" +# FIXME - WOULD LIKE TO QUERY BY NAME BUT HOW TO ACCOMPLISH THAT IS NON-OBVIOUS +# offense_name: +# description: +# - Name of Offense +# required: true +# type: str + +# FIXME - WOULD LIKE TO MANAGE STATE +# state: +# description: Define state of the note: present or absent +# required: false +# choices: ["present", "absent"] +# default: "present" +""" + +EXAMPLES = """ +- name: Add a note to QRadar Offense ID 1 + ibm.qradar.offense_note: + id: 1 + note_text: This an example note entry that should be made on offense id 1 +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, +) + +import copy +import json + + +def set_offense_values(module, qradar_request): + if module.params["closing_reason"]: + found_closing_reason = qradar_request.get( + "/api/siem/offense_closing_reasons?filter={0}".format( + quote('text="{0}"'.format(module.params["closing_reason"])) + ) + ) + if found_closing_reason: + module.params["closing_reason_id"] = found_closing_reason[0]["id"] + else: + module.fail_json( + "Unable to find closing_reason text: {0}".format( + module.params["closing_reason"] + ) + ) + + if module.params["status"]: + module.params["status"] = module.params["status"].upper() + + +def main(): + + argspec = dict( + # state=dict(required=False, choices=["present", "absent"], type='str', default="present"), + id=dict(required=True, type="int"), + note_text=dict(required=True, type="str"), + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) + + qradar_request = QRadarRequest(module, not_rest_data_keys=["state", "id"],) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME + # found_offense = qradar_request.get('/api/siem/offenses?filter={0}'.format(module.params['name'])) + # FIXME - once this is sorted, add it to module_utils + + found_notes = qradar_request.get( + "/api/siem/offenses/{0}/notes?filter={1}".format( + module.params["id"], + quote('note_text="{0}"'.format(module.params["note_text"])), + ) + ) + + # if module.params['state'] == 'present': + + if found_notes: + # The note we want exists either by ID or by text name, verify + + note = found_notes[0] + if note["note_text"] == module.params["note_text"]: + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + else: + if module.check_mode: + module.exit_json( + msg="A change would have occured but did not because Check Mode", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}/notes?note_text={1}".format( + module.params["id"], quote("{0}".format(module.params["note_text"])) + ), + data=False, + ) + module.exit_json( + msg="Successfully created Offense Note ID: {0}".format( + qradar_return_data["id"] + ), + qradar_return_data=qradar_return_data, + changed=False, + ) + + else: + if module.check_mode: + module.exit_json( + msg="A change would have occured but did not because Check Mode", + changed=True, + ) + + qradar_return_data = qradar_request.post_by_path( + "api/siem/offenses/{0}/notes?note_text={1}".format( + module.params["id"], quote("{0}".format(module.params["note_text"])) + ), + data=False, + ) + module.exit_json( + msg="Successfully created Offense Note ID: {0}".format( + qradar_return_data["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + + module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + + # FIXME FIXME FIXME - can we actually delete these via the REST API? + # if module.params['state'] == 'absent': + # if not found_notes: + # module.exit_json(msg="No changes necessary. Nothing to do.", changed=False) + # else: + # if module.check_mode: + # module.exit_json(msg="A change would have occured but did not because Check Mode", changed=True) + # # FIXME: fix the POST here to actually delete + # qradar_return_data = qradar_request.post_by_path( + # 'api/siem/offenses/{0}/notes?note_text={1}'.format( + # module.params['id'], + # quote("{0}".format(module.params['note_text'])), + # ), + # data=False + # ) + # module.exit_json( + # msg="Successfully created Offense Note ID: {0}".format(qradar_return_data['id']), + # qradar_return_data=qradar_return_data, + # changed=True + # ) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py new file mode 100644 index 00000000..57c70ee5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule.py @@ -0,0 +1,248 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: rule +short_description: Manage state of QRadar Rules, with filter options +description: + - Manage state of QRadar Rules, with filter options +version_added: "1.0.0" +options: + id: + description: + - Manage state of a QRadar Rule by ID + required: false + type: int + name: + description: + - Manage state of a QRadar Rule by name + required: false + type: str + state: + description: + - Manage state of a QRadar Rule + required: True + choices: [ "enabled", "disabled", "absent" ] + type: str + owner: + description: + - Manage ownership of a QRadar Rule + required: false + type: str + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + + +# FIXME - provide correct example here +RETURN = """ +""" + +EXAMPLES = """ +- name: Enable Rule 'Ansible Example DDoS Rule' + qradar_rule: + name: 'Ansible Example DDOS Rule' + state: enabled +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + state=dict( + required=True, choices=["enabled", "disabled", "absent"], type="str" + ), + owner=dict(required=False, type="str"), + ) + + module = AnsibleModule( + argument_spec=argspec, + supports_check_mode=True, + required_one_of=[("name", "id")], + mutually_exclusive=[("name", "id")], + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["id", "name", "state", "owner"], + ) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name'])) + module.params["rule"] = {} + + if module.params["id"]: + module.params["rule"] = qradar_request.get( + "/api/analytics/rules/{0}".format(module.params["id"]) + ) + + elif module.params["name"]: + rules = qradar_request.get( + "/api/analytics/rules?filter={0}".format( + quote('"{0}"'.format(module.params["name"])) + ) + ) + if rules: + module.params["rule"] = rules[0] + module.params["id"] = rules[0]["id"] + + if module.params["state"] == "enabled": + if module.params["rule"]: + if module.params["rule"]["enabled"] is True: + # Already enabled + if module.params["id"]: + module.exit_json( + msg="No change needed for rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data={}, + changed=False, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data={}, + changed=False, + ) + else: + # Not enabled, enable It + module.params["rule"]["enabled"] = True + + qradar_return_data = qradar_request.post_by_path( + "api/analytics/rules/{0}".format(module.params["rule"]["id"]), + data=json.dumps(module.params["rule"]), + ) + if module.params["id"]: + module.exit_json( + msg="Successfully enabled rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["id"]: + module.fail_json( + msg="Unable to find rule ID: {0}".format(module.params["id"]) + ) + if module.params["name"]: + module.fail_json( + msg='Unable to find rule named: "{0}"'.format(module.params["name"]) + ) + + elif module.params["state"] == "disabled": + if module.params["rule"]: + if module.params["rule"]["enabled"] is False: + # Already disabled + if module.params["id"]: + module.exit_json( + msg="No change needed for rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data={}, + changed=False, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data={}, + changed=False, + ) + else: + # Not disabled, disable It + module.params["rule"]["enabled"] = False + + qradar_return_data = qradar_request.post_by_path( + "api/analytics/rules/{0}".format(module.params["rule"]["id"]), + data=json.dumps(module.params["rule"]), + ) + if module.params["id"]: + module.exit_json( + msg="Successfully disabled rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully disabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["id"]: + module.fail_json( + msg="Unable to find rule ID: {0}".format(module.params["id"]) + ) + if module.params["name"]: + module.fail_json( + msg='Unable to find rule named: "{0}"'.format(module.params["name"]) + ) + + elif module.params["state"] == "absent": + if module.params["rule"]: + qradar_return_data = qradar_request.delete( + "/api/analytics/rules/{0}".format(module.params["rule"]["id"]) + ) + if module.params["id"]: + module.exit_json( + msg="Successfully deleted rule ID: {0}".format(module.params["id"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully deleted rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + module.exit_json(msg="Nothing to do, rule not found.") + + module.exit_json(rules=rules, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py new file mode 100644 index 00000000..174d4079 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/qradar_rule_info.py @@ -0,0 +1,138 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: rule_info +short_description: Obtain information about one or many QRadar Rules, with filter options +description: + - This module obtains information about one or many QRadar Rules, with filter options +version_added: "1.0.0" +options: + id: + description: + - Obtain only information of the Rule with provided ID + required: false + type: int + name: + description: + - Obtain only information of the Rule that matches the provided name + required: false + type: str + type: + description: + - Obtain only information for the Rules of a certain type + required: false + choices: [ "EVENT", "FLOW", "COMMON", "USER"] + type: str + owner: + description: + - Obtain only information of Rules owned by a certain user + required: false + type: str + origin: + description: + - Obtain only information of Rules that are of a certain origin + required: false + choices: ["SYSTEM", "OVERRIDE", "USER"] + type: str +notes: + - You may provide many filters and they will all be applied, except for C(id) + as that will return only the Rule identified by the unique ID provided. + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>" +""" + + +# FIXME - provide correct example here +RETURN = """ +""" + +EXAMPLES = """ +- name: Get information about the Rule named "Custom Company DDoS Rule" + ibm.qradar.rule_info: + name: "Custom Company DDoS Rule" + register: custom_ddos_rule_info + +- name: debugging output of the custom_ddos_rule_info registered variable + debug: + var: custom_ddos_rule_info +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + owner=dict(required=False, type="str"), + type=dict( + required=False, choices=["EVENT", "FLOW", "COMMON", "USER"], type="str" + ), + origin=dict(required=False, choices=["SYSTEM", "OVERRIDE", "USER"], type="str"), + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) + + qradar_request = QRadarRequest(module) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name'])) + + if module.params["id"]: + rules = qradar_request.get( + "/api/analytics/rules/{0}".format(module.params["id"]) + ) + + else: + query_strs = [] + + if module.params["name"]: + query_strs.append( + quote('name="{0}"'.format(to_text(module.params["name"]))) + ) + + if module.params["owner"]: + query_strs.append(quote("owner={0}".format(module.params["owner"]))) + + if module.params["type"]: + query_strs.append(quote("type={0}".format(module.params["type"]))) + + if module.params["origin"]: + query_strs.append(quote("origin={0}".format(module.params["origin"]))) + + if query_strs: + rules = qradar_request.get( + "/api/analytics/rules?filter={0}".format("&".join(query_strs)) + ) + else: + rules = qradar_request.get("/api/analytics/rules") + + module.exit_json(rules=rules, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule.py new file mode 100644 index 00000000..57c70ee5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule.py @@ -0,0 +1,248 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: rule +short_description: Manage state of QRadar Rules, with filter options +description: + - Manage state of QRadar Rules, with filter options +version_added: "1.0.0" +options: + id: + description: + - Manage state of a QRadar Rule by ID + required: false + type: int + name: + description: + - Manage state of a QRadar Rule by name + required: false + type: str + state: + description: + - Manage state of a QRadar Rule + required: True + choices: [ "enabled", "disabled", "absent" ] + type: str + owner: + description: + - Manage ownership of a QRadar Rule + required: false + type: str + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security> +""" + + +# FIXME - provide correct example here +RETURN = """ +""" + +EXAMPLES = """ +- name: Enable Rule 'Ansible Example DDoS Rule' + qradar_rule: + name: 'Ansible Example DDOS Rule' + state: enabled +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + state=dict( + required=True, choices=["enabled", "disabled", "absent"], type="str" + ), + owner=dict(required=False, type="str"), + ) + + module = AnsibleModule( + argument_spec=argspec, + supports_check_mode=True, + required_one_of=[("name", "id")], + mutually_exclusive=[("name", "id")], + ) + + qradar_request = QRadarRequest( + module, not_rest_data_keys=["id", "name", "state", "owner"], + ) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name'])) + module.params["rule"] = {} + + if module.params["id"]: + module.params["rule"] = qradar_request.get( + "/api/analytics/rules/{0}".format(module.params["id"]) + ) + + elif module.params["name"]: + rules = qradar_request.get( + "/api/analytics/rules?filter={0}".format( + quote('"{0}"'.format(module.params["name"])) + ) + ) + if rules: + module.params["rule"] = rules[0] + module.params["id"] = rules[0]["id"] + + if module.params["state"] == "enabled": + if module.params["rule"]: + if module.params["rule"]["enabled"] is True: + # Already enabled + if module.params["id"]: + module.exit_json( + msg="No change needed for rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data={}, + changed=False, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data={}, + changed=False, + ) + else: + # Not enabled, enable It + module.params["rule"]["enabled"] = True + + qradar_return_data = qradar_request.post_by_path( + "api/analytics/rules/{0}".format(module.params["rule"]["id"]), + data=json.dumps(module.params["rule"]), + ) + if module.params["id"]: + module.exit_json( + msg="Successfully enabled rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["id"]: + module.fail_json( + msg="Unable to find rule ID: {0}".format(module.params["id"]) + ) + if module.params["name"]: + module.fail_json( + msg='Unable to find rule named: "{0}"'.format(module.params["name"]) + ) + + elif module.params["state"] == "disabled": + if module.params["rule"]: + if module.params["rule"]["enabled"] is False: + # Already disabled + if module.params["id"]: + module.exit_json( + msg="No change needed for rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data={}, + changed=False, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully enabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data={}, + changed=False, + ) + else: + # Not disabled, disable It + module.params["rule"]["enabled"] = False + + qradar_return_data = qradar_request.post_by_path( + "api/analytics/rules/{0}".format(module.params["rule"]["id"]), + data=json.dumps(module.params["rule"]), + ) + if module.params["id"]: + module.exit_json( + msg="Successfully disabled rule ID: {0}".format( + module.params["id"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully disabled rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + if module.params["id"]: + module.fail_json( + msg="Unable to find rule ID: {0}".format(module.params["id"]) + ) + if module.params["name"]: + module.fail_json( + msg='Unable to find rule named: "{0}"'.format(module.params["name"]) + ) + + elif module.params["state"] == "absent": + if module.params["rule"]: + qradar_return_data = qradar_request.delete( + "/api/analytics/rules/{0}".format(module.params["rule"]["id"]) + ) + if module.params["id"]: + module.exit_json( + msg="Successfully deleted rule ID: {0}".format(module.params["id"]), + qradar_return_data=qradar_return_data, + changed=True, + ) + if module.params["name"]: + module.exit_json( + msg="Successfully deleted rule named: {0}".format( + module.params["name"] + ), + qradar_return_data=qradar_return_data, + changed=True, + ) + else: + module.exit_json(msg="Nothing to do, rule not found.") + + module.exit_json(rules=rules, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule_info.py b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule_info.py new file mode 100644 index 00000000..174d4079 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/plugins/modules/rule_info.py @@ -0,0 +1,138 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Adam Miller (admiller@redhat.com) +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +module: rule_info +short_description: Obtain information about one or many QRadar Rules, with filter options +description: + - This module obtains information about one or many QRadar Rules, with filter options +version_added: "1.0.0" +options: + id: + description: + - Obtain only information of the Rule with provided ID + required: false + type: int + name: + description: + - Obtain only information of the Rule that matches the provided name + required: false + type: str + type: + description: + - Obtain only information for the Rules of a certain type + required: false + choices: [ "EVENT", "FLOW", "COMMON", "USER"] + type: str + owner: + description: + - Obtain only information of Rules owned by a certain user + required: false + type: str + origin: + description: + - Obtain only information of Rules that are of a certain origin + required: false + choices: ["SYSTEM", "OVERRIDE", "USER"] + type: str +notes: + - You may provide many filters and they will all be applied, except for C(id) + as that will return only the Rule identified by the unique ID provided. + +author: Ansible Security Automation Team (@maxamillion) <https://github.com/ansible-security>" +""" + + +# FIXME - provide correct example here +RETURN = """ +""" + +EXAMPLES = """ +- name: Get information about the Rule named "Custom Company DDoS Rule" + ibm.qradar.rule_info: + name: "Custom Company DDoS Rule" + register: custom_ddos_rule_info + +- name: debugging output of the custom_ddos_rule_info registered variable + debug: + var: custom_ddos_rule_info +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_text + +from ansible.module_utils.urls import Request +from ansible.module_utils.six.moves.urllib.parse import quote +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( + QRadarRequest, + find_dict_in_list, + set_offense_values, +) + +import copy +import json + + +def main(): + + argspec = dict( + id=dict(required=False, type="int"), + name=dict(required=False, type="str"), + owner=dict(required=False, type="str"), + type=dict( + required=False, choices=["EVENT", "FLOW", "COMMON", "USER"], type="str" + ), + origin=dict(required=False, choices=["SYSTEM", "OVERRIDE", "USER"], type="str"), + ) + + module = AnsibleModule(argument_spec=argspec, supports_check_mode=True) + + qradar_request = QRadarRequest(module) + + # if module.params['name']: + # # FIXME - QUERY HERE BY NAME NATIVELY VIA REST API (DOESN'T EXIST YET) + # found_offense = qradar_request.get('/api/analytics/rules?filter={0}'.format(module.params['name'])) + + if module.params["id"]: + rules = qradar_request.get( + "/api/analytics/rules/{0}".format(module.params["id"]) + ) + + else: + query_strs = [] + + if module.params["name"]: + query_strs.append( + quote('name="{0}"'.format(to_text(module.params["name"]))) + ) + + if module.params["owner"]: + query_strs.append(quote("owner={0}".format(module.params["owner"]))) + + if module.params["type"]: + query_strs.append(quote("type={0}".format(module.params["type"]))) + + if module.params["origin"]: + query_strs.append(quote("origin={0}".format(module.params["origin"]))) + + if query_strs: + rules = qradar_request.get( + "/api/analytics/rules?filter={0}".format("&".join(query_strs)) + ) + else: + rules = qradar_request.get("/api/analytics/rules") + + module.exit_json(rules=rules, changed=False) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/requirements.txt b/collections-debian-merged/ansible_collections/ibm/qradar/requirements.txt new file mode 100644 index 00000000..90d40550 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/requirements.txt @@ -0,0 +1 @@ +ansible diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/test-requirements.txt b/collections-debian-merged/ansible_collections/ibm/qradar/test-requirements.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/test-requirements.txt diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/.keep b/collections-debian-merged/ansible_collections/ibm/qradar/tests/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/.keep diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network new file mode 100644 index 00000000..f26802f6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/target-prefixes.network @@ -0,0 +1 @@ +qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/deploy/tasks/main.yml diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml new file mode 100644 index 00000000..87bb1137 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml @@ -0,0 +1,60 @@ +--- +- name: Create Testing Snort Open Source IDS log source + log_source_management: + name: "Testing Collections PB - 192.168.1.112" + type_name: "Snort Open Source IDS" + state: present + description: "Testing Collection PB Description" + identifier: "192.168.1.112" + register: snort_log_source_create + +- name: Assert Create Test Snort Open Source IDS log source changed + assert: + that: + - snort_log_source_create is changed + - snort_log_source_create is not failed + +- name: Create Testing Snort Open Source IDS log source RERUN + log_source_management: + name: "Testing Collections PB - 192.168.1.112" + type_name: "Snort Open Source IDS" + state: present + description: "Testing Collection PB Description" + identifier: "192.168.1.112" + register: snort_log_source_create_rerun + +- name: Assert Create Test Snort Open Source IDS log source is not changed on RERUN + assert: + that: + - snort_log_source_create_rerun is not changed + - snort_log_source_create_rerun is not failed + +- name: Delete Testing Snort Open Source IDS log source + log_source_management: + name: "Testing Collections PB - 192.168.1.112" + type_name: "Snort Open Source IDS" + state: absent + description: "Testing Collection PB Description" + identifier: "192.168.1.112" + register: snort_log_source_delete + +- name: Assert Delete Test Snort Open Source IDS log source changed + assert: + that: + - snort_log_source_delete is changed + - snort_log_source_delete is not failed + +- name: Delete Testing Snort Open Source IDS log source RERUN + log_source_management: + name: "Testing Collections PB - 192.168.1.112" + type_name: "Snort Open Source IDS" + state: absent + description: "Testing Collection PB Description" + identifier: "192.168.1.112" + register: snort_log_source_delete_rerun + +- name: Assert Delete Test Snort Open Source IDS log source is not changed on RERUN + assert: + that: + - snort_log_source_delete_rerun is not changed + - snort_log_source_delete_rerun is not failed diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml new file mode 100644 index 00000000..7495ec9b --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml @@ -0,0 +1,19 @@ +--- + +#- qradar_offense_action: +# id: 1 +# status: "hidden" +# assigned_to: "admin" +# protected: false +# +#- qradar_offense_note: +# offense_id: 2 +# note_text: "testing note text from playbook - modified" +# +#- name: get info about qradar offense +# qradar_offense_info: +# protected: true +# status: "HIDDEN" +# register: offense_info +# +#- debug: var=offense_info diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_deploy/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_source_management/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_offense/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/qradar_rule/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases new file mode 100644 index 00000000..d7e4f1e4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/aliases @@ -0,0 +1 @@ +network/qradar diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml new file mode 100644 index 00000000..142fd613 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml @@ -0,0 +1,55 @@ +--- +- name: get info about qradar offense + rule_info: + name: "Service DoS Attack Detected" + register: rule_info + +- debug: var=rule_info + +- name: enable rule by id + rule: + state: enabled + id: "{{ rule_info['rules'][0]['id']|int }}" + register: enable_rule_by_id + +- name: ensure enable rule by id + assert: + that: + - enable_rule_by_id is changed + - enable_rule_by_id is not failed + +- name: enable rule by id again + rule: + state: enabled + id: "{{ rule_info['rules'][0]['id']|int }}" + register: enable_rule_by_id_again + +- name: ensure enable rule by id again + assert: + that: + - enable_rule_by_id_again is not changed + - enable_rule_by_id_again is not failed + +- name: disable rule by id + rule: + state: disabled + id: "{{ rule_info['rules'][0]['id']|int }}" + register: disable_rule_by_id + +- name: ensure disable rule by id + assert: + that: + - disable_rule_by_id is changed + - disable_rule_by_id is not failed + +- name: disable rule by id again + rule: + state: disabled + id: "{{ rule_info['rules'][0]['id']|int }}" + register: disable_rule_by_id_again + +- name: ensure disable rule by id again + assert: + that: + - disable_rule_by_id_again is not changed + - disable_rule_by_id_again is not failed diff --git a/collections-debian-merged/ansible_collections/ibm/qradar/tox.ini b/collections-debian-merged/ansible_collections/ibm/qradar/tox.ini new file mode 100644 index 00000000..2f0cf5a2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/ibm/qradar/tox.ini @@ -0,0 +1,9 @@ +[tox] +minversion = 1.4.2 +skipsdist = True + +[testenv] +deps = -r{toxinidir}/requirements.txt + +[testenv:venv] +commands = {posargs} |