├── .env
├── LICENSE
├── README.md
├── docker-compose.yml
├── grafana
└── grafana.ini
├── graylog
├── GeoLite2-ASN.mmdb
├── GeoLite2-City.mmdb
├── README.md
├── graylog.conf
├── log4j2.xml
├── network_ports.csv
└── software_vendors.csv
├── wazuh
├── README.md
├── config
│ ├── certs.yml
│ ├── wazuh_cluster
│ │ └── wazuh_manager.conf
│ ├── wazuh_dashboard
│ │ ├── opensearch_dashboards.yml
│ │ └── wazuh.yml
│ └── wazuh_indexer
│ │ ├── internal_users.yml
│ │ └── wazuh.indexer.yml
├── custom-wazuh-manager
│ ├── Dockerfile
│ ├── README.md
│ └── config
│ │ ├── check_repository.sh
│ │ ├── create_user.py
│ │ ├── etc
│ │ ├── cont-init.d
│ │ │ ├── 0-wazuh-init
│ │ │ └── 1-manager
│ │ └── services.d
│ │ │ ├── fluent-bit
│ │ │ ├── finish
│ │ │ └── run
│ │ │ └── ossec-logs
│ │ │ └── run
│ │ ├── fluent-bit.conf
│ │ ├── permanent_data.env
│ │ └── permanent_data.sh
└── generate-indexer-certs.yml
└── wazuh_socfortress_rules.sh
/.env:
--------------------------------------------------------------------------------
1 | ################
2 | # Velociraptor #
3 | ################
4 | VELOX_USER=admin
5 | VELOX_PASSWORD=admin
6 | VELOX_ROLE=administrator
7 | VELOX_SERVER_URL=https://Velociraptor:8000/
8 | VELOX_FRONTEND_HOSTNAME=Velociraptor
9 |
10 |
11 | ###########
12 | # CoPilot #
13 | ###########
14 | # Leave this as is if connecting from a remote machine
15 | SERVER_IP=0.0.0.0
16 |
17 | MYSQL_URL=copilot-mysql
18 | # ! Avoid using special characters in the password ! #
19 | MYSQL_ROOT_PASSWORD=REPLACE_WITH_PASSWORD
20 | MYSQL_USER=copilot
21 | # ! Avoid using special characters in the password ! #
22 | MYSQL_PASSWORD=REPLACE_WITH_PASSWORD
23 |
24 | MINIO_URL=copilot-minio
25 | MINIO_ROOT_USER=admin
26 | # ! Make the password at least 8 characters long ! #
27 | MINIO_ROOT_PASSWORD=REPLACE_ME
28 | MINIO_SECURE=False
29 |
30 | # ! ALERT FORWARDING IP
31 | # Set this to the IP of the host running CoPilot. This is used by Graylog to forward alerts to CoPilot
32 | # ! Not needed anymore since we are reading from the index now
33 | # ! Ensure Graylog is able to reach this IP and port 5000
34 | ALERT_FORWARDING_IP=0.0.0.0
35 |
36 | # Connector Credentials
37 | # ! SETTING UP YOUR CONNECTORS DEMOs https://www.youtube.com/@taylorwalton_socfortress/videos! #
38 | WAZUH_INDEXER_URL=https://wazuh.indexer:9200
39 | WAZUH_INDEXER_USERNAME=admin
40 | WAZUH_INDEXER_PASSWORD=SecretPassword
41 |
42 | WAZUH_MANAGER_URL=https://wazuh.manager:55000
43 | WAZUH_MANAGER_USERNAME=wazuh-wui
44 | WAZUH_MANAGER_PASSWORD=MyS3cr37P450r.*-
45 |
46 | GRAYLOG_URL=http://graylog:9000
47 | GRAYLOG_USERNAME=admin
48 | GRAYLOG_PASSWORD=yourpassword
49 |
50 | SHUFFLE_URL=https://127.1.1.1
51 | SHUFFLER_API_KEY=dummy
52 | SHUFFLE_WORKFLOW_ID=dummy
53 |
54 | VELOCIRAPTOR_URL=https://velociraptor:8889
55 | VELOCIRAPTOR_API_KEY_PATH=dummy
56 |
57 | SUBLIME_URL=http://127.1.1.1
58 | SUBLIME_API_KEY=dummy
59 |
60 | INFLUXDB_URL=http://127.1.1.1
61 | INFLUXDB_API_KEY=dummy
62 | INFLUXDB_ORG_AND_BUCKET=dummy,dummy
63 |
64 | GRAFANA_URL=http://grafana:3000
65 | GRAFANA_USERNAME=admin
66 | GRAFANA_PASSWORD=admin
67 |
68 | WAZUH_WORKER_PROVISIONING_URL=http://127.1.1.1
69 |
70 | EVENT_SHIPPER_URL=graylog_host
71 | GELF_INPUT_PORT=gelf_port
72 |
73 | ALERT_CREATION_PROVISIONING_URL=http://127.1.1.1
74 |
75 | HAPROXY_PROVISIONING_URL=http://127.1.1.1
76 |
77 | # VirusTotal
78 | VIRUSTOTAL_URL=https://www.virustotal.com/api/v3
79 | VIRUSTOTAL_API_KEY=REPLACE_ME
80 |
81 | # Portainer
82 | PORTAINER_URL=http://127.1.1.1:9000
83 | PORTAINER_USERNAME=admin
84 | PORTAINER_PASSWORD=admin
85 | PORTAINER_ENDPOINT_ID=2
86 |
87 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Open Source SIEM Stack
2 |
3 | 💗 Shoutout to dLoProdz for helping put this together 🧡
4 |
5 |
6 |
7 | The idea behind this project is to facilitate testing of SOCFortress' Open Source SIEM Stack. This is by no means production safe security-wise,
8 | and only intended to get people started in a lab environment. This project is licensed under GPLv3 which means you can use and modify in it any way you like, so long as you keep it under the same
9 | licensing scheme. If you don't feel confortable making necessary changes for moving into production you can get in touch with us and we will help you get there.
10 |
11 |
12 |
Watch the Video Walkthrough
13 |
14 |
15 |
16 |
17 |
18 | ## Pre-Deployment
19 |
20 | The first step is to build the Custom Wazuh Manager image using the build script provided in wazuh/custom-wazuh-manager, there you will find instructions for the build.
21 |
22 | Next you need to create, by whichever means you prefer, the required Wazuh SSL certs and place them in the wazuh/config/wazuh_indexer_ssl_certs directory. I'm providing the official Wazuh cert generating
23 | script under wazuh/generate-indexer-certs.yml. Instructions for for running this container/script can be found in the Official Wazuh Docker Repo
24 | and also under the specific subdirectory. Note: Also copy the root-ca.pem certificate into the graylog/ subdirectory as you will need it in a later step.
25 |
26 | After successful build of the Custom Wazuh Image and SSL cert generation, the next step is to modify all the configuration files provided under each module's subdirectory, as the ones provided
27 | are templates taken from each tool's documentation; and also the .env file, which comes pre-populated up to a certain point for your convenience and is located in the directory root, to suit your
28 | environment and needs. Refer to each tool's documentation or follow Taylor Walton's Youtube Channel for guidance on how to
29 | configure each tool.
30 |
31 | You'll also need to follow the pre-deployment step outlined in the Graylog section. graylog/README.md
32 |
33 | Once that is out of the way, you are ready for Deployment.
34 |
35 | ## Deployment
36 |
37 | You can now safely start all containers by running:
38 | ```
39 | docker compose up -d
40 | ```
41 | Most of these services will need some tewaking before you are able to integrate them. I will note the project specific configurations, for the rest please follow
42 | Taylor's Videos.
43 | ### Wazuh
44 |
45 | After initial deployment, the Wazuh Dashboard will present an error in the health check for the wazuh-alerts index as this has not been created yet. This error will only be fully fixed after
46 | successfully integarting Graylog and the Wazuh Indexer. You can go ahead and create any necessary users/roles for the upcoming integrations to work correctly.
47 |
48 | #### Wazuh Rules
49 |
50 | Exec into the Wazuh Manager Container
51 | ```
52 | docker exec -it wazuh.manager /bin/bash
53 | ```
54 |
55 | ```
56 | dnf install git -y
57 | ```
58 |
59 | ```
60 | curl -so ~/wazuh_socfortress_rules.sh https://raw.githubusercontent.com/socfortress/OSSIEM/main/wazuh_socfortress_rules.sh && bash ~/wazuh_socfortress_rules.sh
61 | ```
62 |
63 | ### Graylog
64 |
65 | While the container is running, you'll need to access it's console to perform some extra steps in order to add the Wazuh root CA into Graylog's Java Keystore. Run the following command
66 | to spawn a shell inside the container.
67 | ```
68 | docker exec -it graylog bash
69 | ```
70 | Once inside Graylog, you'll need to copy the Java Keystore located at /opt/java/openjdk/lib/security/cacerts into the /usr/share/graylog/data/config/ directory, for this you can run:
71 | ```
72 | cp /opt/java/openjdk/lib/security/cacerts /usr/share/graylog/data/config/
73 | ```
74 | Next you need to import the Wazuh root CA into the keystore, cd into the /usr/share/graylog/data/config/ and run the following command: (change the certificate name and keystore password as needed,
75 | but note that if the certificate name doesn't match the template, you'll need to modify the docker-compose.yml file accordingly)
76 |
77 | ```
78 | cd /usr/share/graylog/data/config/
79 | ```
80 |
81 | ```
82 | keytool -importcert -keystore cacerts -storepass changeit -alias wazuh_root_ca -file root-ca.pem
83 | ```
84 | You will be prompted to accept this certificate, type "yes" and enter. After this is done Graylog will be able to connect to the Wazuh Indexer.
85 |
86 | ### Velociraptor
87 |
88 | We now need to generate the `api.config.yaml` file which CoPilot will use to access the Velociraptor API
89 |
90 | ```
91 | docker exec -it velociraptor /bin/bash
92 | ```
93 |
94 | ```
95 | ./velociraptor --config server.config.yaml config api_client --name admin --role administrator,api api.config.yaml
96 | ```
97 |
98 | ### Copilot
99 |
100 | #### Once Copilot has started up you can retrieve the admin password by running the following command (Only accessible the first time Copilot is started up)
101 | ```
102 | docker logs "$(docker ps --filter ancestor=ghcr.io/socfortress/copilot-backend:latest --format "{{.ID}}")" 2>&1 | grep "Admin user password"
103 | ```
104 |
105 | ## Post-Deployment
106 |
107 | After you've reached this point you can take a short break to pat yourself in the back, it's all downhill from here on out.
108 |
109 | You'll need to make sure to create any necessary users in each of the tools for the integrations to work correctly. After that has been completed, you can log into CoPilot and start
110 | provisioning customers.
111 |
112 | ## Credits
113 |
114 | Huge shoutout to SOCFortress and Taylor Walton for their hard work and
115 | contributions to the open source community. And of course all credits to the Wazuh Team for their amazing product.
116 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | #########
3 | # Wazuh #
4 | #########
5 | wazuh.manager:
6 | image: ghcr.io/socfortress/wazuh-manager:4.9.0
7 | container_name: wazuh.manager
8 | hostname: wazuh.manager
9 | ulimits:
10 | memlock:
11 | soft: -1
12 | hard: -1
13 | nofile:
14 | soft: 655360
15 | hard: 655360
16 | ports:
17 | - "1514:1514"
18 | - "1515:1515"
19 | # - "514:514/udp"
20 | - "55000:55000"
21 | env_file: .env
22 | environment:
23 | - INDEXER_URL=https://wazuh.indexer:9200
24 | - INDEXER_USERNAME=admin
25 | - INDEXER_PASSWORD=SecretPassword
26 | - FILEBEAT_SSL_VERIFICATION_MODE=full
27 | - SSL_CERTIFICATE_AUTHORITIES=/etc/ssl/root-ca.pem
28 | - SSL_CERTIFICATE=/etc/ssl/filebeat.pem
29 | - SSL_KEY=/etc/ssl/filebeat.key
30 | - API_USERNAME=wazuh-wui
31 | - API_PASSWORD=MyS3cr37P450r.*-
32 | volumes:
33 | - wazuh_api_configuration:/var/ossec/api/configuration
34 | - wazuh_etc:/var/ossec/etc
35 | - wazuh_logs:/var/ossec/logs
36 | - wazuh_queue:/var/ossec/queue
37 | - wazuh_var_multigroups:/var/ossec/var/multigroups
38 | - wazuh_integrations:/var/ossec/integrations
39 | - wazuh_active_response:/var/ossec/active-response/bin
40 | - wazuh_agentless:/var/ossec/agentless
41 | - wazuh_wodles:/var/ossec/wodles
42 | - filebeat_etc:/etc/filebeat
43 | - filebeat_var:/var/lib/filebeat
44 | - fluent-bit:/etc/fluentbit
45 | - ./wazuh/config/wazuh_indexer_ssl_certs/root-ca-manager.pem:/etc/ssl/root-ca.pem
46 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.manager.pem:/etc/ssl/filebeat.pem
47 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.manager-key.pem:/etc/ssl/filebeat.key
48 | - ./wazuh/config/wazuh_cluster/wazuh_manager.conf:/wazuh-config-mount/etc/ossec.conf
49 | # - ./wazuh/config/wazuh_cluster/Wazuh-Rules:/tmp/Wazuh-Rules
50 | restart: unless-stopped
51 |
52 | wazuh.indexer:
53 | image: wazuh/wazuh-indexer:4.9.0
54 | container_name: wazuh.indexer
55 | hostname: wazuh.indexer
56 | ports:
57 | - "9200:9200"
58 | environment:
59 | - "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
60 | ulimits:
61 | memlock:
62 | soft: -1
63 | hard: -1
64 | nofile:
65 | soft: 65536
66 | hard: 65536
67 | volumes:
68 | - wazuh-indexer-data:/var/lib/wazuh-indexer
69 | - ./wazuh/config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-indexer/certs/root-ca.pem
70 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.indexer-key.pem:/usr/share/wazuh-indexer/certs/wazuh.indexer.key
71 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.indexer.pem:/usr/share/wazuh-indexer/certs/wazuh.indexer.pem
72 | - ./wazuh/config/wazuh_indexer_ssl_certs/admin.pem:/usr/share/wazuh-indexer/certs/admin.pem
73 | - ./wazuh/config/wazuh_indexer_ssl_certs/admin-key.pem:/usr/share/wazuh-indexer/certs/admin-key.pem
74 | - ./wazuh/config/wazuh_indexer/wazuh.indexer.yml:/usr/share/wazuh-indexer/opensearch.yml
75 | - ./wazuh/config/wazuh_indexer/internal_users.yml:/usr/share/wazuh-indexer/opensearch-security/internal_users.yml
76 | restart: unless-stopped
77 |
78 | wazuh.dashboard:
79 | image: wazuh/wazuh-dashboard:4.9.0
80 | container_name: wazuh.dashboard
81 | hostname: wazuh.dashboard
82 | ports:
83 | - 5601:5601
84 | environment:
85 | - INDEXER_USERNAME=admin
86 | - INDEXER_PASSWORD=SecretPassword
87 | - WAZUH_API_URL=https://wazuh.manager
88 | - DASHBOARD_USERNAME=kibanaserver
89 | - DASHBOARD_PASSWORD=kibanaserver
90 | - API_USERNAME=wazuh-wui
91 | - API_PASSWORD=MyS3cr37P450r.*-
92 | volumes:
93 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.dashboard.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard.pem
94 | - ./wazuh/config/wazuh_indexer_ssl_certs/wazuh.dashboard-key.pem:/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem
95 | - ./wazuh/config/wazuh_indexer_ssl_certs/root-ca.pem:/usr/share/wazuh-dashboard/certs/root-ca.pem
96 | - ./wazuh/config/wazuh_dashboard/opensearch_dashboards.yml:/usr/share/wazuh-dashboard/config/opensearch_dashboards.yml
97 | - ./wazuh/config/wazuh_dashboard/wazuh.yml:/usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
98 | - wazuh-dashboard-config:/usr/share/wazuh-dashboard/data/wazuh/config
99 | - wazuh-dashboard-custom:/usr/share/wazuh-dashboard/plugins/wazuh/public/assets/custom
100 | depends_on:
101 | - wazuh.indexer
102 | restart: unless-stopped
103 |
104 | ###########
105 | # Graylog #
106 | ###########
107 | # MongoDB: https://hub.docker.com/_/mongo/
108 | mongodb:
109 | image: mongo:6.0.14
110 | container_name: mongodb
111 | hostname: mongodb
112 | volumes:
113 | - mongodb_data:/data/db
114 | - mongodb_config:/data/configdb
115 | restart: unless-stopped
116 |
117 | # Graylog: https://hub.docker.com/r/graylog/graylog/
118 | graylog:
119 | image: graylog/graylog:6.0.6
120 | container_name: graylog
121 | hostname: graylog
122 | environment:
123 | GRAYLOG_SERVER_JAVA_OPTS: "-Dlog4j2.formatMsgNoLookups=true -Djavax.net.ssl.trustStore=/usr/share/graylog/data/config/cacerts -Djavax.net.ssl.trustStorePassword=changeit"
124 | volumes:
125 | - graylog_data:/usr/share/graylog/data
126 | - ./graylog/graylog.conf:/usr/share/graylog/data/config/graylog.conf
127 | - ./graylog/log4j2.xml:/usr/share/graylog/data/config/log4j2.xml
128 | - ./graylog/root-ca.pem:/usr/share/graylog/data/config/root-ca.pem
129 | - ./graylog/GeoLite2-City.mmdb:/usr/share/graylog/data/config//GeoLite2-City.mmdb
130 | - ./graylog/GeoLite2-ASN.mmdb:/usr/share/graylog/data/config/GeoLite2-ASN.mmdb
131 | - ./config/network_ports.csv:/etc/graylog/network_ports.csv
132 | - ./config/software_vendors.csv:/etc/graylog/software_vendors.csv
133 | ports:
134 | # Graylog web interface and REST API
135 | - 9000:9000
136 | # Syslog TCP (Disabled for compatibility with the Wazuh Manager)
137 | # - 1514:1514
138 | # Syslog UDP SophosFW
139 | - 514:514/udp
140 | # Syslog UDP SophosFW
141 | - 2514:2514/udp
142 | # GELF TCP
143 | - 12201:12201
144 | # GELF UDP
145 | - 12201:12201/udp
146 | depends_on:
147 | - mongodb
148 | - wazuh.indexer
149 | restart: unless-stopped
150 |
151 | ###########
152 | # Grafana #
153 | ###########
154 | grafana:
155 | image: grafana/grafana-enterprise
156 | container_name: grafana
157 | hostname: grafana
158 | ports:
159 | - 3000:3000
160 | volumes:
161 | - grafana-storage:/var/lib/grafana
162 | - ./grafana/grafana.ini:/etc/grafana/grafana.ini
163 | restart: unless-stopped
164 |
165 | ################
166 | # Velociraptor #
167 | ################
168 | velociraptor:
169 | container_name: velociraptor
170 | image: wlambert/velociraptor
171 | env_file: .env
172 | volumes:
173 | - velociraptor:/velociraptor/:rw
174 | environment:
175 | - VELOX_USER=${VELOX_USER}
176 | - VELOX_PASSWORD=${VELOX_PASSWORD}
177 | - VELOX_ROLE=${VELOX_ROLE}
178 | - VELOX_SERVER_URL=${VELOX_SERVER_URL}
179 | - VELOX_FRONTEND_HOSTNAME=${VELOX_FRONTEND_HOSTNAME}
180 | ports:
181 | - "8000:8000"
182 | - "8001:8001"
183 | - "8889:8889"
184 | restart: unless-stopped
185 |
186 | ###########
187 | # CoPilot #
188 | ###########
189 | copilot-backend:
190 | image: ghcr.io/socfortress/copilot-backend:latest
191 | container_name: copilot-backend
192 | env_file: .env
193 | # Expose the Ports for Graylog Alerting and Docs
194 | ports:
195 | - "5000:5000"
196 | volumes:
197 | - copilot-logs:/opt/logs
198 | # Mount the copilot.db file to persist the database
199 | - copilot-data:/opt/copilot/backend/data
200 | depends_on:
201 | - copilot-mysql
202 | restart: unless-stopped
203 |
204 | copilot-frontend:
205 | image: ghcr.io/socfortress/copilot-frontend:latest
206 | container_name: copilot-frontend
207 | env_file: .env
208 | environment:
209 | - SERVER_HOST=${SERVER_HOST:-localhost} # Set the domain name of your server
210 | ports:
211 | - "80:80"
212 | - "443:443"
213 | restart: unless-stopped
214 |
215 | copilot-mysql:
216 | image: mysql:8.0.38-debian
217 | container_name: copilot-mysql
218 | env_file: .env
219 | environment:
220 | MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
221 | MYSQL_DATABASE: copilot
222 | MYSQL_USER: ${MYSQL_USER}
223 | MYSQL_PASSWORD: ${MYSQL_PASSWORD}
224 | volumes:
225 | - copilot-mysql_data:/var/lib/mysql
226 | restart: unless-stopped
227 |
228 | copilot-minio:
229 | image: quay.io/minio/minio:RELEASE.2024-09-13T20-26-02Z
230 | container_name: copilot-minio
231 | env_file: .env
232 | environment:
233 | MINIO_ROOT_USER: ${MINIO_ROOT_USER}
234 | MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
235 | volumes:
236 | - copilot_minio-data:/data
237 | command: server /data --console-address ":9001"
238 | restart: unless-stopped
239 |
240 | copilot-nuclei-module:
241 | image: ghcr.io/socfortress/copilot-nuclei-module:latest
242 | container_name: copilot-nuclei-module
243 | restart: unless-stopped
244 |
245 | volumes:
246 | # Wazuh
247 | wazuh_api_configuration:
248 | wazuh_etc:
249 | wazuh_logs:
250 | wazuh_queue:
251 | wazuh_var_multigroups:
252 | wazuh_integrations:
253 | wazuh_active_response:
254 | wazuh_agentless:
255 | wazuh_wodles:
256 | filebeat_etc:
257 | filebeat_var:
258 | fluent-bit:
259 | wazuh-indexer-data:
260 | wazuh-dashboard-config:
261 | wazuh-dashboard-custom:
262 | # Graylog
263 | mongodb_data:
264 | mongodb_config:
265 | graylog_data:
266 | # Grafana
267 | grafana-storage:
268 | # Velociraptor
269 | velociraptor:
270 | # CoPilot
271 | copilot-logs:
272 | copilot-data:
273 | copilot-mysql_data:
274 | copilot_minio-data:
275 |
--------------------------------------------------------------------------------
/graylog/GeoLite2-ASN.mmdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/socfortress/OSSIEM/edee8fbe9d3f185fbd1a5aeb378e7f29c01d65a5/graylog/GeoLite2-ASN.mmdb
--------------------------------------------------------------------------------
/graylog/GeoLite2-City.mmdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/socfortress/OSSIEM/edee8fbe9d3f185fbd1a5aeb378e7f29c01d65a5/graylog/GeoLite2-City.mmdb
--------------------------------------------------------------------------------
/graylog/README.md:
--------------------------------------------------------------------------------
1 | # Graylog
2 |
3 | I've provided some basic files to make your life easier on initial deployment, feel free to change/delete/modify them in any way that is useful to you, but DO NOT skip the next step.
4 |
5 | ## Pre-Deployment
6 |
7 | Graylog container runs as the graylog user with UUID 1100, for this files to be recognized once the container is deployed you need to modify file ownership before starting the container.
8 | ```
9 | sudo chown 1100:1100 *
10 | ```
11 | If you have any other files you would like pass onto your Graylog instance, they would also have to go through the same process for Graylog to be able to use them.
12 |
--------------------------------------------------------------------------------
/graylog/graylog.conf:
--------------------------------------------------------------------------------
1 | ############################
2 | # GRAYLOG CONFIGURATION FILE
3 | ############################
4 | #
5 | # This is the Graylog configuration file. The file has to use ISO 8859-1/Latin-1 character encoding.
6 | # Characters that cannot be directly represented in this encoding can be written using Unicode escapes
7 | # as defined in https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.3, using the \u prefix.
8 | # For example, \u002c.
9 | #
10 | # * Entries are generally expected to be a single line of the form, one of the following:
11 | #
12 | # propertyName=propertyValue
13 | # propertyName:propertyValue
14 | #
15 | # * White space that appears between the property name and property value is ignored,
16 | # so the following are equivalent:
17 | #
18 | # name=Stephen
19 | # name = Stephen
20 | #
21 | # * White space at the beginning of the line is also ignored.
22 | #
23 | # * Lines that start with the comment characters ! or # are ignored. Blank lines are also ignored.
24 | #
25 | # * The property value is generally terminated by the end of the line. White space following the
26 | # property value is not ignored, and is treated as part of the property value.
27 | #
28 | # * A property value can span several lines if each line is terminated by a backslash (‘\’) character.
29 | # For example:
30 | #
31 | # targetCities=\
32 | # Detroit,\
33 | # Chicago,\
34 | # Los Angeles
35 | #
36 | # This is equivalent to targetCities=Detroit,Chicago,Los Angeles (white space at the beginning of lines is ignored).
37 | #
38 | # * The characters newline, carriage return, and tab can be inserted with characters \n, \r, and \t, respectively.
39 | #
40 | # * The backslash character must be escaped as a double backslash. For example:
41 | #
42 | # path=c:\\docs\\doc1
43 | #
44 |
45 | # If you are running more than one instances of Graylog server you have to select one of these
46 | # instances as leader. The leader will perform some periodical tasks that non-leaders won't perform.
47 | is_leader = true
48 |
49 | # The auto-generated node ID will be stored in this file and read after restarts. It is a good idea
50 | # to use an absolute file path here if you are starting Graylog server from init scripts or similar.
51 | node_id_file = /usr/share/graylog/data/config/node-id
52 |
53 | # You MUST set a secret to secure/pepper the stored user passwords here. Use at least 64 characters.
54 | # Generate one by using for example: pwgen -N 1 -s 96
55 | # ATTENTION: This value must be the same on all Graylog nodes in the cluster.
56 | # Changing this value after installation will render all user sessions and encrypted values in the database invalid. (e.g. encrypted access tokens)
57 | password_secret = lNLYcK78TCCDI6xJERGz3cC6u6alzBgrKIbVGWOkgtqm1ZebPm1gYz8FwIuNwQhh8rMYlrzvDsPAeOgKsENnFjctBolYKizM
58 |
59 | # The default root user is named 'admin'
60 | #root_username = admin
61 |
62 | # You MUST specify a hash password for the root user (which you only need to initially set up the
63 | # system and in case you lose connectivity to your authentication backend)
64 | # This password cannot be changed using the API or via the web interface. If you need to change it,
65 | # modify it in this file.
66 | # Create one by using for example: echo -n yourpassword | shasum -a 256
67 | # and put the resulting hash value into the following line
68 | root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951
69 |
70 | # The email address of the root user.
71 | # Default is empty
72 | #root_email = ""
73 |
74 | # The time zone setting of the root user. See http://www.joda.org/joda-time/timezones.html for a list of valid time zones.
75 | # Default is UTC
76 | #root_timezone = UTC
77 |
78 | # Set the bin directory here (relative or absolute)
79 | # This directory contains binaries that are used by the Graylog server.
80 | # Default: bin
81 | bin_dir = /usr/share/graylog/bin
82 |
83 | # Set the data directory here (relative or absolute)
84 | # This directory is used to store Graylog server state.
85 | data_dir = /usr/share/graylog/data
86 |
87 | # Set plugin directory here (relative or absolute)
88 | plugin_dir = /usr/share/graylog/plugin
89 |
90 | ###############
91 | # HTTP settings
92 | ###############
93 |
94 | #### HTTP bind address
95 | #
96 | # The network interface used by the Graylog HTTP interface.
97 | #
98 | # This network interface must be accessible by all Graylog nodes in the cluster and by all clients
99 | # using the Graylog web interface.
100 | #
101 | # If the port is omitted, Graylog will use port 9000 by default.
102 | #
103 | # Default: 127.0.0.1:9000
104 | http_bind_address = 0.0.0.0:9000
105 | #http_bind_address = [2001:db8::1]:9000
106 |
107 | #### HTTP publish URI
108 | #
109 | # The HTTP URI of this Graylog node which is used to communicate with the other Graylog nodes in the cluster and by all
110 | # clients using the Graylog web interface.
111 | #
112 | # The URI will be published in the cluster discovery APIs, so that other Graylog nodes will be able to find and connect to this Graylog node.
113 | #
114 | # This configuration setting has to be used if this Graylog node is available on another network interface than $http_bind_address,
115 | # for example if the machine has multiple network interfaces or is behind a NAT gateway.
116 | #
117 | # If $http_bind_address contains a wildcard IPv4 address (0.0.0.0), the first non-loopback IPv4 address of this machine will be used.
118 | # This configuration setting *must not* contain a wildcard address!
119 | #
120 | # Default: http://$http_bind_address/
121 | #http_publish_uri = http://192.168.1.1:9000/
122 |
123 | #### External Graylog URI
124 | #
125 | # The public URI of Graylog which will be used by the Graylog web interface to communicate with the Graylog REST API.
126 | #
127 | # The external Graylog URI usually has to be specified, if Graylog is running behind a reverse proxy or load-balancer
128 | # and it will be used to generate URLs addressing entities in the Graylog REST API (see $http_bind_address).
129 | #
130 | # When using Graylog Collector, this URI will be used to receive heartbeat messages and must be accessible for all collectors.
131 | #
132 | # This setting can be overridden on a per-request basis with the "X-Graylog-Server-URL" HTTP request header.
133 | #
134 | # Default: $http_publish_uri
135 | #http_external_uri =
136 |
137 | #### Enable CORS headers for HTTP interface
138 | #
139 | # This allows browsers to make Cross-Origin requests from any origin.
140 | # This is disabled for security reasons and typically only needed if running graylog
141 | # with a separate server for frontend development.
142 | #
143 | # Default: false
144 | #http_enable_cors = false
145 |
146 | #### Enable GZIP support for HTTP interface
147 | #
148 | # This compresses API responses and therefore helps to reduce
149 | # overall round trip times. This is enabled by default. Uncomment the next line to disable it.
150 | #http_enable_gzip = false
151 |
152 | # The maximum size of the HTTP request headers in bytes.
153 | #http_max_header_size = 8192
154 |
155 | # The size of the thread pool used exclusively for serving the HTTP interface.
156 | #http_thread_pool_size = 64
157 |
158 | ################
159 | # HTTPS settings
160 | ################
161 |
162 | #### Enable HTTPS support for the HTTP interface
163 | #
164 | # This secures the communication with the HTTP interface with TLS to prevent request forgery and eavesdropping.
165 | #
166 | # Default: false
167 | #http_enable_tls = true
168 |
169 | # The X.509 certificate chain file in PEM format to use for securing the HTTP interface.
170 | #http_tls_cert_file = /path/to/graylog.crt
171 |
172 | # The PKCS#8 private key file in PEM format to use for securing the HTTP interface.
173 | #http_tls_key_file = /path/to/graylog.key
174 |
175 | # The password to unlock the private key used for securing the HTTP interface.
176 | #http_tls_key_password = secret
177 |
178 | # If set to "true", Graylog will periodically investigate indices to figure out which fields are used in which streams.
179 | # It will make field list in Graylog interface show only fields used in selected streams, but can decrease system performance,
180 | # especially on systems with great number of streams and fields.
181 | stream_aware_field_types=false
182 |
183 | # Comma separated list of trusted proxies that are allowed to set the client address with X-Forwarded-For
184 | # header. May be subnets, or hosts.
185 | #trusted_proxies = 127.0.0.1/32, 0:0:0:0:0:0:0:1/128
186 |
187 | # List of Elasticsearch hosts Graylog should connect to.
188 | # Need to be specified as a comma-separated list of valid URIs for the http ports of your elasticsearch nodes.
189 | # If one or more of your elasticsearch hosts require authentication, include the credentials in each node URI that
190 | # requires authentication.
191 | #
192 | # Default: http://127.0.0.1:9200
193 | elasticsearch_hosts = https://admin:SecretPassword@wazuh.indexer:9200
194 |
195 | # Maximum number of attempts to connect to elasticsearch on boot for the version probe.
196 | #
197 | # Default: 0, retry indefinitely with the given delay until a connection could be established
198 | #elasticsearch_version_probe_attempts = 5
199 |
200 | # Waiting time in between connection attempts for elasticsearch_version_probe_attempts
201 | #
202 | # Default: 5s
203 | #elasticsearch_version_probe_delay = 5s
204 |
205 | # Maximum amount of time to wait for successful connection to Elasticsearch HTTP port.
206 | #
207 | # Default: 10 Seconds
208 | #elasticsearch_connect_timeout = 10s
209 |
210 | # Maximum amount of time to wait for reading back a response from an Elasticsearch server.
211 | # (e. g. during search, index creation, or index time-range calculations)
212 | #
213 | # Default: 60 seconds
214 | #elasticsearch_socket_timeout = 60s
215 |
216 | # Maximum idle time for an Elasticsearch connection. If this is exceeded, this connection will
217 | # be tore down.
218 | #
219 | # Default: inf
220 | #elasticsearch_idle_timeout = -1s
221 |
222 | # Maximum number of total connections to Elasticsearch.
223 | #
224 | # Default: 200
225 | #elasticsearch_max_total_connections = 200
226 |
227 | # Maximum number of total connections per Elasticsearch route (normally this means per
228 | # elasticsearch server).
229 | #
230 | # Default: 20
231 | #elasticsearch_max_total_connections_per_route = 20
232 |
233 | # Maximum number of times Graylog will retry failed requests to Elasticsearch.
234 | #
235 | # Default: 2
236 | #elasticsearch_max_retries = 2
237 |
238 | # Enable automatic Elasticsearch node discovery through Nodes Info,
239 | # see https://www.elastic.co/guide/en/elasticsearch/reference/5.4/cluster-nodes-info.html
240 | #
241 | # WARNING: Automatic node discovery does not work if Elasticsearch requires authentication, e. g. with Shield.
242 | #
243 | # Default: false
244 | #elasticsearch_discovery_enabled = true
245 |
246 | # Filter for including/excluding Elasticsearch nodes in discovery according to their custom attributes,
247 | # see https://www.elastic.co/guide/en/elasticsearch/reference/5.4/cluster.html#cluster-nodes
248 | #
249 | # Default: empty
250 | #elasticsearch_discovery_filter = rack:42
251 |
252 | # Frequency of the Elasticsearch node discovery.
253 | #
254 | # Default: 30s
255 | # elasticsearch_discovery_frequency = 30s
256 |
257 | # Set the default scheme when connecting to Elasticsearch discovered nodes
258 | #
259 | # Default: http (available options: http, https)
260 | #elasticsearch_discovery_default_scheme = http
261 |
262 | # Enable payload compression for Elasticsearch requests.
263 | #
264 | # Default: false
265 | #elasticsearch_compression_enabled = true
266 |
267 | # Enable use of "Expect: 100-continue" Header for Elasticsearch index requests.
268 | # If this is disabled, Graylog cannot properly handle HTTP 413 Request Entity Too Large errors.
269 | #
270 | # Default: true
271 | #elasticsearch_use_expect_continue = true
272 |
273 | # Graylog uses Index Sets to manage settings for groups of indices. The default options for index sets are configurable
274 | # for each index set in Graylog under System > Configuration > Index Set Defaults.
275 | # The following settings are used to initialize in-database defaults on the first Graylog server startup.
276 | # Specify these values if you want the Graylog server and indices to start with specific settings.
277 |
278 | # The prefix for the Default Graylog index set.
279 | #
280 | #elasticsearch_index_prefix = graylog
281 |
282 | # The name of the index template for the Default Graylog index set.
283 | #
284 | #elasticsearch_template_name = graylog-internal
285 |
286 | # The prefix for the for graylog event indices.
287 | #
288 | #default_events_index_prefix = gl-events
289 |
290 | # The prefix for graylog system event indices.
291 | #
292 | #default_system_events_index_prefix = gl-system-events
293 |
294 | # Analyzer (tokenizer) to use for message and full_message field. The "standard" filter usually is a good idea.
295 | # All supported analyzers are: standard, simple, whitespace, stop, keyword, pattern, language, snowball, custom
296 | # Elasticsearch documentation: https://www.elastic.co/guide/en/elasticsearch/reference/2.3/analysis.html
297 | # Note that this setting only takes effect on newly created indices.
298 | #
299 | #elasticsearch_analyzer = standard
300 |
301 | # How many Elasticsearch shards and replicas should be used per index?
302 | #
303 | #elasticsearch_shards = 1
304 | #elasticsearch_replicas = 0
305 |
306 | # Maximum number of attempts to connect to datanode on boot.
307 | # Default: 0, retry indefinitely with the given delay until a connection could be established
308 | #datanode_startup_connection_attempts = 5
309 |
310 | # Waiting time in between connection attempts for datanode_startup_connection_attempts
311 | #
312 | # Default: 5s
313 | # datanode_startup_connection_delay = 5s
314 |
315 | # Disable the optimization of Elasticsearch indices after index cycling. This may take some load from Elasticsearch
316 | # on heavily used systems with large indices, but it will decrease search performance. The default is to optimize
317 | # cycled indices.
318 | #
319 | #disable_index_optimization = true
320 |
321 | # Optimize the index down to <= index_optimization_max_num_segments. A higher number may take some load from Elasticsearch
322 | # on heavily used systems with large indices, but it will decrease search performance. The default is 1.
323 | #
324 | #index_optimization_max_num_segments = 1
325 |
326 | # Time interval to trigger a full refresh of the index field types for all indexes. This will query ES for all indexes
327 | # and populate any missing field type information to the database.
328 | #
329 | #index_field_type_periodical_full_refresh_interval = 5m
330 |
331 | # You can configure the default strategy used to determine when to rotate the currently active write index.
332 | # Multiple rotation strategies are supported, the default being "time-size-optimizing":
333 | # - "time-size-optimizing" tries to rotate daily, while focussing on optimal sized shards.
334 | # The global default values can be configured with
335 | # "time_size_optimizing_retention_min_lifetime" and "time_size_optimizing_retention_max_lifetime".
336 | # - "count" of messages per index, use elasticsearch_max_docs_per_index below to configure
337 | # - "size" per index, use elasticsearch_max_size_per_index below to configure
338 | # - "time" interval between index rotations, use elasticsearch_max_time_per_index to configure
339 | # A strategy may be disabled by specifying the optional enabled_index_rotation_strategies list and excluding that strategy.
340 | #
341 | #enabled_index_rotation_strategies = count,size,time,time-size-optimizing
342 |
343 | # The default index rotation strategy to use.
344 | #rotation_strategy = time-size-optimizing
345 |
346 | # (Approximate) maximum number of documents in an Elasticsearch index before a new index
347 | # is being created, also see no_retention and elasticsearch_max_number_of_indices.
348 | # Configure this if you used 'rotation_strategy = count' above.
349 | #
350 | #elasticsearch_max_docs_per_index = 20000000
351 |
352 | # (Approximate) maximum size in bytes per Elasticsearch index on disk before a new index is being created, also see
353 | # no_retention and elasticsearch_max_number_of_indices. Default is 30GB.
354 | # Configure this if you used 'rotation_strategy = size' above.
355 | #
356 | #elasticsearch_max_size_per_index = 32212254720
357 |
358 | # (Approximate) maximum time before a new Elasticsearch index is being created, also see
359 | # no_retention and elasticsearch_max_number_of_indices. Default is 1 day.
360 | # Configure this if you used 'rotation_strategy = time' above.
361 | # Please note that this rotation period does not look at the time specified in the received messages, but is
362 | # using the real clock value to decide when to rotate the index!
363 | # Specify the time using a duration and a suffix indicating which unit you want:
364 | # 1w = 1 week
365 | # 1d = 1 day
366 | # 12h = 12 hours
367 | # Permitted suffixes are: d for day, h for hour, m for minute, s for second.
368 | #
369 | #elasticsearch_max_time_per_index = 1d
370 |
371 | # Controls whether empty indices are rotated. Only applies to the "time" rotation_strategy.
372 | #
373 | #elasticsearch_rotate_empty_index_set=false
374 |
375 | # Provides a hard upper limit for the retention period of any index set at configuration time.
376 | #
377 | # This setting is used to validate the value a user chooses for the maximum number of retained indexes, when configuring
378 | # an index set. However, it is only in effect, when a time-based rotation strategy is chosen.
379 | #
380 | # If a rotation strategy other than time-based is selected and/or no value is provided for this setting, no upper limit
381 | # for index retention will be enforced. This is also the default.
382 |
383 | # Default: none
384 | #max_index_retention_period = P90d
385 |
386 | # Optional upper bound on elasticsearch_max_time_per_index
387 | #
388 | #elasticsearch_max_write_index_age = 1d
389 |
390 | # Disable message retention on this node, i. e. disable Elasticsearch index rotation.
391 | #no_retention = false
392 |
393 | # Decide what happens with the oldest indices when the maximum number of indices is reached.
394 | # The following strategies are available:
395 | # - delete # Deletes the index completely (Default)
396 | # - close # Closes the index and hides it from the system. Can be re-opened later.
397 | #
398 | #retention_strategy = delete
399 |
400 | # This configuration list limits the retention strategies available for user configuration via the UI
401 | # The following strategies can be disabled:
402 | # - delete # Deletes the index completely (Default)
403 | # - close # Closes the index and hides it from the system. Can be re-opened later.
404 | # - none # No operation is performed. The index stays open. (Not recommended)
405 | # WARNING: At least one strategy must be enabled. Be careful when extending this list on existing installations!
406 | disabled_retention_strategies = none,close
407 |
408 | # How many indices do you want to keep for the delete and close retention types?
409 | #
410 | #elasticsearch_max_number_of_indices = 20
411 |
412 | # Disable checking the version of Elasticsearch for being compatible with this Graylog release.
413 | # WARNING: Using Graylog with unsupported and untested versions of Elasticsearch may lead to data loss!
414 | #
415 | #elasticsearch_disable_version_check = true
416 |
417 | # Do you want to allow searches with leading wildcards? This can be extremely resource hungry and should only
418 | # be enabled with care. See also: https://docs.graylog.org/docs/query-language
419 | allow_leading_wildcard_searches = false
420 |
421 | # Do you want to allow searches to be highlighted? Depending on the size of your messages this can be memory hungry and
422 | # should only be enabled after making sure your Elasticsearch cluster has enough memory.
423 | allow_highlighting = false
424 |
425 | # Sets field value suggestion mode. The possible values are:
426 | # 1. "off" - field value suggestions are turned off
427 | # 2. "textual_only" - field values are suggested only for textual fields
428 | # 3. "on" (default) - field values are suggested for all field types, even the types where suggestions are inefficient performance-wise
429 | field_value_suggestion_mode = on
430 |
431 | # Global timeout for index optimization (force merge) requests.
432 | # Default: 1h
433 | #elasticsearch_index_optimization_timeout = 1h
434 |
435 | # Maximum number of concurrently running index optimization (force merge) jobs.
436 | # If you are using lots of different index sets, you might want to increase that number.
437 | # This value should be set lower than elasticsearch_max_total_connections_per_route, otherwise index optimization
438 | # could deplete all the client connections to the search server and block new messages ingestion for prolonged
439 | # periods of time.
440 | # Default: 10
441 | #elasticsearch_index_optimization_jobs = 10
442 |
443 | # Mute the logging-output of ES deprecation warnings during REST calls in the ES RestClient
444 | #elasticsearch_mute_deprecation_warnings = true
445 |
446 | # Time interval for index range information cleanups. This setting defines how often stale index range information
447 | # is being purged from the database.
448 | # Default: 1h
449 | #index_ranges_cleanup_interval = 1h
450 |
451 | # Batch size for the Elasticsearch output. This is the maximum accumulated size of messages that are written to
452 | # Elasticsearch in a batch call. If the configured batch size has not been reached within output_flush_interval seconds,
453 | # everything that is available will be flushed at once.
454 | # Each output buffer processor has to keep an entire batch of messages in memory until it has been sent to
455 | # Elasticsearch, so increasing this value will also increase the memory requirements of the Graylog server.
456 | # Batch sizes can be specified in data units (e.g. bytes, kilobytes, megabytes) or as an absolute number of messages.
457 | # Example: output_batch_size = 10mb
458 | output_batch_size = 500
459 |
460 | # Flush interval (in seconds) for the Elasticsearch output. This is the maximum amount of time between two
461 | # batches of messages written to Elasticsearch. It is only effective at all if your minimum number of messages
462 | # for this time period is less than output_batch_size * outputbuffer_processors.
463 | output_flush_interval = 1
464 |
465 | # As stream outputs are loaded only on demand, an output which is failing to initialize will be tried over and
466 | # over again. To prevent this, the following configuration options define after how many faults an output will
467 | # not be tried again for an also configurable amount of seconds.
468 | output_fault_count_threshold = 5
469 | output_fault_penalty_seconds = 30
470 |
471 | # Number of process buffer processors running in parallel.
472 | # By default, the value will be determined automatically based on the number of CPU cores available to the JVM, using
473 | # the formula (<#cores> * 0.36 + 0.625) rounded to the nearest integer.
474 | # Set this value explicitly to override the dynamically calculated value. Try raising the number if your buffers are
475 | # filling up.
476 | #processbuffer_processors = 5
477 |
478 | # Number of output buffer processors running in parallel.
479 | # By default, the value will be determined automatically based on the number of CPU cores available to the JVM, using
480 | # the formula (<#cores> * 0.162 + 0.625) rounded to the nearest integer.
481 | # Set this value explicitly to override the dynamically calculated value. Try raising the number if your buffers are
482 | # filling up.
483 | #outputbuffer_processors = 3
484 |
485 | # The size of the thread pool in the output buffer processor.
486 | # Default: 3
487 | #outputbuffer_processor_threads_core_pool_size = 3
488 |
489 | # UDP receive buffer size for all message inputs (e. g. SyslogUDPInput).
490 | #udp_recvbuffer_sizes = 1048576
491 |
492 | # Wait strategy describing how buffer processors wait on a cursor sequence. (default: sleeping)
493 | # Possible types:
494 | # - yielding
495 | # Compromise between performance and CPU usage.
496 | # - sleeping
497 | # Compromise between performance and CPU usage. Latency spikes can occur after quiet periods.
498 | # - blocking
499 | # High throughput, low latency, higher CPU usage.
500 | # - busy_spinning
501 | # Avoids syscalls which could introduce latency jitter. Best when threads can be bound to specific CPU cores.
502 | processor_wait_strategy = blocking
503 |
504 | # Size of internal ring buffers. Raise this if raising outputbuffer_processors does not help anymore.
505 | # For optimum performance your LogMessage objects in the ring buffer should fit in your CPU L3 cache.
506 | # Must be a power of 2. (512, 1024, 2048, ...)
507 | ring_size = 65536
508 |
509 | inputbuffer_ring_size = 65536
510 | inputbuffer_wait_strategy = blocking
511 |
512 | # Number of input buffer processors running in parallel.
513 | #inputbuffer_processors = 2
514 |
515 | # Manually stopped inputs are no longer auto-restarted. To re-enable the previous behavior, set auto_restart_inputs to true.
516 | #auto_restart_inputs = true
517 |
518 | # Enable the message journal.
519 | message_journal_enabled = true
520 |
521 | # The directory which will be used to store the message journal. The directory must be exclusively used by Graylog and
522 | # must not contain any other files than the ones created by Graylog itself.
523 | #
524 | # ATTENTION:
525 | # If you create a separate partition for the journal files and use a file system creating directories like 'lost+found'
526 | # in the root directory, you need to create a sub directory for your journal.
527 | # Otherwise Graylog will log an error message that the journal is corrupt and Graylog will not start.
528 | # Default: /journal
529 | #message_journal_dir = data/journal
530 |
531 | # Journal hold messages before they could be written to Elasticsearch.
532 | # For a maximum of 12 hours or 5 GB whichever happens first.
533 | # During normal operation the journal will be smaller.
534 | #message_journal_max_age = 12h
535 | #message_journal_max_size = 5gb
536 |
537 | #message_journal_flush_age = 1m
538 | #message_journal_flush_interval = 1000000
539 | #message_journal_segment_age = 1h
540 | #message_journal_segment_size = 100mb
541 |
542 | # Number of threads used exclusively for dispatching internal events. Default is 2.
543 | #async_eventbus_processors = 2
544 |
545 | # How many seconds to wait between marking node as DEAD for possible load balancers and starting the actual
546 | # shutdown process. Set to 0 if you have no status checking load balancers in front.
547 | lb_recognition_period_seconds = 3
548 |
549 | # Journal usage percentage that triggers requesting throttling for this server node from load balancers. The feature is
550 | # disabled if not set.
551 | #lb_throttle_threshold_percentage = 95
552 |
553 | # Every message is matched against the configured streams and it can happen that a stream contains rules which
554 | # take an unusual amount of time to run, for example if its using regular expressions that perform excessive backtracking.
555 | # This will impact the processing of the entire server. To keep such misbehaving stream rules from impacting other
556 | # streams, Graylog limits the execution time for each stream.
557 | # The default values are noted below, the timeout is in milliseconds.
558 | # If the stream matching for one stream took longer than the timeout value, and this happened more than "max_faults" times
559 | # that stream is disabled and a notification is shown in the web interface.
560 | #stream_processing_timeout = 2000
561 | #stream_processing_max_faults = 3
562 |
563 | # Since 0.21 the Graylog server supports pluggable output modules. This means a single message can be written to multiple
564 | # outputs. The next setting defines the timeout for a single output module, including the default output module where all
565 | # messages end up.
566 | #
567 | # Time in milliseconds to wait for all message outputs to finish writing a single message.
568 | #output_module_timeout = 10000
569 |
570 | # Time in milliseconds after which a detected stale leader node is being rechecked on startup.
571 | #stale_leader_timeout = 2000
572 |
573 | # Time in milliseconds which Graylog is waiting for all threads to stop on shutdown.
574 | #shutdown_timeout = 30000
575 |
576 | # MongoDB connection string
577 | # See https://docs.mongodb.com/manual/reference/connection-string/ for details
578 | mongodb_uri = mongodb://mongodb:27017/graylog
579 |
580 | # Authenticate against the MongoDB server
581 | # '+'-signs in the username or password need to be replaced by '%2B'
582 | #mongodb_uri = mongodb://grayloguser:secret@localhost:27017/graylog
583 |
584 | # Use a replica set instead of a single host
585 | #mongodb_uri = mongodb://grayloguser:secret@localhost:27017,localhost:27018,localhost:27019/graylog?replicaSet=rs01
586 |
587 | # DNS Seedlist https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format
588 | #mongodb_uri = mongodb+srv://server.example.org/graylog
589 |
590 | # Increase this value according to the maximum connections your MongoDB server can handle from a single client
591 | # if you encounter MongoDB connection problems.
592 | mongodb_max_connections = 1000
593 |
594 | # Maximum number of attempts to connect to MongoDB on boot for the version probe.
595 | #
596 | # Default: 0, retry indefinitely until a connection can be established
597 | #mongodb_version_probe_attempts = 5
598 |
599 | # Email transport
600 | #transport_email_enabled = false
601 | #transport_email_hostname = mail.example.com
602 | #transport_email_port = 587
603 | #transport_email_use_auth = true
604 | #transport_email_auth_username = you@example.com
605 | #transport_email_auth_password = secret
606 | #transport_email_from_email = graylog@example.com
607 | #transport_email_socket_connection_timeout = 10s
608 | #transport_email_socket_timeout = 10s
609 |
610 | # Encryption settings
611 | #
612 | # ATTENTION:
613 | # Using SMTP with STARTTLS *and* SMTPS at the same time is *not* possible.
614 |
615 | # Use SMTP with STARTTLS, see https://en.wikipedia.org/wiki/Opportunistic_TLS
616 | #transport_email_use_tls = true
617 |
618 | # Use SMTP over SSL (SMTPS), see https://en.wikipedia.org/wiki/SMTPS
619 | # This is deprecated on most SMTP services!
620 | #transport_email_use_ssl = false
621 |
622 |
623 | # Specify and uncomment this if you want to include links to the stream in your stream alert mails.
624 | # This should define the fully qualified base url to your web interface exactly the same way as it is accessed by your users.
625 | #transport_email_web_interface_url = https://graylog.example.com
626 |
627 | # The default connect timeout for outgoing HTTP connections.
628 | # Values must be a positive duration (and between 1 and 2147483647 when converted to milliseconds).
629 | # Default: 5s
630 | #http_connect_timeout = 5s
631 |
632 | # The default read timeout for outgoing HTTP connections.
633 | # Values must be a positive duration (and between 1 and 2147483647 when converted to milliseconds).
634 | # Default: 10s
635 | #http_read_timeout = 10s
636 |
637 | # The default write timeout for outgoing HTTP connections.
638 | # Values must be a positive duration (and between 1 and 2147483647 when converted to milliseconds).
639 | # Default: 10s
640 | #http_write_timeout = 10s
641 |
642 | # HTTP proxy for outgoing HTTP connections
643 | # ATTENTION: If you configure a proxy, make sure to also configure the "http_non_proxy_hosts" option so internal
644 | # HTTP connections with other nodes does not go through the proxy.
645 | # Examples:
646 | # - http://proxy.example.com:8123
647 | # - http://username:password@proxy.example.com:8123
648 | #http_proxy_uri =
649 |
650 | # A list of hosts that should be reached directly, bypassing the configured proxy server.
651 | # This is a list of patterns separated by ",". The patterns may start or end with a "*" for wildcards.
652 | # Any host matching one of these patterns will be reached through a direct connection instead of through a proxy.
653 | # Examples:
654 | # - localhost,127.0.0.1
655 | # - 10.0.*,*.example.com
656 | #http_non_proxy_hosts =
657 |
658 | # Connection timeout for a configured LDAP server (e. g. ActiveDirectory) in milliseconds.
659 | #ldap_connection_timeout = 2000
660 |
661 | # Disable the use of a native system stats collector (currently OSHI)
662 | #disable_native_system_stats_collector = false
663 |
664 | # The default cache time for dashboard widgets. (Default: 10 seconds, minimum: 1 second)
665 | #dashboard_widget_default_cache_time = 10s
666 |
667 | # For some cluster-related REST requests, the node must query all other nodes in the cluster. This is the maximum number
668 | # of threads available for this. Increase it, if '/cluster/*' requests take long to complete.
669 | # Should be http_thread_pool_size * average_cluster_size if you have a high number of concurrent users.
670 | #proxied_requests_thread_pool_size = 64
671 |
672 | # The default HTTP call timeout for cluster-related REST requests. This timeout might be overriden for some
673 | # resources in code or other configuration values. (some cluster metrics resources use a lower timeout)
674 | #proxied_requests_default_call_timeout = 5s
675 |
676 | # The server is writing processing status information to the database on a regular basis. This setting controls how
677 | # often the data is written to the database.
678 | # Default: 1s (cannot be less than 1s)
679 | #processing_status_persist_interval = 1s
680 |
681 | # Configures the threshold for detecting outdated processing status records. Any records that haven't been updated
682 | # in the configured threshold will be ignored.
683 | # Default: 1m (one minute)
684 | #processing_status_update_threshold = 1m
685 |
686 | # Configures the journal write rate threshold for selecting processing status records. Any records that have a lower
687 | # one minute rate than the configured value might be ignored. (dependent on number of messages in the journal)
688 | # Default: 1
689 | #processing_status_journal_write_rate_threshold = 1
690 |
691 | # Automatically load content packs in "content_packs_dir" on the first start of Graylog.
692 | #content_packs_loader_enabled = false
693 |
694 | # The directory which contains content packs which should be loaded on the first start of Graylog.
695 | # Default: /contentpacks
696 | #content_packs_dir = data/contentpacks
697 |
698 | # A comma-separated list of content packs (files in "content_packs_dir") which should be applied on
699 | # the first start of Graylog.
700 | # Default: empty
701 | #content_packs_auto_install = grok-patterns.json
702 |
703 | # The allowed TLS protocols for system wide TLS enabled servers. (e.g. message inputs, http interface)
704 | # Setting this to an empty value, leaves it up to system libraries and the used JDK to chose a default.
705 | # Default: TLSv1.2,TLSv1.3 (might be automatically adjusted to protocols supported by the JDK)
706 | #enabled_tls_protocols = TLSv1.2,TLSv1.3
707 |
708 | # Enable Prometheus exporter HTTP server.
709 | # Default: false
710 | #prometheus_exporter_enabled = false
711 |
712 | # IP address and port for the Prometheus exporter HTTP server.
713 | # Default: 127.0.0.1:9833
714 | #prometheus_exporter_bind_address = 127.0.0.1:9833
715 |
716 | # Path to the Prometheus exporter core mapping file. If this option is enabled, the full built-in core mapping is
717 | # replaced with the mappings in this file.
718 | # This file is monitored for changes and updates will be applied at runtime.
719 | # Default: none
720 | #prometheus_exporter_mapping_file_path_core = prometheus-exporter-mapping-core.yml
721 |
722 | # Path to the Prometheus exporter custom mapping file. If this option is enabled, the mappings in this file are
723 | # configured in addition to the built-in core mappings. The mappings in this file cannot overwrite any core mappings.
724 | # This file is monitored for changes and updates will be applied at runtime.
725 | # Default: none
726 | #prometheus_exporter_mapping_file_path_custom = prometheus-exporter-mapping-custom.yml
727 |
728 | # Configures the refresh interval for the monitored Prometheus exporter mapping files.
729 | # Default: 60s
730 | #prometheus_exporter_mapping_file_refresh_interval = 60s
731 |
732 | # Optional allowed paths for Graylog data files. If provided, certain operations in Graylog will only be permitted
733 | # if the data file(s) are located in the specified paths (for example, with the CSV File lookup adapter).
734 | # All subdirectories of indicated paths are allowed by default. This Provides an additional layer of security,
735 | # and allows administrators to control where in the file system Graylog users can select files from.
736 | #allowed_auxiliary_paths = /etc/graylog/data-files,/etc/custom-allowed-path
737 |
738 | # Do not perform any preflight checks when starting Graylog
739 | # Default: false
740 | #skip_preflight_checks = false
741 |
742 | # Ignore any exceptions encountered when running migrations
743 | # Use with caution - skipping failing migrations may result in an inconsistent DB state.
744 | # Default: false
745 | #ignore_migration_failures = false
746 |
747 | # Comma-separated list of notification types which should not emit a system event.
748 | # Default: SIDECAR_STATUS_UNKNOWN which would create a new event whenever the status of a sidecar becomes "Unknown"
749 | #system_event_excluded_types = SIDECAR_STATUS_UNKNOWN
750 |
751 | # RSS settings for content stream
752 | #content_stream_rss_url = https://www.graylog.org/post
753 | #content_stream_refresh_interval = 7d
754 |
755 | # Maximum value that can be set for an event limit.
756 | # Default: 1000
757 | #event_definition_max_event_limit = 1000
758 |
759 | # Optional limits on scheduling concurrency by job type. No more than the specified number of worker
760 | # threads will be executing jobs of the specified type across the entire cluster.
761 | # Default: no limitation
762 | # Note: Monitor job queue metrics to avoid excessive backlog of unprocessed jobs when using this setting!
763 | # Available job types in Graylog Open:
764 | # check-for-cert-renewal-execution-v1
765 | # event-processor-execution-v1
766 | # notification-execution-v1
767 | #job_scheduler_concurrency_limits = event-processor-execution-v1:2,notification-execution-v1:2
768 |
--------------------------------------------------------------------------------
/graylog/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/graylog/network_ports.csv:
--------------------------------------------------------------------------------
1 | "port","common"
2 | "21", "yes"
3 | "25", "yes"
4 | "22", "yes"
5 | "53", "yes"
6 | "80", "yes"
7 | "135", "yes"
8 | "389", "yes"
9 | "443", "yes"
10 | "445", "yes"
11 | "993", "yes"
12 | "995", "yes"
13 | "1514", "yes"
14 | "1515", "yes"
15 | "3389", "yes"
16 | "5000", "yes"
17 | "5223", "yes"
18 | "8000", "yes"
19 | "8002", "yes"
20 | "8080", "yes"
21 | "8083", "yes"
22 | "8443", "yes"
23 |
--------------------------------------------------------------------------------
/graylog/software_vendors.csv:
--------------------------------------------------------------------------------
1 | "vendor","approved"
2 | "Microsoft Corporation", "yes"
3 | "Sysinternals - www.sysinternals.com", "yes"
4 | "The Git Development Community", "yes"
5 | "Vivaldi Technologies AS", "yes"
6 | "GitHub, Inc.", "yes"
7 | "GitHub", "yes"
8 | "Brave Software, Inc.", "yes"
9 | "Node.js", "yes"
10 | "Avira Operations GmbH & Co. KG", "yes"
11 | "BraveSoftware Inc.", "yes"
12 | "Sysinternals", "yes"
13 |
--------------------------------------------------------------------------------
/wazuh/README.md:
--------------------------------------------------------------------------------
1 | # Wazuh Docker Certificate Generation Script/Image
2 |
3 | This instructions are taken from the Official Wazuh Docker Repo. For our purposes only the first two steps are needed.
4 |
5 | ## Deploy Wazuh Docker in single node configuration
6 |
7 | This deployment is defined in the `docker-compose.yml` file with one Wazuh manager containers, one Wazuh indexer containers, and one Wazuh dashboard container. It can be deployed by following these steps:
8 |
9 | 1) Increase max_map_count on your host (Linux). This command must be run with root permissions:
10 | ```
11 | $ sysctl -w vm.max_map_count=262144
12 | ```
13 | 2) Run the certificate creation script:
14 | ```
15 | $ docker-compose -f generate-indexer-certs.yml run --rm generator
16 | ```
17 | 3) Start the environment with docker-compose:
18 |
19 | - In the foregroud:
20 | ```
21 | $ docker-compose up
22 | ```
23 | - In the background:
24 | ```
25 | $ docker-compose up -d
26 | ```
27 |
28 | The environment takes about 1 minute to get up (depending on your Docker host) for the first time since Wazuh Indexer must be started for the first time and the indexes and index patterns must be generated.
29 |
--------------------------------------------------------------------------------
/wazuh/config/certs.yml:
--------------------------------------------------------------------------------
1 | nodes:
2 | # Wazuh indexer server nodes
3 | indexer:
4 | - name: wazuh.indexer
5 | ip: wazuh.indexer
6 |
7 | # Wazuh server nodes
8 | # Use node_type only with more than one Wazuh manager
9 | server:
10 | - name: wazuh.manager
11 | ip: wazuh.manager
12 |
13 | # Wazuh dashboard node
14 | dashboard:
15 | - name: wazuh.dashboard
16 | ip: wazuh.dashboard
17 |
--------------------------------------------------------------------------------
/wazuh/config/wazuh_cluster/wazuh_manager.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 | yes
4 | yes
5 | no
6 | no
7 | no
8 | smtp.example.wazuh.com
9 | wazuh@example.wazuh.com
10 | recipient@example.wazuh.com
11 | 12
12 | alerts.log
13 | 10m
14 | 0
15 |
16 |
17 |
18 | 3
19 | 12
20 |
21 |
22 |
23 |
24 | plain
25 |
26 |
27 |
28 | secure
29 | 1514
30 | tcp
31 | 131072
32 |
33 |
34 |
35 |
36 | no
37 | yes
38 | yes
39 | yes
40 | yes
41 | yes
42 | yes
43 | yes
44 |
45 |
46 | 43200
47 |
48 | etc/rootcheck/rootkit_files.txt
49 | etc/rootcheck/rootkit_trojans.txt
50 |
51 | yes
52 |
53 |
54 |
55 | yes
56 | 1800
57 | 1d
58 | yes
59 |
60 | wodles/java
61 | wodles/ciscat
62 |
63 |
64 |
65 |
66 | yes
67 | yes
68 | /var/log/osquery/osqueryd.results.log
69 | /etc/osquery/osquery.conf
70 | yes
71 |
72 |
73 |
74 |
75 | no
76 | 1h
77 | yes
78 | yes
79 | yes
80 | yes
81 | yes
82 | yes
83 | yes
84 |
85 |
86 |
87 | 10
88 |
89 |
90 |
91 |
92 | yes
93 | yes
94 | 12h
95 | yes
96 |
97 |
98 |
99 | yes
100 | yes
101 | 60m
102 |
103 |
104 |
105 | yes
106 |
107 | https://wazuh.indexer:9200
108 |
109 |
110 |
111 | /etc/ssl/root-ca.pem
112 |
113 | /etc/ssl/filebeat.pem
114 | /etc/ssl/filebeat.key
115 |
116 |
117 |
118 |
119 |
120 | no
121 |
122 |
123 | 43200
124 |
125 | yes
126 |
127 |
128 | yes
129 |
130 |
131 | no
132 |
133 |
134 | /etc,/usr/bin,/usr/sbin
135 | /bin,/sbin,/boot
136 |
137 |
138 | /etc/mtab
139 | /etc/hosts.deny
140 | /etc/mail/statistics
141 | /etc/random-seed
142 | /etc/random.seed
143 | /etc/adjtime
144 | /etc/httpd/logs
145 | /etc/utmpx
146 | /etc/wtmpx
147 | /etc/cups/certs
148 | /etc/dumpdates
149 | /etc/svc/volatile
150 |
151 |
152 | .log$|.swp$
153 |
154 |
155 | /etc/ssl/private.key
156 |
157 | yes
158 | yes
159 | yes
160 | yes
161 |
162 |
163 | 10
164 |
165 |
166 | 100
167 |
168 |
169 |
170 | yes
171 | 5m
172 | 1h
173 | 10
174 |
175 |
176 |
177 |
178 |
179 | 127.0.0.1
180 | ^localhost.localdomain$
181 |
182 |
183 |
184 | disable-account
185 | disable-account
186 | yes
187 |
188 |
189 |
190 | restart-wazuh
191 | restart-wazuh
192 |
193 |
194 |
195 | firewall-drop
196 | firewall-drop
197 | yes
198 |
199 |
200 |
201 | host-deny
202 | host-deny
203 | yes
204 |
205 |
206 |
207 | route-null
208 | route-null
209 | yes
210 |
211 |
212 |
213 | win_route-null
214 | route-null.exe
215 | yes
216 |
217 |
218 |
219 | netsh
220 | netsh.exe
221 | yes
222 |
223 |
224 |
229 |
230 |
231 |
232 | command
233 | df -P
234 | 360
235 |
236 |
237 |
238 | full_command
239 | netstat -tulpn | sed 's/\([[:alnum:]]\+\)\ \+[[:digit:]]\+\ \+[[:digit:]]\+\ \+\(.*\):\([[:digit:]]*\)\ \+\([0-9\.\:\*]\+\).\+\ \([[:digit:]]*\/[[:alnum:]\-]*\).*/\1 \2 == \3 == \4 \5/' | sort -k 4 -g | sed 's/ == \(.*\) ==/:\1/' | sed 1,2d
240 | netstat listening ports
241 | 360
242 |
243 |
244 |
245 | full_command
246 | last -n 20
247 | 360
248 |
249 |
250 |
251 | syslog
252 | /var/ossec/logs/active-responses.log
253 |
254 |
255 |
256 |
257 | ruleset/decoders
258 | ruleset/rules
259 | 0215-policy_rules.xml
260 | etc/lists/audit-keys
261 | etc/lists/amazon/aws-eventnames
262 | etc/lists/security-eventchannel
263 |
264 |
265 | etc/decoders
266 | etc/rules
267 |
268 |
269 |
270 | yes
271 | 1
272 | 64
273 | 15m
274 |
275 |
276 |
277 |
278 | no
279 | 1515
280 | no
281 | yes
282 | no
283 | HIGH:!ADH:!EXP:!MD5:!RC4:!3DES:!CAMELLIA:@STRENGTH
284 |
285 | no
286 | etc/sslmanager.cert
287 | etc/sslmanager.key
288 | no
289 |
290 |
291 |
292 | wazuh
293 | node01
294 | master
295 | aa093264ef885029653eea20dfcf51ae
296 | 1516
297 | 0.0.0.0
298 |
299 | wazuh.manager
300 |
301 | no
302 | yes
303 |
304 |
305 |
306 |
--------------------------------------------------------------------------------
/wazuh/config/wazuh_dashboard/opensearch_dashboards.yml:
--------------------------------------------------------------------------------
1 | server.host: 0.0.0.0
2 | server.port: 5601
3 | opensearch.hosts: https://wazuh.indexer:9200
4 | opensearch.ssl.verificationMode: certificate
5 | opensearch.requestHeadersWhitelist: ["securitytenant","Authorization"]
6 | opensearch_security.multitenancy.enabled: false
7 | opensearch_security.readonly_mode.roles: ["kibana_read_only"]
8 | server.ssl.enabled: true
9 | server.ssl.key: "/usr/share/wazuh-dashboard/certs/wazuh-dashboard-key.pem"
10 | server.ssl.certificate: "/usr/share/wazuh-dashboard/certs/wazuh-dashboard.pem"
11 | opensearch.ssl.certificateAuthorities: ["/usr/share/wazuh-dashboard/certs/root-ca.pem"]
12 | uiSettings.overrides.defaultRoute: /app/wz-home
13 |
--------------------------------------------------------------------------------
/wazuh/config/wazuh_dashboard/wazuh.yml:
--------------------------------------------------------------------------------
1 | hosts:
2 | - 1513629884013:
3 | url: "https://wazuh.manager"
4 | port: 55000
5 | username: wazuh-wui
6 | password: "MyS3cr37P450r.*-"
7 | run_as: false
8 | alerts.sample.prefix: "wazuh-alerts-"
--------------------------------------------------------------------------------
/wazuh/config/wazuh_indexer/internal_users.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # This is the internal user database
3 | # The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh
4 |
5 | _meta:
6 | type: "internalusers"
7 | config_version: 2
8 |
9 | # Define your internal users here
10 |
11 | ## Demo users
12 |
13 | admin:
14 | hash: "$2y$12$K/SpwjtB.wOHJ/Nc6GVRDuc1h0rM1DfvziFRNPtk27P.c4yDr9njO"
15 | reserved: true
16 | backend_roles:
17 | - "admin"
18 | description: "Demo admin user"
19 |
20 | kibanaserver:
21 | hash: "$2a$12$4AcgAt3xwOWadA5s5blL6ev39OXDNhmOesEoo33eZtrq2N0YrU3H."
22 | reserved: true
23 | description: "Demo kibanaserver user"
24 |
25 | kibanaro:
26 | hash: "$2a$12$JJSXNfTowz7Uu5ttXfeYpeYE0arACvcwlPBStB1F.MI7f0U9Z4DGC"
27 | reserved: false
28 | backend_roles:
29 | - "kibanauser"
30 | - "readall"
31 | attributes:
32 | attribute1: "value1"
33 | attribute2: "value2"
34 | attribute3: "value3"
35 | description: "Demo kibanaro user"
36 |
37 | logstash:
38 | hash: "$2a$12$u1ShR4l4uBS3Uv59Pa2y5.1uQuZBrZtmNfqB3iM/.jL0XoV9sghS2"
39 | reserved: false
40 | backend_roles:
41 | - "logstash"
42 | description: "Demo logstash user"
43 |
44 | readall:
45 | hash: "$2a$12$ae4ycwzwvLtZxwZ82RmiEunBbIPiAmGZduBAjKN0TXdwQFtCwARz2"
46 | reserved: false
47 | backend_roles:
48 | - "readall"
49 | description: "Demo readall user"
50 |
51 | snapshotrestore:
52 | hash: "$2y$12$DpwmetHKwgYnorbgdvORCenv4NAK8cPUg8AI6pxLCuWf/ALc0.v7W"
53 | reserved: false
54 | backend_roles:
55 | - "snapshotrestore"
56 | description: "Demo snapshotrestore user"
57 |
--------------------------------------------------------------------------------
/wazuh/config/wazuh_indexer/wazuh.indexer.yml:
--------------------------------------------------------------------------------
1 | network.host: "0.0.0.0"
2 | node.name: "wazuh.indexer"
3 | path.data: /var/lib/wazuh-indexer
4 | path.logs: /var/log/wazuh-indexer
5 | discovery.type: single-node
6 | http.port: 9200-9299
7 | transport.tcp.port: 9300-9399
8 | # SOCFortress comments out due to: https://community.graylog.org/t/elasticsearch-exception-reason-key-types-is-not-supported-in-the-metadata-section/27468/6
9 | #compatibility.override_main_response_version: true
10 | plugins.security.ssl.http.pemcert_filepath: /usr/share/wazuh-indexer/certs/wazuh.indexer.pem
11 | plugins.security.ssl.http.pemkey_filepath: /usr/share/wazuh-indexer/certs/wazuh.indexer.key
12 | plugins.security.ssl.http.pemtrustedcas_filepath: /usr/share/wazuh-indexer/certs/root-ca.pem
13 | plugins.security.ssl.transport.pemcert_filepath: /usr/share/wazuh-indexer/certs/wazuh.indexer.pem
14 | plugins.security.ssl.transport.pemkey_filepath: /usr/share/wazuh-indexer/certs/wazuh.indexer.key
15 | plugins.security.ssl.transport.pemtrustedcas_filepath: /usr/share/wazuh-indexer/certs/root-ca.pem
16 | plugins.security.ssl.http.enabled: true
17 | plugins.security.ssl.transport.enforce_hostname_verification: false
18 | plugins.security.ssl.transport.resolve_hostname: false
19 | plugins.security.authcz.admin_dn:
20 | - "CN=admin,OU=Wazuh,O=Wazuh,L=California,C=US"
21 | plugins.security.check_snapshot_restore_write_privileges: true
22 | plugins.security.enable_snapshot_restore_privilege: true
23 | plugins.security.nodes_dn:
24 | - "CN=wazuh.indexer,OU=Wazuh,O=Wazuh,L=California,C=US"
25 | plugins.security.restapi.roles_enabled:
26 | - "all_access"
27 | - "security_rest_api_access"
28 | plugins.security.system_indices.enabled: true
29 | plugins.security.system_indices.indices: [".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opendistro-notifications-*", ".opendistro-notebooks", ".opensearch-observability", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"]
30 | plugins.security.allow_default_init_securityindex: true
31 | cluster.routing.allocation.disk.threshold_enabled: false
32 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/Dockerfile:
--------------------------------------------------------------------------------
1 | # Wazuh Docker Copyright (C) 2017, Wazuh Inc. (License GPLv2)
2 | FROM amazonlinux:2023
3 |
4 | RUN rm /bin/sh && ln -s /bin/bash /bin/sh
5 |
6 | ARG WAZUH_VERSION
7 | ARG WAZUH_TAG_REVISION
8 | ARG S6_VERSION="v2.2.0.3"
9 |
10 | RUN yum install curl-minimal xz gnupg tar gzip openssl findutils procps -y &&\
11 | yum clean all
12 |
13 | COPY config/check_repository.sh /
14 | COPY config/permanent_data.env config/permanent_data.sh /
15 |
16 | RUN chmod 775 /check_repository.sh
17 | RUN source /check_repository.sh
18 |
19 | RUN yum install wazuh-manager-${WAZUH_VERSION}-${WAZUH_TAG_REVISION} -y && \
20 | yum clean all && \
21 | curl --fail --silent -L https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh && \
22 | curl --fail --silent -L https://github.com/just-containers/s6-overlay/releases/download/${S6_VERSION}/s6-overlay-amd64.tar.gz \
23 | -o /tmp/s6-overlay-amd64.tar.gz && \
24 | tar xzf /tmp/s6-overlay-amd64.tar.gz -C / --exclude="./bin" && \
25 | tar xzf /tmp/s6-overlay-amd64.tar.gz -C /usr ./bin && \
26 | rm /tmp/s6-overlay-amd64.tar.gz
27 |
28 | COPY config/etc/ /etc/
29 | COPY --chown=root:wazuh config/create_user.py /var/ossec/framework/scripts/create_user.py
30 |
31 | COPY config/fluent-bit.conf /etc/fluent-bit/
32 | RUN chmod go-w /etc/fluent-bit/fluent-bit.conf
33 |
34 | # Prepare permanent data
35 | # Sync calls are due to https://github.com/docker/docker/issues/9547
36 |
37 | #Make mount directories for keep permissions
38 |
39 | RUN mkdir -p /var/ossec/var/multigroups && \
40 | chown root:wazuh /var/ossec/var/multigroups && \
41 | chmod 770 /var/ossec/var/multigroups && \
42 | mkdir -p /var/ossec/agentless && \
43 | chown root:wazuh /var/ossec/agentless && \
44 | chmod 770 /var/ossec/agentless && \
45 | mkdir -p /var/ossec/active-response/bin && \
46 | chown root:wazuh /var/ossec/active-response/bin && \
47 | chmod 770 /var/ossec/active-response/bin && \
48 | mkdir -p /var/fluent-bit && \
49 | chmod 755 /permanent_data.sh && \
50 | sync && /permanent_data.sh && \
51 | sync && rm /permanent_data.sh
52 |
53 | # Services ports
54 | EXPOSE 55000/tcp 1514/tcp 1515/tcp 514/udp 1516/tcp
55 |
56 | ENTRYPOINT [ "/init" ]
57 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/README.md:
--------------------------------------------------------------------------------
1 | # Wazuh Manager Docker Image Build Script
2 |
3 | A modified Wazuh Manager image build script to replace Filebeat with Fluent Bit for log shipping to Graylog. Only tested on >4.9.0.
4 |
5 | ## Disclaimer:
6 |
7 | This will break your Wazuh Dashboard's ability to visualize data residing in your Indexer. Use Grafana instead to create dashboards and visualize your log data.
8 |
9 | ## Build:
10 | ```
11 | docker build -t socfortress/wazuh-manager:[WAZUH_VERSION] --build-arg WAZUH_VERSION=[WAZUH_VERSION] --build-arg WAZUH_TAG_REVISION=[WAZUH_TAG_REVISION] .
12 | ```
13 | Tested Version:
14 | ```
15 | docker build -t socfortress/wazuh-manager:4.9.0 --build-arg WAZUH_VERSION=4.9.0 --build-arg WAZUH_TAG_REVISION=1 .
16 | ```
17 |
18 | ## Usage:
19 |
20 | The file config/fluent-bit.conf holds the predefined config for FluentBit to ship Wazuh alerts in the alerts.json log file to Graylog on port 5555, change this before building if you want to set a
21 | different port to connect to Graylog.
22 |
23 | ## Caveats:
24 |
25 | When spinning up the container for the first time, you will see an error regarding the wazuh-alerts index as it has still not been created. Only after integrating Graylog into the stack will this
26 | error be fixed.
27 |
28 | If you already have a working docker implementation all that is needed is to change the image in the docker compose file and recreate the container, you should now be able to ship your logs to Graylog.
29 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/check_repository.sh:
--------------------------------------------------------------------------------
1 | ## variables
2 | APT_KEY=https://packages.wazuh.com/key/GPG-KEY-WAZUH
3 | GPG_SIGN="gpgcheck=1\ngpgkey=${APT_KEY}]"
4 | REPOSITORY="[wazuh]\n${GPG_SIGN}\nenabled=1\nname=EL-\$releasever - Wazuh\nbaseurl=https://packages.wazuh.com/4.x/yum/\nprotect=1"
5 | WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '["]tag_name["]:' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2-)
6 | MAJOR_BUILD=$(echo $WAZUH_VERSION | cut -d. -f1)
7 | MID_BUILD=$(echo $WAZUH_VERSION | cut -d. -f2)
8 | MINOR_BUILD=$(echo $WAZUH_VERSION | cut -d. -f3)
9 | MAJOR_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f1)
10 | MID_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f2)
11 | MINOR_CURRENT=$(echo $WAZUH_CURRENT_VERSION | cut -d. -f3)
12 |
13 | ## check version to use the correct repository
14 | if [ "$MAJOR_BUILD" -gt "$MAJOR_CURRENT" ]; then
15 | APT_KEY=https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH
16 | REPOSITORY="[wazuh]\n${GPG_SIGN}\nenabled=1\nname=EL-\$releasever - Wazuh\nbaseurl=https://packages-dev.wazuh.com/pre-release/yum/\nprotect=1"
17 | elif [ "$MAJOR_BUILD" -eq "$MAJOR_CURRENT" ]; then
18 | if [ "$MID_BUILD" -gt "$MID_CURRENT" ]; then
19 | APT_KEY=https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH
20 | REPOSITORY="[wazuh]\n${GPG_SIGN}\nenabled=1\nname=EL-\$releasever - Wazuh\nbaseurl=https://packages-dev.wazuh.com/pre-release/yum/\nprotect=1"
21 | elif [ "$MID_BUILD" -eq "$MID_CURRENT" ]; then
22 | if [ "$MINOR_BUILD" -gt "$MINOR_CURRENT" ]; then
23 | APT_KEY=https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH
24 | REPOSITORY="[wazuh]\n${GPG_SIGN}\nenabled=1\nname=EL-\$releasever - Wazuh\nbaseurl=https://packages-dev.wazuh.com/pre-release/yum/\nprotect=1"
25 | fi
26 | fi
27 | fi
28 |
29 | rpm --import "${APT_KEY}"
30 | echo -e "${REPOSITORY}" | tee /etc/yum.repos.d/wazuh.repo
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/create_user.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import sys
3 | import json
4 | import random
5 | import string
6 | import os
7 |
8 | # Set framework path
9 | sys.path.append(os.path.dirname(sys.argv[0]) + "/../framework")
10 |
11 | USER_FILE_PATH = "/var/ossec/api/configuration/admin.json"
12 | SPECIAL_CHARS = "@$!%*?&-_"
13 |
14 |
15 | try:
16 | from wazuh.rbac.orm import check_database_integrity
17 | from wazuh.security import (
18 | create_user,
19 | get_users,
20 | get_roles,
21 | set_user_role,
22 | update_user,
23 | )
24 | except ModuleNotFoundError as e:
25 | logging.error("No module 'wazuh' found.")
26 | sys.exit(1)
27 |
28 |
29 | def read_user_file(path=USER_FILE_PATH):
30 | with open(path) as user_file:
31 | data = json.load(user_file)
32 | return data["username"], data["password"]
33 |
34 |
35 | def db_users():
36 | users_result = get_users()
37 | return {user["username"]: user["id"] for user in users_result.affected_items}
38 |
39 |
40 | def db_roles():
41 | roles_result = get_roles()
42 | return {role["name"]: role["id"] for role in roles_result.affected_items}
43 |
44 | def disable_user(uid):
45 | random_pass = "".join(
46 | random.choices(
47 | string.ascii_uppercase
48 | + string.ascii_lowercase
49 | + string.digits
50 | + SPECIAL_CHARS,
51 | k=8,
52 | )
53 | )
54 | # assure there must be at least one character from each group
55 | random_pass = random_pass + ''.join([random.choice(chars) for chars in [string.ascii_lowercase, string.digits, string.ascii_uppercase, SPECIAL_CHARS]])
56 | random_pass = ''.join(random.sample(random_pass,len(random_pass)))
57 | update_user(
58 | user_id=[
59 | str(uid),
60 | ],
61 | password=random_pass,
62 | )
63 |
64 |
65 | if __name__ == "__main__":
66 | if not os.path.exists(USER_FILE_PATH):
67 | # abort if no user file detected
68 | sys.exit(0)
69 | username, password = read_user_file()
70 |
71 | # create RBAC database
72 | check_database_integrity()
73 |
74 | initial_users = db_users()
75 | if username not in initial_users:
76 | # create a new user
77 | create_user(username=username, password=password)
78 | users = db_users()
79 | uid = users[username]
80 | roles = db_roles()
81 | rid = roles["administrator"]
82 | set_user_role(
83 | user_id=[
84 | str(uid),
85 | ],
86 | role_ids=[
87 | str(rid),
88 | ],
89 | )
90 | else:
91 | # modify an existing user ("wazuh" or "wazuh-wui")
92 | uid = initial_users[username]
93 | update_user(
94 | user_id=[
95 | str(uid),
96 | ],
97 | password=password,
98 | )
99 | # disable unused default users
100 | for def_user in ['wazuh', 'wazuh-wui']:
101 | if def_user != username:
102 | disable_user(initial_users[def_user])
103 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/etc/cont-init.d/0-wazuh-init:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv bash
2 | # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
3 |
4 | # Variables
5 | source /permanent_data.env
6 |
7 | WAZUH_INSTALL_PATH=/var/ossec
8 | WAZUH_CONFIG_MOUNT=/wazuh-config-mount
9 | AUTO_ENROLLMENT_ENABLED=${AUTO_ENROLLMENT_ENABLED:-true}
10 |
11 |
12 | ##############################################################################
13 | # Aux functions
14 | ##############################################################################
15 | print() {
16 | echo -e $1
17 | }
18 |
19 | error_and_exit() {
20 | echo "Error executing command: '$1'."
21 | echo 'Exiting.'
22 | exit 1
23 | }
24 |
25 | exec_cmd() {
26 | eval $1 > /dev/null 2>&1 || error_and_exit "$1"
27 | }
28 |
29 | exec_cmd_stdout() {
30 | eval $1 2>&1 || error_and_exit "$1"
31 | }
32 |
33 |
34 | ##############################################################################
35 | # This function will attempt to mount every directory in PERMANENT_DATA
36 | # into the respective path.
37 | # If the path is empty means permanent data volume is also empty, so a backup
38 | # will be copied into it. Otherwise it will not be copied because there is
39 | # already data inside the volume for the specified path.
40 | ##############################################################################
41 |
42 | mount_permanent_data() {
43 | for permanent_dir in "${PERMANENT_DATA[@]}"; do
44 | data_tmp="${WAZUH_INSTALL_PATH}/data_tmp/permanent${permanent_dir}/"
45 | print ${data_tmp}
46 | # Check if the path is not empty
47 | if find ${permanent_dir} -mindepth 1 | read; then
48 | print "The path ${permanent_dir} is already mounted"
49 | else
50 | if find ${data_tmp} -mindepth 1 | read; then
51 | print "Installing ${permanent_dir}"
52 | exec_cmd "cp -a ${data_tmp}. ${permanent_dir}"
53 | else
54 | print "The path ${permanent_dir} is empty, skiped"
55 | fi
56 | fi
57 | done
58 | }
59 |
60 | ##############################################################################
61 | # This function will replace from the permanent data volume every file
62 | # contained in PERMANENT_DATA_EXCP
63 | # Some files as 'internal_options.conf' are saved as permanent data, but
64 | # they must be updated to work properly if wazuh version is changed.
65 | ##############################################################################
66 |
67 | apply_exclusion_data() {
68 | for exclusion_file in "${PERMANENT_DATA_EXCP[@]}"; do
69 | if [ -e ${WAZUH_INSTALL_PATH}/data_tmp/exclusion/${exclusion_file} ]
70 | then
71 | DIR=$(dirname "${exclusion_file}")
72 | if [ ! -e ${DIR} ]
73 | then
74 | mkdir -p ${DIR}
75 | fi
76 |
77 | print "Updating ${exclusion_file}"
78 | exec_cmd "cp -p ${WAZUH_INSTALL_PATH}/data_tmp/exclusion/${exclusion_file} ${exclusion_file}"
79 | fi
80 | done
81 | }
82 |
83 | ##############################################################################
84 | # This function will rename in the permanent data volume every file
85 | # contained in PERMANENT_DATA_MOVE
86 | ##############################################################################
87 |
88 | move_data_files() {
89 | for mov_file in "${PERMANENT_DATA_MOVE[@]}"; do
90 | file_split=( $mov_file )
91 | if [ -e ${file_split[0]} ]
92 | then
93 | print "moving ${mov_file}"
94 | exec_cmd "mv -f ${mov_file}"
95 | fi
96 | done
97 | }
98 |
99 |
100 | ##############################################################################
101 | # This function will delete from the permanent data volume every file
102 | # contained in PERMANENT_DATA_DEL
103 | ##############################################################################
104 |
105 | remove_data_files() {
106 | for del_file in "${PERMANENT_DATA_DEL[@]}"; do
107 | if [ -e ${del_file} ]
108 | then
109 | print "Removing ${del_file}"
110 | exec_cmd "rm -f ${del_file}"
111 | fi
112 | done
113 | }
114 |
115 | ##############################################################################
116 | # Create certificates: Manager
117 | ##############################################################################
118 |
119 | create_ossec_key_cert() {
120 | print "Creating wazuh-authd key and cert"
121 | exec_cmd "openssl genrsa -out ${WAZUH_INSTALL_PATH}/etc/sslmanager.key 4096"
122 | exec_cmd "openssl req -new -x509 -key ${WAZUH_INSTALL_PATH}/etc/sslmanager.key -out ${WAZUH_INSTALL_PATH}/etc/sslmanager.cert -days 3650 -subj /CN=${HOSTNAME}/"
123 | }
124 |
125 | ##############################################################################
126 | # Copy all files from $WAZUH_CONFIG_MOUNT to $WAZUH_INSTALL_PATH and respect
127 | # destination files permissions
128 | #
129 | # For example, to mount the file /var/ossec/data/etc/ossec.conf, mount it at
130 | # $WAZUH_CONFIG_MOUNT/etc/ossec.conf in your container and this code will
131 | # replace the ossec.conf file in /var/ossec/data/etc with yours.
132 | ##############################################################################
133 |
134 | mount_files() {
135 | if [ -e "$WAZUH_CONFIG_MOUNT" ]
136 | then
137 | print "Identified Wazuh configuration files to mount..."
138 | exec_cmd_stdout "cp --verbose -r $WAZUH_CONFIG_MOUNT/* $WAZUH_INSTALL_PATH"
139 | else
140 | print "No Wazuh configuration files to mount..."
141 | fi
142 | }
143 |
144 |
145 | ##############################################################################
146 | # Allow users to set the container hostname as dynamically on
147 | # container start.
148 | #
149 | # To use this:
150 | # 1. Create your own ossec.conf file
151 | # 2. In your ossec.conf file, set to_be_replaced_by_hostname as your node_name
152 | # 3. Mount your custom ossec.conf file at $WAZUH_CONFIG_MOUNT/etc/ossec.conf
153 | ##############################################################################
154 |
155 | set_custom_hostname() {
156 | sed -i 's/to_be_replaced_by_hostname<\/node_name>/'"${HOSTNAME}"'<\/node_name>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf
157 | }
158 |
159 | ##############################################################################
160 | # Allow users to set the container cluster key dynamically on
161 | # container start.
162 | #
163 | # To use this:
164 | # 1. Create your own ossec.conf file
165 | # 2. In your ossec.conf file, set to_be_replaced_by_cluster_key as your key
166 | # 3. Mount your custom ossec.conf file at $WAZUH_CONFIG_MOUNT/etc/ossec.conf
167 | ##############################################################################
168 |
169 | set_custom_cluster_key() {
170 | sed -i 's/to_be_replaced_by_cluster_key<\/key>/'"${WAZUH_CLUSTER_KEY}"'<\/key>/g' ${WAZUH_INSTALL_PATH}/etc/ossec.conf
171 | }
172 |
173 | ##############################################################################
174 | # Modify /var/ossec/queue/rids directory owner on
175 | # container start.
176 | ##############################################################################
177 |
178 | set_rids_owner() {
179 | chown -R wazuh:wazuh /var/ossec/queue/rids
180 | }
181 |
182 | ##############################################################################
183 | # Change any ossec user/group to wazuh user/group
184 | ##############################################################################
185 |
186 | set_correct_permOwner() {
187 | find / -group 997 -exec chown :999 {} +;
188 | find / -group 101 -exec chown :999 {} +;
189 | find / -user 101 -exec chown 999 {} +;
190 | }
191 |
192 | ##############################################################################
193 | # Main function
194 | ##############################################################################
195 |
196 | main() {
197 | # Mount permanent data (i.e. ossec.conf)
198 | mount_permanent_data
199 |
200 | # Restore files stored in permanent data that are not permanent (i.e. internal_options.conf)
201 | apply_exclusion_data
202 |
203 | # Apply correct permission and ownership
204 | set_correct_permOwner
205 |
206 | # Rename files stored in permanent data (i.e. queue/ossec)
207 | move_data_files
208 |
209 | # Remove some files in permanent_data (i.e. .template.db)
210 | remove_data_files
211 |
212 | # Generate wazuh-authd certs if AUTO_ENROLLMENT_ENABLED is true and does not exist
213 | if [ $AUTO_ENROLLMENT_ENABLED == true ]
214 | then
215 | if [ ! -e ${WAZUH_INSTALL_PATH}/etc/sslmanager.key ]
216 | then
217 | create_ossec_key_cert
218 | fi
219 | fi
220 |
221 | # Mount selected files (WAZUH_CONFIG_MOUNT) to container
222 | mount_files
223 |
224 | # Allow setting custom hostname
225 | set_custom_hostname
226 |
227 | # Allow setting custom cluster key
228 | set_custom_cluster_key
229 |
230 | # Delete temporary data folder
231 | rm -rf ${WAZUH_INSTALL_PATH}/data_tmp
232 |
233 | # Set rids directory owner
234 | set_rids_owner
235 | }
236 |
237 | main
238 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/etc/cont-init.d/1-manager:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv bash
2 |
3 | ##############################################################################
4 | # Migration sequence
5 | # Detect if there is a mounted volume on /wazuh-migration and copy the data
6 | # to /var/ossec, finally it will create a flag ".migration-completed" inside
7 | # the mounted volume
8 | ##############################################################################
9 |
10 | function __colortext()
11 | {
12 | echo -e " \e[1;$2m$1\e[0m"
13 | }
14 |
15 | function echogreen()
16 | {
17 | echo $(__colortext "$1" "32")
18 | }
19 |
20 | function echoyellow()
21 | {
22 | echo $(__colortext "$1" "33")
23 | }
24 |
25 | function echored()
26 | {
27 | echo $(__colortext "$1" "31")
28 | }
29 |
30 | function_wazuh_migration(){
31 | if [ -d "/wazuh-migration" ]; then
32 | if [ ! -e /wazuh-migration/.migration-completed ]; then
33 | if [ ! -e /wazuh-migration/global.db ]; then
34 | echoyellow "The volume mounted on /wazuh-migration does not contain all the correct files."
35 | return
36 | fi
37 |
38 | \cp -f /wazuh-migration/data/etc/ossec.conf /var/ossec/etc/ossec.conf
39 | chown root:wazuh /var/ossec/etc/ossec.conf
40 | chmod 640 /var/ossec/etc/ossec.conf
41 |
42 | \cp -f /wazuh-migration/data/etc/client.keys /var/ossec/etc/client.keys
43 | chown wazuh:wazuh /var/ossec/etc/client.keys
44 | chmod 640 /var/ossec/etc/client.keys
45 |
46 | \cp -f /wazuh-migration/data/etc/sslmanager.cert /var/ossec/etc/sslmanager.cert
47 | \cp -f /wazuh-migration/data/etc/sslmanager.key /var/ossec/etc/sslmanager.key
48 | chown root:root /var/ossec/etc/sslmanager.cert /var/ossec/etc/sslmanager.key
49 | chmod 640 /var/ossec/etc/sslmanager.cert /var/ossec/etc/sslmanager.key
50 |
51 | \cp -f /wazuh-migration/data/etc/shared/default/agent.conf /var/ossec/etc/shared/default/agent.conf
52 | chown wazuh:wazuh /var/ossec/etc/shared/default/agent.conf
53 | chmod 660 /var/ossec/etc/shared/default/agent.conf
54 |
55 | \cp -f /wazuh-migration/data/etc/decoders/* /var/ossec/etc/decoders/
56 | chown wazuh:wazuh /var/ossec/etc/decoders/*
57 | chmod 660 /var/ossec/etc/decoders/*
58 |
59 | \cp -f /wazuh-migration/data/etc/rules/* /var/ossec/etc/rules/
60 | chown wazuh:wazuh /var/ossec/etc/rules/*
61 | chmod 660 /var/ossec/etc/rules/*
62 |
63 | if [ -e /wazuh-migration/data/agentless/.passlist ]; then
64 | \cp -f /wazuh-migration/data/agentless/.passlist /var/ossec/agentless/.passlist
65 | chown root:wazuh /var/ossec/agentless/.passlist
66 | chmod 640 /var/ossec/agentless/.passlist
67 | fi
68 |
69 | \cp -f /wazuh-migration/global.db /var/ossec/queue/db/global.db
70 | chown wazuh:wazuh /var/ossec/queue/db/global.db
71 | chmod 640 /var/ossec/queue/db/global.db
72 |
73 | # mark volume as migrated
74 | touch /wazuh-migration/.migration-completed
75 |
76 | echogreen "Migration completed succesfully"
77 | else
78 | echoyellow "This volume has already been migrated. You may proceed and remove it from the mount point (/wazuh-migration)"
79 | fi
80 | fi
81 | }
82 |
83 | function_create_custom_user() {
84 | if [[ ! -z $API_USERNAME ]] && [[ ! -z $API_PASSWORD ]]; then
85 | cat << EOF > /var/ossec/api/configuration/admin.json
86 | {
87 | "username": "$API_USERNAME",
88 | "password": "$API_PASSWORD"
89 | }
90 | EOF
91 |
92 | # create or customize API user
93 | if /var/ossec/framework/python/bin/python3 /var/ossec/framework/scripts/create_user.py; then
94 | # remove json if exit code is 0
95 | rm /var/ossec/api/configuration/admin.json
96 | rm /var/ossec/framework/scripts/create_user.py
97 | else
98 | echored "There was an error configuring the API user"
99 | # terminate container to avoid unpredictable behavior
100 | exec s6-svscanctl -t /var/run/s6/services
101 | exit 1
102 | fi
103 | fi
104 | }
105 |
106 | function_entrypoint_scripts() {
107 | # It will run every .sh script located in entrypoint-scripts folder in lexicographical order
108 | if [ -d "/entrypoint-scripts/" ]
109 | then
110 | for script in `ls /entrypoint-scripts/*.sh | sort -n`; do
111 | bash "$script"
112 | done
113 | fi
114 | }
115 |
116 | function_configure_vulnerability_detection() {
117 | if [ "$INDEXER_PASSWORD" != "" ]; then
118 | >&2 echo "Configuring password."
119 | /var/ossec/bin/wazuh-keystore -f indexer -k username -v $INDEXER_USERNAME
120 | /var/ossec/bin/wazuh-keystore -f indexer -k password -v $INDEXER_PASSWORD
121 | fi
122 | }
123 |
124 | # Migrate data from /wazuh-migration volume
125 | function_wazuh_migration
126 |
127 | # create API custom user
128 | function_create_custom_user
129 |
130 | # configure Vulnerabilty detection
131 | function_configure_vulnerability_detection
132 |
133 | # run entrypoint scripts
134 | function_entrypoint_scripts
135 |
136 | # Start Wazuh
137 | /var/ossec/bin/wazuh-control start
138 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/etc/services.d/fluent-bit/finish:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 | echo >&2 "Fluent Bit exited. code=${1}"
3 |
4 | # terminate other services to exit from the container
5 | exec s6-svscanctl -t /var/run/s6/services
6 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/etc/services.d/fluent-bit/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv sh
2 | echo >&2 "starting Fluent Bit"
3 |
4 | exec /opt/fluent-bit/bin/fluent-bit -c /etc/fluent-bit/fluent-bit.conf -path.home /opt/fluent-bit/ -path.config /etc/fluent-bit -path.data /var/fluent-bit -path.logs /var/log/fluent-bit
5 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/etc/services.d/ossec-logs/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv sh
2 |
3 | # dumping ossec.log to standard output
4 | exec tail -F /var/ossec/logs/ossec.log
5 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/fluent-bit.conf:
--------------------------------------------------------------------------------
1 | [SERVICE]
2 | # Flush
3 | # =====
4 | # set an interval of seconds before to flush records to a destination
5 | flush 5
6 |
7 | # Daemon
8 | # ======
9 | # instruct Fluent Bit to run in foreground or background mode.
10 | daemon Off
11 |
12 | # Log_Level
13 | # =========
14 | # Set the verbosity level of the service, values can be:
15 | #
16 | # - error
17 | # - warning
18 | # - info
19 | # - debug
20 | # - trace
21 | #
22 | # by default 'info' is set, that means it includes 'error' and 'warning'.
23 | log_level info
24 |
25 | # Parsers File
26 | # ============
27 | # specify an optional 'Parsers' configuration file
28 | parsers_file parsers.conf
29 |
30 | # Plugins File
31 | # ============
32 | # specify an optional 'Plugins' configuration file to load external plugins.
33 | plugins_file plugins.conf
34 |
35 | # HTTP Server
36 | # ===========
37 | # Enable/Disable the built-in HTTP Server for metrics
38 | http_server Off
39 | http_listen 0.0.0.0
40 | http_port 2020
41 |
42 | # Storage
43 | # =======
44 | # Fluent Bit can use memory and filesystem buffering based mechanisms
45 | #
46 | # - https://docs.fluentbit.io/manual/administration/buffering-and-storage
47 | #
48 | # storage metrics
49 | # ---------------
50 | # publish storage pipeline metrics in '/api/v1/storage'. The metrics are
51 | # exported only if the 'http_server' option is enabled.
52 | #
53 | storage.metrics on
54 |
55 | # storage.path
56 | # ------------
57 | # absolute file system path to store filesystem data buffers (chunks).
58 | #
59 | storage.path /var/fluent-bit
60 |
61 | # storage.sync
62 | # ------------
63 | # configure the synchronization mode used to store the data into the
64 | # filesystem. It can take the values normal or full.
65 | #
66 | storage.sync normal
67 |
68 | # storage.checksum
69 | # ----------------
70 | # enable the data integrity check when writing and reading data from the
71 | # filesystem. The storage layer uses the CRC32 algorithm.
72 | #
73 | storage.checksum off
74 |
75 | # storage.backlog.mem_limit
76 | # -------------------------
77 | # if storage.path is set, Fluent Bit will look for data chunks that were
78 | # not delivered and are still in the storage layer, these are called
79 | # backlog data. This option configure a hint of maximum value of memory
80 | # to use when processing these records.
81 | #
82 | storage.backlog.mem_limit 5M
83 |
84 | [INPUT]
85 | name tail
86 | path /var/ossec/logs/alerts/alerts.json
87 | tag wazuh
88 | parser json
89 | Buffer_Max_Size 5MB
90 | Buffer_Chunk_Size 400k
91 | storage.type filesystem
92 | Mem_Buf_Limit 512MB
93 | # Read interval (sec) Default: 1
94 | # interval_sec 1
95 |
96 | [OUTPUT]
97 | name tcp
98 | Host graylog
99 | Port 5555
100 | net.keepalive off
101 | Match wazuh
102 | Format json_lines
103 | json_date_key true
104 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/permanent_data.env:
--------------------------------------------------------------------------------
1 | # Permanent data mounted in volumes
2 | i=0
3 | PERMANENT_DATA[((i++))]="/var/ossec/api/configuration"
4 | PERMANENT_DATA[((i++))]="/var/ossec/etc"
5 | PERMANENT_DATA[((i++))]="/var/ossec/logs"
6 | PERMANENT_DATA[((i++))]="/var/ossec/queue"
7 | PERMANENT_DATA[((i++))]="/var/ossec/agentless"
8 | PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
9 | PERMANENT_DATA[((i++))]="/var/ossec/integrations"
10 | PERMANENT_DATA[((i++))]="/var/ossec/active-response/bin"
11 | PERMANENT_DATA[((i++))]="/var/ossec/wodles"
12 | PERMANENT_DATA[((i++))]="/etc/fluent-bit"
13 |
14 | export PERMANENT_DATA
15 |
16 | # Files mounted in a volume that should not be permanent
17 | i=0
18 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/etc/internal_options.conf"
19 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/slack"
20 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/slack.py"
21 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/virustotal"
22 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/virustotal.py"
23 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/shuffle"
24 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/shuffle.py"
25 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/pagerduty"
26 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/pagerduty.py"
27 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/maltiverse"
28 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/integrations/maltiverse.py"
29 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/default-firewall-drop"
30 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/disable-account"
31 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/firewalld-drop"
32 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/firewall-drop"
33 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/host-deny"
34 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/ip-customblock"
35 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/ipfw"
36 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/kaspersky.py"
37 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/kaspersky"
38 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/npf"
39 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/wazuh-slack"
40 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/pf"
41 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/restart-wazuh"
42 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/restart.sh"
43 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/active-response/bin/route-null"
44 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/sshlogin.exp"
45 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_pixconfig_diff"
46 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_asa-fwsmconfig_diff"
47 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_integrity_check_bsd"
48 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/main.exp"
49 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/su.exp"
50 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_integrity_check_linux"
51 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/register_host.sh"
52 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_generic_diff"
53 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_foundry_diff"
54 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh_nopass.exp"
55 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/agentless/ssh.exp"
56 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/utils.py"
57 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/aws-s3"
58 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/aws-s3.py"
59 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/__init__.py"
60 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/aws_tools.py"
61 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/wazuh_integration.py"
62 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/__init__.py"
63 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/aws_bucket.py"
64 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/cloudtrail.py"
65 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/config.py"
66 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/guardduty.py"
67 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/load_balancers.py"
68 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/server_access.py"
69 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/umbrella.py"
70 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/vpcflow.py"
71 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/buckets_s3/waf.py"
72 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/services/__init__.py"
73 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/services/aws_service.py"
74 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/services/cloudwatchlogs.py"
75 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/services/inspector.py"
76 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/subscribers/__init__.py"
77 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/subscribers/s3_log_handler.py"
78 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/subscribers/sqs_message_processor.py"
79 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/aws/subscribers/sqs_queue.py"
80 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/azure/azure-logs"
81 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/azure/azure-logs.py"
82 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/azure/db/orm.py"
83 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/azure/db/utils.py"
84 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/azure/db/__init__.py"
85 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/docker/DockerListener"
86 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/docker/DockerListener.py"
87 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/gcloud/gcloud"
88 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/gcloud/gcloud.py"
89 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/gcloud/integration.py"
90 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/gcloud/tools.py"
91 | PERMANENT_DATA_EXCP[((i++))]="/var/ossec/wodles/gcloud/exceptions.py"
92 | export PERMANENT_DATA_EXCP
93 |
94 | # Files mounted in a volume that should be deleted
95 | i=0
96 | PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
97 | export PERMANENT_DATA_DEL
98 |
99 | i=0
100 | PERMANENT_DATA_MOVE[((i++))]="/var/ossec/logs/ossec /var/ossec/logs/wazuh"
101 | PERMANENT_DATA_MOVE[((i++))]="/var/ossec/queue/ossec /var/ossec/queue/sockets"
102 | export PERMANENT_DATA_MOVE
103 |
--------------------------------------------------------------------------------
/wazuh/custom-wazuh-manager/config/permanent_data.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
3 |
4 | # Variables
5 | source /permanent_data.env
6 |
7 | WAZUH_INSTALL_PATH=/var/ossec
8 | DATA_TMP_PATH=${WAZUH_INSTALL_PATH}/data_tmp
9 | mkdir ${DATA_TMP_PATH}
10 |
11 | # Move exclusion files to EXCLUSION_PATH
12 | EXCLUSION_PATH=${DATA_TMP_PATH}/exclusion
13 | mkdir ${EXCLUSION_PATH}
14 |
15 | for exclusion_file in "${PERMANENT_DATA_EXCP[@]}"; do
16 | # Create the directory for the exclusion file if it does not exist
17 | DIR=$(dirname "${exclusion_file}")
18 | if [ ! -e ${EXCLUSION_PATH}/${DIR} ]
19 | then
20 | mkdir -p ${EXCLUSION_PATH}/${DIR}
21 | fi
22 |
23 | mv ${exclusion_file} ${EXCLUSION_PATH}/${exclusion_file}
24 | done
25 |
26 | # Move permanent files to PERMANENT_PATH
27 | PERMANENT_PATH=${DATA_TMP_PATH}/permanent
28 | mkdir ${PERMANENT_PATH}
29 |
30 | for permanent_dir in "${PERMANENT_DATA[@]}"; do
31 | # Create the directory for the permanent file if it does not exist
32 | DIR=$(dirname "${permanent_dir}")
33 | if [ ! -e ${PERMANENT_PATH}${DIR} ]
34 | then
35 | mkdir -p ${PERMANENT_PATH}${DIR}
36 | fi
37 |
38 | mv ${permanent_dir} ${PERMANENT_PATH}${permanent_dir}
39 |
40 | done
41 |
--------------------------------------------------------------------------------
/wazuh/generate-indexer-certs.yml:
--------------------------------------------------------------------------------
1 | # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
2 | version: '3'
3 |
4 | services:
5 | generator:
6 | image: wazuh/wazuh-certs-generator:0.0.2
7 | hostname: wazuh-certs-generator
8 | volumes:
9 | - ./config/wazuh_indexer_ssl_certs/:/certificates/
10 | - ./config/certs.yml:/config/certs.yml
11 |
--------------------------------------------------------------------------------
/wazuh_socfortress_rules.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
3 |
4 | clear
5 |
6 | ## Continue?
7 |
8 | ## Check if system is based on yum or apt-get
9 | while true; do
10 | read -p "Do you wish to configure Wazuh with the SOCFortress ruleset? WARNING - This script will replace all of your current custom Wazuh Rules. Please proceed with caution and it is recommended to manually back up your rules... continue? " yn
11 | case $yn in
12 | [Yy]* ) break;;
13 | [Nn]* ) exit;;
14 | * ) echo "Please answer yes or no.";;
15 | esac
16 | done
17 |
18 | if [ -n "$(command -v yum)" ]; then
19 | sys_type="yum"
20 | sep="-"
21 | elif [ -n "$(command -v zypper)" ]; then
22 | sys_type="zypper"
23 | sep="-"
24 | elif [ -n "$(command -v apt-get)" ]; then
25 | sys_type="apt-get"
26 | sep="="
27 | fi
28 |
29 | ## Prints information
30 | logger() {
31 | now=$(date +'%m/%d/%Y %H:%M:%S')
32 | case $1 in
33 | "-e")
34 | mtype="INFO:"
35 | message="$2"
36 | ;;
37 | "-w")
38 | mtype="WARNING:"
39 | message="$2"
40 | ;;
41 | *)
42 | mtype="INFO:"
43 | message="$1"
44 | ;;
45 | esac
46 | echo "$now $mtype $message"
47 | }
48 |
49 |
50 | ## Check if Git exists
51 | if ! command -v git &> /dev/null
52 | then
53 | logger -e "git package could not be found. Please install with yum/apt-get install git."
54 | exit
55 | else
56 | logger -e "git package found. Continuing..."
57 | fi
58 |
59 |
60 | checkArch() {
61 | arch=$(uname -m)
62 |
63 | if [ "$arch" != "x86_64" ]; then
64 | logger -e "Incompatible system. This script must be run on a 64-bit system."
65 | exit 1
66 | fi
67 | }
68 |
69 | restartService() {
70 | if [ -n "$(ps -e | egrep '^\s*1\s.*systemd$')" ]; then
71 | eval "systemctl restart $1.service ${debug}"
72 | if [ "$?" != 0 ]; then
73 | logger -e "${1^} could not be restarted. Please check /var/ossec/logs/ossec.log for details."
74 | logger -e "An error has occurred. Attempting to restore backed up rules"
75 | \cp -r /tmp/wazuh_rules_backup/* /var/ossec/etc/rules/
76 | chown wazuh:wazuh /var/ossec/etc/rules/*
77 | chmod 660 /var/ossec/etc/rules/*
78 | /var/ossec/bin/wazuh-control restart
79 | rm -rf /tmp/Wazuh-Rules
80 | else
81 | sleep 1
82 | fi
83 | elif [ -n "$(ps -e | egrep '^\s*1\s.*init$')" ]; then
84 | eval "chkconfig $1 on ${debug}"
85 | eval "service $1 restart ${debug}"
86 | eval "/etc/init.d/$1 start ${debug}"
87 | if [ "$?" != 0 ]; then
88 | logger -e "${1^} could not be restarted. Please check /var/ossec/logs/ossec.log for details."
89 | logger -e "An error has occurred. Attempting to restore backed up rules"
90 | \cp -r /tmp/wazuh_rules_backup/* /var/ossec/etc/rules/
91 | chown wazuh:wazuh /var/ossec/etc/rules/*
92 | chmod 660 /var/ossec/etc/rules/*
93 | /var/ossec/bin/wazuh-control restart
94 | rm -rf /tmp/Wazuh-Rules
95 | else
96 | sleep 1
97 | fi
98 | elif [ -x "/etc/rc.d/init.d/$1" ]; then
99 | eval "/etc/rc.d/init.d/$1 start ${debug}"
100 | if [ "$?" != 0 ]; then
101 | logger -e "${1^} could not be restarted. Please check /var/ossec/logs/ossec.log for details."
102 | else
103 | logger "${1^} restarted"
104 | fi
105 | else
106 | logger -e "${1^} could not restart. No service found on the system."
107 | fi
108 | }
109 |
110 | healthCheck() {
111 | cd /var/ossec || exit 1 # Set the current working directory to /var/ossec
112 | logger "Performing a health check"
113 | eval "/var/ossec/bin/wazuh-control restart ${debug}"
114 | sleep 20
115 | if [ -n "$(/var/ossec/bin/wazuh-control status | grep 'wazuh-logcollector not running...')" ]; then
116 | logger -e "Wazuh-Manager Service is not healthy. Please check /var/ossec/logs/ossec.log for details."
117 | else
118 | logger -e "Wazuh-Manager Service is healthy. Thanks for checking us out :) Get started with our free-for-life tier here: https://www.socfortress.co/trial.html Happy Defending!"
119 | rm -rf /tmp/Wazuh-Rules
120 | fi
121 | }
122 |
123 | ## Install the required packages for the installation
124 | cloneRules() {
125 | logger "Beginning the Install"
126 |
127 | if [ "$sys_type" == "yum" ]; then
128 | logger -e "Verifying that Wazuh-Manager software is installed... continued"
129 | if rpm -qa | grep -q wazuh-manager; then
130 | mkdir /tmp/wazuh_rules_backup
131 | logger -e "Backing up current rules into /tmp/wazuh_rules_backup/"
132 | \cp -r /var/ossec/etc/rules/* /tmp/wazuh_rules_backup/
133 | git clone https://github.com/socfortress/Wazuh-Rules.git /tmp/Wazuh-Rules
134 | cd /tmp/Wazuh-Rules || exit 1
135 | find . -name '*xml' -exec mv {} /var/ossec/etc/rules/ \;
136 | find /var/ossec/etc/rules/ -name 'decoder-linux-sysmon.xml' -exec mv {} /var/ossec/etc/decoders/ \;
137 | find /var/ossec/etc/rules/ -name 'yara_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
138 | find /var/ossec/etc/rules/ -name 'auditd_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
139 | find /var/ossec/etc/rules/ -name 'naxsi-opnsense_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
140 | find /var/ossec/etc/rules/ -name 'maltrail_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
141 | find /var/ossec/etc/rules/ -name 'decoder-manager-logs.xml' -exec mv {} /var/ossec/etc/decoders/ \;
142 | /var/ossec/bin/wazuh-control info 2>&1 | tee /tmp/version.txt
143 | chown wazuh:wazuh /var/ossec/etc/rules/*
144 | chmod 660 /var/ossec/etc/rules/*
145 | /var/ossec/bin/wazuh-control restart
146 | cd /var/ossec || exit 1
147 | rm -rf /tmp/Wazuh-Rules
148 | else
149 | logger -e "Wazuh-Manager software could not be found or is not installed"
150 | fi
151 | elif [ "$sys_type" == "apt-get" ]; then
152 | logger -e "Verifying that Wazuh-Manager software is installed... continued"
153 | if apt list --installed | grep -q wazuh-manager; then
154 | mkdir /tmp/wazuh_rules_backup
155 | logger -e "Backing up current rules into /tmp/wazuh_rules_backup/"
156 | \cp -r /var/ossec/etc/rules/* /tmp/wazuh_rules_backup/
157 | git clone https://github.com/socfortress/Wazuh-Rules.git /tmp/Wazuh-Rules
158 | cd /tmp/Wazuh-Rules || exit 1
159 | find . -name '*xml' -exec mv {} /var/ossec/etc/rules/ \;
160 | find /var/ossec/etc/rules/ -name 'decoder-linux-sysmon.xml' -exec mv {} /var/ossec/etc/decoders/ \;
161 | find /var/ossec/etc/rules/ -name 'yara_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
162 | find /var/ossec/etc/rules/ -name 'auditd_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
163 | find /var/ossec/etc/rules/ -name 'naxsi-opnsense_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
164 | find /var/ossec/etc/rules/ -name 'maltrail_decoders.xml' -exec mv {} /var/ossec/etc/decoders/ \;
165 | find /var/ossec/etc/rules/ -name 'decoder-manager-logs.xml' -exec mv {} /var/ossec/etc/decoders/ \;
166 | /var/ossec/bin/wazuh-control info 2>&1 | tee /tmp/version.txt
167 | chown wazuh:wazuh /var/ossec/etc/rules/*
168 | chmod 660 /var/ossec/etc/rules/*
169 | /var/ossec/bin/wazuh-control restart
170 | cd /var/ossec || exit 1
171 | rm -rf /tmp/Wazuh-Rules
172 | else
173 | logger -e "Wazuh-Manager software could not be found or is not installed"
174 | fi
175 | else
176 | logger "Continuing"
177 | fi
178 |
179 | if [ "$?" != 0 ]; then
180 | logger -e "An error has occurred. Attempting to restore backed up rules"
181 | \cp -r /tmp/wazuh_rules_backup/* /var/ossec/etc/rules/
182 | chown wazuh:wazuh /var/ossec/etc/rules/*
183 | chmod 660 /var/ossec/etc/rules/*
184 | /var/ossec/bin/wazuh-control restart
185 | cd /var/ossec || exit 1
186 | rm -rf /tmp/Wazuh-Rules
187 | else
188 | logger -e "Rules downloaded, attempting to restart the Wazuh-Manager service"
189 | restartService "wazuh-manager"
190 | sleep 5
191 | fi
192 | }
193 |
194 | main() {
195 | if [ "$EUID" -ne 0 ]; then
196 | logger -e "This script must be run as root."
197 | exit 1
198 | fi
199 |
200 | checkArch
201 | cloneRules
202 | healthCheck
203 | }
204 |
205 | main "$@"
206 |
--------------------------------------------------------------------------------