--- /dev/null
+repo: b55c69ab0638427c3307fb169a767b950530ce4a
+node: 5afbec313087627a125241c880b8a03f819f714f
+branch: default
+latesttag: v2.5.0-beta1
+latesttagdistance: 21
--- /dev/null
+
+syntax: glob
+
+*.so
+*.o
+*.a
+*.dSYM
+.hgignore
+
+# Auto generated build files
+src/Config.OS
+src/headers/zconf.h
+src/headers/zlib.h
+src/isbigendian.c
+src/analysisd/compiled_rules/compiled_rules.h
+
+# Compiled programs
+bin/agent_control
+bin/clear_stats
+bin/list_agents
+bin/manage_agents
+bin/ossec-agentd
+bin/ossec-agentlessd
+bin/ossec-analysisd
+bin/ossec-csyslogd
+bin/ossec-dbd
+bin/ossec-execd
+bin/ossec-logcollector
+bin/ossec-logtest
+bin/ossec-maild
+bin/ossec-monitord
+bin/ossec-remoted
+bin/ossec-reportd
+bin/ossec-syscheckd
+bin/rootcheck_control
+bin/syscheck_control
+bin/syscheck_update
+bin/
+src/addagent/manage_agents
+src/agentlessd/ossec-agentlessd
+src/analysisd/ossec-analysisd
+src/analysisd/ossec-logtest
+src/client-agent/ossec-agentd
+src/logcollector/ossec-logcollector
+src/monitord/ossec-monitord
+src/monitord/ossec-reportd
+src/os_csyslogd/ossec-csyslogd
+src/os_dbd/ossec-dbd
+src/os_execd/ossec-execd
+src/os_maild/ossec-maild
+src/remoted/ossec-remoted
+src/syscheckd/ossec-syscheckd
+src/util/agent_control
+src/util/clear_stats
+src/util/list_agents
+src/util/rootcheck_control
+src/util/syscheck_control
+src/util/syscheck_update
+src/analysisd/ossec-makelists
+src/isbigendian
+src/util/ossec-regex
+src/util/verify-agent-conf
--- /dev/null
+08e342871614314bce5004348e0fb4afe1ca29d0 OSSEC_HIDS_0_3
+4fa9b5d98615125f4e8ef879c95978d23031a64d v_09
+5b120f348f051e599539b68e57fae94abfe42f83 v_0_8
+7550abc82f5402592a646615f02fd698686de7bd OSSEC_HIDS_0_4
+946d14c2b5ba7c21cd6eefe5f56f136df93f28a6 v1_1_0
+8b7a8120903fe0e18fcd9a29897919669c46adfc v2.5.0-beta1
-OSSEC v2.3
-Copyright (C) 2009 Trend Micro Inc.
+OSSEC v2.5.1
+Copyright (C) 2010 Trend Micro Inc.
** Reporting bugs **
-OSSEC v2.3
-Copyright (C) 2009 Trend Micro Inc.
+OSSEC v2.5.1
+Copyright (C) 2010 Trend Micro Inc.
= Information about OSSEC =
-# @(#) $Id: CONTRIB,v 1.26 2009/11/23 18:52:44 dcid Exp $
+# @(#) $Id$
#
Many thanks to everyone who contributed and helped with
-Development
- Daniel B. Cid <dcid ( at ) ossec.net>
+ - Jeremy Rossi <jrossi ( at ) ptnsecurity.com>
+ - Stephen Kreusch <stephen.kreusch at gmail.com>
- Meir Michanie <meirgotroot ( at ) gmail.com>
- Slava Semushin <php-coder at altlinux.org>
- - Jeremy Rossi
- Ahmet Ozturk <oahmet ( at ) metu.edu.tr>
-OSSEC v2.3
+OSSEC v2.5.1
Copyright (C) 2009 Trend Micro Inc.
- Copyright (C) 2009 Trend Micro Inc. All rights reserved.
+ Copyright (C) 2010 Trend Micro Inc. All rights reserved.
OSSEC HIDS is a free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License (version 3) as
+ it under the terms of the GNU General Public License (version 2) as
published by the FSF - Free Software Foundation.
Note that this license applies to the source code, as well as
-----------------------------------------------------------------------------
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
this License.
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
-OSSEC v2.3
-Copyright (C) 2009 Trend Micro Inc.
+OSSEC v2.5.1
+Copyright (C) 2010 Trend Micro Inc.
= Information about OSSEC =
GREP="/bin/grep"
IPTABLES="/sbin/iptables"
IPFILTER="/sbin/ipf"
+if [ "X$UNAME" = "XSunOS" ]; then
+ IPFILTER="/usr/sbin/ipf"
+fi
GENFILT="/usr/sbin/genfilt"
LSFILT="/usr/sbin/lsfilt"
MKFILT="/usr/sbin/mkfilt"
--- /dev/null
+:: Simple script to block an ip using netsh. Commands from http://windowsnerd.com/\r
+@ECHO OFF\r
+ECHO.\r
+\r
+\r
+:: Logging it all\r
+FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B\r
+FOR /F "TOKENS=1* DELIMS= " %%A IN ('TIME/T') DO SET TIME=%%A\r
+ECHO %DATE% %TIME% %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 >> active-response/active-responses.log\r
+\r
+\r
+IF "%1"=="add" GOTO ADD\r
+IF "%1"=="delete" GOTO DEL\r
+:ERROR\r
+\r
+ECHO "Invalid argument. %1"\r
+GOTO Exit;\r
+\r
+\r
+:: Adding to the blocked.\r
+\r
+:ADD\r
+:: Extracts last ip address from ipconfig.\r
+netsh ipsec static add policy description="ossec block list"\r
+netsh ipsec static add filter filterlist="ossecfilter" srcaddr=%3 dstaddr=me protocol=tcp mirrored=yes\r
+netsh ipsec static add rule policy="ossec" filterlist="ossecfilter" filteraction="block" desc="list of blocked ips"\r
+netsh ipsec static set policy assign=y\r
+GOTO Exit;\r
+\r
+:DEL\r
+netsh ipsec static delete filter filterlist="ossecfilter" srcaddr=%3 dstaddr=me protocol=tcp mirrored=yes\r
+\r
+:Exit\r
\r
:ADD\r
:: Extracts last ip address from ipconfig.\r
-FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG /ALL ^| FIND "IP Address"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B\r
+FOR /F "TOKENS=2* DELIMS=:" %%A IN ('IPCONFIG ^| FIND "IP"') DO FOR %%B IN (%%A) DO SET IPADDR=%%B\r
route add %3 mask 255.255.255.255 %IPADDR%\r
GOTO Exit;\r
\r
# # #
##########################################################
-#$Id: ossec-batch-manager.pl,v 1.4 2007/11/05 21:05:39 jeff Exp $
+#$Id$
# TODO:
# - Add check for ossec 1.4 and support longer agent names
# - Add in eval so that older version of perl without
my ($id, $name, $ip, $key) = split;
if ($id == $extractid) {
# Newlines are valid base64 characters so use '' instead for \n
- $decoded = MIME::Base64::encode($key, '');
+ $decoded = MIME::Base64::encode($_, '');
print "$decoded\n";
exit 0;
}
--- /dev/null
+import ConfigParser
+import subprocess
+import os
+import sys
+import os.path
+
+class OssecTester(object):
+ def __init__(self):
+ self._debug = False
+ self._quiet = False
+ self._ossec_conf = "/var/ossec/etc/ossec.conf"
+ self._base_dir = "/var/ossec/"
+ self._ossec_path = "/var/ossec/bin/"
+ self._test_path = "./tests"
+
+ def buildCmd(self, rule, alert, decoder):
+ cmd = ['%s/ossec-logtest'%(self._ossec_path),]
+ if self._ossec_conf: cmd += ["-c",self._ossec_conf]
+ if self._base_dir: cmd += ["-D", self._base_dir]
+ cmd += ['-U', "%s:%s:%s"%(rule,alert,decoder)]
+ return cmd
+
+ def runTest(self, log, rule, alert, decoder, section, name, negate=False):
+ print self.buildCmd(rule, alert, decoder)
+ p = subprocess.Popen(self.buildCmd(rule, alert, decoder),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ stdin=subprocess.PIPE,
+ shell=False)
+ std_out = p.communicate(log)[0]
+ if (p.returncode != 0 and not negate) or (p.returncode == 0 and negate):
+ print ""
+ print "-" * 60
+ print "Failed: Exit code = %s"%(p.returncode)
+ print " Alert = %s"%(alert)
+ print " Rule = %s"%(rule)
+ print " Decoder = %s"%(decoder)
+ print " Section = %s"%(section)
+ print " line name = %s"%(name)
+ print " "
+ print std_out
+ elif self._debug:
+ print "Exit code= %s"%(p.returncode)
+ print std_out
+ else:
+ sys.stdout.write(".")
+
+ def run(self):
+ for aFile in os.listdir(self._test_path):
+ aFile = os.path.join(self._test_path, aFile)
+ print "- [ File = %s ] ---------"%(aFile)
+ if aFile.endswith(".ini"):
+ tGroup = ConfigParser.ConfigParser()
+ tGroup.read([aFile])
+ tSections = tGroup.sections()
+ for t in tSections:
+ rule = tGroup.get(t, "rule")
+ alert = tGroup.get(t, "alert")
+ decoder = tGroup.get(t, "decoder")
+ for (name, value) in tGroup.items(t):
+ if name.startswith("log "):
+ if self._debug:
+ print "-"* 60
+ if name.endswith("pass"):
+ neg = False
+ elif name.endswith("fail"):
+ neg = True
+ else:
+ neg = False
+ self.runTest(value, rule, alert, decoder, t, name, negate=neg)
+ print ""
+
+if __name__ == "__main__":
+ OT = OssecTester()
+ OT.run()
+
+
+
+
+
+
--- /dev/null
+[Query cache denied]
+log 1 pass = Aug 29 15:33:13 ns3 named[464]: client 217.148.39.3#1036: query (cache) denied
+log 2 pass = Aug 29 15:33:13 ns3 named[464]: client 217.148.39.4#32769: query (cache) denied
+log 3 pass = Aug 29 15:33:13 ns3 named[464]: client 217.148.39.3#1036: query (cache) denied
+log 4 fail = Aug 29 15:33:13 ns3 name[464]: client 217.148.39.4#32769: query (cache) denied
+log 5 pass = Aug 29 15:33:13 ns3 named[464]: client 217.148.39.3#1036: query (cache)
+
+rule = 12108
+alert = 4
+decoder = named
# ---------------------------------------------------------------------------
# Author: Meir Michanie (meirm@riunx.com)
# Co-Author: J.A.Senger (jorge@br10.com.br)
-# $Id: ossec2mysql.pl,v 1.13 2007/09/05 00:38:26 dcid Exp $
+# $Id$
# ---------------------------------------------------------------------------
# http://www.riunx.com/
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# Author: Meir Michanie (meirm@riunx.com)
# Co-Author: J.A.Senger (jorge@br10.com.br)
-# $Id: ossec2mysqld.pl,v 1.11 2007/09/05 00:38:26 dcid Exp $
-# $Revision: 1.11 $
+# $Id$
+# $Revision$
## ---------------------------------------------------------------------------
# http://www.riunx.com/
# ---------------------------------------------------------------------------
-<!-- @(#) $Id: decoder.xml,v 1.162 2009/11/09 20:32:29 dcid Exp $
+<!-- @(#) $Id$
- OSSEC log decoder.
- Author: Daniel B. Cid
- License: http://www.ossec.net/en/licensing.html
<decoder name="ssh-reverse-mapping">
<parent>sshd</parent>
<prematch>^reverse mapping checking </prematch>
- <regex offset="after_prematch">^\w+ for (\S+) </regex>
+ <regex offset="after_prematch">^\w+ for \S+ [(\S+)] |^\w+ for (\S+) </regex>
<order>srcip</order>
</decoder>
<order>srcip</order>
</decoder>
+<decoder name="ssh-osx-refuse">
+ <parent>sshd</parent>
+ <prematch>^refused connect </prematch>
+ <regex offset="after_prematch">^from (\S+)$</regex>
+ <order>srcip</order>
+</decoder>
+
<!--
<!--
+ - rshd decoder
+ - Example message:
+ - Dec 17 10:49:23 hostname rshd[347339]: Connection from 10.217.223.31 on illegal port
+ -->
+<decoder name="rshd">
+ <program_name>^rshd$</program_name>
+</decoder>
+
+<decoder name="rshd-illegal-connection">
+ <parent>rshd</parent>
+ <regex>^Connection from (\S+) on illegal port$</regex>
+ <order>srcip</order>
+</decoder>
+
+
+
+<!--
+ - cimserver decoder
+ - Example messages:
+ - Dec 18 18:06:28 hostname cimserver[18575]: PGS17200: Authentication failed for user jones_b.
+ - Dec 18 18:06:29 hostname cimserver[18575]: PGS17200: Authentication failed for user domain\jones_b.
+ -->
+<decoder name="cimserver">
+ <program_name>^cimserver$</program_name>
+</decoder>
+
+<decoder name="cimserver-failed-authentication">
+ <parent>cimserver</parent>
+ <prematch>^\w+: Authentication failed for user </prematch>
+ <regex offset="after_prematch">^(\S+).$</regex>
+ <order>user</order>
+</decoder>
+
+
+
+<!--
- Samba decoder.
- Will extraxt the username/srcip
- Examples:
- ftpd[811166]: refused connect from 88.225.42.182
- in.ftpd[18561]: [ID 484914 daemon.notice] gethostbyaddr: nameservices.net. != 216.117.134.168
- ftpd[31918]: FTPD: EXPORT file local , remote
+ - Dec 21 12:21:20 hostname ftpd[323115]: login jones_b from client.example.org failed.
-->
<decoder name="ftpd">
<program_name>^ftpd|^in.ftpd</program_name>
<order>srcip</order>
</decoder>
+<decoder name="ftpd-tru64">
+ <parent>ftpd</parent>
+ <prematch>^login \S+ from \S+ failed.</prematch>
+ <regex>^login (\S+) from (\S+) failed.$</regex>
+ <order>user, srcip</order>
+</decoder>
+
<!-- Arpwatch decoder.
<decoder name="dovecot-success">
<parent>dovecot</parent>
<prematch offset="after_parent">^\w\w\w\w-login: Login: </prematch>
- <regex offset="after_prematch">^user=\p(\S+)\p, method=\S+, rip=(\S+), </regex>
- <order>user, srcip</order>
+ <regex offset="after_prematch">^user=\p(\S+)\p, method=\S+, rip=\S*(\d+.\d+.\d+.\d+), lip=\S*(\d+.\d+.\d+.\d+), (\S*)$</regex>
+ <order>user, srcip, dstip, protocol</order>
</decoder>
<decoder name="dovecot-aborted">
<parent>dovecot</parent>
<prematch offset="after_parent">^\w\w\w\w-login: Aborted login</prematch>
- <regex offset="after_prematch"> user=\p\S+>, method=\w+, rip=(\S+), lip=\S+</regex>
- <order>srcip</order>
+ <regex offset="after_prematch">: user=\p(\S+)\p, method=\S+, rip=::ffff:(\d+.\d+.\d+.\d+), lip=::ffff:(\d+.\d+.\d+.\d+)$</regex>
+ <order>user, srcip, dstip</order>
+</decoder>
+
+<decoder name="dovecot-fail">
+ <parent>dovecot</parent>
+ <prematch offset="after_parent">^auth\(default\)|auth-worker\(default\)</prematch>
+ <regex offset="after_prematch">^: \S+\((\S+),(\d+.\d+.\d+.\d+)\)</regex>
+ <order>user, srcip</order>
</decoder>
<decoder name="dovecot-disconnect">
<parent>dovecot</parent>
<prematch offset="after_parent">^\w\w\w\w-login: Disconnected: </prematch>
- <regex offset="after_prematch">^rip=(\S+), </regex>
- <order>srcip</order>
+ <regex offset="after_prematch">^rip=(\S+), lip=(\d+.\d+.\d+.\d+)</regex>
+ <order>srcip, dstip</order>
</decoder>
-->
<decoder name="windows-snare">
<type>windows</type>
- <prematch>^MSWinEventLog\t\d\t\.+\t\d+\t\w\w\w \w\w\w \d\d \d\d</prematch>
+ <prematch>^MSWinEventLog\t\d\t\.+\t\d+\t\w\w\S+ \w\w\w \d\d \d\d</prematch>
<regex offset="after_prematch">^:\d\d:\d\d \d\d\d\d\t(\d+)\t(\.+)</regex>
<regex>\t(\.+)\t\.+\t(\.+)\t(\.+)\t</regex>
<order>id, extra_data, user, status, system_name</order>
<rules>
<include>rules_config.xml</include>
+ <include>pam_rules.xml</include>
<include>sshd_rules.xml</include>
+ <include>telnetd_rules.xml</include>
<include>syslog_rules.xml</include>
+ <include>arpwatch_rules.xml</include>
+ <include>symantec-av_rules.xml</include>
+ <include>symantec-ws_rules.xml</include>
<include>pix_rules.xml</include>
<include>named_rules.xml</include>
+ <include>smbd_rules.xml</include>
+ <include>vsftpd_rules.xml</include>
<include>pure-ftpd_rules.xml</include>
<include>proftpd_rules.xml</include>
+ <include>ms_ftpd_rules.xml</include>
+ <include>ftpd_rules.xml</include>
+ <include>hordeimp_rules.xml</include>
+ <include>roundcube_rules.xml</include>
+ <include>wordpress_rules.xml</include>
+ <include>cimserver_rules.xml</include>
+ <include>vpopmail_rules.xml</include>
+ <include>vmpop3d_rules.xml</include>
+ <include>courier_rules.xml</include>
<include>web_rules.xml</include>
<include>apache_rules.xml</include>
+ <include>nginx_rules.xml</include>
+ <include>php_rules.xml</include>
+ <include>mysql_rules.xml</include>
+ <include>postgresql_rules.xml</include>
<include>ids_rules.xml</include>
<include>squid_rules.xml</include>
<include>firewall_rules.xml</include>
+ <include>cisco-ios_rules.xml</include>
+ <include>netscreenfw_rules.xml</include>
+ <include>sonicwall_rules.xml</include>
<include>postfix_rules.xml</include>
<include>sendmail_rules.xml</include>
+ <include>imapd_rules.xml</include>
+ <include>mailscanner_rules.xml</include>
+ <include>dovecot_rules.xml</include>
+ <include>ms-exchange_rules.xml</include>
+ <include>racoon_rules.xml</include>
+ <include>vpn_concentrator_rules.xml</include>
<include>spamd_rules.xml</include>
<include>msauth_rules.xml</include>
+ <include>mcafee_av_rules.xml</include>
+ <include>trend-osce_rules.xml</include>
+ <include>ms-se_rules.xml</include>
+ <!-- <include>policy_rules.xml</include> -->
+ <include>zeus_rules.xml</include>
+ <include>solaris_bsm_rules.xml</include>
+ <include>vmware_rules.xml</include>
+ <include>ms_dhcp_rules.xml</include>
+ <include>asterisk_rules.xml</include>
+ <include>ossec_rules.xml</include>
<include>attack_rules.xml</include>
- </rules>
+ <include>local_rules.xml</include>
+ </rules>
<syscheck>
- <!-- Frequency that syscheck is executed -- default every 2 hours -->
- <frequency>7200</frequency>
+ <!-- Frequency that syscheck is executed -- default every 20 hours -->
+ <frequency>17200</frequency>
<!-- Directories to check (perform all possible verifications) -->
<directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
<rules>
<include>rules_config.xml</include>
+ <include>pam_rules.xml</include>
<include>sshd_rules.xml</include>
+ <include>telnetd_rules.xml</include>
<include>syslog_rules.xml</include>
+ <include>arpwatch_rules.xml</include>
+ <include>symantec-av_rules.xml</include>
+ <include>symantec-ws_rules.xml</include>
<include>pix_rules.xml</include>
<include>named_rules.xml</include>
+ <include>smbd_rules.xml</include>
+ <include>vsftpd_rules.xml</include>
<include>pure-ftpd_rules.xml</include>
<include>proftpd_rules.xml</include>
+ <include>ms_ftpd_rules.xml</include>
+ <include>ftpd_rules.xml</include>
+ <include>hordeimp_rules.xml</include>
+ <include>roundcube_rules.xml</include>
+ <include>wordpress_rules.xml</include>
+ <include>cimserver_rules.xml</include>
+ <include>vpopmail_rules.xml</include>
+ <include>vmpop3d_rules.xml</include>
+ <include>courier_rules.xml</include>
<include>web_rules.xml</include>
<include>apache_rules.xml</include>
+ <include>nginx_rules.xml</include>
+ <include>php_rules.xml</include>
+ <include>mysql_rules.xml</include>
+ <include>postgresql_rules.xml</include>
<include>ids_rules.xml</include>
<include>squid_rules.xml</include>
<include>firewall_rules.xml</include>
+ <include>cisco-ios_rules.xml</include>
+ <include>netscreenfw_rules.xml</include>
+ <include>sonicwall_rules.xml</include>
<include>postfix_rules.xml</include>
<include>sendmail_rules.xml</include>
+ <include>imapd_rules.xml</include>
+ <include>mailscanner_rules.xml</include>
+ <include>dovecot_rules.xml</include>
+ <include>ms-exchange_rules.xml</include>
+ <include>racoon_rules.xml</include>
+ <include>vpn_concentrator_rules.xml</include>
<include>spamd_rules.xml</include>
<include>msauth_rules.xml</include>
+ <include>mcafee_av_rules.xml</include>
+ <include>trend-osce_rules.xml</include>
+ <include>ms-se_rules.xml</include>
+ <!-- <include>policy_rules.xml</include> -->
+ <include>zeus_rules.xml</include>
+ <include>solaris_bsm_rules.xml</include>
+ <include>vmware_rules.xml</include>
+ <include>ms_dhcp_rules.xml</include>
+ <include>asterisk_rules.xml</include>
+ <include>ossec_rules.xml</include>
<include>attack_rules.xml</include>
- </rules>
+ <include>local_rules.xml</include>
+ </rules>
+
<syscheck>
- <!-- Frequency that syscheck is executed -- default every 2 hours -->
- <frequency>7200</frequency>
+ <!-- Frequency that syscheck is executed -- default every 20 hours -->
+ <frequency>72000</frequency>
<!-- Directories to check (perform all possible verifications) -->
<directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
-<!-- @(#) $Id: apache_rules.xml,v 1.36 2009/09/16 14:19:45 dcid Exp $
+<!-- @(#) $Id$
- Official Apache rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<if_sid>30103</if_sid>
<match>exit signal Segmentation Fault</match>
<description>Apache segmentation fault.</description>
- <info>http://www.securityfocus.com/infocus/1633</info>
+ <info type="link">http://www.securityfocus.com/infocus/1633</info>
<group>service_availability,</group>
</rule>
<if_sid>30101</if_sid>
<match>Client sent malformed Host header</match>
<description>Code Red attack.</description>
- <info>http://www.cert.org/advisories/CA-2001-19.html</info>
+ <info type="link">http://www.cert.org/advisories/CA-2001-19.html</info>
+ <info type="text">CERT: Advisory CA-2001-19 "Code Red" Worm Exploiting Buffer Overflow In IIS Indexing Service DLL</info>
<group>automatic_attack,</group>
</rule>
-<!-- @(#) $Id: arpwatch_rules.xml,v 1.9 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Arpwatch rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: asterisk_rules.xml,v 1.4 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Asterisk rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: attack_rules.xml,v 1.18 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official "attack" correlation rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<rule id="40107" level="14">
<regex>cachefsd: Segmentation Fault - core dumped</regex>
<description>Heap overflow in the Solaris cachefsd service.</description>
- <cve>2002-0033</cve>
+ <info type='cve'>2002-0033</info>
<group>exploit_attempt,</group>
</rule>
<match>attempt to execute code on stack by</match>
<description>Stack overflow attempt or program exiting </description>
<description>with SEGV (Solaris).</description>
- <info>http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ch18/389-392.html</info>
+ <info type="link">http://snap.nlc.dcccd.edu/reference/sysadmin/julian/ch18/389-392.html</info>
<group>exploit_attempt,</group>
</rule>
<if_matched_group>connection_attempt</if_matched_group>
<description>Network scan from same source ip.</description>
<same_source_ip />
- <info>http://project.honeynet.org/papers/enemy2/</info>
+ <info type="link">http://project.honeynet.org/papers/enemy2/</info>
</rule>
</group> <!-- SYSLOG,SCANS -->
--- /dev/null
+<!-- @(#) $Id$
+ - Official Compaq Insight Manager (cimserver) rules for OSSEC.
+ -
+ - Author: Stephen Kreusch
+ -
+ - This program is a free software; you can redistribute it
+ - and/or modify it under the terms of the GNU General Public
+ - License (version 3) as published by the FSF - Free Software
+ - Foundation.
+ -
+ - License details: http://www.ossec.net/en/licensing.html
+ -->
+
+<group name="syslog,cimserver,">
+ <rule id="9600" level="0" noalert="1">
+ <decoded_as>cimserver</decoded_as>
+ <description>cimserver messages grouped.</description>
+ </rule>
+
+ <rule id="9610" level="5">
+ <if_sid>9600</if_sid>
+ <match>Authentication failed</match>
+ <description>Compaq Insight Manager authentication failure.</description>
+ <group>authentication_failed,</group>
+ </rule>
+
+ <rule id="9611" level="12">
+ <if_sid>9600</if_sid>
+ <match>Server stopped</match>
+ <description>Compaq Insight Manager stopped.</description>
+ <group>service_availability,</group>
+ </rule>
+</group>
+
+<!-- EOF -->
-<!-- @(#) $Id: cisco-ios_rules.xml,v 1.4 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Cisco IOS rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: courier_rules.xml,v 1.4 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Courier rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<rule id="3902" level="5">
<if_sid>3900</if_sid>
- <match>^LOGIN FAILED,</match>
+ <match>^LOGIN FAILED,| FAILED:</match>
<description>Courier (imap/pop3) authentication failed.</description>
<group>authentication_failed,</group>
</rule>
<group>authentication_success,</group>
</rule>
- <rule id="3910" level="10" frequency="6" timeframe="240">
+ <rule id="3910" level="10" frequency="10" timeframe="30">
<if_matched_sid>3902</if_matched_sid>
<description>Courier brute force (multiple failed logins).</description>
<group>authentication_failures,</group>
<same_source_ip />
</rule>
- <rule id="3911" level="10" frequency="10" timeframe="60">
+ <rule id="3911" level="10" frequency="15" timeframe="30">
<if_matched_sid>3901</if_matched_sid>
<same_source_ip />
<description>Multiple connection attempts from same source.</description>
-<!-- @(#) $Id: firewall_rules.xml,v 1.10 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Firewall rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: ftpd_rules.xml,v 1.6 2008/08/05 18:54:23 dcid Exp $
+<!-- @(#) $Id$
- Official ftpd rules for OSSEC.
- Author: Ahmet Ozturk
- License: http://www.ossec.net/en/licensing.html
<description>FTP authentication failure.</description>
<group>authentication_failed,</group>
</rule>
+
+ <rule id="11113" level="5">
+ <if_sid>11100</if_sid>
+ <regex>^login \S+ from \S+ failed</regex>
+ <description>FTP authentication failure.</description>
+ <group>authentication_failed,</group>
+ </rule>
</group> <!-- SYSLOG,FTPD -->
-<!-- @(#) $Id: hordeimp_rules.xml,v 1.7 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Horde IMP rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: ids_rules.xml,v 1.26 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official IDS rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: imapd_rules.xml,v 1.7 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official imapd rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: local_rules.xml,v 1.6 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Example of local rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: mailscanner_rules.xml,v 1.6 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Example of MailScanner rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: mcafee_av_rules.xml,v 1.4 2009/04/03 14:39:15 dcid Exp $
+<!-- @(#) $Id$
- McAfee AV rules for OSSEC.
-
- Copyright (C) 2008 Michael Starks
-<!-- @(#) $Id: ms-exchange_rules.xml,v 1.7 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Example of MS Exchange rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
--- /dev/null
+<!-- @(#) $Id$
+ - Official Microsoft Security Essentials rules for OSSEC.
+ -
+ - Copyright (C) 2010 Trend Micro Inc.
+ - All rights reserved.
+ -
+ - This program is a free software; you can redistribute it
+ - and/or modify it under the terms of the GNU General Public
+ - License (version 2) as published by the FSF - Free Software
+ - Foundation.
+ -
+ - License details: http://www.ossec.net/en/licensing.html
+ -->
+
+
+
+
+<group name="windows,mse,">
+ <rule id="7701" level="0">
+ <category>windows</category>
+ <extra_data>^Microsoft Antimalware</extra_data>
+ <description>Grouping of Microsoft Security Essentials rules.</description>
+ </rule>
+
+ <rule id="7710" level="12">
+ <if_sid>7701</if_sid>
+ <id>^1008$</id>
+ <group>virus</group>
+ <description>Microsoft Security Essentials - Virus detected, but unable to remove.</description>
+ </rule>
+
+ <rule id="7711" level="7">
+ <if_sid>7701</if_sid>
+ <id>^1007$</id>
+ <group>virus</group>
+ <description>Microsoft Security Essentials - Virus detected and properly removed.</description>
+ </rule>
+
+ <rule id="7712" level="7">
+ <if_sid>7701</if_sid>
+ <id>^1015$|^1006$</id>
+ <group>virus</group>
+ <description>Microsoft Security Essentials - Virus detected.</description>
+ </rule>
+
+ <rule id="7720" level="3">
+ <if_sid>7701</if_sid>
+ <id>^5007$</id>
+ <description>Microsoft Security Essentials - Configuration changed.</description>
+ <group>policy_changed,</group>
+ </rule>
+
+ <rule id="7731" level="5">
+ <if_sid>7711, 7712</if_sid>
+ <match>Virus:DOS/EICAR_Test_File</match>
+ <options>alert_by_email</options>
+ <description>Microsoft Security Essentials - EICAR test file detected.</description>
+ </rule>
+
+
+ <rule id="7750" level="10" frequency="6" timeframe="240">
+ <if_matched_sid>7711</if_matched_sid>
+ <description>Multiple Microsoft Security Essentials AV warnings detected.</description>
+ </rule>
+
+ <rule id="7751" level="10" frequency="6" timeframe="240">
+ <if_matched_sid>7712</if_matched_sid>
+ <description>Multiple Microsoft Security Essentials AV warnings detected.</description>
+ </rule>
+</group> <!-- mse -->
+
+
+<!-- EOF -->
-<!-- @(#) $Id: ms_dhcp_rules.xml,v 1.1 2009/05/28 17:08:39 dcid Exp $
+<!-- @(#) $Id$
- Microsoft Windows 2003 ipv4, Windows 2008 ipv4/ipv6 DHCP rules for OSSEC.
- Author: phishphreek@gmail.com
- License: http://www.ossec.net/en/licensing.html (http://gplv3.fsf.org)
-<!-- @(#) $Id: ms_ftpd_rules.xml,v 1.5 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Example of Microsoft FTP rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: msauth_rules.xml,v 1.35 2009/11/06 15:30:30 dcid Exp $
+<!-- @(#) $Id$
- Example of Microsoft Windows (2000, XP, 2003) rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<rule id="18110" level="8">
<if_sid>18104</if_sid>
- <id>^624|^626|^645|^4720|^4722</id>
+ <id>^624|^626|^645|^4720|^4722|^4741</id>
<description>User account enabled or created.</description>
<group>adduser,account_changed,</group>
</rule>
<group>policy_changed,</group>
</rule>
- <rule id="18114" level="8">
+ <rule id="18114" level="5">
<if_sid>18104</if_sid>
- <id>^63|^641|^664|^658|^659|^660|^662|^668|^4907</id>
- <description>Group account changed.</description>
- <group>adduser,account_changed,</group>
+ <id>^632$|^4728$|^633$|^4729$|^636$|^4732$|^637$|^4733$|^639$|^4735$|</id>
+ <id>^641$|^4737$|^637$|^4733$|^659$|^4755$|^660$|^4766$|^668$|^4764$|</id>
+ <id>^649$|^4745$|^650$|^4746$|^651$|^4747$|^654$|^4750$|^655$|^4751$|</id>
+ <id>^656$|^4752$|^659$|^4755$|^660$|^4756$|^661$|^4757$|^664$|^4760$|</id>
+ <id>^665$|^4761$|^666$|^4762$</id>
+ <description>Group Account Changed</description>
+ <group>group_changed,win_group_changed,</group>
</rule>
<rule id="18115" level="8">
<if_sid>18104</if_sid>
<id>^640</id>
<description>General account database changed.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com259.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com259.html</info>
<group>adduser,account_changed,</group>
</rule>
</rule>
<rule id="18128" level="8">
- <if_sid>18104</if_sid>
- <id>^65|^66</id>
+ <!-- if_sid>18104</if_sid -->
+ <id>^65xxx</id>
<description>Group account added/changed/deleted.</description>
+ <info>This rule has been deprecated</info>
<group>account_changed,</group>
</rule>
<if_sid>18106</if_sid>
<id>^529</id>
<description>Logon Failure - Unknown user or bad password.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com190.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com190.html</info>
<group>win_authentication_failed,</group>
</rule>
<id>^530</id>
<description>Logon Failure - Account logon time restriction </description>
<description>violation.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com191.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com191.html</info>
<group>win_authentication_failed,login_denied,</group>
</rule>
<if_sid>18106</if_sid>
<id>^531</id>
<description>Logon Failure - Account currently disabled.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com192.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com192.html</info>
<group>win_authentication_failed,login_denied,</group>
</rule>
<if_sid>18106</if_sid>
<id>^532</id>
<description>Logon Failure - Specified account expired.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com193.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com193.html</info>
<group>win_authentication_failed,login_denied,</group>
</rule>
<id>^533</id>
<description>Logon Failure - User not allowed to login at </description>
<description>this computer.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com194.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com194.html</info>
<group>win_authentication_failed,login_denied,</group>
</rule>
<if_sid>18106</if_sid>
<id>^534</id>
<description>Logon Failure - User not granted logon type.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com195.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com195.html</info>
<group>win_authentication_failed,</group>
</rule>
<if_sid>18106</if_sid>
<id>^535</id>
<description>Logon Failure - Account's password expired.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com196.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com196.html</info>
<group>win_authentication_failed,</group>
</rule>
<if_sid>18104</if_sid>
<id>^671|^4767</id>
<description>User account unlocked.</description>
- <info>http://www.ultimatewindowssecurity.com/events/com291.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/events/com291.html</info>
<group>account_changed,</group>
</rule>
<id>^7040</id>
<group>policy_changed,</group>
<description>Service startup type was changed.</description>
- <info>This does not appear to be logged on Windows 2000.</info>
+ <info type="text">This does not appear to be logged on Windows 2000.</info>
</rule>
<rule id="18146" level="5">
<description>Windows User Logoff.</description>
</rule>
+<!-- Granular group rules -->
+
+ <rule id="18200" level="5">
+ <if_sid>18104</if_sid>
+ <id>^631$|^4727$|^635$|^4731$|^658$|^4754$|^648$|^4744$|^653$|^4749$|</id>
+ <id>^663$|^4759$</id>
+ <description>Group Account Created</description>
+ <group>group_created,win_group_created,</group>
+ </rule>
+
+ <rule id="18201" level="5">
+ <if_sid>18104</if_sid>
+ <id>^634$|^4730$|^638$|^4734$|^662$|^4758$|^652$|^4748$|^657$|^4753$|</id>
+ <id>^667$|^4763$</id>
+ <description>Group Account Deleted</description>
+ <group>group_deleted,win_group_deleted,</group>
+ </rule>
+
+ <rule id="18202" level="5">
+ <if_sid>18200</if_sid>
+ <id>^631$|^4727$</id>
+ <description>Security Enabled Global Group Created</description>
+ <group>group_created,win_group_created,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=631</info>
+ </rule>
+
+ <rule id="18203" level="5">
+ <if_sid>18114</if_sid>
+ <id>^632$|^4728$</id>
+ <description>Security Enabled Global Group Member Added</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=632</info>
+ </rule>
+
+ <rule id="18204" level="5">
+ <if_sid>18114</if_sid>
+ <id>^633$|^4729$</id>
+ <description>Security Enabled Global Group Member Removed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=633</info>
+ </rule>
+
+ <rule id="18205" level="5">
+ <if_sid>18201</if_sid>
+ <id>^634$|^4730$</id>
+ <description>Security Enabled Global Group Deleted</description>
+ <group>group_deleted,win_group_deleted,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=634</info>
+ </rule>
+
+ <rule id="18206" level="5">
+ <if_sid>18200</if_sid>
+ <id>^635$|^4731$</id>
+ <description>Security Enabled Local Group Created</description>
+ <group>group_created,win_group_created,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=635</info>
+ </rule>
+
+ <rule id="18207" level="5">
+ <if_sid>18114</if_sid>
+ <id>^636$|^4732$</id>
+ <description>Security Enabled Local Group Member Added</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=636</info>
+ </rule>
+
+ <rule id="18208" level="5">
+ <if_sid>18114</if_sid>
+ <id>^637$|^4733$</id>
+ <description>Security Enabled Local Group Member Removed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=637</info>
+ </rule>
+
+ <rule id="18209" level="5">
+ <if_sid>18201</if_sid>
+ <id>^638$|^4734$</id>
+ <description>Security Enabled Local Group Deleted</description>
+ <group>group_deleted,win_group_deleted,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=638</info>
+ </rule>
+
+ <rule id="18210" level="5">
+ <if_sid>18114</if_sid>
+ <id>^639$|^4735$</id>
+ <description>Security Enabled Local Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=639</info>
+ </rule>
+
+ <rule id="18211" level="5">
+ <if_sid>18114</if_sid>
+ <id>^641$|^4737$</id>
+ <description>Security Enabled Global Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=641</info>
+ </rule>
+
+ <rule id="18212" level="5">
+ <if_sid>18200</if_sid>
+ <id>^658$|^4754$</id>
+ <description>Security Enabled Universal Group Created</description>
+ <group>group_created,win_group_created,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=658</info>
+ </rule>
+
+ <rule id="18213" level="5">
+ <if_sid>18114</if_sid>
+ <id>^659$|^4755$</id>
+ <description>Security Enabled Universal Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=659</info>
+ </rule>
+
+ <rule id="18214" level="5">
+ <if_sid>18114</if_sid>
+ <id>^660$|^4756$</id>
+ <description>Security Enabled Universal Group Member Added</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=660</info>
+ </rule>
+
+ <rule id="18215" level="5">
+ <if_sid>18114</if_sid>
+ <id>^661$|^4757$</id>
+ <description>Security Enabled Universal Group Member Removed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=661</info>
+ </rule>
+
+ <rule id="18216" level="5">
+ <if_sid>18201</if_sid>
+ <id>^662$|^4758$</id>
+ <description>Security Enabled Universal Group Deleted</description>
+ <group>group_deleted,win_group_deleted,</group>
+ <info>http://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=662</info>
+ </rule>
+
+ <rule id="18217" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+\p*S-1-5-32-544\p*</regex>
+ <description>Administrators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18218" level="5">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-1-0}</regex>
+ <description>Everyone Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18219" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-9}</regex>
+ <description>Enterprise Domain Controllers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18220" level="5">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-11}</regex>
+ <description>Authenticated Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18221" level="5">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-13}</regex>
+ <description>Terminal Server Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18222" level="12">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-512}</regex>
+ <description>Domain Admins Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18223" level="5">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-513}</regex>
+ <description>Domain Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18224" level="0">
+ <if_sid>18223,18203</if_sid>
+ <match>Target Account Name: None</match>
+ <description>Local User Group NONE</description>
+ <info>Bogus group user added to upon creation</info>
+ </rule>
+
+ <rule id="18225" level="12">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-514}</regex>
+ <description>Domain Guests Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18226" level="5">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-515}</regex>
+ <description>Domain Computers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18227" level="12">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-516}</regex>
+ <description>Domain Controllers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18228" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-517}</regex>
+ <description>Cert Publishers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18229" level="12">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\.+-518}</regex>
+ <description>Schema Admins Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18230" level="12">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-519}</regex>
+ <description>Enterprise Admins Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18231" level="10">
+ <if_sid>18203,18204</if_sid>
+ <regex> ID:\s+%{S-1-5-21\S+-520}</regex>
+ <description>Group Policy Creator Owners Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18232" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex>\w* ID:\s+%{S-1-5-21\S+-553}</regex>
+ <description>RAS and IAS Servers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18233" level="5">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-545}</regex>
+ <description>Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18234" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-546}</regex>
+ <description>Guests Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18235" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-547}</regex>
+ <description>Power Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18236" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-548}</regex>
+ <description>Account Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18237" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-549}</regex>
+ <description>Server Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18238" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex>\w* ID:\s+%{S-1-5-32-550}</regex>
+ <description>Print Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18239" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-551}</regex>
+ <description>Backup Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18240" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-552}</regex>
+ <description>Replicators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18241" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-554}</regex>
+ <description>Pre-Windows 2000 Compatible Access Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18242" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-555}</regex>
+ <description>Remote Desktop Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18243" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-556}</regex>
+ <description>Network Configuration Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18244" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-557}</regex>
+ <description>Incoming Forest Trust Builders Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18245" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-558}</regex>
+ <description>Performance Monitor Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18246" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-559}</regex>
+ <description>Performance Log Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18247" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-560}</regex>
+ <description>Windows Authorization Access Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18248" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-561}</regex>
+ <description>Terminal Server License Servers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18249" level="8">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-562}</regex>
+ <description>Distributed COM Users Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18250" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-\s*21\.+\s*-498}</regex>
+ <description>Enterprise Read-only Domain Controllers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18251" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-\s*21\.+\s*-529}</regex>
+ <description>Read-only Domain Controllers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18252" level="12">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-569}</regex>
+ <description>Cryptographic Operators Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18253" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-\s*21\.+\s*-571}</regex>
+ <description>Allowed RODC Password Replication Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18254" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-\s*21\.+\s*-572}</regex>
+ <description>Denied RODC Password Replication Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18255" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-573}</regex>
+ <description>Event Log Readers Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
+
+ <rule id="18256" level="10">
+ <if_sid>18207,18208</if_sid>
+ <regex> ID:\s+%{S-1-5-32-574}</regex>
+ <description>Certificate Service DCOM Access Group Changed</description>
+ <group>group_changed,win_group_changed,</group>
+ <info>http://support.microsoft.com/kb/243330</info>
+ </rule>
<!-- Ignore Login events, type 5, from Advapi for:
- LOCAL SERVICE and NETWORK SERVICE.
<match>Failure Code: 0x1F</match>
<description>Windows DC integrity check on decrypted </description>
<description>field failed.</description>
- <info>http://www.ultimatewindowssecurity.com/kerberrors.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/kerberrors.html</info>
<group>win_authentication_failed,attacks,</group>
</rule>
<if_sid>18139</if_sid>
<match>Failure Code: 0x22</match>
<description>Windows DC - Possible replay attack.</description>
- <info>http://www.ultimatewindowssecurity.com/kerberrors.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/kerberrors.html</info>
<group>win_authentication_failed,attacks,</group>
</rule>
<if_sid>18139</if_sid>
<match>Failure Code: 0x25</match>
<description>Windows DC - Clock skew too great.</description>
- <info>http://www.ultimatewindowssecurity.com/kerberrors.html</info>
+ <info type="link">http://www.ultimatewindowssecurity.com/kerberrors.html</info>
<group>win_authentication_failed,attacks,</group>
</rule>
-<!-- @(#) $Id: mysql_rules.xml,v 1.3 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official MySQL rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: named_rules.xml,v 1.21 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Example of Named rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<match>denied update from|unapproved update from</match>
<description>DNS update denied. </description>
<description>Generally mis-configuration.</description>
- <info>http://seclists.org/lists/incidents/2000/May/0217.html</info>
+ <info type="link">http://seclists.org/incidents/2000/May/217</info>
<group>client_misconfig,</group>
</rule>
<if_sid>12100</if_sid>
<regex>update \S+ denied</regex>
<description>DNS update using RFC2136 Dynamic protocol.</description>
- <info>http://www.isc.org/index.pl?/sw/bind/FAQ.php</info>
+ <!-- <info>http://www.isc.org/index.pl?/sw/bind/FAQ.php</info> dead link, and don't know what the issue is with this -->
</rule>
<rule id="12108" level="4">
<if_sid>12100</if_sid>
<match>query (cache) denied</match>
<description>Query cache denied (maybe config error).</description>
- <info>http://www.reedmedia.net/misc/dns/errors.html</info>
+ <info type="link">http://www.reedmedia.net/misc/dns/errors.html</info>
</rule>
<rule id="12109" level="12">
-<!-- @(#) $Id: netscreenfw_rules.xml,v 1.14 2009/07/31 18:06:10 dcid Exp $
+<!-- @(#) $Id$
- Official Netscreen Firewall rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: nginx_rules.xml,v 1.2 2009/09/16 18:27:56 dcid Exp $
+<!-- @(#) $Id$
- Official Nginx rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: ossec_rules.xml,v 1.23 2009/11/04 18:45:37 dcid Exp $
+<!-- @(#) $Id$
- Official ossec rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: pam_rules.xml,v 1.10 2009/11/04 20:09:22 dcid Exp $
+<!-- @(#) $Id$
- Official Unix Pam rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<rule id="5522" level="0">
<if_sid>5502</if_sid>
<program_name>^CRON$</program_name>
- <match>^pam_unix(cron:session): session closed for user root$</match>
+ <match>^pam_unix(cron:session): session closed for user </match>
<description>Ignoring Annoying Ubuntu/debian cron login events.</description>
</rule>
-<!-- @(#) $Id: php_rules.xml,v 1.1 2009/09/16 18:27:56 dcid Exp $
+<!-- @(#) $Id$
- Official PHP rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: pix_rules.xml,v 1.22 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official PIX rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: policy_rules.xml,v 1.8 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Policy rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: postfix_rules.xml,v 1.17 2008/04/21 17:32:11 dcid Exp $
+<!-- @(#) $Id$
- Official postfix rules for OSSEC.
- Author: Ahmet Ozturk
- Author: Daniel B. Cid
<description>Postfix insufficient disk space error.</description>
<group>service_availability,</group>
</rule>
-
+
+ <rule id="3334" level="3">
+ <if_sid>3320</if_sid>
+ <match>^daemon started </match>
+ <description>Postfix started.</description>
+ </rule>
+
+ <rule id="3333" level="7">
+ <if_sid>3320</if_sid>
+ <match>^terminating on signal</match>
+ <description>Postfix stopped.</description>
+ <group>service_availability,</group>
+ </rule>
+
<rule id="3351" level="6" frequency="$POSTFIX_FREQ" timeframe="90">
<if_matched_sid>3301</if_matched_sid>
<same_source_ip />
-<!-- @(#) $Id: postgresql_rules.xml,v 1.5 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official PostgreSQL rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: proftpd_rules.xml,v 1.17 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Proftpd rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<match>Refused PORT </match>
<description>Attempt to bypass firewall that can't adequately</description>
<description> keep state of FTP traffic.</description>
- <info>http://www.kb.cert.org/vuls/id/328867</info>
+ <info type="link">http://www.kb.cert.org/vuls/id/328867</info>
+ <info type="text">US-Cert Note VU#328867: Multiple vendors' firewalls do not adequately keep state of FTP traffic</info>
</rule>
<rule id="11210" level="10">
-<!-- @(#) $Id: pure-ftpd_rules.xml,v 1.9 2007/01/03 02:35:48 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: racoon_rules.xml,v 1.4 2007/01/07 23:52:10 dcid Exp $
+<!-- @(#) $Id$
- Racoon VPN rules for OSSEC HIDS.
- Author: Daniel B. Cid
- License: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: roundcube_rules.xml,v 1.1 2009/07/31 18:06:10 dcid Exp $
+<!-- @(#) $Id$
- Official Roundcube rules for OSSEC.
-
- Author: Michael Starks
-<!-- @(#) $Id: rules_config.xml,v 1.15 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Rules config.
- Configuration options. This file must always be included, otherwise
- most of the rules will not work properly.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: sendmail_rules.xml,v 1.15 2008/07/25 15:40:14 dcid Exp $
+<!-- @(#) $Id$
- Official sendmail rules for OSSEC.
- Author: Ahmet Ozturk
- Author: Daniel B. Cid
-<!-- @(#) $Id: smbd_rules.xml,v 1.10 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official SMB rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<group name="syslog,smbd,">
<rule id="13100" level="0" noalert="1">
- <match>^smbd</match>
+ <decoded_as>smbd</decoded_as>
<description>Grouping for the smbd rules.</description>
</rule>
-<!-- @(#) $Id: solaris_bsm_rules.xml,v 1.3 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Solaris BSM Auditing rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: sonicwall_rules.xml,v 1.3 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official SonicWall rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: spamd_rules.xml,v 1.8 2007/01/03 02:35:48 dcid Exp $
+<!-- @(#) $Id$
- Spamd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: squid_rules.xml,v 1.38 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Squid rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<url>blst.php|xxx3.php|ngr7.php|ngr2.php|/nul.php$|/mul.php$|/444.php</url>
<description>Attempt to access a Beagle worm (or variant) </description>
<description>file.</description>
- <info>http://www.symantec.com/avcenter/venc/data/w32.beagle.dp.html</info>
+ <info type="link">http://www.symantec.com/avcenter/venc/data/w32.beagle.dp.html</info>
+ <info type="text">W32.Beagle.DP is a Worm that drops Trojan.Lodear and opens a back door on the compromised computer.</info>
<group>automatic_attack,</group>
</rule>
<if_matched_sid>35021</if_matched_sid>
<same_source_ip />
<description>Infected machine with W32.Beagle.DP.</description>
- <info>http://www.symantec.com/avcenter/venc/data/w32.beagle.dp.html</info>
+ <info type="link">http://www.symantec.com/avcenter/venc/data/w32.beagle.dp.html</info>
+ <info type="text">W32.Beagle.DP is a Worm that drops Trojan.Lodear and opens a back door on the compromised computer.</info>
</rule>
<rule id="35055" level="10" frequency="$SQUID_FREQ" timeframe="90">
-<!-- @(#) $Id: sshd_rules.xml,v 1.22 2009/11/09 20:18:52 dcid Exp $
+<!-- @(#) $Id$
- Official SSHD rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<rule id="5709" level="0">
<if_sid>5700</if_sid>
<match>error: Could not get shadow information for NOUSER|</match>
- <match>fatal: Read from socket failed: |error: ssh_msg_send: write</match>
+ <match>fatal: Read from socket failed: |error: ssh_msg_send: write|</match>
+ <match>^syslogin_perform_logout: </match>
<description>Useless SSHD message without an user/ip and context.</description>
</rule>
<if_matched_sid>5713</if_matched_sid>
<match>Local: crc32 compensation attack</match>
<description>SSH CRC-32 Compensation attack</description>
- <cve>2001-0144</cve>
- <info>http://www.securityfocus.com/bid/2347/info/</info>
+ <info type="cve">2001-0144</info>
+ <info type="link">http://www.securityfocus.com/bid/2347/info/</info>
<group>exploit_attempt,</group>
</rule>
-<!-- @(#) $Id: symantec-av_rules.xml,v 1.6 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Symantec AV rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: symantec-ws_rules.xml,v 1.3 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official Symantec Web Security rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: syslog_rules.xml,v 1.87 2009/12/01 15:40:07 dcid Exp $
+<!-- @(#) $Id$
- Official Generic Syslog rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<description>File system full.</description>
<group>low_diskspace,</group>
</rule>
+
+ <rule id="1008" level="5">
+ <match>killed by SIGTERM</match>
+ <description>Process exiting (killed).</description>
+ <group>service_availability,</group>
+ </rule>
</group> <!-- SYSLOG,ERRORS -->
+<!-- rshd -->
+<group name="syslog,access_control,">
+ <rule id="2550" level="0" noalert="1">
+ <decoded_as>rshd</decoded_as>
+ <description>rshd messages grouped.</description>
+ </rule>
+
+ <rule id="2551" level="10">
+ <if_sid>2550</if_sid>
+ <regex>^Connection from \S+ on illegal port$</regex>
+ <description>Connection to rshd from unprivileged port. Possible network scan.</description>
+ <group>connection_attempt,</group>
+ </rule>
+</group>
+
+
+
<!-- Mail/Procmail messages -->
<group name="syslog,mail,">
<rule id="2701" level="0">
<if_sid>9100</if_sid>
<regex>^GRE: \S+ from \S+ failed: status = -1 </regex>
<description>PPTPD failed message (communication error)</description>
- <info>poptop.sourceforge.net/dox/gre-protocol-unavailable.phtml</info>
+ <info type="link">http://poptop.sourceforge.net/dox/gre-protocol-unavailable.phtml</info>
</rule>
<rule id="9102" level="0">
-<!-- @(#) $Id: telnetd_rules.xml,v 1.4 2007/01/03 02:35:48 dcid Exp $
+<!-- @(#) $Id$
- Telnetd rules for OSSEC.
- Author: Ahmet Ozturk
- License: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: pure-ftpd_rules_da.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_de.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_en.xml,v 1.1 2008/04/14 18:30:06 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_es.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_fr.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_fr_funny.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_it.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_nl.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_no.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_pt_br.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_ro.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_sk.xml,v 1.1 2008/04/10 18:47:41 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_sv.xml,v 1.1 2008/04/10 18:47:42 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: pure-ftpd_rules_tr.xml,v 1.1 2008/04/10 18:47:42 dcid Exp $
+<!-- @(#) $Id$
- Official pure-ftpd rules for OSSEC.
- Author: Peter Ahlert <peter@ifup.de>
- Author: Daniel B. Cid
-<!-- @(#) $Id: trend-osce_rules.xml,v 1.2 2009/08/18 18:16:27 dcid Exp $
+<!-- @(#) $Id$
- Official Trend Micro OSCE (Office Scan) rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: vmpop3d_rules.xml,v 1.1 2008/07/25 15:40:14 dcid Exp $
+<!-- @(#) $Id$
- Official rules for vm-pop3d.
-
- License: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: vmware_rules.xml,v 1.2 2009/06/24 17:06:19 dcid Exp $
+<!-- @(#) $Id$
- Official VMWare ESX rules for OSSEC.
-
- Copyright (C) 2009 Trend Micro Inc.
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: vpn_concentrator_rules.xml,v 1.4 2009/06/24 17:06:20 dcid Exp $
+<!-- @(#) $Id$
-
- Official Cisco VPN Concentrator rules for OSSEC.
-
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
-<!-- @(#) $Id: vpopmail_rules.xml,v 1.4 2009/07/23 14:10:44 dcid Exp $
+<!-- @(#) $Id$
- Official rules for vpopmail.
-
- Author: Ceg Ryan <cegryan ( at ) gmail.com>
-<!-- @(#) $Id: vsftpd_rules.xml,v 1.5 2007/01/03 02:35:49 dcid Exp $
+<!-- @(#) $Id$
- Official vsftpd rules for OSSEC.
- Author: Joachim Vorrath <joachim.vorrath@vorrath-net.de>
- Author: Jorge Augusto Senger <jorge@br10.com.br>
-<!-- @(#) $Id: web_rules.xml,v 1.25 2009/09/25 14:35:20 dcid Exp $
+<!-- @(#) $Id$
-
- Official Web access rules for OSSEC.
-
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<description>Access log messages grouped.</description>
</rule>
+ <rule id="31108" level="0">
+ <if_sid>31100</if_sid>
+ <id>^2|^3</id>
+ <compiled_rule>is_simple_http_request</compiled_rule>
+ <description>Ignored URLs (simple queries).</description>
+ </rule>
+
<rule id="31101" level="5">
<if_sid>31100</if_sid>
<id>^4</id>
<rule id="31102" level="0">
<if_sid>31101</if_sid>
- <id>^403|^404</id>
- <url>.jpg$|.gif$|favicon.ico$|.png$|robots.txt$|.css$</url>
-
- <!-- Add any other url to be ignored in here
- (to avoid too many false positives from your site)
- <url>|.html$|.jpe$</url>
- -->
-
+ <url>.jpg$|.gif$|favicon.ico$|.png$|robots.txt$|.css$|.js$</url>
+ <compiled_rule>is_simple_http_request</compiled_rule>
<description>Ignored extensions on 400 error codes.</description>
</rule>
<!-- Attempt to do directory transversal, simple sql injections,
- or access to the etc or bin directory (unix). -->
- <url>%027|%00|%01|%7f|%2E%2E|%0A|%0D|../..|..\..|echo;|..</url>
+ <url>%027|%00|%01|%7f|%2E%2E|%0A|%0D|../..|..\..|echo;|..|</url>
<url>cmd.exe|root.exe|_mem_bin|msadc|/winnt/|</url>
- <url>/x90/|default.ida|/sumthin|nsiislog.dll|chmod%|wget%|cd%|</url>
- <url>cat%|exec%|rm%20</url>
+ <url>/x90/|default.ida|/sumthin|nsiislog.dll|chmod%|wget%|cd%20|</url>
+ <url>cat%20|exec%20|rm%20</url>
<description>Common web attack.</description>
<group>attack,</group>
</rule>
<rule id="31105" level="6">
<if_sid>31100</if_sid>
- <url>%3Cscript|%2Fscript|script>|script%3E|SRC=javascript|IMG%20|</url>
+ <url>%3Cscript|%3C%2Fscript|script>|script%3E|SRC=javascript|IMG%20|</url>
<url>%20ONLOAD=|INPUT%20|iframe%20</url>
<description>XSS (Cross Site Scripting) attempt.</description>
<group>attack,</group>
</rule>
- <rule id="31106" level="12">
+ <rule id="31106" level="6">
<if_sid>31103, 31104, 31105</if_sid>
<id>^200</id>
<description>A web attack returned code 200 (success).</description>
-->
<rule id="31107" level="0">
<if_sid>31103, 31104, 31105</if_sid>
- <url>^/search.php?search=|^index.php?searchword=</url>
+ <url>^/search.php?search=|^/index.php?searchword=</url>
<description>Ignored URLs for the web attacks</description>
</rule>
<options>alert_by_email</options>
<description>Web server 503 error code (Service unavailable).</description>
</rule>
+
+
+ <!-- Rules to ignore crawlers -->
+ <rule id="31140" level="0">
+ <if_sid>31101</if_sid>
+ <compiled_rule>is_valid_crawler</compiled_rule>
+ <description>Ignoring google/msn/yahoo bots.</description>
+ </rule>
+
<rule id="31151" level="10" frequency="10" timeframe="120">
<if_matched_sid>31101</if_matched_sid>
-<!-- @(#) $Id: wordpress_rules.xml,v 1.4 2009/11/30 17:41:52 dcid Exp $
+<!-- @(#) $Id$
- Official Wordpress rules for OSSEC.
-
- Author: Daniel B. Cid
-<!-- @(#) $Id: zeus_rules.xml,v 1.7 2009/06/24 17:06:20 dcid Exp $
+<!-- @(#) $Id$
-
- Official Zeus rules for OSSEC.
-
-
- This program is a free software; you can redistribute it
- and/or modify it under the terms of the GNU General Public
- - License (version 3) as published by the FSF - Free Software
+ - License (version 2) as published by the FSF - Free Software
- Foundation.
-
- License details: http://www.ossec.net/en/licensing.html
<include>hordeimp_rules.xml</include>
<include>roundcube_rules.xml</include>
<include>wordpress_rules.xml</include>
+ <include>cimserver_rules.xml</include>
<include>vpopmail_rules.xml</include>
<include>vmpop3d_rules.xml</include>
<include>courier_rules.xml</include>
<include>msauth_rules.xml</include>
<include>mcafee_av_rules.xml</include>
<include>trend-osce_rules.xml</include>
+ <include>ms-se_rules.xml</include>
<!-- <include>policy_rules.xml</include> -->
<include>zeus_rules.xml</include>
<include>solaris_bsm_rules.xml</include>
echo "DIR=\"${INSTALLDIR}\"" > ${LOCATION}
echo "CC=${CC}" >> ${LOCATION}
+ echo "GCC=${CC}" >> ${LOCATION}
+ echo "CLANG=clang" >> ${LOCATION}
# Changing Config.OS with the new C flags
# Checking if debug is enabled
OS_CONFIG = ${PT}config/lib_config.a
OS_ZLIB = ${PT}os_zlib/os_zlib.c ${PT}external/libz.a
OS_LINK = ${IEXTRA}
+DBS = cdb/cdb.a
DIR=`grep DIR ${LOCATION} | cut -f2 -d\"`
GROUP="ossec"
USER="ossec"
-subdirs="logs bin queue queue/ossec queue/alerts queue/syscheck queue/rids var var/run etc etc/shared active-response active-response/bin agentless .ssh"
+subdirs="logs bin queue queue/ossec queue/alerts queue/syscheck queue/rids queue/diff var var/run etc etc/shared active-response active-response/bin agentless .ssh"
# ${DIR} must be set
chown ${USER}:${GROUP} ${DIR}/logs/ossec.log
chmod 664 ${DIR}/logs/ossec.log
+chown -R ${USER}:${GROUP} ${DIR}/queue/diff
+chmod -R 750 ${DIR}/queue/diff
+chmod 740 ${DIR}/queue/diff/* > /dev/null 2>&1
+
+
# For the etc dir
cp -pr ../bin/ossec* ${DIR}/bin/
cp -pr ../bin/manage_agents ${DIR}/bin/
cp -pr ../bin/syscheck_update ${DIR}/bin/
+cp -pr ../bin/verify-agent-conf ${DIR}/bin/
cp -pr ../bin/clear_stats ${DIR}/bin/
cp -pr ../bin/list_agents ${DIR}/bin/
cp -pr ../bin/agent_control ${DIR}/bin/
DIR="/var/ossec"
CC=gcc
+GCC=gcc
+CLANG=clang
@echo "\"make clean\" to clean anything built."
@echo "\"make setagent\" to set agent install."
@echo "\"make setlocal\" to set local install."
+ @echo "\"make setclang\" to use clang for building ossec."
+ @echo "\"make unsetclang\" to use gcc for building ossec."
@echo "\"make setprelude\" to enable prelude output."
@echo "\"make setdb\" to enable database support."
@echo "\"make unsetdb\" to disable database support."
+ @echo "\"make setoneway\" to enable one-way connection to the manager."
clean:
@/bin/sh ./Makeall clean
setagent:
@echo "CEXTRA=-DCLIENT" >> ./Config.OS
+setclang:
+ @sed -i '' -e "s/^CC=.*/CC=clang/g" LOCATION
+
+unsetclang:
+ @sed -i '' -e "s/^CC=.*/CC=gcc/g" LOCATION
+
setprelude:
@echo "CPRELUDE=-DPRELUDE -lprelude `libprelude-config --pthread-cflags` `libprelude-config --libs`" >> ./Config.OS
setfullsubject:
@echo "FEXTRA=-DCLEANFULL" >> ./Config.OS
+setoneway:
+ @echo "FEXTRA=-DONEWAY" >> ./Config.OS
-/* @(#) $Id: b64.c,v 1.2 2006/06/21 00:18:21 dcid Exp $ */
+/* @(#) $Id$ */
/*
* Copyright (C), 2000-2004 by the monit project group.
* All Rights Reserved.
*
* @author Jan-Henrik Haukeland, <hauk@tildeslash.com>
*
- * @version \$Id: b64.c,v 1.2 2006/06/21 00:18:21 dcid Exp $
+ * @version \$Id$
*
* @file
*/
-/* @(#) $Id: main.c,v 1.15 2009/08/05 18:02:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: manage_agents.c,v 1.33 2009/08/19 18:35:57 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: manage_agents.h,v 1.20 2009/08/05 18:02:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: manage_keys.c,v 1.20 2009/08/05 18:02:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: read_from_user.c,v 1.6 2009/06/24 17:06:20 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: validate.c,v 1.19 2009/06/24 17:06:20 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: agentlessd.c,v 1.13 2009/06/24 17:06:20 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
+/* Send generic log message. */
+int send_log_msg(char *script, char *host, char *msg)
+{
+ char sys_location[1024 +1];
+
+ sys_location[1024] = '\0';
+ snprintf(sys_location, 1024, "(%s) %s->%s", script, host, SYSCHECK);
+
+ if(SendMSG(lessdc.queue, msg, sys_location, LOCALFILE_MQ) < 0)
+ {
+ merror(QUEUE_SEND, ARGV0);
+ if((lessdc.queue = StartMQ(DEFAULTQPATH, WRITE)) < 0)
+ {
+ ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH);
+ }
+
+ /* If we reach here, we can try to send it again */
+ SendMSG(lessdc.queue, msg, sys_location, LOCALFILE_MQ);
+ }
+ return(0);
+}
+
+
+
/* Generate diffs alerts. */
int gen_diff_alert(char *host, char *script, int alert_diff_time)
{
send_intcheck_msg(entry->type, entry->server[i]+1,
tmp_str);
}
+ else if(strncmp(buf, "LOG: ", 4) == 0)
+ {
+ tmp_str = buf + 5;
+ send_log_msg(entry->type, entry->server[i]+1,
+ tmp_str);
+ }
else if((entry->state & LESSD_STATE_DIFF) &&
(strncmp(buf, "STORE: ", 7) == 0))
{
-/* @(#) $Id: agentlessd.h,v 1.2 2009/06/24 17:06:21 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: main.c,v 1.3 2009/11/18 19:07:39 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#!/usr/bin/env expect
-# @(#) $Id: main.exp,v 1.5 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/bin/sh
-# @(#) $Id: register_host.sh,v 1.5 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh.exp,v 1.4 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_asa-fwsmconfig_diff,v 1.2 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_foundry_diff,v 1.2 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_generic_diff,v 1.10 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_integrity_check_bsd,v 1.10 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_integrity_check_linux,v 1.11 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: ssh_nopass.exp,v 1.3 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
expect {
#!/usr/bin/env expect
-# @(#) $Id: ssh_pixconfig_diff,v 1.6 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: sshlogin.exp,v 1.5 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#!/usr/bin/env expect
-# @(#) $Id: su.exp,v 1.5 2009/06/24 17:06:21 dcid Exp $
+# @(#) $Id$
# Agentless monitoring
#
# Copyright (C) 2009 Trend Micro Inc.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
include ../Config.Make
-LOCAL= analysisd.c stats.c rules.c rules_list.c config.c fts.c eventinfo.c eventinfo_list.c cleanevent.c active-response.c picviz.c prelude.c compiled_rules/*.o ${OS_CONFIG}
+OTHER = stats.c lists.c lists_list.c rules.c rules_list.c config.c fts.c dodiff.c eventinfo.c eventinfo_list.c cleanevent.c active-response.c picviz.c prelude.c compiled_rules/*.o ${OS_CONFIG}
+LOCAL = analysisd.c ${OTHER}
PLUGINS = decoders/decoders.a
ALERTS = alerts/alerts.a
+DBS = cdb/cdb.a cdb/cdb_make.a
-loga_OBJS = ${LOCAL} ${PLUGINS} ${ALERTS} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_SHARED} ${OS_ZLIB} ${CPRELUDE}
+loga_OBJS = ${LOCAL} ${PLUGINS} ${DBS} ${ALERTS} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_SHARED} ${OS_ZLIB} ${CPRELUDE}
+lists_OBJS = lists_make.c ${OTHER} ${PLUGINS} ${DBS} ${ALERTS} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_SHARED} ${OS_ZLIB} ${CPRELUDE}
+all: logaudit logtest makelists
logaudit:
+ cd ./cdb; make
cd ./alerts; make
cd ./decoders; make
cd ./compiled_rules; make;
$(CC) $(CFLAGS) ${OS_LINK} -I./ ${loga_OBJS} -o ${NAME}
- make logtest
logtest:
+ cd ./cdb; make
cd ./decoders; make logtest
cd ./compiled_rules; make;
$(CC) $(CFLAGS) ${OS_LINK} -DTESTRULE -I./ testrule.c ${loga_OBJS} -o ossec-logtest
+makelists:
+ cd ./cdb; make
+ $(CC) $(CFLAGS) ${OS_LINK} -DTESTRULE -I./ makelists.c ${lists_OBJS} -o ossec-makelists
+
clean:
+ cd ./cdb; make clean
cd ./alerts; make clean
cd ./decoders; make clean
cd ./compiled_rules; make clean
build:
${BUILD}
cp -pr ossec-logtest ${PT}../bin
+ cp -pr ossec-makelists ${PT}../bin
-/* @(#) $Id: active-response.c,v 1.26 2009/06/24 17:06:21 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: active-response.h,v 1.13 2009/06/24 17:06:21 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: alerts.h,v 1.6 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: exec.c,v 1.39 2009/11/20 15:38:28 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: exec.h,v 1.7 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: getloglocation.c,v 1.14 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: getloglocation.h,v 1.10 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: log.c,v 1.33 2009/11/20 15:38:28 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
}
+
+void OS_LogOutput(Eventinfo *lf)
+{
+ printf(
+ "** Alert %d.%ld:%s - %s\n"
+ "%d %s %02d %s %s%s%s\nRule: %d (level %d) -> '%s'\n"
+ "Src IP: %s\nUser: %s\n%.1256s\n",
+ lf->time,
+ __crt_ftell,
+ lf->generated_rule->alert_opts & DO_MAILALERT?" mail ":"",
+ lf->generated_rule->group,
+ lf->year,
+ lf->mon,
+ lf->day,
+ lf->hour,
+ lf->hostname != lf->location?lf->hostname:"",
+ lf->hostname != lf->location?"->":"",
+ lf->location,
+ lf->generated_rule->sigid,
+ lf->generated_rule->level,
+ lf->generated_rule->comment,
+ lf->srcip == NULL?"(none)":lf->srcip,
+ lf->dstuser == NULL?"(none)":lf->dstuser,
+ lf->full_log);
+
+
+ /* Printing the last events if present */
+ if(lf->generated_rule->last_events)
+ {
+ char **lasts = lf->generated_rule->last_events;
+ while(*lasts)
+ {
+ printf("%.1256s\n",*lasts);
+ lasts++;
+ }
+ lf->generated_rule->last_events[0] = NULL;
+ }
+
+ printf("\n");
+
+ fflush(stdout);
+ return;
+}
+
+
+
/* OS_Log: v0.3, 2006/03/04 */
/* _writefile: v0.2, 2005/02/09 */
void OS_Log(Eventinfo *lf)
-/* @(#) $Id: log.h,v 1.8 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#define FWDROP "drop"
#define FWALLOW "accept"
+void OS_LogOutput(Eventinfo *lf);
void OS_Log(Eventinfo *lf);
void OS_Store(Eventinfo *lf);
int FW_Log(Eventinfo *lf);
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: analysisd.c,v 1.149 2009/11/20 16:11:46 dcid Exp $ */
+/* @(#) $Id$ */
-/* Copyright (C) 2009 Trend Micro Inc.
+/* Copyright (C) 2010 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#include "config.h"
#include "rules.h"
#include "stats.h"
+
#include "eventinfo.h"
#include "analysisd.h"
/* For rules */
void Rules_OP_CreateRules();
+void Lists_OP_CreateLists();
int Rules_OP_ReadRules(char * cfgfile);
int _setlevels(RuleNode *node, int nnode);
int AddHash_Rule(RuleNode *node);
int FTS(Eventinfo *lf);
int AddtoIGnore(Eventinfo *lf);
int IGnore(Eventinfo *lf);
+int doDiff(RuleInfo *currently_rule, Eventinfo *lf);
/* For decoders */
OS_PicvizOpen(Config.picviz_socket);
chown(Config.picviz_socket, uid, gid);
}
-
-
+
/* Setting the group */
if(Privsep_SetGroup(gid) < 0)
ErrorExit(SETGID_ERROR,ARGV0,group);
- /* Initializing the list */
- OS_CreateOSDecoderList();
-
-
- /* Reading decoders */
- if(!ReadDecodeXML(XML_DECODER))
+ /*
+ * Anonymous Section: Load rules, decoders, and lists
+ *
+ * As lists require two pass loading of rules that make use of list lookups
+ * are created with blank database structs, and need to be filled in after
+ * completion of all rules and lists.
+ */
{
- ErrorExit(CONFIG_ERROR, ARGV0, XML_DECODER);
- }
+ {
+ /* Initializing the decoders list */
+ OS_CreateOSDecoderList();
- /* Reading local ones. */
- c = ReadDecodeXML(XML_LDECODER);
- if(!c)
- {
- if((c != -2))
- ErrorExit(CONFIG_ERROR, ARGV0, XML_LDECODER);
- }
- else
- {
- if(!test_config)
- verbose("%s: INFO: Reading local decoder file.", ARGV0);
- }
- SetDecodeXML();
+ if(!Config.decoders)
+ { /* Legacy loading */
+ /* Reading decoders */
+ if(!ReadDecodeXML(XML_DECODER))
+ {
+ ErrorExit(CONFIG_ERROR, ARGV0, XML_DECODER);
+ }
-
- /* Creating the rules list */
- Rules_OP_CreateRules();
+ /* Reading local ones. */
+ c = ReadDecodeXML(XML_LDECODER);
+ if(!c)
+ {
+ if((c != -2))
+ ErrorExit(CONFIG_ERROR, ARGV0, XML_LDECODER);
+ }
+ else
+ {
+ if(!test_config)
+ verbose("%s: INFO: Reading local decoder file.", ARGV0);
+ }
+ }
+ else
+ { /* New loaded based on file speified in ossec.conf */
+ char **decodersfiles;
+ decodersfiles = Config.decoders;
+ while( decodersfiles && *decodersfiles)
+ {
+ if(!test_config)
+ verbose("%s: INFO: Reading decoder file %s.", ARGV0, *decodersfiles);
+ if(!ReadDecodeXML(*decodersfiles))
+ ErrorExit(CONFIG_ERROR, ARGV0, *decodersfiles);
+
+ free(*decodersfiles);
+ decodersfiles++;
+ }
+ }
-
- /* Reading the rules */
- {
- char **rulesfiles;
- rulesfiles = Config.includes;
- while(rulesfiles && *rulesfiles)
- {
- if(!test_config)
- verbose("%s: INFO: Reading rules file: '%s'", ARGV0, *rulesfiles);
- if(Rules_OP_ReadRules(*rulesfiles) < 0)
- ErrorExit(RULES_ERROR, ARGV0, *rulesfiles);
-
- free(*rulesfiles);
- rulesfiles++;
+ /* Load decoders */
+ SetDecodeXML();
}
+ { /* Load Lists */
+ /* Initializing the lists of list struct */
+ Lists_OP_CreateLists();
+ /* Load each list into list struct */
+ {
+ char **listfiles;
+ listfiles = Config.lists;
+ while(listfiles && *listfiles)
+ {
+ if(!test_config)
+ verbose("%s: INFO: Reading loading the lists file: '%s'", ARGV0, *listfiles);
+ if(Lists_OP_LoadList(*listfiles) < 0)
+ ErrorExit(LISTS_ERROR, ARGV0, *listfiles);
+ free(*listfiles);
+ listfiles++;
+ }
+ free(Config.lists);
+ Config.lists = NULL;
+ }
+ }
+ { /* Load Rules */
+ /* Creating the rules list */
+ Rules_OP_CreateRules();
- free(Config.includes);
- Config.includes = NULL;
+ /* Reading the rules */
+ {
+ char **rulesfiles;
+ rulesfiles = Config.includes;
+ while(rulesfiles && *rulesfiles)
+ {
+ if(!test_config)
+ verbose("%s: INFO: Reading rules file: '%s'", ARGV0, *rulesfiles);
+ if(Rules_OP_ReadRules(*rulesfiles) < 0)
+ ErrorExit(RULES_ERROR, ARGV0, *rulesfiles);
+
+ free(*rulesfiles);
+ rulesfiles++;
+ }
+
+ free(Config.includes);
+ Config.includes = NULL;
+ }
+
+ /* Find all rules with that require list lookups and attache the
+ * the correct list struct to the rule. This keeps rules from having to
+ * search thought the list of lists for the correct file during rule evaluation.
+ */
+ OS_ListLoadRules();
+ }
}
-
+
/* Fixing the levels/accuracy */
{
#ifdef TESTRULE
- if(full_output)
+ if(full_output && !alert_only)
print_out(" Trying rule: %d - %s", currently_rule->sigid,
currently_rule->comment);
#endif
}
-
/* Checking program name */
if(currently_rule->program_name)
{
strlen(lf->id),
currently_rule->id))
return(NULL);
+ #ifdef CDBLOOKUP
+
+ #endif
}
{
return(NULL);
}
+ #ifdef CDBLOOKUP
+
+ #endif
}
{
return(NULL);
}
+ #ifdef CDBLOOKUP
+
+ #endif
}
/* Checking for the dstip */
{
return(NULL);
}
+ #ifdef CDBLOOKUP
+
+ #endif
}
if(currently_rule->srcport)
{
return(NULL);
}
+ #ifdef CDBLOOKUP
+
+ #endif
}
if(currently_rule->dstport)
{
{
return(NULL);
}
+ #ifdef CDBLOOKUP
+
+ #endif
}
} /* END PACKET_INFO */
return(NULL);
}
else
+ #ifdef CDBLOOKUP
+
+ #endif
{
/* no user set */
return(NULL);
currently_rule->status))
return(NULL);
}
+
+
+ /* Do diff check. */
+ if(currently_rule->context_opts & SAME_DODIFF)
+ {
+ if(!doDiff(currently_rule, lf))
+ {
+ return(NULL);
+ }
+ }
}
-
/* Checking for the FTS flag */
if(currently_rule->alert_opts & DO_FTS)
{
}
}
+ /* List lookups */
+ if(currently_rule->lists != NULL)
+ {
+ ListRule *list_holder=currently_rule->lists;
+ while(list_holder)
+ {
+ switch(list_holder->field)
+ {
+ case RULE_SRCIP:
+ if(!lf->srcip)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->srcip))
+ return(NULL);
+ break;
+ case RULE_SRCPORT:
+ if(!lf->srcport)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->srcport))
+ return(NULL);
+ break;
+ case RULE_DSTIP:
+ if(!lf->dstip)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->dstip))
+ return(NULL);
+ break;
+ case RULE_DSTPORT:
+ if(!lf->dstport)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->dstport))
+ return(NULL);
+ break;
+ case RULE_USER:
+ if(lf->srcuser)
+ {
+ if(!OS_DBSearch(list_holder,lf->srcuser))
+ return(NULL);
+ }
+ else if(lf->dstuser)
+ {
+ if(!OS_DBSearch(list_holder,lf->dstuser))
+ return(NULL);
+ }
+ else
+ {
+ return(NULL);
+ }
+ break;
+ case RULE_URL:
+ if(!lf->url)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->url))
+ return(NULL);
+ break;
+ case RULE_ID:
+ if(!lf->id)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->id))
+ return(NULL);
+ break;
+ case RULE_HOSTNAME:
+ if(!lf->hostname)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->hostname))
+ return(NULL);
+ break;
+ case RULE_PROGRAM_NAME:
+ if(!lf->program_name)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->program_name))
+ return(NULL);
+ break;
+ case RULE_STATUS:
+ if(!lf->status)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->status))
+ return(NULL);
+ break;
+ case RULE_ACTION:
+ if(!lf->action)
+ return(NULL);
+ if(!OS_DBSearch(list_holder,lf->action))
+ return(NULL);
+ break;
+ default:
+ return(NULL);
+ }
+
+ list_holder = list_holder->next;
+ }
+ }
+
/* If it is a context rule, search for it */
if(currently_rule->context == 1)
}
#ifdef TESTRULE
- if(full_output)
+ if(full_output && !alert_only)
print_out(" *Rule %d matched.", currently_rule->sigid);
#endif
RuleInfo *child_rule = NULL;
#ifdef TESTRULE
- if(full_output)
+ if(full_output && !alert_only)
print_out(" *Trying child rules.");
#endif
/* EOF */
+
-/* @(#) $Id: analysisd.h,v 1.10 2009/06/24 17:06:21 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
int __crt_wday;
-/* For test rule only. */
-#ifdef TESTRULE
-int full_output;
-#endif
time_t c_time; /* Current time of event. Used everywhere */
--- /dev/null
+# Makefile for analysisd alerts
+# Daniel B. Cid <dcid@sourcefire.com>||<daniel.cid@gmail.com>
+# http://www.ossec.net/hids/
+
+PT=../../
+NAME=cdb
+
+include ../../Config.Make
+
+SRCS = cdb.c cdb_hash.c cdb_make.c uint32_pack.c uint32_unpack.c
+OBJS = cdb.o cdb_hash.o cdb_make.o uint32_pack.o uint32_unpack.o
+
+
+response:
+ $(CC) -I../ $(CFLAGS) -c $(SRCS)
+ ar cru cdb.a $(OBJS)
+ ar cru cdb_make.a $(OBJS)
+ ranlib cdb.a
+ ranlib cdb_make.a
+
+clean:
+ ${CLEAN}
--- /dev/null
+/* Public domain. */
+/* Adapted from DJB's original cdb-0.75 package */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include "cdb.h"
+
+#ifndef EPROTO
+#define EPROTO -15 /* cdb 0.75's default for PROTOless systems */
+#endif
+
+void cdb_free(struct cdb *c)
+{
+ if (c->map) {
+ munmap(c->map,c->size);
+ c->map = 0;
+ }
+}
+
+void cdb_findstart(struct cdb *c)
+{
+ c->loop = 0;
+}
+
+void cdb_init(struct cdb *c,int fd)
+{
+ struct stat st;
+ char *x;
+
+ cdb_free(c);
+ cdb_findstart(c);
+ c->fd = fd;
+
+ if (fstat(fd,&st) == 0)
+ if (st.st_size <= 0xffffffff) {
+ x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0);
+ if (x + 1) {
+ c->size = st.st_size;
+ c->map = x;
+ }
+ }
+}
+
+int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos)
+{
+ if (c->map) {
+ if ((pos > c->size) || (c->size - pos < len)) goto FORMAT;
+ memcpy(buf,c->map + pos,len);
+ }
+ else {
+ if (lseek(c->fd,pos,SEEK_SET) == -1) return -1;
+ /* if (seek_set(c->fd,pos) == -1) return -1; */
+ while (len > 0) {
+ int r;
+ do
+ r = read(c->fd,buf,len);
+ while ((r == -1) && (errno == EINTR));
+ if (r == -1) return -1;
+ if (r == 0) goto FORMAT;
+ buf += r;
+ len -= r;
+ }
+ }
+ return 0;
+
+ FORMAT:
+ errno = EPROTO;
+ return -1;
+}
+
+static int match(struct cdb *c,char *key,unsigned int len,uint32 pos)
+{
+ char buf[32];
+ int n;
+
+ while (len > 0) {
+ n = sizeof buf;
+ if (n > len) n = len;
+ if (cdb_read(c,buf,n,pos) == -1) return -1;
+ if (memcmp(buf,key,n)) return 0;
+ pos += n;
+ key += n;
+ len -= n;
+ }
+ return 1;
+}
+
+int cdb_findnext(struct cdb *c,char *key,unsigned int len)
+{
+ char buf[8];
+ uint32 pos;
+ uint32 u;
+
+ if (!c->loop) {
+ u = cdb_hash(key,len);
+ if (cdb_read(c,buf,8,(u << 3) & 2047) == -1) return -1;
+ uint32_unpack(buf + 4,&c->hslots);
+ if (!c->hslots) return 0;
+ uint32_unpack(buf,&c->hpos);
+ c->khash = u;
+ u >>= 8;
+ u %= c->hslots;
+ u <<= 3;
+ c->kpos = c->hpos + u;
+ }
+
+ while (c->loop < c->hslots) {
+ if (cdb_read(c,buf,8,c->kpos) == -1) return -1;
+ uint32_unpack(buf + 4,&pos);
+ if (!pos) return 0;
+ c->loop += 1;
+ c->kpos += 8;
+ if (c->kpos == c->hpos + (c->hslots << 3)) c->kpos = c->hpos;
+ uint32_unpack(buf,&u);
+ if (u == c->khash) {
+ if (cdb_read(c,buf,8,pos) == -1) return -1;
+ uint32_unpack(buf,&u);
+ if (u == len)
+ switch(match(c,key,len,pos + 8)) {
+ case -1:
+ return -1;
+ case 1:
+ uint32_unpack(buf + 4,&c->dlen);
+ c->dpos = pos + 8 + len;
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+int cdb_find(struct cdb *c,char *key,unsigned int len)
+{
+ cdb_findstart(c);
+ return cdb_findnext(c,key,len);
+}
--- /dev/null
+/* Public domain. */
+/* Adapted from DJB's original cdb-0.75 package */
+
+#ifndef CDB_H
+#define CDB_H
+
+#include "uint32.h"
+
+#define CDB_HASHSTART 5381
+extern uint32 cdb_hashadd(uint32,unsigned char);
+extern uint32 cdb_hash(char *,unsigned int);
+
+struct cdb {
+ char *map; /* 0 if no map is available */
+ int fd;
+ uint32 size; /* initialized if map is nonzero */
+ uint32 loop; /* number of hash slots searched under this key */
+ uint32 khash; /* initialized if loop is nonzero */
+ uint32 kpos; /* initialized if loop is nonzero */
+ uint32 hpos; /* initialized if loop is nonzero */
+ uint32 hslots; /* initialized if loop is nonzero */
+ uint32 dpos; /* initialized if cdb_findnext() returns 1 */
+ uint32 dlen; /* initialized if cdb_findnext() returns 1 */
+} ;
+
+extern void cdb_free(struct cdb *);
+extern void cdb_init(struct cdb *,int fd);
+
+extern int cdb_read(struct cdb *,char *,unsigned int,uint32);
+
+extern void cdb_findstart(struct cdb *);
+extern int cdb_findnext(struct cdb *,char *,unsigned int);
+extern int cdb_find(struct cdb *,char *,unsigned int);
+
+#define cdb_datapos(c) ((c)->dpos)
+#define cdb_datalen(c) ((c)->dlen)
+
+#endif
--- /dev/null
+/* Public domain. */
+/* Adapted from DJB's original cdb-0.75 package */
+
+#include "cdb.h"
+
+uint32 cdb_hashadd(uint32 h,unsigned char c)
+{
+ h += (h << 5);
+ return h ^ c;
+}
+
+uint32 cdb_hash(char *buf,unsigned int len)
+{
+ uint32 h;
+
+ h = CDB_HASHSTART;
+ while (len) {
+ h = cdb_hashadd(h,*buf++);
+ --len;
+ }
+ return h;
+}
--- /dev/null
+/* Public domain. */
+/* Adapted from DJB's original cdb-0.75 package */
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include "cdb.h"
+#include "cdb_make.h"
+#include "uint32.h"
+
+static int cdb_make_write(struct cdb_make *c, char *buf, uint32 sz) {
+ fwrite(buf, sz, 1, c->fp);
+ return ferror(c->fp);
+}
+
+int cdb_make_start(struct cdb_make *c, FILE * f)
+{
+ c->head = 0;
+ c->split = 0;
+ c->hash = 0;
+ c->numentries = 0;
+ c->fp = f;
+ c->pos = sizeof c->final;
+ if (fseek(f,c->pos,SEEK_SET) == -1) {
+ perror("fseek failed");
+ return -1;
+ }
+ return ftell(c->fp);
+}
+
+static int posplus(struct cdb_make *c,uint32 len)
+{
+ uint32 newpos = c->pos + len;
+ if (newpos < len) { errno = ENOMEM; return -1; }
+ c->pos = newpos;
+ return 0;
+}
+
+int cdb_make_addend(struct cdb_make *c,unsigned int keylen,unsigned int datalen,uint32 h)
+{
+ struct cdb_hplist *head;
+
+ head = c->head;
+ if (!head || (head->num >= CDB_HPLIST)) {
+ head = (struct cdb_hplist *) malloc(sizeof(struct cdb_hplist));
+ if (!head) return -1;
+ head->num = 0;
+ head->next = c->head;
+ c->head = head;
+ }
+ head->hp[head->num].h = h;
+ head->hp[head->num].p = c->pos;
+ ++head->num;
+ ++c->numentries;
+ if (posplus(c,8) == -1) return -1;
+ if (posplus(c,keylen) == -1) return -1;
+ if (posplus(c,datalen) == -1) return -1;
+ return 0;
+}
+
+int cdb_make_addbegin(struct cdb_make *c,unsigned int keylen,unsigned int datalen)
+{
+ char buf[8];
+
+ if (keylen > 0xffffffff) { errno = ENOMEM; return -1; }
+ if (datalen > 0xffffffff) { errno = ENOMEM; return -1; }
+
+ uint32_pack(buf,keylen);
+ uint32_pack(buf + 4,datalen);
+ if (cdb_make_write(c,buf,8) != 0) return -1;
+ /* if (buffer_putalign(&c->b,buf,8) == -1) return -1; */
+ return 0;
+}
+
+int cdb_make_add(struct cdb_make *c,char *key,unsigned int keylen,char *data,unsigned int datalen)
+{
+ if (cdb_make_addbegin(c,keylen,datalen) == -1) return -1;
+ if (cdb_make_write(c,key,keylen) != 0) return -1;
+ if (cdb_make_write(c,data,datalen) != 0) return -1;
+ /* if (buffer_putalign(&c->b,key,keylen) == -1) return -1; */
+ /* if (buffer_putalign(&c->b,data,datalen) == -1) return -1; */
+ return cdb_make_addend(c,keylen,datalen,cdb_hash(key,keylen));
+}
+
+int cdb_make_finish(struct cdb_make *c)
+{
+ char buf[8];
+ int i;
+ uint32 len;
+ uint32 u;
+ uint32 memsize;
+ uint32 count;
+ uint32 where;
+ struct cdb_hplist *x;
+ struct cdb_hp *hp;
+
+ for (i = 0;i < 256;++i)
+ c->count[i] = 0;
+
+ for (x = c->head;x;x = x->next) {
+ i = x->num;
+ while (i--)
+ ++c->count[255 & x->hp[i].h];
+ }
+
+ memsize = 1;
+ for (i = 0;i < 256;++i) {
+ u = c->count[i] * 2;
+ if (u > memsize)
+ memsize = u;
+ }
+
+ memsize += c->numentries; /* no overflow possible up to now */
+ u = (uint32) 0 - (uint32) 1;
+ u /= sizeof(struct cdb_hp);
+ if (memsize > u) { errno = ENOMEM; return -1; }
+
+ c->split = (struct cdb_hp *) malloc(memsize * sizeof(struct cdb_hp));
+ if (!c->split) return -1;
+
+ c->hash = c->split + c->numentries;
+
+ u = 0;
+ for (i = 0;i < 256;++i) {
+ u += c->count[i]; /* bounded by numentries, so no overflow */
+ c->start[i] = u;
+ }
+
+ for (x = c->head;x;x = x->next) {
+ i = x->num;
+ while (i--)
+ c->split[--c->start[255 & x->hp[i].h]] = x->hp[i];
+ }
+
+ for (i = 0;i < 256;++i) {
+ count = c->count[i];
+
+ len = count + count; /* no overflow possible */
+ uint32_pack(c->final + 8 * i,c->pos);
+ uint32_pack(c->final + 8 * i + 4,len);
+
+ for (u = 0;u < len;++u)
+ c->hash[u].h = c->hash[u].p = 0;
+
+ hp = c->split + c->start[i];
+ for (u = 0;u < count;++u) {
+ where = (hp->h >> 8) % len;
+ while (c->hash[where].p)
+ if (++where == len)
+ where = 0;
+ c->hash[where] = *hp++;
+ }
+
+ for (u = 0;u < len;++u) {
+ uint32_pack(buf,c->hash[u].h);
+ uint32_pack(buf + 4,c->hash[u].p);
+ if (cdb_make_write(c,buf,8) != 0) return -1;
+ /* if (buffer_putalign(&c->b,buf,8) == -1) return -1; */
+ if (posplus(c,8) == -1) return -1;
+ }
+ }
+
+ if (c->split) free(c->split);
+
+ for (x = c->head;x;c->head = x) {
+ x = x->next;
+ free(c->head);
+ }
+
+ if (fflush(c->fp) != 0) return -1;
+ /* if (buffer_flush(&c->b) == -1) return -1; */
+ rewind(c->fp);
+ if (ftell(c->fp) != 0) return -1;
+ /* if (seek_begin(c->fd) == -1) return -1; */
+ if (cdb_make_write(c,c->final,sizeof c->final) != 0) return -1;
+ return fflush(c->fp);
+ /* return buffer_putflush(&c->b,c->final,sizeof c->final); */
+}
--- /dev/null
+/* Public domain. */
+/* Adapted from DJB's original cdb-0.75 package */
+
+#ifndef CDB_MAKE_H
+#define CDB_MAKE_H
+
+#include <stdio.h>
+#include "uint32.h"
+
+#define CDB_HPLIST 1000
+
+struct cdb_hp { uint32 h; uint32 p; } ;
+
+struct cdb_hplist {
+ struct cdb_hp hp[CDB_HPLIST];
+ struct cdb_hplist *next;
+ int num;
+} ;
+
+struct cdb_make {
+ /* char bspace[8192]; */
+ char final[2048];
+ uint32 count[256];
+ uint32 start[256];
+ struct cdb_hplist *head;
+ struct cdb_hp *split; /* includes space for hash */
+ struct cdb_hp *hash;
+ uint32 numentries;
+ /* buffer b; */
+ uint32 pos;
+ /* int fd; */
+ FILE * fp;
+} ;
+
+extern int cdb_make_start(struct cdb_make *, FILE *);
+extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int);
+extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32);
+extern int cdb_make_add(struct cdb_make *,char *,unsigned int,char *,unsigned int);
+extern int cdb_make_finish(struct cdb_make *);
+
+#endif
--- /dev/null
+#ifndef UINT32_H
+#define UINT32_H
+
+/* adopted from libowfat 0.9 (GPL) */
+
+typedef unsigned int uint32;
+
+extern void uint32_pack(char *out,uint32 in);
+extern void uint32_unpack(const char *in,uint32 *out);
+
+#endif
--- /dev/null
+#define NO_UINT32_MACROS
+#include "uint32.h"
+
+/* adopted from libowfat 0.9 (GPL) */
+
+void uint32_pack(char *out,uint32 in) {
+ *out=in&0xff; in>>=8;
+ *++out=in&0xff; in>>=8;
+ *++out=in&0xff; in>>=8;
+ *++out=in&0xff;
+}
--- /dev/null
+#define NO_UINT32_MACROS
+#include "uint32.h"
+
+/* adopted from libowfat 0.9 (GPL) */
+
+void uint32_unpack(const char *in,uint32 *out) {
+ *out = (((uint32)(unsigned char)in[3])<<24) |
+ (((uint32)(unsigned char)in[2])<<16) |
+ (((uint32)(unsigned char)in[1])<<8) |
+ (uint32)(unsigned char)in[0];
+}
-/* @(#) $Id: cleanevent.c,v 1.42 2009/06/24 17:06:21 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#ifdef TESTRULE
- print_out("**Phase 1: Completed pre-decoding.");
- print_out(" full event: '%s'", lf->full_log);
- print_out(" hostname: '%s'", lf->hostname);
- print_out(" program_name: '%s'", lf->program_name);
- print_out(" log: '%s'", lf->log);
+ if(!alert_only)
+ {
+ print_out("**Phase 1: Completed pre-decoding.");
+ print_out(" full event: '%s'", lf->full_log);
+ print_out(" hostname: '%s'", lf->hostname);
+ print_out(" program_name: '%s'", lf->program_name);
+ print_out(" log: '%s'", lf->log);
+ }
#endif
return(0);
check_id_size
comp_srcuser_dstuser
comp_mswin_targetuser_calleruser_diff
+is_simple_http_request
+is_valid_crawler
-/* @(#) $Id: generic_samples.c,v 1.2 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
}
+/* Example 4:
+ * Checks if a HTTP request is a simple GET/POST without a query.
+ * This avoid that we call the attack rules for no reason.
+ */
+void *is_simple_http_request(Eventinfo *lf)
+{
+
+ /* Simple GET / request. */
+ if(strcmp(lf->url,"/") == 0)
+ {
+ return(lf);
+ }
+
+
+ /* Simple request, no query. */
+ if(!strchr(lf->url,'?'))
+ {
+ return(lf);
+ }
+
+
+ /* In here, we have an additional query to be checked. */
+ return(NULL);
+}
+
+
+/* Example 5:
+ * Checks if the source ip is from a valid bot.
+ */
+void *is_valid_crawler(Eventinfo *lf)
+{
+ if((strncmp(lf->log, "66.249.",7) == 0)|| /* Google bot */
+ (strncmp(lf->log, "72.14.",6) == 0)|| /* Feedfetcher-Google */
+ (strncmp(lf->log, "209.85.",7) == 0)|| /* Feedfetcher-Google */
+ (strncmp(lf->log, "65.55.",6) == 0)|| /* MSN/Bing */
+ (strncmp(lf->log, "207.46.",7) == 0)|| /* MSN/Bing */
+ (strncmp(lf->log, "74.6.",5) == 0)|| /* Yahoo */
+ (strncmp(lf->log, "72.30.",6) == 0)|| /* Yahoo */
+ (strncmp(lf->log, "67.195.",7) == 0) /* Yahoo */
+ )
+ {
+ return(lf);
+ }
+
+ return(NULL);
+}
+
+
+
/* END generic samples. */
-/* @(#) $Id: config.c,v 1.32 2009/11/04 15:18:59 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
Config.logbylevel = 1;
Config.includes = NULL;
+ Config.lists = NULL;
+ Config.decoders = NULL;
modules|= CGLOBAL;
modules|= CRULES;
-/* @(#) $Id: config.h,v 1.19 2009/11/20 15:38:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: decode-xml.c,v 1.47 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
int ReadDecodeXML(char *file)
{
+ debug1("ReadDecoderXML File = %s", file);
OS_XML xml;
XML_NODE node = NULL;
-/* @(#) $Id: decoder.c,v 1.42 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#ifdef TESTRULE
- print_out("\n**Phase 2: Completed decoding.");
+ if(!alert_only)
+ {
+ print_out("\n**Phase 2: Completed decoding.");
+ }
#endif
do
#ifdef TESTRULE
- print_out(" decoder: '%s'", nnode->name);
+ if(!alert_only)print_out(" decoder: '%s'", nnode->name);
#endif
}while((node=node->next) != NULL);
#ifdef TESTRULE
- print_out(" No decoder matched.");
+ if(!alert_only)
+ {
+ print_out(" No decoder matched.");
+ }
#endif
}
void *DstUser_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" dstuser: '%s'", field);
+ if(!alert_only)print_out(" dstuser: '%s'", field);
#endif
lf->dstuser = field;
void *SrcUser_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" srcuser: '%s'", field);
+ if(!alert_only)print_out(" srcuser: '%s'", field);
#endif
lf->srcuser = field;
void *SrcIP_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" srcip: '%s'", field);
+ if(!alert_only)print_out(" srcip: '%s'", field);
#endif
lf->srcip = field;
void *DstIP_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" dstip: '%s'", field);
+ if(!alert_only)print_out(" dstip: '%s'", field);
#endif
lf->dstip = field;
void *SrcPort_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" srcport: '%s'", field);
+ if(!alert_only)print_out(" srcport: '%s'", field);
#endif
lf->srcport = field;
void *DstPort_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" dstport: '%s'", field);
+ if(!alert_only)print_out(" dstport: '%s'", field);
#endif
lf->dstport = field;
void *Protocol_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" proto: '%s'", field);
+ if(!alert_only)print_out(" proto: '%s'", field);
#endif
lf->protocol = field;
void *Action_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" action: '%s'", field);
+ if(!alert_only)print_out(" action: '%s'", field);
#endif
lf->action = field;
void *ID_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" id: '%s'", field);
+ if(!alert_only)print_out(" id: '%s'", field);
#endif
lf->id = field;
void *Url_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" url: '%s'", field);
+ if(!alert_only)print_out(" url: '%s'", field);
#endif
lf->url = field;
void *Data_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" extra_data: '%s'", field);
+ if(!alert_only)print_out(" extra_data: '%s'", field);
#endif
lf->data = field;
void *Status_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" status: '%s'", field);
+ if(!alert_only)print_out(" status: '%s'", field);
#endif
lf->status = field;
void *SystemName_FP(Eventinfo *lf, char *field)
{
#ifdef TESTRULE
- print_out(" system_name: '%s'", field);
+ if(!alert_only)print_out(" system_name: '%s'", field);
#endif
lf->systemname = field;
-/* @(#) $Id: decoder.h,v 1.20 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: decoders_list.c,v 1.7 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: hostinfo.c,v 1.14 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: plugin_decoders.h,v 1.7 2009/06/24 17:06:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: ossecalert_decoder.c,v 1.3 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: pf_decoder.c,v 1.5 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: sonicwall_decoder.c,v 1.5 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: symantecws_decoder.c,v 1.5 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: rootcheck.c,v 1.26 2009/07/24 18:34:11 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: syscheck.c,v 1.53 2009/11/04 18:45:38 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
{
merror("%s: Error handling integrity database.",ARGV0);
sdb.db_err++; /* Increment db error */
+ lf->data = NULL;
return(0);
}
/* checksum match, we can just return and keep going */
if(strcmp(saved_sum, c_sum) == 0)
+ {
+ lf->data = NULL;
return(0);
+ }
/* If we reached here, the checksum of the file has changed */
break;
default:
+ lf->data = NULL;
return(0);
break;
}
snprintf(sdb.size, OS_FLSIZE,
"Size changed from '%s' to '%s'\n",
oldsize, newsize);
+
+ #ifdef PRELUDE
+ os_strdup(oldsize, lf->size_before);
+ os_strdup(newsize, lf->size_after);
+ #endif
}
/* Permission message */
}
else if(oldperm > 0 && newperm > 0)
{
+
snprintf(sdb.perm, OS_FLSIZE, "Permissions changed from "
"'%c%c%c%c%c%c%c%c%c' "
"to '%c%c%c%c%c%c%c%c%c'\n",
(newperm & S_ISVTX)? 't' :
(newperm & S_IXOTH)? 'x' : '-');
+
+ #ifdef PRELUDE
+ lf->perm_before = oldperm;
+ lf->perm_after = newperm;
+ #endif
}
/* Ownership message */
snprintf(sdb.owner, OS_FLSIZE, "Ownership was '%s', "
"now it is '%s'\n",
olduid, newuid);
+
+
+ #ifdef PRELUDE
+ os_strdup(olduid, lf->owner_before);
+ os_strdup(newuid, lf->owner_after);
+ #endif
}
/* group ownership message */
snprintf(sdb.gowner, OS_FLSIZE,"Group ownership was '%s', "
"now it is '%s'\n",
oldgid, newgid);
+ #ifdef PRELUDE
+ os_strdup(oldgid, lf->gowner_before);
+ os_strdup(newgid, lf->gowner_after);
+ #endif
}
/* md5 message */
snprintf(sdb.md5, OS_FLSIZE, "Old md5sum was: '%s'\n"
"New md5sum is : '%s'\n",
oldmd5, newmd5);
+ #ifdef PRELUDE
+ os_strdup(oldmd5, lf->md5_before);
+ os_strdup(newmd5, lf->md5_after);
+ #endif
}
/* sha1 */
snprintf(sdb.sha1, OS_FLSIZE, "Old sha1sum was: '%s'\n"
"New sha1sum is : '%s'\n",
oldsha1, newsha1);
+ #ifdef PRELUDE
+ os_strdup(oldsha1, lf->sha1_before);
+ os_strdup(newsha1, lf->sha1_after);
+ #endif
}
+ #ifdef PRELUDE
+ os_strdup(f_name, lf->filename);
+ #endif
/* Provide information about the file */
- snprintf(sdb.comment, 512, "Integrity checksum changed for: "
+ snprintf(sdb.comment, OS_MAXSTR, "Integrity checksum changed for: "
"'%.756s'\n"
"%s"
"%s"
"%s"
"%s"
"%s"
- "%s",
+ "%s"
+ "%s%s",
f_name,
sdb.size,
sdb.perm,
sdb.owner,
sdb.gowner,
sdb.md5,
- sdb.sha1);
+ sdb.sha1,
+ lf->data == NULL?"":"What changed:\n",
+ lf->data == NULL?"":lf->data
+ );
}
free(lf->full_log);
os_strdup(sdb.comment, lf->full_log);
lf->log = lf->full_log;
+ lf->data = NULL;
/* Setting decoder */
/* Setting decoder */
lf->decoder_info = sdb.syscheck_dec;
+ lf->data = NULL;
return(1);
}
+ lf->data = NULL;
return(0);
}
merror(SK_INV_MSG, ARGV0);
return(0);
}
-
-
+
+
/* Zeroing to get the check sum */
*f_name = '\0';
f_name++;
+ /* Getting diff. */
+ lf->data = strchr(f_name, '\n');
+ if(lf->data)
+ {
+ *lf->data = '\0';
+ lf->data++;
+ }
+ else
+ {
+ lf->data = NULL;
+ }
+
+
+
/* Checking if file is supposed to be ignored */
if(Config.syscheck_ignore)
{
{
if(strncasecmp(*ff_ig, f_name, strlen(*ff_ig)) == 0)
{
+ lf->data = NULL;
return(0);
}
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation.
+ *
+ * License details at the LICENSE file included with OSSEC or
+ * online at: http://www.ossec.net/en/licensing.html
+ */
+
+
+
+#include "eventinfo.h"
+#include "shared.h"
+
+char flastcontent[OS_SIZE_8192 +1];
+char *fmsglast = "Previous output:";
+
+static int _add2last(char *str, int strsize, char *file)
+{
+ FILE *fp;
+
+ fp = fopen(file, "w");
+ if(!fp)
+ {
+ /* Try to create the directories. */
+ char *dirrule = NULL;
+ char *diragent = NULL;
+
+ dirrule = strrchr(file, '/');
+ if(!dirrule)
+ {
+ merror("%s: ERROR: Invalid file name to diff: %s",
+ ARGV0, file);
+ return(0);
+ }
+ *dirrule = '\0';
+
+ diragent = strrchr(file, '/');
+ if(!diragent)
+ {
+ merror("%s: ERROR: Invalid file name to diff (2): %s",
+ ARGV0, file);
+ return(0);
+ }
+ *diragent = '\0';
+
+ /* Checking if the diragent exists. */
+ if(IsDir(file) != 0)
+ {
+ if(mkdir(file, 0770) == -1)
+ {
+ merror(MKDIR_ERROR, ARGV0, file);
+ return(0);
+ }
+ }
+ *diragent = '/';
+
+ if(IsDir(file) != 0)
+ {
+ if(mkdir(file, 0770) == -1)
+ {
+ merror(MKDIR_ERROR, ARGV0, file);
+ return(0);
+ }
+ }
+ *dirrule = '/';
+
+ fp = fopen(file, "w");
+ if(!fp)
+ {
+ merror(FOPEN_ERROR, ARGV0, file);
+ return(0);
+ }
+ }
+
+ fwrite(str, strsize + 1, 1, fp);
+ fclose(fp);
+ return(1);
+}
+
+
+int doDiff(RuleInfo *currently_rule, Eventinfo *lf)
+{
+ int date_of_change;
+ char *htpt = NULL;
+ char flastfile[OS_SIZE_2048 +1];
+ char fdifffile[OS_SIZE_2048 +1];
+ char flastcontent[OS_SIZE_8192 +1];
+
+
+ /* Cleaning up global. */
+ flastcontent[0] = '\0';
+ flastcontent[OS_SIZE_8192] = '\0';
+ currently_rule->last_events[0] = NULL;
+
+
+ if(lf->hostname[0] == '(')
+ {
+ htpt = strchr(lf->hostname, ')');
+ if(htpt)
+ {
+ *htpt = '\0';
+ }
+ snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname+1,
+ currently_rule->sigid, DIFF_LAST_FILE);
+
+ if(htpt)
+ {
+ *htpt = ')';
+ }
+ htpt = NULL;
+ }
+ else
+ {
+ snprintf(flastfile, OS_SIZE_2048, "%s/%s/%d/%s", DIFF_DIR, lf->hostname,
+ currently_rule->sigid, DIFF_LAST_FILE);
+ }
+
+ /* lf->size can't be too long. */
+ if(lf->size >= OS_SIZE_8192)
+ {
+ merror("%s: ERROR: event size (%d) too long for diff.", ARGV0, lf->size);
+ return(0);
+ }
+
+
+ /* Checking if last diff exists. */
+ date_of_change = File_DateofChange(flastfile);
+ if(date_of_change <= 0)
+ {
+ merror("last file: %s",flastfile);
+ if(!_add2last(lf->log, lf->size, flastfile))
+ {
+ merror("%s: ERROR: unable to create last file: %s", ARGV0, flastfile);
+ return(0);
+ }
+ return(0);
+ }
+ else
+ {
+ FILE *fp;
+ int n;
+ fp = fopen(flastfile,"r");
+ if(!fp)
+ {
+ merror(FOPEN_ERROR, ARGV0, flastfile);
+ return(0);
+ }
+
+ n = fread(flastcontent, 1, OS_SIZE_8192, fp);
+ if(n > 0)
+ {
+ flastcontent[n] = '\0';
+ }
+ else
+ {
+ merror("%s: ERROR: read error on %s", ARGV0, flastfile);
+ fclose(fp);
+ return(0);
+ }
+ fclose(fp);
+ }
+
+ /* Nothing changed. */
+ if(strcmp(flastcontent, lf->log) == 0)
+ {
+ return(0);
+ }
+
+
+ /* File was modified. */
+ if(lf->hostname[0] == '(')
+ {
+ htpt = strchr(lf->hostname, ')');
+ if(htpt)
+ {
+ *htpt = '\0';
+ }
+ snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname+1,
+ currently_rule->sigid, date_of_change);
+
+ if(htpt)
+ {
+ *htpt = ')';
+ }
+ htpt = NULL;
+ }
+ else
+ {
+ snprintf(fdifffile, OS_SIZE_2048, "%s/%s/%d/state.%d", DIFF_DIR, lf->hostname,
+ currently_rule->sigid, date_of_change);
+ }
+
+ rename(flastfile, fdifffile);
+ if(!_add2last(lf->log, lf->size, flastfile))
+ {
+ merror("%s: ERROR: unable to create last file: %s", ARGV0, flastfile);
+ }
+
+ currently_rule->last_events[0] = fmsglast;
+ currently_rule->last_events[1] = flastcontent;
+ return(1);
+
+}
+
+
+
+/* EOF */
-/* @(#) $Id: eventinfo.c,v 1.41 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
lf->generated_rule = NULL;
lf->sid_node_to_delete = NULL;
lf->decoder_info = NULL_Decoder;
-
+
+ #ifdef PRELUDE
+ lf->filename = NULL;
+ lf->perm_before = 0;
+ lf->perm_after = 0;
+ lf->md5_before = NULL;
+ lf->md5_after = NULL;
+ lf->sha1_before = NULL;
+ lf->sha1_after = NULL;
+ lf->size_before = NULL;
+ lf->size_after = NULL;
+ lf->owner_before = NULL;
+ lf->owner_after = NULL;
+ lf->gowner_before = NULL;
+ lf->gowner_after = NULL;
+ #endif
+
return;
}
if(lf->systemname)
free(lf->systemname);
+ #ifdef PRELUDE
+ if(lf->filename)
+ free(lf->filename);
+ if (lf->md5_before)
+ free(lf->md5_before);
+ if (lf->md5_after)
+ free(lf->md5_after);
+ if (lf->sha1_before)
+ free(lf->sha1_before);
+ if (lf->sha1_after)
+ free(lf->sha1_after);
+ if (lf->size_before)
+ free(lf->size_before);
+ if (lf->size_after)
+ free(lf->size_after);
+ if (lf->owner_before)
+ free(lf->owner_before);
+ if (lf->owner_after)
+ free(lf->owner_after);
+ if (lf->gowner_before)
+ free(lf->gowner_before);
+ if (lf->gowner_after)
+ free(lf->gowner_after);
+ #endif
/* Freeing node to delete */
if(lf->sid_node_to_delete)
-/* @(#) $Id: eventinfo.h,v 1.37 2009/07/24 18:34:11 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
int time;
int day;
int year;
- char hour[9];
+ char hour[10];
char mon[4];
+
+ /* SYSCHECK Results variables -- only used by prelude for now */
+ #ifdef PRELUDE
+ char *filename;
+ int perm_before;
+ int perm_after;
+ char *md5_before;
+ char *md5_after;
+ char *sha1_before;
+ char *sha1_after;
+ char *size_before;
+ char *size_after;
+ char *owner_before;
+ char *owner_after;
+ char *gowner_before;
+ char *gowner_after;
+ #endif
}Eventinfo;
+/* For test rule only. */
+#ifdef TESTRULE
+int full_output;
+int alert_only;
+#endif
+
+
/** Types of events (from decoders) **/
#define UNKNOWN 0 /* Unkown */
#define SYSLOG 1 /* syslog messages */
-/* @(#) $Id: eventinfo_list.c,v 1.7 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: fts.c,v 1.34 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
int fts_minsize_for_str = 0;
OSList *fts_list = NULL;
-OSStore *fts_store = NULL;
+OSHash *fts_store = NULL;
FILE *fp_list = NULL;
FILE *fp_ignore = NULL;
}
/* Creating store data */
- fts_store = OSStore_Create();
+ fts_store = OSHash_Create();
if(!fts_store)
{
merror(LIST_ERROR, ARGV0);
return(0);
}
+ if(!OSHash_setSize(fts_store, 2048))
+ {
+ merror(LIST_ERROR, ARGV0);
+ return(0);
+ }
+
/* Getting default list size */
fts_list_size = getDefine_Int("analysisd",
"fts_list_size",
os_strdup(_line, tmp_s);
- if(!OSStore_Put(fts_store, tmp_s, NULL))
+ if(OSHash_Add(fts_store, tmp_s, tmp_s) <= 0)
{
+ free(tmp_s);
merror(LIST_ADD_ERROR, ARGV0);
}
}
/** Checking if FTS is already present **/
- if(lf->decoder_info->type == WINDOWS)
- {
- /* Windows is case insensitive */
- if(OSStore_NCaseCheck(fts_store, _line))
- {
- return(0);
- }
- }
- else if(OSStore_NCheck(fts_store, _line))
+ if(OSHash_Get(fts_store, _line))
{
return(0);
- }
+ }
/* Checking if from the last FTS events, we had
os_strdup(_line, line_for_list);
}
- if(!OSStore_Put(fts_store, line_for_list, NULL))
+ if(OSHash_Add(fts_store, line_for_list, line_for_list) <= 1)
{
- merror(LIST_ADD_ERROR, ARGV0);
+ return(0);
}
-/* @(#) $Id: fts.h,v 1.8 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation.
+ *
+ * License details at the LICENSE file included with OSSEC or
+ * online at: http://www.ossec.net/en/licensing.html
+ */
+
+
+
+#include "config.h"
+#include "eventinfo.h"
+
+
+
+/* Lists_OP_CreateLists, v0.1, 2010/01/08
+ * Will initilalize the cdb lookup lists
+ */
+void Lists_OP_CreateLists()
+{
+ OS_CreateListsList();
+ return;
+}
+
+int Lists_OP_LoadList(char * listfile)
+{
+ /* XXX Jeremy: I hate this. I think I'm missing something dumb here */
+ char *holder;
+ char a_filename[OS_MAXSTR];
+ a_filename[OS_MAXSTR - 2] = '\0';
+ char b_filename[OS_MAXSTR];
+ b_filename[OS_MAXSTR - 2] = '\0';
+
+ ListNode *tmp_listnode_pt = NULL;
+ tmp_listnode_pt = (ListNode *)calloc(1,sizeof(ListNode));
+ debug1("crated new listnode for %s\n", listfile);
+ if (tmp_listnode_pt == NULL)
+ ErrorExit(MEM_ERROR,ARGV0);
+ snprintf(a_filename, OS_MAXSTR-1, "%s", listfile);
+ if((strchr(a_filename, '/') == NULL))
+ {
+ /* default to rules/ if a path is not given */
+ snprintf(b_filename, OS_MAXSTR-1, "rules/%s", a_filename);
+ snprintf(a_filename, OS_MAXSTR-1, "%s", b_filename);
+ }
+ if((holder = strstr(a_filename, ".cdb")))
+ {
+ snprintf(b_filename, (int)(holder - a_filename) + 1, "%s", a_filename);
+ snprintf(a_filename, OS_MAXSTR-1, "%s", b_filename);
+ }
+ snprintf(b_filename, OS_MAXSTR-1, "%s.cdb", a_filename);
+ os_strdup(a_filename, tmp_listnode_pt->txt_filename);
+ os_strdup(b_filename, tmp_listnode_pt->cdb_filename);
+ tmp_listnode_pt->loaded = 0;
+ OS_AddList(tmp_listnode_pt);
+ return 0;
+}
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+/* Rules are needed for lists */
+
+#include "cdb/cdb.h"
+#include "cdb/uint32.h"
+
+#define LR_STRING_MATCH 0
+#define LR_STRING_NOT_MATCH 1
+#define LR_STRING_MATCH_VALUE 2
+
+#define LR_ADDRESS_MATCH 10
+#define LR_ADDRESS_NOT_MATCH 11
+#define LR_ADDRESS_MATCH_VALUE 12
+
+
+typedef struct ListNode
+{
+ int loaded;
+ char *cdb_filename;
+ char *txt_filename;
+ struct cdb cdb;
+ struct ListNode *next;
+}ListNode;
+
+typedef struct ListRule
+{
+ int loaded;
+ int field;
+ int lookup_type;
+ OSMatch *matcher;
+ char *filename;
+ ListNode *db;
+ struct ListRule *next;
+}ListRule;
+
+/* create the rule list */
+void OS_CreateListsList();
+/* Add rule information to the list */
+int OS_AddList( ListNode *new_listnode );
+int Lists_OP_LoadList(char *listfile);
+int OS_DBSearchKey(ListRule *lrule, char *key);
+int OS_DBSearch(ListRule *lrule, char *key);
+void OS_ListLoadRules();
+ListRule *OS_AddListRule(ListRule *first_rule_list, int lookup_type, int field, char *listname, OSMatch *matcher);
+ListNode *OS_GetFirstList();
+ListNode *OS_FindList(char *listname);
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+#include "shared.h"
+#include "rules.h"
+#include "cdb/cdb.h"
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+/* Global */
+ListNode *global_listnode;
+ListRule *global_listrule;
+
+/*
+ */
+ListNode *_OS_AddList(ListNode *new_listnode);
+
+
+/* Create the ListRule */
+void OS_CreateListsList()
+{
+ global_listnode = NULL;
+ global_listrule = NULL;
+
+ return;
+}
+
+/* Get first listnode */
+ListNode *OS_GetFirstList()
+{
+ ListNode *listnode_pt = global_listnode;
+
+ return(listnode_pt);
+}
+
+ListRule *OS_GetFirstListRule()
+{
+ ListRule *listrule_pt = global_listrule;
+ return listrule_pt;
+}
+
+void OS_ListLoadRules()
+{
+ ListRule *lrule = global_listrule;
+ while(lrule != NULL)
+ {
+ if(!lrule->loaded)
+ {
+ lrule->db = OS_FindList(lrule->filename);
+ lrule->loaded=1;
+ }
+ lrule = lrule->next;
+ }
+}
+
+ListRule *_OS_AddListRule(ListRule *new_listrule)
+{
+
+ if(global_listrule == NULL)
+ {
+ global_listrule = new_listrule;
+ }
+ else
+ {
+ ListRule *last_list_rule = global_listrule;
+ while(last_list_rule->next != NULL)
+ {
+ last_list_rule = last_list_rule->next;
+ }
+ last_list_rule->next = new_listrule;
+ }
+ return(global_listrule);
+}
+
+
+
+/* Add a list in the chain */
+ListNode *_OS_AddList(ListNode *new_listnode)
+{
+ if(global_listnode == NULL)
+ {
+ /* First list */
+ global_listnode = new_listnode;
+ }
+ else
+ {
+ /* Adding new list to the end */
+ ListNode *last_list_node = global_listnode;
+
+ while(last_list_node->next != NULL)
+ {
+ last_list_node = last_list_node->next;
+ }
+ last_list_node->next = new_listnode;
+
+ }
+ return(global_listnode);
+}
+
+/* External AddList */
+int OS_AddList(ListNode *new_listnode)
+{
+ _OS_AddList(new_listnode);
+ return(0);
+}
+
+ListNode *_OS_FindList(ListNode *_listnode, char *listname)
+{
+ ListNode *last_list_node = OS_GetFirstList();
+ if (last_list_node != NULL) {
+ do
+ {
+ if (strcmp(last_list_node->txt_filename, listname) == 0 ||
+ strcmp(last_list_node->cdb_filename, listname) == 0)
+ {
+ /* Found first match returning */
+ return(last_list_node);
+ }
+ last_list_node = last_list_node->next;
+ } while (last_list_node != NULL);
+ }
+ return(NULL);
+}
+
+ListNode *OS_FindList(char *listname)
+{
+ ListNode *matched = NULL;
+ matched = _OS_FindList(global_listnode, listname);
+ return matched;
+}
+
+ListRule *OS_AddListRule(ListRule *first_rule_list,
+ int lookup_type,
+ int field,
+ char *listname,
+ OSMatch *matcher)
+{
+ ListRule *new_rulelist_pt = NULL;
+ new_rulelist_pt = (ListRule *)calloc(1,sizeof(ListRule));
+ new_rulelist_pt->field = field;
+ new_rulelist_pt->next = NULL;
+ new_rulelist_pt->matcher = matcher;
+ new_rulelist_pt->lookup_type = lookup_type;
+ new_rulelist_pt->filename = listname;
+ if((new_rulelist_pt->db = OS_FindList(listname)) == NULL)
+ new_rulelist_pt->loaded = 0;
+ else
+ new_rulelist_pt->loaded = 1;
+ if(first_rule_list == NULL)
+ {
+ debug1("Adding First rulelist item: filename: %s field: %d lookup_type: %d",
+ new_rulelist_pt->filename,
+ new_rulelist_pt->field,
+ new_rulelist_pt->lookup_type);
+ first_rule_list = new_rulelist_pt;
+ }
+ else
+ {
+ while(first_rule_list->next)
+ {
+ first_rule_list = first_rule_list->next;
+ }
+ debug1("Adding rulelist item: filename: %s field: %d lookup_type: %d",
+ new_rulelist_pt->filename,
+ new_rulelist_pt->field,
+ new_rulelist_pt->lookup_type);
+ first_rule_list->next = new_rulelist_pt;
+ }
+ return first_rule_list;
+}
+
+int _OS_CDBOpen(ListNode *lnode)
+{
+ int fd;
+ if (lnode->loaded != 1)
+ {
+ if((fd = open(lnode->cdb_filename, O_RDONLY)) == -1)
+ {
+ merror(OPEN_ERROR, ARGV0, lnode->cdb_filename, strerror (errno));
+ return -1;
+ }
+ cdb_init(&lnode->cdb, fd);
+ lnode->loaded = 1;
+ }
+ return 0;
+}
+
+int OS_DBSearchKeyValue(ListRule *lrule, char *key)
+{
+ int result=-1;
+ char *val;
+ unsigned vlen, vpos;
+ if (lrule->db!= NULL)
+ {
+ if(_OS_CDBOpen(lrule->db) == -1) return 0;
+ if(cdb_find(&lrule->db->cdb, key, strlen(key)) > 0 ) {
+ vpos = cdb_datapos(&lrule->db->cdb);
+ vlen = cdb_datalen(&lrule->db->cdb);
+ val = malloc(vlen);
+ cdb_read(&lrule->db->cdb, val, vlen, vpos);
+ result = OSMatch_Execute(val, vlen, lrule->matcher);
+ free(val);
+ return result;
+ } else {
+ return 0;
+ }
+ }
+ return 0;
+}
+
+
+
+int OS_DBSeachKey(ListRule *lrule, char *key)
+{
+ if (lrule->db != NULL)
+ {
+ if(_OS_CDBOpen(lrule->db) == -1) return -1;
+ if( cdb_find(&lrule->db->cdb, key, strlen(key)) > 0 ) return 1;
+ }
+ return 0;
+}
+
+int OS_DBSeachKeyAddress(ListRule *lrule, char *key)
+{
+ //char _ip[128];
+ //_ip[127] = "\0";
+ if (lrule->db != NULL)
+ {
+ if(_OS_CDBOpen(lrule->db) == -1) return -1;
+ //snprintf(_ip,128,"%s",key);
+ //XXX Breka apart string on the . boundtrys a loop over to longest match.
+
+ if( cdb_find(&lrule->db->cdb, key, strlen(key)) > 0 ) {
+ return 1;
+ }
+ else
+ {
+ char *tmpkey;
+ os_strdup(key, tmpkey);
+ while(strlen(tmpkey) > 0)
+ {
+ if(tmpkey[strlen(tmpkey) - 1] == '.')
+ {
+ if( cdb_find(&lrule->db->cdb, tmpkey, strlen(tmpkey)) > 0 ) {
+ free(tmpkey);
+ return 1;
+ }
+ }
+ tmpkey[strlen(tmpkey) - 1] = '\0';
+ }
+ free(tmpkey);
+ }
+ }
+ return 0;
+}
+
+int OS_DBSearch(ListRule *lrule, char *key)
+{
+ //XXX - god damn hack!!! Jeremy Rossi
+ if (lrule->loaded == 0)
+ {
+ lrule->db = OS_FindList(lrule->filename);
+ lrule->loaded = 1;
+ }
+ switch(lrule->lookup_type)
+ {
+ case LR_STRING_MATCH:
+ //debug1("LR_STRING_MATCH");
+ if(OS_DBSeachKey(lrule, key) == 1)
+ return 1;
+ else
+ return 0;
+ break;
+ case LR_STRING_NOT_MATCH:
+ //debug1("LR_STRING_NOT_MATCH");
+ if(OS_DBSeachKey(lrule, key) == 1)
+ return 0;
+ else
+ return 1;
+ break;
+ case LR_STRING_MATCH_VALUE:
+ //debug1("LR_STRING_MATCH_VALUE");
+ // XXX TODO
+ return 0;
+ break;
+ case LR_ADDRESS_MATCH:
+ //debug1("LR_ADDRESS_MATCH");
+ return OS_DBSeachKeyAddress(lrule, key);
+ break;
+ case LR_ADDRESS_NOT_MATCH:
+ //debug1("LR_ADDRESS_NOT_MATCH");
+ if(OS_DBSeachKeyAddress(lrule, key) == 0)
+ return 1;
+ else
+ return 0;
+ break;
+ case LR_ADDRESS_MATCH_VALUE:
+ //debug1("LR_ADDRESS_MATCH_VALUE");
+ // XXX TODO
+ return 0;
+ break;
+ default:
+ debug1("lists_list.c::OS_DBSearch should never hit default");
+ return 0;
+ }
+ return 0;
+}
+
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation
+ */
+
+#include "shared.h"
+#include "rules.h"
+#include "cdb/cdb.h"
+#include "cdb/cdb_make.h"
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "lists_make.h"
+
+void Lists_OP_MakeAll(int force)
+{
+ ListNode *lnode = OS_GetFirstList();
+ while(lnode)
+ {
+ Lists_OP_MakeCDB(lnode->txt_filename,
+ lnode->cdb_filename,
+ force);
+ lnode = lnode->next;
+ }
+}
+
+void Lists_OP_MakeCDB(char *txt_filename, char *cdb_filename, int force)
+{
+ /*
+ struct stat cdb_stat;
+ struct stat txt_stat;
+ */
+ struct cdb_make cdbm;
+ FILE *tmp_fd;
+ FILE *txt_fd;
+ char *tmp_str;
+ char *key, *val;
+ char str[OS_MAXSTR+1];
+
+ str[OS_MAXSTR]= '\0';
+ char tmp_filename[OS_MAXSTR];
+ tmp_filename[OS_MAXSTR - 2] = '\0';
+ snprintf(tmp_filename, OS_MAXSTR - 2, "%s.tmp", txt_filename);
+
+ /*
+ if((stat(txt_filename, &txt_stat)) == -1)
+ debug1("%s: stat of file %s failed", ARGV0, txt_filename);
+ if((stat(cdb_filename, &cdb_stat)) == -1)
+ debug1("%s: stat of file %s failed", ARGV0, cdb_filename);
+ */
+ if(File_DateofChange(txt_filename) > File_DateofChange(cdb_filename) ||
+ force)
+ {
+ printf(" * File %s need to be updated\n", cdb_filename);
+ tmp_fd = fopen(tmp_filename, "w+");
+ cdb_make_start(&cdbm, tmp_fd);
+ if(!(txt_fd = fopen(txt_filename, "r")))
+ {
+ merror(FOPEN_ERROR, ARGV0, txt_filename);
+ return;
+ }
+ while((fgets(str, OS_MAXSTR-1,txt_fd)) != NULL)
+ {
+ /* Removing new lines or carriage returns. */
+ tmp_str = strchr(str, '\r');
+ if(tmp_str)
+ *tmp_str = '\0';
+ tmp_str = strchr(str, '\n');
+ if(tmp_str)
+ *tmp_str = '\0';
+ if((val = strchr(str, ':')))
+ {
+ *val = '\0';
+ val++;
+ }
+ else
+ {
+ continue;
+ }
+ key = str;
+ cdb_make_add(&cdbm, key, strlen(key), val, strlen(val));
+ if(force) print_out(" * adding - key: %s value: %s",key,val);
+ }
+ cdb_make_finish(&cdbm);
+ rename(tmp_filename,cdb_filename);
+ }
+ else
+ {
+ printf(" * File %s does not need to be compiled\n", cdb_filename);
+ }
+}
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 3) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+void makelist_help(const char *prog);
+void Lists_OP_MakeCDB(char *txt_filename, char *cdb_filename, int force);
+void Lists_OP_MakeAll(int force);
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation.
+ *
+ * License details at the LICENSE file included with OSSEC or
+ * online at: http://www.ossec.net/en/licensing.html
+ */
+
+
+/* Part of the OSSEC
+ * Available at http://www.ossec.net
+ */
+
+
+/* ossec-analysisd.
+ * Responsible for correlation and log decoding.
+ */
+#ifdef ARGV0
+ #undef ARGV0
+ #define ARGV0 "ossec-testrule"
+#endif
+
+#include "shared.h"
+
+
+/** Local headers **/
+#include "active-response.h"
+#include "config.h"
+#include "rules.h"
+#include "stats.h"
+#include "lists_make.h"
+
+#include "eventinfo.h"
+#include "analysisd.h"
+
+#include "picviz.h"
+
+
+
+/** External functions prototypes (only called here) **/
+
+/* For config */
+int GlobalConf(char * cfgfile);
+
+
+/* For Lists */
+void Lists_OP_CreateLists();
+
+void makelist_help(const char *prog)
+{
+ print_out(" ");
+ print_out("%s %s - %s (%s)", __name, __version, __author, __contact);
+ print_out("%s", __site);
+ print_out(" ");
+ print_out(" %s: -[Vhdt] [-u user] [-g group] [-c config] [-D dir]", prog);
+ print_out(" -V Version and license message");
+ print_out(" -h This help message");
+ print_out(" -d Execute in debug mode");
+ print_out(" -f Force rebuild of all databases");
+ print_out(" -u <user> Run as 'user'");
+ print_out(" -g <group> Run as 'group'");
+ print_out(" -c <config> Read the 'config' file");
+ print_out(" -D <dir> Chroot to 'dir'");
+ print_out(" ");
+ exit(1);
+}
+
+/** int main(int argc, char **argv)
+ */
+int main(int argc, char **argv)
+{
+ int c = 0;
+ char *dir = DEFAULTDIR;
+ char *user = USER;
+ char *group = GROUPGLOBAL;
+ int uid = 0,gid = 0;
+ int force = 0;
+
+ char *cfg = DEFAULTCPATH;
+
+ /* Setting the name */
+ OS_SetName(ARGV0);
+
+ thishour = 0;
+ today = 0;
+ prev_year = 0;
+ memset(prev_month, '\0', 4);
+
+ while((c = getopt(argc, argv, "Vdhfu:g:D:c:")) != -1){
+ switch(c){
+ case 'V':
+ print_version();
+ break;
+ case 'h':
+ makelist_help(ARGV0);
+ break;
+ case 'd':
+ nowDebug();
+ break;
+ case 'u':
+ if(!optarg)
+ ErrorExit("%s: -u needs an argument",ARGV0);
+ user = optarg;
+ break;
+ case 'g':
+ if(!optarg)
+ ErrorExit("%s: -g needs an argument",ARGV0);
+ group = optarg;
+ break;
+ case 'D':
+ if(!optarg)
+ ErrorExit("%s: -D needs an argument",ARGV0);
+ dir = optarg;
+ case 'c':
+ if(!optarg)
+ ErrorExit("%s: -c needs an argument",ARGV0);
+ cfg = optarg;
+ break;
+ case 'f':
+ force = 1;
+ break;
+ default:
+ help(ARGV0);
+ break;
+ }
+
+ }
+
+
+ /*Check if the user/group given are valid */
+ uid = Privsep_GetUser(user);
+ gid = Privsep_GetGroup(group);
+ if((uid < 0)||(gid < 0))
+ ErrorExit(USER_ERROR,ARGV0,user,group);
+
+
+ /* Found user */
+ debug1(FOUND_USER, ARGV0);
+
+
+ /* Reading configuration file */
+ if(GlobalConf(cfg) < 0)
+ {
+ ErrorExit(CONFIG_ERROR,ARGV0, cfg);
+ }
+
+ debug1(READ_CONFIG, ARGV0);
+
+ /* Setting the group */
+ if(Privsep_SetGroup(gid) < 0)
+ ErrorExit(SETGID_ERROR,ARGV0,group);
+
+ /* Chrooting */
+ if(Privsep_Chroot(dir) < 0)
+ ErrorExit(CHROOT_ERROR,ARGV0,dir);
+
+ nowChroot();
+
+
+
+ /* Createing the lists for use in rules */
+ Lists_OP_CreateLists();
+
+ /* Reading the lists */
+ {
+ char **listfiles;
+ listfiles = Config.lists;
+ while(listfiles && *listfiles)
+ {
+ if(Lists_OP_LoadList(*listfiles) < 0)
+ ErrorExit(LISTS_ERROR, ARGV0, *listfiles);
+ free(*listfiles);
+ listfiles++;
+ }
+ free(Config.lists);
+ Config.lists = NULL;
+ }
+
+ Lists_OP_MakeAll(force);
+
+ exit(0);
+}
+
+/* EOF */
-/* @(#) $Id: picviz.c,v 1.2 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Sebastien Tricaud
* Copyright (C) 2009 Trend Micro Inc.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: picviz.h,v 1.2 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Sebastien Tricaud
* Copyright (C) 2009 Trend Micro Inc.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: prelude.c,v 1.14 2009/11/09 20:18:52 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "prelude.h"
#include "shared.h"
#include "eventinfo.h"
+#include "rules.h"
#define DEFAULT_ANALYZER_NAME "OSSEC"
#define ANALYZER_CLASS "Host IDS, File Integrity Checker, Log Analyzer"
#define ANALYZER_MODEL "Ossec"
#define ANALYZER_MANUFACTURER __site
#define ANALYZER_VERSION __version
-
+#define FILE_USER 0
+#define FILE_GROUP 1
+#define FILE_OTHER 2
/*
* Ossec to Prelude
}
+void FileAccess_PreludeLog(idmef_message_t *idmef,
+ int filenum,
+ char *filename,
+ char *md5,
+ char *sha1,
+ char *owner,
+ char *gowner,
+ int perm) {
+
+ int _checksum_counter = 0;
+ char _prelude_section[128];
+ _prelude_section[127] = '\0';
+
+ debug1("%s: DEBUG: filename = %s.", ARGV0, filename);
+ debug1("%s: DEBUG: filenum = %d.", ARGV0, filenum);
+ if (filenum == 0) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).name",filenum);
+ add_idmef_object(idmef, _prelude_section, filename);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).category",filenum);
+ add_idmef_object(idmef, _prelude_section, "original");
+ } else if (filenum == 1) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).name",filenum);
+ add_idmef_object(idmef, _prelude_section, filename);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).category",filenum);
+ add_idmef_object(idmef, _prelude_section, "current");
+ } else {
+ return;
+ }
+
+
+ /* Add the hashs */
+ if (md5) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).checksum(%d).algorithm",filenum, _checksum_counter);
+ add_idmef_object(idmef, _prelude_section, "MD5");
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).checksum(%d).value",filenum, _checksum_counter);
+ add_idmef_object(idmef, _prelude_section, md5);
+ _checksum_counter++;
+ }
+ if (sha1) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).checksum(%d).algorithm",filenum, _checksum_counter);
+ add_idmef_object(idmef, _prelude_section, "SHA1");
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).checksum(%d).value",filenum, _checksum_counter);
+ add_idmef_object(idmef, _prelude_section, sha1);
+ _checksum_counter++;
+ }
+
+ /* add the owner */
+ if (owner) {
+ debug1("%s: DEBUG: owner = %s.", ARGV0, owner);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).user_id.number",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,owner);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).user_id.type",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section, "user-privs");
+ }
+ /*add the group owner */
+ if (gowner) {
+ debug1("%s: DEBUG: gowner = %s.", ARGV0, gowner);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).user_id.number",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,gowner);
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).user_id.type",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section, "group-privs");
+ }
+ /*add the permissions */
+ if (perm) {
+ if (perm & S_IWUSR) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(0)",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,"write");
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(1)",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,"delete");
+ }
+ if (perm & S_IXUSR) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(2)",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,"execute");
+ }
+ if (perm & S_IRUSR ) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(3)",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,"read");
+ }
+ if (perm & S_ISUID) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(4)",filenum,FILE_USER);
+ add_idmef_object(idmef, _prelude_section,"executeAs");
+ }
+
+ if (perm & S_IWGRP) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(0)",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,"write");
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(1)",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,"delete");
+ }
+ if (perm & S_IXGRP) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(2)",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,"execute");
+ }
+ if (perm & S_IRGRP ) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(3)",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,"read");
+ }
+ if (perm & S_ISGID) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(4)",filenum,FILE_GROUP);
+ add_idmef_object(idmef, _prelude_section,"executeAs");
+ }
+ if (perm & S_IWOTH) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(0)",filenum,FILE_OTHER);
+ add_idmef_object(idmef, _prelude_section,"write");
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(1)",filenum,FILE_OTHER);
+ add_idmef_object(idmef, _prelude_section,"delete");
+ }
+ if (perm & S_IXOTH) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(2)",filenum,FILE_OTHER);
+ add_idmef_object(idmef, _prelude_section,"execute");
+ }
+ if (perm & S_IROTH ) {
+ snprintf(_prelude_section,128,"alert.target(0).file(%d).File_Access(%d).permission(3)",filenum,FILE_OTHER);
+ add_idmef_object(idmef, _prelude_section,"read");
+ }
+ }
+ return;
+}
void OS_PreludeLog(Eventinfo *lf)
{
int ret;
+ int classification_counter = 0;
+ int additional_data_counter = 0;
+ char _prelude_section[128];
+ char _prelude_data[256];
idmef_message_t *idmef;
+ RuleInfoDetail *last_info_detail;
/* Generate prelude alert */
ret = idmef_message_new(&idmef);
- if ( ret < 0 )
- {
+ if ( ret < 0 ) {
merror("%s: OSSEC2Prelude: Cannot create IDMEF message", ARGV0);
return;
}
add_idmef_object(idmef, "alert.assessment.impact.description",
lf->generated_rule->comment);
-
+
add_idmef_object(idmef, "alert.assessment.impact.severity",
(lf->generated_rule->level > 15) ? "high":
ossec2prelude_sev[lf->generated_rule->level]);
-
+
add_idmef_object(idmef, "alert.assessment.impact.completion", "succeeded");
-
- add_idmef_object(idmef, "alert.classification.text",
- lf->generated_rule->comment);
-
-
- /* Setting source info. */
- add_idmef_object(idmef, "alert.source(0).Spoofed", "no");
- add_idmef_object(idmef, "alert.source(0).Node.Address(0).address",
- lf->srcip);
- add_idmef_object(idmef, "alert.source(0).Service.port", lf->srcport);
- if(lf->srcuser)
+ if (lf->action)
{
- add_idmef_object(idmef, "alert.source(0).User.UserId(0).name", lf->srcuser);
+ switch(*lf->action)
+ {
+ /* discard, drop, deny, */
+ case 'd':
+ case 'D':
+ /* reject, */
+ case 'r':
+ case 'R':
+ /* block */
+ case 'b':
+ case 'B':
+ snprintf(_prelude_data,256,"DROP: %s", lf->action);
+ break;
+ /* Closed */
+ case 'c':
+ case 'C':
+ /* Teardown */
+ case 't':
+ case 'T':
+ snprintf(_prelude_data,256,"CLOSED: %s", lf->action);
+ break;
+ /* allow, accept, */
+ case 'a':
+ case 'A':
+ /* pass/permitted */
+ case 'p':
+ case 'P':
+ /* open */
+ case 'o':
+ case 'O':
+ snprintf(_prelude_data,256,"ALLOW: %s", lf->action);
+ break;
+ default:
+ snprintf(_prelude_data,256,"%s", lf->action);
+ break;
+ }
+ add_idmef_object(idmef, "alert.assessment.action(0).category", "3");
+ add_idmef_object(idmef, "alert.assessment.action(0).description", _prelude_data);
}
- /* Setting target */
- add_idmef_object(idmef, "alert.target(0).Service.name", lf->program_name);
- add_idmef_object(idmef, "alert.target(0).Spoofed", "no");
- if(lf->dstip)
- {
- add_idmef_object(idmef, "alert.target(0).Node.Address(0).address",
- lf->dstip);
- }
- else
+
+
+
+ /* Begin Classification Infomations */
{
- char *tmp_str;
- char new_prelude_target[256];
+ add_idmef_object(idmef, "alert.classification.text",
+ lf->generated_rule->comment);
- new_prelude_target[255] = '\0';
- strncpy(new_prelude_target, lf->hostname, 255);
- /* The messages can have the file, so we need to remove it.
- * formats can be:
- * enigma->/var/log/authlog
- * (esqueleto2) 192.168.2.99->/var/log/squid/access.log
+ /* The Common Vulnerabilities and Exposures (CVE) (http://www.cve.mitre.org/)
+ * infomation if present in the triggering rule
*/
- tmp_str = strstr(new_prelude_target, "->");
- if(tmp_str)
+ if(lf->generated_rule->cve)
{
- *tmp_str = '\0';
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "cve");
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, lf->generated_rule->cve);
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).meaning",
+ classification_counter);
+ snprintf(_prelude_data,256,"CVE:%s", lf->generated_rule->cve);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+ classification_counter++;
}
- add_idmef_object(idmef, "alert.target(0).Node.Address(0).address",
- new_prelude_target);
- }
- add_idmef_object(idmef, "alert.target(0).Service.name", lf->hostname);
- add_idmef_object(idmef, "alert.target(0).Service.port", lf->dstport);
- if(lf->dstuser)
- {
- add_idmef_object(idmef, "alert.target(0).User.category", "2");
- add_idmef_object(idmef, "alert.target(0).User.UserId(0).name", lf->dstuser);
- }
+ /* Rule sid is used to create a link to the rule on the OSSEC wiki */
+ if(lf->generated_rule->sigid)
+ {
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "vendor-specific");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ snprintf(_prelude_data,256,"Rule:%d",lf->generated_rule->sigid);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).meaning",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "OSSEC Rule Wiki Documentation");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).url",
+ classification_counter);
+ snprintf(_prelude_data, 256,"http://www.ossec.net/wiki/Rule:%d",
+ lf->generated_rule->sigid);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+
+ classification_counter++;
+ }
+
+ /* Extended Info Details */
+ for (last_info_detail = lf->generated_rule->info_details;
+ last_info_detail != NULL;
+ last_info_detail = last_info_detail->next)
+ {
+ if (last_info_detail->type == RULEINFODETAIL_LINK)
+ {
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "vendor-specific");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ snprintf(_prelude_data,256,"Rule:%d link",lf->generated_rule->sigid);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).url",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, last_info_detail->data);
+
+ classification_counter++;
+ }
+ else if(last_info_detail->type == RULEINFODETAIL_TEXT)
+ {
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "vendor-specific");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ snprintf(_prelude_data,256,"Rule:%d info",lf->generated_rule->sigid);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).meaning",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, last_info_detail->data);
+ classification_counter++;
+ }
+ else
+ {
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ switch(last_info_detail->type)
+ {
+ case RULEINFODETAIL_CVE:
+ add_idmef_object(idmef, _prelude_section, "cve");
+ break;
+ case RULEINFODETAIL_OSVDB:
+ add_idmef_object(idmef, _prelude_section, "osvdb");
+ break;
+ case RULEINFODETAIL_BUGTRACK:
+ add_idmef_object(idmef, _prelude_section, "bugtraqid");
+ break;
+ default:
+ add_idmef_object(idmef, _prelude_section, "vendor-specific");
+ break;
+ }
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, last_info_detail->data);
+ }
+ }
+ /* Break ok the list of groups on the "," boundry
+ * For each section create a prelude reference classification
+ * that points back to the the OSSEC wiki for more infomation.
+ */
+ if(lf->generated_rule->group)
+ {
+ char *copy_group;
+ char new_generated_rule_group[256];
+ new_generated_rule_group[255] = '\0';
+ strncpy(new_generated_rule_group, lf->generated_rule->group, 255);
+ copy_group = strtok(new_generated_rule_group, ",");
+ while (copy_group) {
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).origin",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "vendor-specific");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).name",
+ classification_counter);
+ snprintf(_prelude_data,256,"Group:%s",copy_group);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).meaning",
+ classification_counter);
+ add_idmef_object(idmef, _prelude_section, "OSSEC Group Wiki Documenation");
+
+ snprintf(_prelude_section,128,"alert.classification.reference(%d).url",
+ classification_counter);
+ snprintf(_prelude_data,256,"http://www.ossec.net/wiki/Group:%s",
+ copy_group);
+ add_idmef_object(idmef, _prelude_section, _prelude_data);
+
+ classification_counter++;
+ copy_group = strtok(NULL, ",");
+ }
+ }
+ } /* end classification block */
+
+
+
+ /* Begin Node infomation block */
+ {
+ /* Setting source info. */
+ add_idmef_object(idmef, "alert.source(0).Spoofed", "no");
+ add_idmef_object(idmef, "alert.source(0).Node.Address(0).address",
+ lf->srcip);
+ add_idmef_object(idmef, "alert.source(0).Service.port", lf->srcport);
+
+ if(lf->srcuser)
+ {
+ add_idmef_object(idmef, "alert.source(0).User.UserId(0).name", lf->srcuser);
+ }
+
+
+ /* Setting target */
+ add_idmef_object(idmef, "alert.target(0).Service.name", lf->program_name);
+ add_idmef_object(idmef, "alert.target(0).Spoofed", "no");
+
+ if(lf->dstip)
+ {
+ add_idmef_object(idmef, "alert.target(0).Node.Address(0).address",
+ lf->dstip);
+ }
+ else
+ {
+ char *tmp_str;
+ char new_prelude_target[256];
+
+ new_prelude_target[255] = '\0';
+ strncpy(new_prelude_target, lf->hostname, 255);
+
+ /* The messages can have the file, so we need to remove it.
+ * formats can be:
+ * enigma->/var/log/authlog
+ * (esqueleto2) 192.168.2.99->/var/log/squid/access.log
+ */
+ tmp_str = strstr(new_prelude_target, "->");
+ if(tmp_str)
+ {
+ *tmp_str = '\0';
+ }
+ add_idmef_object(idmef, "alert.target(0).Node.Address(0).address",
+ new_prelude_target);
+ }
+ add_idmef_object(idmef, "alert.target(0).Service.name", lf->hostname);
+ add_idmef_object(idmef, "alert.target(0).Service.port", lf->dstport);
+
+ if(lf->dstuser)
+ {
+ add_idmef_object(idmef, "alert.target(0).User.category", "2");
+ add_idmef_object(idmef, "alert.target(0).User.UserId(0).name", lf->dstuser);
+ }
+ } /* end Node infomation block */
+
+
/* Setting source file. */
add_idmef_object(idmef, "alert.additional_data(0).type", "string");
add_idmef_object(idmef, "alert.additional_data(0).meaning", "Source file");
add_idmef_object(idmef, "alert.additional_data(0).data", lf->location);
+ additional_data_counter++;
/* Setting full log. */
add_idmef_object(idmef, "alert.additional_data(1).type", "string");
add_idmef_object(idmef, "alert.additional_data(1).meaning", "Full Log");
add_idmef_object(idmef, "alert.additional_data(1).data", lf->full_log);
+ additional_data_counter++;
idmef_alert_set_analyzer(idmef_message_get_alert(idmef),
idmef_analyzer_ref
(prelude_client_get_analyzer(prelude_client)),
IDMEF_LIST_PREPEND);
+ debug1("%s: DEBUG: lf->filename = %s.", ARGV0, lf->filename);
+ if (lf->filename) {
+ FileAccess_PreludeLog(idmef,
+ 0,
+ lf->filename,
+ lf->md5_before,
+ lf->sha1_before,
+ lf->owner_before,
+ lf->gowner_before,
+ lf->perm_before);
+ FileAccess_PreludeLog(idmef,
+ 1,
+ lf->filename,
+ lf->md5_after,
+ lf->sha1_after,
+ lf->owner_after,
+ lf->gowner_after,
+ lf->perm_after);
+ debug1("%s: DEBUG: done with alert.target(0).file(1)", ARGV0);
+ }
+ debug1("%s: DEBUG: Sending IDMEF alert", ARGV0);
prelude_client_send_idmef(prelude_client, idmef);
+ debug1("%s: DEBUG: destroying IDMEF alert", ARGV0);
idmef_message_destroy(idmef);
}
-/* $Id: prelude.h,v 1.6 2009/06/24 17:06:22 dcid Exp $ */
+/* $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* More details at the LICENSE file included with OSSEC or
-/* @(#) $Id: rules.c,v 1.79 2009/11/04 18:45:37 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
return;
}
-
-
/* Rules_OP_ReadRules, v0.3, 2005/03/21
* Read the log rules.
* v0.3: Fixed many memory problems.
char *xml_status = "status";
char *xml_action = "action";
char *xml_compiled = "compiled_rule";
-
+
+ char *xml_list = "list";
+ char *xml_list_lookup = "lookup";
+ char *xml_list_field = "field";
+ char *xml_list_cvalue = "check_value";
+ char *xml_match_key = "match_key";
+ char *xml_not_match_key = "not_match_key";
+ char *xml_match_key_value = "match_key_value";
+ char *xml_address_key = "address_match_key";
+ char *xml_not_address_key = "not_address_match_key";
+ char *xml_address_key_value = "address_match_key_value";
+
char *xml_if_sid = "if_sid";
char *xml_if_group = "if_group";
char *xml_if_level = "if_level";
char *xml_same_user = "same_user";
char *xml_same_location = "same_location";
char *xml_same_id = "same_id";
+ char *xml_dodiff = "check_diff";
char *xml_different_url = "different_url";
int default_timeframe = 360;
- /* Building the rule file name + path */
- i = strlen(RULEPATH) + strlen(rulefile) + 2;
- rulepath = (char *)calloc(i,sizeof(char));
- if(!rulepath)
+ /* If no directory in the rulefile add the default */
+ if((strchr(rulefile, '/')) == NULL)
{
- ErrorExit(MEM_ERROR,ARGV0);
+ /* Building the rule file name + path */
+ i = strlen(RULEPATH) + strlen(rulefile) + 2;
+ rulepath = (char *)calloc(i,sizeof(char));
+ if(!rulepath)
+ {
+ ErrorExit(MEM_ERROR,ARGV0);
+ }
+ snprintf(rulepath,i,"%s/%s",RULEPATH,rulefile);
+ }
+ else
+ {
+ os_strdup(rulefile, rulepath);
+ debug1("%s is the rulefile", rulefile);
+ debug1("Not modifing the rule path");
}
- snprintf(rulepath,i,"%s/%s",RULEPATH,rulefile);
i = 0;
/* Rule elements block */
{
int k = 0;
+ int info_type = 0;
+ int count_info_detail = 0;
+ RuleInfoDetail *last_info_detail = NULL;
char *regex = NULL;
char *match = NULL;
char *url = NULL;
return(-1);
}
}
+ else if(strcasecmp(rule_opt[k]->element,xml_cve)==0)
+ {
+ if(config_ruleinfo->info_details == NULL)
+ {
+ config_ruleinfo->info_details = zeroinfodetails(RULEINFODETAIL_CVE,
+ rule_opt[k]->content);
+ }
+ else
+ {
+ for (last_info_detail = config_ruleinfo->info_details;
+ last_info_detail->next != NULL;
+ last_info_detail = last_info_detail->next)
+ {
+ count_info_detail++;
+ }
+ /* Silently Drop info messages if their are more then MAX_RULEINFODETAIL */
+ if (count_info_detail <= MAX_RULEINFODETAIL)
+ {
+ last_info_detail->next = zeroinfodetails(RULEINFODETAIL_CVE,
+ rule_opt[k]->content);
+ }
+ }
+
+ /* keep old methods for now */
+ config_ruleinfo->cve=
+ loadmemory(config_ruleinfo->cve,
+ rule_opt[k]->content);
+ }
else if(strcasecmp(rule_opt[k]->element,xml_info)==0)
{
+
+ info_type = get_info_attributes(rule_opt[k]->attributes,
+ rule_opt[k]->values);
+ debug1("info_type = %d", info_type);
+
+ if(config_ruleinfo->info_details == NULL)
+ {
+ config_ruleinfo->info_details = zeroinfodetails(info_type,
+ rule_opt[k]->content);
+ }
+ else
+ {
+ for (last_info_detail = config_ruleinfo->info_details;
+ last_info_detail->next != NULL;
+ last_info_detail = last_info_detail->next) {
+ count_info_detail++;
+ }
+ /* Silently Drop info messages if their are more then MAX_RULEINFODETAIL */
+ if (count_info_detail <= MAX_RULEINFODETAIL) {
+ last_info_detail->next = zeroinfodetails(info_type, rule_opt[k]->content);
+ }
+ }
+
+
+ /* keep old methods for now */
config_ruleinfo->info=
loadmemory(config_ruleinfo->info,
rule_opt[k]->content);
loadmemory(config_ruleinfo->group,
rule_opt[k]->content);
}
- else if(strcasecmp(rule_opt[k]->element,xml_cve)==0)
- {
- config_ruleinfo->cve=
- loadmemory(config_ruleinfo->cve,
- rule_opt[k]->content);
- }
else if(strcasecmp(rule_opt[k]->element,xml_comment)==0)
{
char *newline;
loadmemory(config_ruleinfo->action,
rule_opt[k]->content);
}
+ else if(strcasecmp(rule_opt[k]->element,xml_list)==0)
+ {
+ debug1("-> %s == %s",rule_opt[k]->element, xml_list);
+ if (rule_opt[k]->attributes && rule_opt[k]->values && rule_opt[k]->content)
+ {
+ int list_att_num=0;
+ int rule_type=0;
+ OSMatch *matcher=NULL;
+ int lookup_type = LR_STRING_MATCH;
+ while(rule_opt[k]->attributes[list_att_num])
+ {
+ if(strcasecmp(rule_opt[k]->attributes[list_att_num], xml_list_lookup) == 0)
+ {
+ if(strcasecmp(rule_opt[k]->values[list_att_num],xml_match_key) == 0)
+ lookup_type = LR_STRING_MATCH;
+ else if(strcasecmp(rule_opt[k]->values[list_att_num],xml_not_match_key)==0)
+ lookup_type = LR_STRING_NOT_MATCH;
+ else if(strcasecmp(rule_opt[k]->values[list_att_num],xml_match_key_value)==0)
+ lookup_type = LR_STRING_MATCH_VALUE;
+ else if(strcasecmp(rule_opt[k]->values[list_att_num],xml_address_key)==0)
+ lookup_type = LR_ADDRESS_MATCH;
+ else if(strcasecmp(rule_opt[k]->values[list_att_num],xml_not_address_key)==0)
+ lookup_type = LR_ADDRESS_NOT_MATCH;
+ else if(strcasecmp(rule_opt[k]->values[list_att_num],xml_address_key_value)==0)
+ lookup_type = LR_ADDRESS_MATCH_VALUE;
+ else
+ {
+ merror(INVALID_CONFIG, ARGV0,
+ rule_opt[k]->element,
+ rule_opt[k]->content);
+ merror("%s: List match lookup=\"%s\" is not valid.",
+ ARGV0,rule_opt[k]->values[list_att_num]);
+ return(-1);
+ }
+ }
+ else if(strcasecmp(rule_opt[k]->attributes[list_att_num], xml_list_field)==0)
+ {
+ if(strcasecmp(rule_opt[k]->values[list_att_num],xml_srcip)==0)
+ rule_type = RULE_SRCIP;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_srcport)==0)
+ rule_type = RULE_SRCPORT;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_dstip)==0)
+ rule_type = RULE_DSTIP;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_dstport)==0)
+ rule_type = RULE_DSTPORT;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_user)==0)
+ rule_type = RULE_USER;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_url)==0)
+ rule_type = RULE_URL;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_id)==0)
+ rule_type = RULE_ID;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_hostname)==0)
+ rule_type = RULE_HOSTNAME;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_program_name)==0)
+ rule_type = RULE_PROGRAM_NAME;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_status)==0)
+ rule_type = RULE_STATUS;
+ else if (strcasecmp(rule_opt[k]->values[list_att_num],xml_action)==0)
+ rule_type = RULE_ACTION;
+ else
+ {
+ merror(INVALID_CONFIG, ARGV0,
+ rule_opt[k]->element,
+ rule_opt[k]->content);
+ merror("%s: List match field=\"%s\" is not valid.",
+ ARGV0,rule_opt[k]->values[list_att_num]);
+ return(-1);
+ }
+ }
+ else if(strcasecmp(rule_opt[k]->attributes[list_att_num], xml_list_cvalue)==0)
+ {
+ os_calloc(1, sizeof(OSMatch), matcher);
+ if(!OSMatch_Compile(rule_opt[k]->values[list_att_num], matcher, 0))
+ {
+ merror(INVALID_CONFIG, ARGV0,
+ rule_opt[k]->element,
+ rule_opt[k]->content);
+ merror(REGEX_COMPILE,
+ ARGV0,
+ rule_opt[k]->values[list_att_num],
+ matcher->error);
+ return(-1);
+ }
+ }
+ else
+ {
+ merror("%s:List feild=\"%s\" is not valid",ARGV0,
+ rule_opt[k]->values[list_att_num]);
+ merror(INVALID_CONFIG, ARGV0,
+ rule_opt[k]->element, rule_opt[k]->content);
+ return(-1);
+ }
+ list_att_num++;
+ }
+ if(rule_type == 0)
+ {
+ merror("%s:List requires the field=\"\" Attrubute",ARGV0);
+ merror(INVALID_CONFIG, ARGV0,
+ rule_opt[k]->element, rule_opt[k]->content);
+ return(-1);
+ }
+
+ /* Wow it's all ready - this seams too complex to get to this point */
+ config_ruleinfo->lists = OS_AddListRule(config_ruleinfo->lists,
+ lookup_type,
+ rule_type,
+ rule_opt[k]->content,
+ matcher);
+ if (config_ruleinfo->lists == NULL)
+ {
+ merror("%s: List error: Could not load %s", ARGV0, rule_opt[k]->content);
+ return(-1);
+ }
+ }
+ else
+ {
+ merror("%s:List must have a correctly formatted feild attribute",
+ ARGV0);
+ merror(INVALID_CONFIG,
+ ARGV0,
+ rule_opt[k]->element,
+ rule_opt[k]->content);
+ return(-1);
+ }
+ /* xml_list eval is done */
+ }
else if(strcasecmp(rule_opt[k]->element,xml_url)==0)
{
url=
config_ruleinfo->alert_opts |= SAME_EXTRAINFO;
}
else if(strcasecmp(rule_opt[k]->element,
+ xml_dodiff)==0)
+ {
+ config_ruleinfo->context++;
+ config_ruleinfo->context_opts|= SAME_DODIFF;
+ if(!(config_ruleinfo->alert_opts & DO_EXTRAINFO))
+ config_ruleinfo->alert_opts |= DO_EXTRAINFO;
+ }
+ else if(strcasecmp(rule_opt[k]->element,
xml_same_dst_port) == 0)
{
config_ruleinfo->context_opts|= SAME_DSTPORT;
config_ruleinfo->alert_opts &=0xfff-DO_LOGALERT;
}
}
+ else if(strcmp("no_ar", rule_opt[k]->content) == 0)
+ {
+ if(!(config_ruleinfo->alert_opts & NO_AR))
+ {
+ config_ruleinfo->alert_opts|= NO_AR;
+ }
+ }
else
{
merror(XML_VALUEERR, ARGV0, xml_options,
}
else if(config_ruleinfo->context)
{
- config_ruleinfo->event_search =
+ if((config_ruleinfo->context == 1) &&
+ (config_ruleinfo->context_opts & SAME_DODIFF))
+ {
+ config_ruleinfo->context = 0;
+ }
+ else
+ {
+ config_ruleinfo->event_search =
(void *)Search_LastEvents;
+ }
}
} /* while(rule[j]) */
}
+RuleInfoDetail *zeroinfodetails(int type, char *data)
+{
+ RuleInfoDetail *info_details_pt = NULL;
+
+ info_details_pt = (RuleInfoDetail *)calloc(1,sizeof(RuleInfoDetail));
+
+ if (info_details_pt == NULL)
+ {
+ ErrorExit(MEM_ERROR,ARGV0);
+ }
+ /* type */
+ info_details_pt->type = type;
+
+ /* data */
+ os_strdup(data, info_details_pt->data);
+
+ info_details_pt->next = NULL;
+
+
+ return(info_details_pt);
+}
+
+
RuleInfo *zerorulemember(int id, int level,
int maxsize, int frequency,
int timeframe, int noalert,
ruleinfo_pt->comment = NULL;
ruleinfo_pt->info = NULL;
ruleinfo_pt->cve = NULL;
+ ruleinfo_pt->info_details = NULL;
ruleinfo_pt->if_sid = NULL;
ruleinfo_pt->if_group = NULL;
ruleinfo_pt->event_search = NULL;
ruleinfo_pt->compiled_rule = NULL;
+ ruleinfo_pt->lists = NULL;
return(ruleinfo_pt);
}
+int get_info_attributes(char **attributes, char **values)
+{
+ char *xml_type = "type";
+ int k=0;
+ if(!attributes)
+ return(RULEINFODETAIL_TEXT);
+
+ while(attributes[k])
+ {
+ if (!values[k])
+ {
+ merror("rules_op: Entry info type \"%s\" does not have a value",
+ attributes[k]);
+ return (-1);
+ }
+ else if(strcasecmp(attributes[k],xml_type) == 0)
+ {
+ if(strcmp(values[k], "text") == 0)
+ {
+ return(RULEINFODETAIL_TEXT);
+ }
+ else if(strcmp(values[k], "link") == 0)
+ {
+ return(RULEINFODETAIL_LINK);
+ }
+ else if(strcmp(values[k], "cve") == 0)
+ {
+ return(RULEINFODETAIL_CVE);
+ }
+ else if(strcmp(values[k], "osvdb") == 0)
+ {
+ return(RULEINFODETAIL_OSVDB);
+ }
+ }
+ }
+ return(RULEINFODETAIL_TEXT);
+}
/* Get the attributes */
int getattributes(char **attributes, char **values,
return;
}
+ /* No AR when options no_ar is set */
+ if(rule_config->alert_opts & NO_AR)
+ {
+ return;
+ }
+
if(!active_responses)
{
return;
-/* @(#) $Id: rules.h,v 1.41 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "shared.h"
#include "active-response.h"
+#include "lists.h"
+
/* Event context - stored on a uint8 */
#define SAME_USER 0x001 /* 1 */
#define DIFFERENT_URL 0x010 /* */
#define SAME_SRCPORT 0x020
#define SAME_DSTPORT 0x040
+#define SAME_DODIFF 0x100
#define NOT_SAME_USER 0xffe /* 0xfff - 0x001 */
#define NOT_SAME_SRCIP 0xffd /* 0xfff - 0x002 */
#define NOT_SAME_ID 0xffb /* 0xfff - 0x004 */
#define DO_FTS 0x001
#define DO_MAILALERT 0x002
#define DO_LOGALERT 0x004
+#define NO_AR 0x008
#define NO_ALERT 0x010
#define DO_OVERWRITE 0x020
#define DO_PACKETINFO 0x040
#define DO_EXTRAINFO 0x100
#define SAME_EXTRAINFO 0x200
+#define RULE_MASTER 1
+#define RULE_SRCIP 2
+#define RULE_SRCPORT 4
+#define RULE_DSTIP 8
+#define RULE_DSTPORT 16
+#define RULE_USER 32
+#define RULE_URL 64
+#define RULE_ID 128
+#define RULE_HOSTNAME 256
+#define RULE_PROGRAM_NAME 512
+#define RULE_STATUS 1024
+#define RULE_ACTION 2048
+
+
+#define RULEINFODETAIL_TEXT 0
+#define RULEINFODETAIL_LINK 1
+#define RULEINFODETAIL_CVE 2
+#define RULEINFODETAIL_OSVDB 3
+#define RULEINFODETAIL_BUGTRACK 4
+
+#define MAX_RULEINFODETAIL 32
+
+typedef struct _RuleInfoDetail
+{
+ int type;
+ char *data;
+ struct _RuleInfoDetail *next;
+}RuleInfoDetail;
typedef struct _RuleInfo
{
char *comment; /* description in the xml */
char *info;
char *cve;
+ RuleInfoDetail *info_details;
+ ListRule *lists;
char *if_sid;
char *if_level;
RuleInfo *currently_rule; /* */
+RuleInfoDetail *zeroinfodetails(int type, char *data);
+int get_info_attributes(char **attributes, char **values);
+
/* RuleInfo functions */
RuleInfo *zerorulemember(int id,
int level,
-/* @(#) $Id: rules_list.c,v 1.28 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
r_node->ruleinfo->maxsize = newrule->maxsize;
r_node->ruleinfo->frequency = newrule->frequency;
r_node->ruleinfo->timeframe = newrule->timeframe;
+ r_node->ruleinfo->ignore_time = newrule->ignore_time;
r_node->ruleinfo->group = newrule->group;
r_node->ruleinfo->match = newrule->match;
-/* @(#) $Id: stats.c,v 1.30 2009/06/24 17:06:22 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: testrule.c,v 1.7 2009/08/25 11:30:57 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#define ARGV0 "ossec-testrule"
#endif
+
+
#include "shared.h"
#include "alerts/alerts.h"
#include "config.h"
#include "rules.h"
#include "stats.h"
+
#include "eventinfo.h"
#include "analysisd.h"
/** Internal Functions **/
-void OS_ReadMSG(int m_queue);
+void OS_ReadMSG(int m_queue, char *ut_str);
RuleInfo *OS_CheckIfRuleMatch(Eventinfo *lf, RuleNode *curr_node);
/* For rules */
void Rules_OP_CreateRules();
+void Lists_OP_CreateLists();
int Rules_OP_ReadRules(char * cfgfile);
int _setlevels(RuleNode *node, int nnode);
int AddHash_Rule(RuleNode *node);
*/
int main(int argc, char **argv)
{
+ int t_config = 0;
int c = 0, m_queue = 0;
+ char *ut_str = NULL;
+
char *dir = DEFAULTDIR;
char *user = USER;
char *group = GROUPGLOBAL;
today = 0;
prev_year = 0;
full_output = 0;
+ alert_only = 0;
+
active_responses = NULL;
memset(prev_month, '\0', 4);
- while((c = getopt(argc, argv, "Vfdhu:g:D:c:")) != -1){
+ while((c = getopt(argc, argv, "VatfdhU:u:g:D:c:")) != -1){
switch(c){
case 'V':
print_version();
break;
+ case 't':
+ t_config = 1;
+ break;
case 'h':
help(ARGV0);
break;
case 'd':
nowDebug();
break;
+ case 'U':
+ if(!optarg)
+ ErrorExit("%s: -U needs an argument",ARGV0);
+ ut_str = optarg;
+ break;
case 'u':
if(!optarg)
ErrorExit("%s: -u needs an argument",ARGV0);
ErrorExit("%s: -c needs an argument",ARGV0);
cfg = optarg;
break;
+ case 'a':
+ alert_only = 1;
+ break;
case 'f':
full_output = 1;
break;
}
+
+
/* Reading configuration file */
if(GlobalConf(cfg) < 0)
{
ErrorExit(CHROOT_ERROR,ARGV0,dir);
-
- /* Reading decoders */
- OS_CreateOSDecoderList();
- if(!ReadDecodeXML("etc/decoder.xml"))
+ /*
+ * Anonymous Section: Load rules, decoders, and lists
+ *
+ * As lists require two pass loading of rules that make use of list lookups
+ * are created with blank database structs, and need to be filled in after
+ * completion of all rules and lists.
+ */
{
- ErrorExit(CONFIG_ERROR, ARGV0, XML_DECODER);
- }
+ { /* Lad decders */
+ /* Initializing the decoders list */
+ OS_CreateOSDecoderList();
+
+ if(!Config.decoders)
+ { /* Legacy loading */
+ /* Reading decoders */
+ if(!ReadDecodeXML("etc/decoder.xml"))
+ {
+ ErrorExit(CONFIG_ERROR, ARGV0, XML_DECODER);
+ }
- c = ReadDecodeXML("etc/local_decoder.xml");
- if(!c)
- {
- if((c != -2))
- ErrorExit(CONFIG_ERROR, ARGV0, XML_LDECODER);
- }
- SetDecodeXML();
+ /* Reading local ones. */
+ c = ReadDecodeXML("etc/local_decoder.xml");
+ if(!c)
+ {
+ if((c != -2))
+ ErrorExit(CONFIG_ERROR, ARGV0, XML_LDECODER);
+ }
+ else
+ {
+ verbose("%s: INFO: Reading local decoder file.", ARGV0);
+ }
+ }
+ else
+ { /* New loaded based on file speified in ossec.conf */
+ char **decodersfiles;
+ decodersfiles = Config.decoders;
+ while( decodersfiles && *decodersfiles)
+ {
-
- /* Creating the rules list */
- Rules_OP_CreateRules();
+ verbose("%s: INFO: Reading decoder file %s.", ARGV0, *decodersfiles);
+ if(!ReadDecodeXML(*decodersfiles))
+ ErrorExit(CONFIG_ERROR, ARGV0, *decodersfiles);
+
+ free(*decodersfiles);
+ decodersfiles++;
+ }
+ }
-
- /* Reading the rules */
- {
- char **rulesfiles;
- rulesfiles = Config.includes;
- while(rulesfiles && *rulesfiles)
- {
- debug1("%s: INFO: Reading rules file: '%s'", ARGV0, *rulesfiles);
- if(Rules_OP_ReadRules(*rulesfiles) < 0)
- ErrorExit(RULES_ERROR, ARGV0, *rulesfiles);
-
- free(*rulesfiles);
- rulesfiles++;
+ /* Load decoders */
+ SetDecodeXML();
+ }
+ { /* Load Lists */
+ /* Initializing the lists of list struct */
+ Lists_OP_CreateLists();
+ /* Load each list into list struct */
+ {
+ char **listfiles;
+ listfiles = Config.lists;
+ while(listfiles && *listfiles)
+ {
+ verbose("%s: INFO: Reading loading the lists file: '%s'", ARGV0, *listfiles);
+ if(Lists_OP_LoadList(*listfiles) < 0)
+ ErrorExit(LISTS_ERROR, ARGV0, *listfiles);
+ free(*listfiles);
+ listfiles++;
+ }
+ free(Config.lists);
+ Config.lists = NULL;
+ }
}
+ { /* Load Rules */
+ /* Creating the rules list */
+ Rules_OP_CreateRules();
+
+ /* Reading the rules */
+ {
+ char **rulesfiles;
+ rulesfiles = Config.includes;
+ while(rulesfiles && *rulesfiles)
+ {
+ debug1("%s: INFO: Reading rules file: '%s'", ARGV0, *rulesfiles);
+ if(Rules_OP_ReadRules(*rulesfiles) < 0)
+ ErrorExit(RULES_ERROR, ARGV0, *rulesfiles);
+
+ free(*rulesfiles);
+ rulesfiles++;
+ }
- free(Config.includes);
- Config.includes = NULL;
+ free(Config.includes);
+ Config.includes = NULL;
+ }
+
+ /* Find all rules with that require list lookups and attache the
+ * the correct list struct to the rule. This keeps rules from having to
+ * search thought the list of lists for the correct file during rule evaluation.
+ */
+ OS_ListLoadRules();
+ }
}
-
+
/* Fixing the levels/accuracy */
{
}
+ if(t_config == 1)
+ {
+ exit(0);
+ }
+
/* Start up message */
verbose(STARTUP_MSG, ARGV0, getpid());
/* Going to main loop */
- OS_ReadMSG(m_queue);
+ OS_ReadMSG(m_queue, ut_str);
exit(0);
* Main function. Receives the messages(events)
* and analyze them all.
*/
-void OS_ReadMSG(int m_queue)
+void OS_ReadMSG(int m_queue, char *ut_str)
{
int i;
char msg[OS_MAXSTR +1];
+ int exit_code = 0;
+ char *ut_alertlevel = NULL;
+ char *ut_rulelevel = NULL;
+ char *ut_decoder_name = NULL;
+
+ if(ut_str)
+ {
+ /* XXX Break apart string */
+ ut_rulelevel = ut_str;
+ ut_alertlevel = strchr(ut_rulelevel, ':');
+ if(!ut_alertlevel)
+ {
+ ErrorExit("%s: -U requires the matching format to be "
+ "\"<rule_id>:<alert_level>:<decoder_name>\"", ARGV0);
+ }
+ else
+ {
+ *ut_alertlevel = '\0';
+ ut_alertlevel++;
+ }
+ ut_decoder_name = strchr(ut_alertlevel, ':');
+ if(!ut_decoder_name)
+ {
+ ErrorExit("%s: -U requires the matching format to be "
+ "\"<rule_id>:<alert_level>:<decoder_name>\"", ARGV0);
+ }
+ else
+ {
+ *ut_decoder_name = '\0';
+ ut_decoder_name++;
+ }
+ }
+
+ RuleInfoDetail *last_info_detail;
Eventinfo *lf;
}
+ __crt_ftell = 1;
+
/* Getting currently time before starting */
c_time = time(NULL);
memset(msg, '\0', OS_MAXSTR +1);
+ if(!alert_only)
print_out("%s: Type one log per line.\n", ARGV0);
/* Fixing the msg. */
- strncpy(msg, "1:a:", 5);
+ snprintf(msg, 15, "1:stdin:");
/* Receive message from queue */
- if(fgets(msg +4, OS_MAXSTR, stdin))
+ if(fgets(msg +8, OS_MAXSTR, stdin))
{
RuleNode *rulenode_pt;
/* Make sure we ignore blank lines. */
- if(strlen(msg) < 6)
+ if(strlen(msg) < 10)
{
continue;
}
- print_out("\n");
+ if(!alert_only)print_out("\n");
/* Default values for the log info */
#ifdef TESTRULE
- if(full_output)
+ if(full_output && !alert_only)
print_out("\n**Rule debugging:");
#endif
}
#ifdef TESTRULE
+ if(!alert_only)
+ {
+ char *(ruleinfodetail_text[])={"Text","Link","CVE","OSVDB","BUGTRACKID"};
print_out("\n**Phase 3: Completed filtering (rules).");
print_out(" Rule id: '%d'", currently_rule->sigid);
print_out(" Level: '%d'", currently_rule->level);
print_out(" Description: '%s'",currently_rule->comment);
+ for (last_info_detail = currently_rule->info_details; last_info_detail != NULL; last_info_detail = last_info_detail->next)
+ {
+ print_out(" Info - %s: '%s'", ruleinfodetail_text[last_info_detail->type], last_info_detail->data);
+ }
+ }
#endif
/* Log the alert if configured to ... */
if(currently_rule->alert_opts & DO_LOGALERT)
{
- print_out("**Alert to be generated.\n\n");
+ if(alert_only)
+ {
+ OS_LogOutput(lf);
+ __crt_ftell++;
+ }
+ else
+ {
+ print_out("**Alert to be generated.\n\n");
+ }
}
}while((rulenode_pt = rulenode_pt->next) != NULL);
+ if(ut_str)
+ {
+ /*setup exit code if we are doing unit testing*/
+ char holder[1024];
+ holder[1] = '\0';
+ exit_code = 3;
+ if(strcasecmp(ut_decoder_name, lf->decoder_info->name) == 0)
+ {
+ exit_code--;
+ snprintf(holder, 1023, "%d", currently_rule->sigid);
+ if(strcasecmp(ut_rulelevel, holder) == 0)
+ {
+ exit_code--;
+ snprintf(holder, 1023, "%d", currently_rule->level);
+ if(strcasecmp(ut_alertlevel, holder) == 0)
+ {
+ exit_code--;
+ printf("%d\n",exit_code);
+ }
+ }
+ }
+ }
+
/* Only clear the memory if the eventinfo was not
* added to the stateful memory
}
else
{
- exit(0);
+ exit(exit_code);
}
}
+ exit(exit_code);
return;
}
/* EOF */
+
All rights reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation
OSSEC HIDS, ossec-agent
-/* @(#) $Id: agentd.c,v 1.44 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: agentd.h,v 1.26 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: config.c,v 1.15 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: event-forward.c,v 1.14 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: intcheck_op.c,v 1.4 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: main.c,v 1.16 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: notify.c,v 1.23 2009/06/26 13:50:02 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
curr_time = time(0);
+ #ifndef ONEWAY
/* Check if the server has responded */
if((curr_time - available_server) > (3*NOTIFY_TIME))
{
verbose(SERVER_UP, ARGV0);
os_delwait();
}
+ #endif
/* Check if time has elapsed */
-/* @(#) $Id: receiver-win.c,v 1.8 2009/12/01 15:40:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: receiver.c,v 1.28 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: sendmsg.c,v 1.7 2009/12/01 20:27:00 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: start_agent.c,v 1.17 2009/12/01 15:40:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
if(logr->sock >= 0)
{
sleep(1);
- close(logr->sock);
+ CloseSocket(logr->sock);
logr->sock = -1;
if(logr->rip[1])
memset(cleartext, '\0', OS_MAXSTR +1);
memset(fmsg, '\0', OS_MAXSTR +1);
snprintf(msg, OS_MAXSTR, "%s%s", CONTROL_HEADER, HC_STARTUP);
+
+
+ #ifdef ONEWAY
+ return;
+ #endif
/* Sending start message and waiting for the ack */
-/* @(#) $Id: active-response.c,v 1.15 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: active-response.h,v 1.5 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: agentlessd-config.c,v 1.6 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: agentlessd-config.h,v 1.4 2009/06/24 17:06:24 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: config.c,v 1.25 2009/08/27 18:17:41 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
char *osremote = "remote";
char *osclient = "client";
char *oscommand = "command";
+ char *osreports = "reports";
char *osactive_response = "active-response";
XML_NODE chld_node = NULL;
chld_node = OS_GetElementsbyNode(&xml,node[i]);
-
+
if(!node[i]->element)
{
merror(XML_ELEMNULL, ARGV0);
if((modules & CAR)&&(ReadActiveResponses(chld_node, d1, d2)<0))
return(OS_INVALID);
}
+ else if(strcmp(node[i]->element, osreports) == 0)
+ {
+ if((modules & CREPORTS)&&(Read_CReports(chld_node, d1, d2)<0))
+ return(OS_INVALID);
+ }
else
{
merror(XML_INVELEM, ARGV0, node[i]->element);
return(OS_INVALID);
}
+ //printf("before\n");
OS_ClearNode(chld_node);
+ //printf("after\n");
i++;
}
{
if(modules & CAGENT_CONFIG)
{
+ #ifndef CLIENT
+ merror(XML_ERROR, ARGV0, cfgfile, xml.err, xml.err_line);
+ #endif
}
else
{
{
if(strcmp(xml_agent_name, node[i]->attributes[attrs]) == 0)
{
+ #ifdef CLIENT
char *agentname = os_read_agent_name();
if(!agentname)
}
free(agentname);
}
+ #endif
}
else if(strcmp(xml_agent_os, node[i]->attributes[attrs]) == 0)
{
+ #ifdef CLIENT
char *agentos = getuname();
if(agentos)
passed_agent_test = 0;
merror("%s: ERROR: Unable to retrieve uname.", ARGV0);
}
+ #endif
}
else if(strcmp(xml_agent_overwrite, node[i]->attributes[attrs]) == 0)
{
-/* @(#) $Id: config.h,v 1.14 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
#define CDBD 0002000
#define CSYSLOGD 0004000
#define CAGENTLESS 0020000
+#define CREPORTS 0040000
#define CAGENT_CONFIG 0010000
int Read_Client(XML_NODE node, void *d1, void *d2);
int ReadActiveResponses(XML_NODE node, void *d1, void *d2);
int ReadActiveCommands(XML_NODE node, void *d1, void *d2);
+int Read_CReports(XML_NODE node, void *config1, void *config2);
void AssignIgnore_Global(char **ignores, void *configp);
-/* @(#) $Id: csyslogd-config.c,v 1.3 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: csyslogd-config.h,v 1.3 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: dbd-config.c,v 1.7 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: dbd-config.h,v 1.9 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: email-alerts-config.c,v 1.10 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: global-config.c,v 1.24 2009/07/23 19:31:35 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: global-config.h,v 1.16 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/* List of rules */
char **includes;
+ /* List of Lists */
+ char **lists;
+
+ /* List of decoders */
+ char **decoders;
+
/* Global rule hash. */
void *g_rules_hash;
-/* @(#) $Id: localfile-config.c,v 1.25 2009/11/03 21:07:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
char *xml_localfile_location = "location";
char *xml_localfile_command = "command";
char *xml_localfile_logformat = "log_format";
-
+ char *xml_localfile_frequency = "frequency";
+ char *xml_localfile_alias = "alias";
logreader *logf;
logreader_config *log_config;
logf = log_config->config;
logf[0].file = NULL;
logf[0].command = NULL;
+ logf[0].alias = NULL;
logf[0].logformat = NULL;
logf[1].file = NULL;
logf[1].command = NULL;
+ logf[1].alias = NULL;
logf[1].logformat = NULL;
}
else
logf = log_config->config;
logf[pl +1].file = NULL;
logf[pl +1].command = NULL;
+ logf[pl +1].alias = NULL;
logf[pl +1].logformat = NULL;
}
logf[pl].file = NULL;
logf[pl].command = NULL;
+ logf[pl].alias = NULL;
logf[pl].logformat = NULL;
logf[pl].fp = NULL;
logf[pl].ffile = NULL;
logf[pl].djb_program_name = NULL;
-
+ logf[pl].ign = 360;
+
/* Searching for entries related to files */
i = 0;
os_strdup(node[i]->content, logf[pl].file);
logf[pl].command = logf[pl].file;
}
+ else if(strcmp(node[i]->element,xml_localfile_frequency) == 0)
+ {
+ if(!OS_StrIsNum(node[i]->content))
+ {
+ merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
+ return(OS_INVALID);
+ }
+
+ logf[pl].ign = atoi(node[i]->content);
+ }
else if(strcmp(node[i]->element,xml_localfile_location) == 0)
{
#ifdef WIN32
logf = log_config->config;
logf[pl].file = NULL;
+ logf[pl].alias = NULL;
logf[pl].logformat = NULL;
logf[pl].fp = NULL;
logf[pl].ffile = NULL;
logf[pl +1].file = NULL;
+ logf[pl +1].alias = NULL;
logf[pl +1].logformat = NULL;
/* We can not increment the file count in here */
if(strcmp(logf[pl].logformat, "syslog") == 0)
{
}
+ else if(strcmp(logf[pl].logformat, "generic") == 0)
+ {
+ }
else if(strcmp(logf[pl].logformat, "snort-full") == 0)
{
}
else if(strcmp(logf[pl].logformat, "command") == 0)
{
}
+ else if(strcmp(logf[pl].logformat, "full_command") == 0)
+ {
+ }
+ else if(strncmp(logf[pl].logformat, "multi-line", 10) == 0)
+ {
+ int x = 0;
+ logf[pl].logformat+=10;
+
+ while(logf[pl].logformat[0] == ' ')
+ logf[pl].logformat++;
+
+ if(logf[pl].logformat[0] != ':')
+ {
+ merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
+ return(OS_INVALID);
+ }
+ logf[pl].logformat++;
+
+ while(*logf[pl].logformat == ' ')
+ logf[pl].logformat++;
+
+ while(logf[pl].logformat[x] >= '0' && logf[pl].logformat[x] <= '9')
+ x++;
+
+ while(logf[pl].logformat[x] == ' ')
+ x++;
+
+ if(logf[pl].logformat[x] != '\0')
+ {
+ merror(XML_VALUEERR,ARGV0,node[i]->element,node[i]->content);
+ return(OS_INVALID);
+ }
+ }
else if(strcmp(logf[pl].logformat, EVENTLOG) == 0)
{
}
return(OS_INVALID);
}
}
+ else if(strcasecmp(node[i]->element,xml_localfile_alias) == 0)
+ {
+ os_strdup(node[i]->content, logf[pl].alias);
+ }
else
{
merror(XML_INVELEM, ARGV0, node[i]->element);
}
}
- if(strcmp(logf[pl].logformat, "command") == 0)
+ if((strcmp(logf[pl].logformat, "command") == 0)||
+ (strcmp(logf[pl].logformat, "full_command") == 0))
{
if(!logf[pl].command)
{
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
char *logformat;
char *djb_program_name;
char *command;
-
+ char *alias;
+
void (*read)(int i, int *rc, int drop_it);
FILE *fp;
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+/* Functions to handle the configuration files
+ */
+
+
+#include "shared.h"
+#include "reports-config.h"
+
+
+/* Filter argument. */
+static int _filter_arg(char *mystr)
+{
+ if(!mystr)
+ {
+ return(0);
+ }
+
+ while(*mystr)
+ {
+ if((*mystr >= 'a' && *mystr <= 'z') ||
+ (*mystr >= 'A' && *mystr <= 'Z') ||
+ (*mystr >= '0' && *mystr <= '9') ||
+ *mystr == '-' || *mystr == '_')
+ {
+ mystr++;
+ }
+ else
+ {
+ *mystr = '-';
+ mystr++;
+ }
+ }
+
+ return(1);
+}
+
+
+int Read_CReports(XML_NODE node, void *config, void *config2)
+{
+ int i = 0,s = 0;
+
+ /* XML definitions */
+ char *xml_title = "title";
+ char *xml_type = "type";
+ char *xml_categories = "category";
+ char *xml_group = "group";
+ char *xml_rule = "rule";
+ char *xml_level = "level";
+ char *xml_location = "location";
+ char *xml_showlogs = "showlogs";
+ char *xml_srcip = "srcip";
+ char *xml_user = "user";
+ char *xml_frequency = "frequency";
+ char *xml_email = "email_to";
+
+
+ monitor_config *mon_config = (monitor_config *)config;
+
+
+ /* Getting any configured entry. */
+ if(mon_config->reports)
+ {
+ while(mon_config->reports[s])
+ s++;
+ }
+
+
+ /* Allocating the memory for the config. */
+ os_realloc(mon_config->reports, (s + 2) * sizeof(report_config *),
+ mon_config->reports);
+ os_calloc(1, sizeof(report_config), mon_config->reports[s]);
+ mon_config->reports[s + 1] = NULL;
+
+
+ /* Zeroing the elements. */
+ mon_config->reports[s]->title = NULL;
+ mon_config->reports[s]->args = NULL;
+ mon_config->reports[s]->relations = NULL;
+ mon_config->reports[s]->type = NULL;
+ mon_config->reports[s]->emailto = NULL;
+
+ mon_config->reports[s]->r_filter.group = NULL;
+ mon_config->reports[s]->r_filter.rule = NULL;
+ mon_config->reports[s]->r_filter.level = NULL;
+ mon_config->reports[s]->r_filter.location = NULL;
+ mon_config->reports[s]->r_filter.srcip = NULL;
+ mon_config->reports[s]->r_filter.user = NULL;
+ mon_config->reports[s]->r_filter.related_group = 0;
+ mon_config->reports[s]->r_filter.related_rule = 0;
+ mon_config->reports[s]->r_filter.related_level = 0;
+ mon_config->reports[s]->r_filter.related_location = 0;
+ mon_config->reports[s]->r_filter.related_srcip = 0;
+ mon_config->reports[s]->r_filter.related_user = 0;
+ mon_config->reports[s]->r_filter.report_name = NULL;
+ mon_config->reports[s]->r_filter.show_alerts = 0;
+
+
+
+ /* Reading the XML. */
+ while(node[i])
+ {
+ if(!node[i]->element)
+ {
+ merror(XML_ELEMNULL, __local_name);
+ return(OS_INVALID);
+ }
+ else if(!node[i]->content)
+ {
+ merror(XML_VALUENULL, __local_name, node[i]->element);
+ return(OS_INVALID);
+ }
+ else if(strcmp(node[i]->element, xml_title) == 0)
+ {
+ if(!mon_config->reports[s]->title)
+ {
+ os_strdup(node[i]->content, mon_config->reports[s]->title);
+ }
+ }
+ else if(strcmp(node[i]->element, xml_type) == 0)
+ {
+ if(strcmp(node[i]->content, "email") == 0)
+ {
+ if(!mon_config->reports[s]->type)
+ {
+ os_strdup(node[i]->content, mon_config->reports[s]->type);
+ }
+ }
+ else
+ {
+ merror(XML_VALUEERR, __local_name,node[i]->element,node[i]->content);
+ }
+ }
+ else if(strcmp(node[i]->element, xml_frequency) == 0)
+ {
+ }
+ else if(strcmp(node[i]->element, xml_showlogs) == 0)
+ {
+ if(strcasecmp(node[i]->content, "yes") == 0)
+ {
+ mon_config->reports[s]->r_filter.show_alerts = 1;
+ }
+ }
+ else if(strcmp(node[i]->element, xml_categories) == 0)
+ {
+ char *ncat = NULL;
+ _filter_arg(node[i]->content);
+
+
+ os_strdup(node[i]->content, ncat);
+
+ if(os_report_configfilter("group", ncat,
+ &mon_config->reports[s]->r_filter, REPORT_FILTER) < 0)
+ {
+ merror(CONFIG_ERROR, __local_name, "user argument");
+ }
+ }
+ else if((strcmp(node[i]->element, xml_group) == 0)||
+ (strcmp(node[i]->element, xml_rule) == 0)||
+ (strcmp(node[i]->element, xml_level) == 0)||
+ (strcmp(node[i]->element, xml_location) == 0)||
+ (strcmp(node[i]->element, xml_srcip) == 0)||
+ (strcmp(node[i]->element, xml_user) == 0))
+ {
+ int reportf = REPORT_FILTER;
+ char *ncat = NULL;
+ _filter_arg(node[i]->content);
+
+ if(node[i]->attributes && node[i]->values)
+ {
+ if(node[i]->attributes[0] && node[i]->values[0])
+ {
+ if(strcmp(node[i]->attributes[0], "type") == 0)
+ {
+ if(strcmp(node[i]->values[0], "relation") == 0)
+ {
+ reportf = REPORT_RELATED;
+ }
+ else
+ {
+ merror("%s: WARN: Invalid value for 'relation' attribute: '%s'. (ignored).", __local_name, node[i]->values[0]);
+ i++;
+ continue;
+ }
+ }
+ else
+ {
+ merror("%s: WARN: Invalid attribute: %s (ignored). ", __local_name, node[i]->attributes[0]);
+ i++;
+ continue;
+ }
+ }
+ }
+
+ os_strdup(node[i]->content, ncat);
+
+ if(os_report_configfilter(node[i]->element, ncat,
+ &mon_config->reports[s]->r_filter, reportf) < 0)
+ {
+ merror("%s: Invalid filter: %s:%s (ignored).", __local_name, node[i]->element, node[i]->content);
+ }
+ }
+ else if(strcmp(node[i]->element, xml_email) == 0)
+ {
+ mon_config->reports[s]->emailto = os_AddStrArray(node[i]->content, mon_config->reports[s]->emailto);
+ }
+ else
+ {
+ merror(XML_INVELEM, __local_name, node[i]->element);
+ return(OS_INVALID);
+ }
+ i++;
+ }
+
+
+ /* Setting proper report type. */
+ mon_config->reports[s]->r_filter.report_type = REPORT_TYPE_DAILY;
+
+ if(mon_config->reports[s]->emailto == NULL)
+ {
+ if(mon_config->reports[s]->title)
+ merror("%s: No \"email to\" configured for the report '%s'. Ignoring it.", __local_name, mon_config->reports[s]->title);
+ else
+ merror("%s: No \"email to\" and title configured for report. Ignoring it.", __local_name);
+ }
+
+ if(!mon_config->reports[s]->title)
+ {
+ os_strdup("OSSEC Report (unnamed)", mon_config->reports[s]->title);
+ }
+ mon_config->reports[s]->r_filter.report_name = mon_config->reports[s]->title;
+
+ return(0);
+}
+
+
+/* EOF */
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+#ifndef _REPORTSCONFIG_H
+#define _REPORTSCONFIG_H
+
+#include "report_op.h"
+
+
+/* Structure for the report. */
+typedef struct _report_config
+{
+ char *title;
+ char *args;
+ char *relations;
+ char *type;
+ char **emailto;
+ report_filter r_filter;
+}report_config;
+
+typedef struct _monitor_config
+{
+ short int day_wait;
+ short int compress;
+ short int sign;
+ short int monitor_agents;
+ int a_queue;
+
+ char *smtpserver;
+ char *emailfrom;
+
+ char **agents;
+ report_config **reports;
+}monitor_config;
+
+
+
+#endif
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: rules-config.c,v 1.5 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "global-config.h"
+
+static int cmpr(const void *a, const void *b) {
+ /*printf("%s - %s\n", *(char **)a, *(char **)b);*/
+ return strcmp(*(char **)a, *(char **)b);
+}
+
+static int file_in_list(int list_size, char *f_name, char *d_name, char **alist)
+{
+ int i = 0;
+ for(i=0; i<(list_size-1); i++)
+ {
+ if((strcmp(alist[i], f_name) == 0 || strcmp(alist[i], d_name) == 0))
+ {
+ return(1);
+ }
+ }
+ return(0);
+}
+
int Read_Rules(XML_NODE node, void *configp, void *mailp)
{
int i = 0;
- /* White list size */
int rules_size = 1;
+ int lists_size = 1;
+ int decoders_size = 1;
+
+
+ char path[PATH_MAX +2];
+ char f_name[PATH_MAX +2];
+ int start_point = 0;
+ int att_count = 0;
+ struct dirent *entry;
+ DIR *dfd;
+ OSRegex regex;
/* XML definitions */
char *xml_rules_include = "include";
+ char *xml_rules_rule = "rule";
+ char *xml_rules_rules_dir = "rule_dir";
+ char *xml_rules_lists = "list";
+ char *xml_rules_lists_dir = "list_dir";
+ char *xml_rules_decoders = "decoder";
+ char *xml_rules_decoders_dir = "decoder_dir";
_Config *Config;
return(OS_INVALID);
}
/* Mail notification */
- else if(strcmp(node[i]->element, xml_rules_include) == 0)
+ else if((strcmp(node[i]->element, xml_rules_include) == 0) ||
+ (strcmp(node[i]->element, xml_rules_rule) == 0))
{
rules_size++;
Config->includes = realloc(Config->includes,
os_strdup(node[i]->content,Config->includes[rules_size -2]);
Config->includes[rules_size -1] = NULL;
+ debug1("adding rule: %s", node[i]->content);
+ }
+ else if(strcmp(node[i]->element, xml_rules_decoders) == 0)
+ {
+ decoders_size++;
+ Config->decoders = realloc(Config->decoders,
+ sizeof(char *)*decoders_size);
+ if(!Config->decoders)
+ {
+ merror(MEM_ERROR, ARGV0);
+ return(OS_INVALID);
+ }
+
+ os_strdup(node[i]->content,Config->decoders[decoders_size -2]);
+ Config->decoders[decoders_size -1] = NULL;
+ debug1("adding decoder: %s", node[i]->content);
+ }
+ else if(strcmp(node[i]->element, xml_rules_lists) == 0)
+ {
+ lists_size++;
+ Config->lists = realloc(Config->lists,
+ sizeof(char *)*lists_size);
+ if(!Config->lists)
+ {
+ merror(MEM_ERROR, ARGV0);
+ return(OS_INVALID);
+ }
+ os_strdup(node[i]->content,Config->lists[lists_size -2]);
+ Config->lists[lists_size -1] = NULL;
+
+ }
+ else if(strcmp(node[i]->element, xml_rules_lists) == 0)
+ {
+ lists_size++;
+ Config->lists = realloc(Config->lists,
+ sizeof(char *)*lists_size);
+ if(!Config->lists)
+ {
+ merror(MEM_ERROR, ARGV0);
+ return(OS_INVALID);
+ }
+ os_strdup(node[i]->content,Config->lists[lists_size -2]);
+ Config->lists[lists_size -1] = NULL;
+
+ }
+ else if(strcmp(node[i]->element, xml_rules_decoders_dir) == 0)
+ {
+
+ if(node[i]->attributes && node[i]->values)
+ {
+ while(node[i]->attributes[att_count])
+ {
+ if((strcasecmp(node[i]->attributes[att_count], "pattern") == 0))
+ {
+ if(node[i]->values[att_count])
+ {
+ if(!OSRegex_Compile(node[i]->values[att_count], ®ex, 0))
+ {
+ merror(CONFIG_ERROR, ARGV0, "pattern in decoders_dir does not compile");
+ merror("%s: ERROR: Regex would not compile", ARGV0);
+ return(-1);
+ }
+ }
+ }
+ att_count++;
+ }
+ }
+ else
+ {
+ OSRegex_Compile(".xml$", ®ex, 0);
+ }
+
+ #ifdef TESTRULE
+ snprintf(path,PATH_MAX +1,"%s", node[i]->content);
+ #else
+ snprintf(path,PATH_MAX +1,"%s/%s", DEFAULTDIR, node[i]->content);
+ #endif
+
+ f_name[PATH_MAX +1] = '\0';
+ dfd = opendir(path);
+
+ if(dfd != NULL) {
+ start_point = decoders_size- 1;
+ while((entry = readdir(dfd)) != NULL)
+ {
+ snprintf(f_name, PATH_MAX +1, "%s/%s", node[i]->content, entry->d_name);
+
+ /* Just ignore . and .. */
+ if((strcmp(entry->d_name,".") == 0) || (strcmp(entry->d_name,"..") == 0))
+ continue;
+
+ /* no dups allowed */
+ if(file_in_list(decoders_size, f_name, entry->d_name, Config->decoders))
+ continue;
+
+ if(OSRegex_Execute(f_name, ®ex))
+ {
+ decoders_size++;
+ Config->decoders= realloc(Config->decoders, sizeof(char *)*decoders_size);
+ if(!Config->decoders)
+ {
+ merror(MEM_ERROR, ARGV0);
+ return(-1);
+ }
+
+ os_strdup(f_name, Config->decoders[decoders_size -2]);
+ Config->decoders[decoders_size -1] = NULL;
+ debug1("adding decoder: %s", f_name);
+ }
+ else
+ {
+ debug1("Regex does not match \"%s\"", f_name);
+ }
+ }
+
+ closedir(dfd);
+ /* Sort just then newly added items */
+ qsort(Config->decoders + start_point , decoders_size- start_point -1, sizeof(char *), cmpr);
+ }
+ int ii=0;
+ debug1("decoders_size %d", decoders_size);
+ for(ii=0;ii<decoders_size-1;ii++)
+ debug1("- %s", Config->decoders[ii]);
+ }
+ else if(strcmp(node[i]->element, xml_rules_rules_dir) == 0)
+ {
+ if(node[i]->attributes && node[i]->values)
+ {
+ while(node[i]->attributes[att_count])
+ {
+ if((strcasecmp(node[i]->attributes[att_count], "pattern") == 0))
+ {
+ if(node[i]->values[att_count])
+ {
+ if(!OSRegex_Compile(node[i]->values[att_count], ®ex, 0))
+ {
+ merror(CONFIG_ERROR, ARGV0, "pattern in rules_dir does not compile");
+ merror("%s: ERROR: Regex would not compile", ARGV0);
+ return(-1);
+ }
+ }
+ }
+ att_count++;
+ }
+ }
+ else
+ {
+ OSRegex_Compile(".xml$", ®ex, 0);
+ }
+
+ #ifdef TESTRULE
+ snprintf(path,PATH_MAX +1,"%s", node[i]->content);
+ #else
+ snprintf(path,PATH_MAX +1,"%s/%s", DEFAULTDIR, node[i]->content);
+ #endif
+
+ f_name[PATH_MAX +1] = '\0';
+ dfd = opendir(path);
+
+ if(dfd != NULL) {
+ start_point = rules_size - 1;
+ while((entry = readdir(dfd)) != NULL)
+ {
+ snprintf(f_name, PATH_MAX +1, "%s/%s", node[i]->content, entry->d_name);
+
+ /* Just ignore . and .. */
+ if((strcmp(entry->d_name,".") == 0) || (strcmp(entry->d_name,"..") == 0))
+ continue;
+
+ /* no dups allowed */
+ if(file_in_list(rules_size, f_name, entry->d_name, Config->includes))
+ continue;
+
+ if(OSRegex_Execute(f_name, ®ex))
+ {
+ rules_size++;
+ Config->includes = realloc(Config->includes, sizeof(char *)*rules_size);
+ if(!Config->includes)
+ {
+ merror(MEM_ERROR, ARGV0);
+ return(-1);
+ }
+
+ os_strdup(f_name, Config->includes[rules_size -2]);
+ Config->includes[rules_size -1] = NULL;
+ debug1("adding rule: %s", f_name);
+ }
+ else
+ {
+ debug1("Regex does not match \"%s\"", f_name);
+ }
+ }
+
+ closedir(dfd);
+ /* Sort just then newly added items */
+ qsort(Config->includes + start_point , rules_size - start_point -1, sizeof(char *), cmpr);
+ }
}
else
{
-/* @(#) $Id: syscheck-config.c,v 1.25 2009/11/04 15:18:59 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-int dump_syscheck_entry(config *syscheck, char *entry, int vals, int reg)
+int dump_syscheck_entry(config *syscheck, char *entry, int vals, int reg, char *restrictfile)
{
int pl = 0;
os_calloc(2, sizeof(int), syscheck->opts);
syscheck->opts[pl + 1] = 0;
- syscheck->opts[pl] = vals;
+ syscheck->opts[pl] = vals;
+
+ os_calloc(2, sizeof(OSMatch *), syscheck->filerestrict);
+ syscheck->filerestrict[pl] = NULL;
+ syscheck->filerestrict[pl + 1] = NULL;
}
else
{
syscheck->opts);
syscheck->opts[pl + 1] = 0;
syscheck->opts[pl] = vals;
+
+ os_realloc(syscheck->filerestrict, (pl +2) * sizeof(char *),
+ syscheck->filerestrict);
+ syscheck->filerestrict[pl] = NULL;
+ syscheck->filerestrict[pl + 1] = NULL;
+ }
+ if(restrictfile)
+ {
+ os_calloc(1, sizeof(OSMatch), syscheck->filerestrict[pl]);
+ if(!OSMatch_Compile(restrictfile, syscheck->filerestrict[pl], 0))
+ {
+ OSMatch *ptm;
+
+ ptm = syscheck->filerestrict[pl];
+
+ merror(REGEX_COMPILE, ARGV0, restrictfile,
+ ptm->error);
+ free(syscheck->filerestrict[pl]);
+ syscheck->filerestrict[pl] = NULL;
+ }
}
}
}
/* Adding new entry */
- dump_syscheck_entry(syscheck, tmp_entry, 0, 1);
+ dump_syscheck_entry(syscheck, tmp_entry, 0, 1, NULL);
/* Next entry */
char *xml_check_group = "check_group";
char *xml_check_perm = "check_perm";
char *xml_real_time = "realtime";
+ char *xml_report_changes = "report_changes";
+ char *xml_restrict = "restrict";
+ char *restrictfile = NULL;
char **dir;
char *tmp_str;
dir = OS_StrBreak(',', dirs, MAX_DIR_SIZE); /* Max number */
char **values = NULL;
tmp_dir = *dir;
+ restrictfile = NULL;
/* Removing spaces at the beginning */
while(*tmp_dir == ' ')
return(0);
}
}
+ else if(strcmp(*attrs, xml_report_changes) == 0)
+ {
+ if(strcmp(*values, "yes") == 0)
+ {
+ opts|=CHECK_SEECHANGES;
+ }
+ else if(strcmp(*values, "no") == 0)
+ {
+ }
+ else
+ {
+ merror(SK_INV_OPT, ARGV0, *values, *attrs);
+ return(0);
+ }
+ }
+ else if(strcmp(*attrs, xml_restrict) == 0)
+ {
+ os_strdup(*values, restrictfile);
+ }
else
{
merror(SK_INV_ATTR, ARGV0, *attrs);
if(opts == 0)
{
merror(SYSCHECK_NO_OPT, ARGV0, dirs);
+ if(restrictfile) free(restrictfile);
return(0);
}
while(g.gl_pathv[gindex])
{
- dump_syscheck_entry(syscheck, g.gl_pathv[gindex], opts, 0);
+ dump_syscheck_entry(syscheck, g.gl_pathv[gindex], opts, 0, restrictfile);
gindex++;
}
else
{
- dump_syscheck_entry(syscheck, tmp_dir, opts, 0);
+ dump_syscheck_entry(syscheck, tmp_dir, opts, 0, restrictfile);
}
#else
- dump_syscheck_entry(syscheck, tmp_dir, opts, 0);
+ dump_syscheck_entry(syscheck, tmp_dir, opts, 0, restrictfile);
#endif
+
+ if(restrictfile)
+ {
+ free(restrictfile);
+ restrictfile = NULL;
+ }
/* Next entry */
-/* @(#) $Id: syscheck-config.h,v 1.20 2009/10/02 19:28:34 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#define CHECK_GROUP 0000020
#define CHECK_SHA1SUM 0000040
#define CHECK_REALTIME 0000100
+#define CHECK_SEECHANGES 0000200
#include <stdio.h>
void **ignore_regex;
char **dir;
+ void **filerestrict;
/* Windows only registry checking */
#ifdef WIN32
FILE *reg_fp;
#endif
- FILE *fp;
+ void *fp;
rtfim *realtime;
-/* @(#) $Id: error_messages.h,v 1.88 2009/06/24 17:06:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#define UNLINK_ERROR "%s(1123): ERROR: Unable to delete file: '%s'."
#define RENAME_ERROR "%s(1124): ERROR: Unable to rename file: '%s'."
#define INT_ERROR "%s(1125): ERROR: Internal error (undefined)."
+#define OPEN_ERROR "%s(1126): ERROR: Unable to open file '%s' reason '%s'"
/* COMMON ERRORS */
#define SEND_ERROR "%s(1218): ERROR: Unable to send message to %s."
#define RULESLOAD_ERROR "%s(1219): ERROR: Unable to access the rules directory."
#define RULES_ERROR "%s(1220): ERROR: Error loading the rules: '%s'."
+#define LISTS_ERROR "%s(1221): ERROR: Error loading the list: '%s'."
#define QUEUE_SEND "%s(1224): ERROR: Error sending message to queue."
#define SIGNAL_RECV "%s(1225): INFO: SIGNAL Received. Exit Cleaning..."
#define XML_ERROR "%s(1226): ERROR: Error reading XML file '%s': %s (line %d)."
#define SERVER_UNAV "%s: WARN: Server unavailable. Setting lock."
#define SERVER_UP "%s: INFO: Server responded. Releasing lock."
-
/* Ossec alert messages */
#define OS_AD_STARTED "ossec: Ossec started."
#define OS_AG_STARTED "ossec: Agent started: '%s->%s'."
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: adler32.c,v 1.1 2006/06/13 16:50:58 dcid Exp $ */
+/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: compress.c,v 1.2 2006/08/11 14:49:04 dcid Exp $ */
+/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
* factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
*/
-/* @(#) $Id: crc32.c,v 1.1 2006/06/13 16:50:58 dcid Exp $ */
+/* @(#) $Id$ */
/*
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
*
*/
-/* @(#) $Id: deflate.c,v 1.1 2006/06/13 16:50:58 dcid Exp $ */
+/* @(#) $Id$ */
#include "deflate.h"
subject to change. Applications should only use zlib.h.
*/
-/* @(#) $Id: deflate.h,v 1.1 2006/06/13 16:50:58 dcid Exp $ */
+/* @(#) $Id$ */
#ifndef DEFLATE_H
#define DEFLATE_H
* Compile this file with -DNO_GZCOMPRESS to avoid the compression code.
*/
-/* @(#) $Id: gzio.c,v 1.2 2006/08/09 00:42:42 dcid Exp $ */
+/* @(#) $Id$ */
#include <stdio.h>
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
-/* @(#) $Id: trees.c,v 1.1 2006/06/13 16:50:59 dcid Exp $ */
+/* @(#) $Id$ */
/* #define GEN_TREES_H */
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: uncompr.c,v 1.2 2006/08/17 00:41:20 dcid Exp $ */
+/* @(#) $Id$ */
#define ZLIB_INTERNAL
#include "zlib.h"
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: zconf.h,v 1.1 2006/06/13 16:50:59 dcid Exp $ */
+/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: zconf.in.h,v 1.1 2006/06/13 16:50:59 dcid Exp $ */
+/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: zutil.c,v 1.1 2006/06/13 16:51:00 dcid Exp $ */
+/* @(#) $Id$ */
#include "zutil.h"
subject to change. Applications should only use zlib.h.
*/
-/* @(#) $Id: zutil.h,v 1.1 2006/06/13 16:51:00 dcid Exp $ */
+/* @(#) $Id$ */
#ifndef ZUTIL_H
#define ZUTIL_H
-/* @(#) $Id: agent_op.h,v 1.3 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: ar.h,v 1.7 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: debug_op.h,v 1.10 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: defs.h,v 1.77 2009/11/23 18:52:44 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
/* Some Global names */
#define __name "OSSEC HIDS"
-#define __version "v2.3"
+#define __version "v2.5.1"
#define __author "Trend Micro Inc."
#define __contact "contact@ossec.net"
#define __site "http://www.ossec.net"
#define __license "\
This program is free software; you can redistribute it and/or modify\n\
-it under the terms of the GNU General Public License (version 3) as \n\
+it under the terms of the GNU General Public License (version 2) as \n\
published by the Free Software Foundation. For more details, go to \n\
http://www.ossec.net/main/license/\n"
-/* @(#) $Id: dirtree_op.h,v 1.3 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: file-queue.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: file_op.h,v 1.14 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: hash_op.h,v 1.4 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
*/
void *OSHash_Get(OSHash *self, char *key);
+int OSHash_setSize(OSHash *self, int new_size);
#endif
-/* @(#) $Id: help.h,v 1.7 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: list_op.h,v 1.12 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: math_op.h,v 1.3 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: mem_op.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "shared.h"
+void **os_AddPtArray(void *pt, void **array);
+char **os_AddStrArray(char *str, char **array);
void os_FreeArray(char *ch1, char **ch2);
int os_IsStrOnArray(char *str, char **array);
char *os_LoadString(char *at, char *str);
-/* @(#) $Id: mq_op.h,v 1.10 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_err.h,v 1.7 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: privsep_op.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: pthreads_op.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: rc.h,v 1.10 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read-agents.h,v 1.12 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read-alert.h,v 1.7 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: regex_op.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: report_op.h,v 1.2 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#define REPORT_REL_RULE 0x010
#define REPORT_REL_GROUP 0x020
#define REPORT_REL_LOCATION 0x040
+#define REPORT_TYPE_DAILY 0x100
char *rule;
char *level;
char *location;
+ char *user;
+ char *srcip;
+ char *filename;
void *top_user;
void *top_srcip;
int related_rule;
int related_group;
int related_location;
+
+ int report_type;
+ int show_alerts;
+ void *fp;
}report_filter;
-/* @(#) $Id: rules_op.h,v 1.3 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#define DIFFERENT_URL 0x010 /* */
#define SAME_SRCPORT 0x020
#define SAME_DSTPORT 0x040
+#define SAME_DODIFF 0x100
#define NOT_SAME_USER 0xffe /* 0xfff - 0x001 */
#define NOT_SAME_SRCIP 0xffd /* 0xfff - 0x002 */
#define NOT_SAME_ID 0xffb /* 0xfff - 0x004 */
#define DO_FTS 0x001
#define DO_MAILALERT 0x002
#define DO_LOGALERT 0x004
+#define NO_AR 0x008
#define NO_ALERT 0x010
#define DO_OVERWRITE 0x020
#define DO_PACKETINFO 0x040
-/* @(#) $Id: sec.h,v 1.20 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: shared.h,v 1.47 2009/09/17 18:47:23 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
typedef int sock2len_t;
#endif
-/* For Windows (so high maintenance :)) */
+
+#ifndef WIN32
+#define CloseSocket(x) close(x)
+#endif
+
+
+/* For Windows */
#ifdef WIN32
typedef int uid_t;
typedef int gid_t;
#define srandom(x) srand(x)
#define random(x) rand(x)
#define lstat(x,y) stat(x,y)
+#define CloseSocket(x) closesocket(x)
void WinSetError();
typedef unsigned short int u_int16_t;
typedef unsigned char u_int8_t;
-/* @(#) $Id: sig_op.h,v 1.6 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: store_op.h,v 1.8 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: validate_op.h,v 1.13 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: wait_op.h,v 1.4 2009/06/24 17:06:26 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
### Do not modify bellow here ###
NAME="OSSEC HIDS"
-VERSION="v2.3"
+VERSION="v2.5.1"
AUTHOR="Trend Micro Inc."
DAEMONS="ossec-logcollector ossec-syscheckd ossec-agentd ossec-execd"
done
}
-
-# Start function
-start()
+testconfig()
{
- SDAEMONS="ossec-execd ossec-agentd ossec-logcollector ossec-syscheckd"
-
- echo "Starting $NAME $VERSION (by $AUTHOR)..."
- lock;
- checkpid;
-
# We first loop to check the config.
for i in ${SDAEMONS}; do
${DIR}/bin/${i} -t;
exit 1;
fi
done
+}
+
+# Start function
+start()
+{
+ SDAEMONS="ossec-execd ossec-agentd ossec-logcollector ossec-syscheckd"
+
+ echo "Starting $NAME $VERSION (by $AUTHOR)..."
+ lock;
+ checkpid;
+
# We actually start them now.
for i in ${SDAEMONS}; do
case "$1" in
start)
+ testconfig
start
;;
stop)
stopa
;;
restart)
+ testconfig
stopa
start
;;
checkconfig() {
- CONFIGFILE="${CONFIGFILE:-/var/ossec/etc/ossec.conf}"
+ CONFIGFILE="${CONFIGFILE:-${DIRECTORY}/etc/ossec.conf}"
if [ ! -r "${CONFIGFILE}" ]; then
eerror "Unable to read configuration file: ${CONFIGFILE}"
return 1
NAME="OSSEC HIDS"
-VERSION="v2.3"
+VERSION="v2.5.1"
AUTHOR="Trend Micro Inc."
DAEMONS="ossec-monitord ossec-logcollector ossec-syscheckd ossec-analysisd ossec-maild ossec-execd ${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON}"
{
if [ "X$2" = "X" ]; then
echo ""
- echo "Enable options: database, client-syslog, agentless"
- echo "Usage: $0 enable [database|client-syslog|agentless]"
+ echo "Enable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 enable [database|client-syslog|agentless|debug]"
exit 1;
fi
echo "CSYSLOG_DAEMON=ossec-csyslogd" >> ${PLIST};
elif [ "X$2" = "Xagentless" ]; then
echo "AGENTLESS_DAEMON=ossec-agentlessd" >> ${PLIST};
+ elif [ "X$2" = "Xdebug" ]; then
+ echo "DEBUG_CLI=\"-d\"" >> ${PLIST};
else
echo ""
echo "Invalid enable option."
echo ""
- echo "Enable options: database, client-syslog, agentless"
- echo "Usage: $0 enable [database|client-syslog|agentless]"
+ echo "Enable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 enable [database|client-syslog|agentless|debug]"
exit 1;
fi
{
if [ "X$2" = "X" ]; then
echo ""
- echo "Disable options: database, client-syslog, agentless"
- echo "Usage: $0 disable [database|client-syslog|agentless]"
+ echo "Disable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 disable [database|client-syslog|agentless,debug]"
exit 1;
fi
echo "CSYSLOG_DAEMON=\"\"" >> ${PLIST};
elif [ "X$2" = "Xagentless" ]; then
echo "AGENTLESS_DAEMON=\"\"" >> ${PLIST};
+ elif [ "X$2" = "Xdebug" ]; then
+ echo "DEBUG_CLI=\"\"" >> ${PLIST};
else
echo ""
echo "Invalid disable option."
echo ""
- echo "Disable options: database, client-syslog, agentless"
- echo "Usage: $0 disable [database|client-syslog|agentless]"
+ echo "Disable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 disable [database|client-syslog|agentless|debug]"
exit 1;
fi
done
}
+testconfig()
+{
+ # We first loop to check the config.
+ for i in ${SDAEMONS}; do
+ ${DIR}/bin/${i} -t ${DEBUG_CLI};
+ if [ $? != 0 ]; then
+ echo "${i}: Configuration error. Exiting"
+ unlock;
+ exit 1;
+ fi
+ done
+}
+
# Start function
start()
SDAEMONS="${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON} ossec-maild ossec-execd ossec-analysisd ossec-logcollector ossec-syscheckd ossec-monitord"
echo "Starting $NAME $VERSION (by $AUTHOR)..."
+ ${DIR}/bin/ossec-logtest -t
+ if [ ! $? = 0 ]; then
+ echo "ossec-analysisd: Configuration error. Exiting."
+ fi
+
lock;
checkpid;
- # We first loop to check the config.
- for i in ${SDAEMONS}; do
- ${DIR}/bin/${i} -t;
- if [ $? != 0 ]; then
- echo "${i}: Configuration error. Exiting"
- unlock;
- exit 1;
- fi
- done
# We actually start them now.
for i in ${SDAEMONS}; do
pstatus ${i};
if [ $? = 0 ]; then
- ${DIR}/bin/${i};
+ ${DIR}/bin/${i} ${DEBUG_CLI};
if [ $? != 0 ]; then
unlock;
exit 1;
case "$1" in
start)
+ testconfig
start
;;
stop)
stopa
;;
restart)
+ testconfig
stopa
start
;;
NAME="OSSEC HIDS"
-VERSION="v2.3"
+VERSION="v2.5.1"
AUTHOR="Trend Micro Inc."
DAEMONS="ossec-monitord ossec-logcollector ossec-remoted ossec-syscheckd ossec-analysisd ossec-maild ossec-execd ${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON}"
{
if [ "X$2" = "X" ]; then
echo ""
- echo "Enable options: database, client-syslog, agentless"
- echo "Usage: $0 enable [database|client-syslog|agentless]"
+ echo "Enable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 enable [database|client-syslog|agentless|debug]"
exit 1;
fi
echo "CSYSLOG_DAEMON=ossec-csyslogd" >> ${PLIST};
elif [ "X$2" = "Xagentless" ]; then
echo "AGENTLESS_DAEMON=ossec-agentlessd" >> ${PLIST};
+ elif [ "X$2" = "Xdebug" ]; then
+ echo "DEBUG_CLI=\"-d\"" >> ${PLIST};
else
echo ""
echo "Invalid enable option."
echo ""
- echo "Enable options: database, client-syslog, agentless"
- echo "Usage: $0 enable [database|client-syslog|agentless]"
+ echo "Enable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 enable [database|client-syslog|agentless|debug]"
exit 1;
fi
{
if [ "X$2" = "X" ]; then
echo ""
- echo "Disable options: database, client-syslog, agentless"
- echo "Usage: $0 disable [database|client-syslog|agentless]"
+ echo "Disable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 disable [database|client-syslog|agentless|debug]"
exit 1;
fi
echo "CSYSLOG_DAEMON=\"\"" >> ${PLIST};
elif [ "X$2" = "Xagentless" ]; then
echo "AGENTLESS_DAEMON=\"\"" >> ${PLIST};
+ elif [ "X$2" = "Xdebug" ]; then
+ echo "DEBUG_CLI=\"\"" >> ${PLIST};
else
echo ""
echo "Invalid disable option."
echo ""
- echo "Disable options: database, client-syslog, agentless"
- echo "Usage: $0 disable [database|client-syslog|agentless]"
+ echo "Disable options: database, client-syslog, agentless, debug"
+ echo "Usage: $0 disable [database|client-syslog|agentless|debug]"
exit 1;
fi
done
}
+testconfig()
+{
+ # We first loop to check the config.
+ for i in ${SDAEMONS}; do
+ ${DIR}/bin/${i} -t ${DEBUG_CLI};
+ if [ $? != 0 ]; then
+ echo "${i}: Configuration error. Exiting"
+ unlock;
+ exit 1;
+ fi
+ done
+}
# Start function
start()
SDAEMONS="${DB_DAEMON} ${CSYSLOG_DAEMON} ${AGENTLESS_DAEMON} ossec-maild ossec-execd ossec-analysisd ossec-logcollector ossec-remoted ossec-syscheckd ossec-monitord"
echo "Starting $NAME $VERSION (by $AUTHOR)..."
+ ${DIR}/bin/ossec-logtest -t
+ if [ ! $? = 0 ]; then
+ echo "ossec-analysisd: Configuration error. Exiting."
+ fi
lock;
checkpid;
- # We first loop to check the config.
- for i in ${SDAEMONS}; do
- ${DIR}/bin/${i} -t;
- if [ $? != 0 ]; then
- echo "${i}: Configuration error. Exiting"
- unlock;
- exit 1;
- fi
- done
# We actually start them now.
for i in ${SDAEMONS}; do
pstatus ${i};
if [ $? = 0 ]; then
- ${DIR}/bin/${i};
+ ${DIR}/bin/${i} ${DEBUG_CLI};
if [ $? != 0 ]; then
unlock;
exit 1;
case "$1" in
start)
+ testconfig
start
;;
stop)
stopa
;;
restart)
+ testconfig
stopa
start
;;
All right reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation
OSSEC, logcollector.
-/* @(#) $Id: config.c,v 1.20 2009/06/24 18:52:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: logcollector.c,v 1.59 2009/11/03 21:07:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
int update_fname(int i);
+char *rand_keepalive_str(char *dst, int size)
+{
+ static const char text[] = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "!@#$%^&*()_+-=;'[],./?";
+ int i, len = rand() % (size - 10);
+ strncpy(dst, "--MARK--: ", 12);
+ for ( i = 10; i < len; ++i )
+ {
+ dst[i] = text[rand() % (sizeof text - 1)];
+ }
+ dst[i] = '\0';
+ return dst;
+}
+
/** void LogCollectorStart() v0.4
* Handle file management.
*/
int i = 0, r = 0;
int max_file = 0;
int f_check = 0;
+ int curr_time = 0;
+ char keepalive[1024];
+
+
/* To check for inode changes */
struct stat tmp_stat;
{
logff[i].file = NULL;
logff[i].fp = NULL;
+ logff[i].size = 0;
if(logff[i].command)
{
logff[i].read = (void *)read_command;
+
+ verbose("%s: INFO: Monitoring output of command(%d): %s", ARGV0, logff[i].ign, logff[i].command);
+
+ if(!logff[i].alias)
+ {
+ os_strdup(logff[i].command, logff[i].alias);
+ }
}
else
{
ARGV0);
}
}
+ else if(strcmp(logff[i].logformat, "full_command") == 0)
+ {
+ logff[i].file = NULL;
+ logff[i].fp = NULL;
+ logff[i].size = 0;
+ if(logff[i].command)
+ {
+ logff[i].read = (void *)read_fullcommand;
+
+ verbose("%s: INFO: Monitoring full output of command(%d): %s", ARGV0, logff[i].ign, logff[i].command);
+
+ if(!logff[i].alias)
+ os_strdup(logff[i].command, logff[i].alias);
+ }
+ else
+ {
+ merror("%s: ERROR: Missing command argument. Ignoring it.",
+ ARGV0);
+ }
+ }
else
{
}
logff[i].read = (void *)read_djbmultilog;
}
+ else if(logff[i].logformat[0] >= '0' && logff[i].logformat[0] <= '9')
+ {
+ logff[i].read = (void *)read_multiline;
+ }
else
{
logff[i].read = (void *)read_syslog;
}
#endif
}
+
+ if(logff[i].alias)
+ {
+ int ii = 0;
+ while(logff[i].alias[ii] != '\0')
+ {
+ if(logff[i].alias[ii] == ':')
+ {
+ logff[i].alias[ii] = '\\';
+ }
+ ii++;
+ }
+ }
}
if(!logff[i].fp)
{
/* Run the command. */
- if((f_check == VCHECK_FILES) && logff[i].command)
+ if(logff[i].command && (f_check %2))
{
- logff[i].read(i, &r, 0);
+ curr_time = time(0);
+ if((curr_time - logff[i].size) >= logff[i].ign)
+ {
+ logff[i].size = curr_time;
+ logff[i].read(i, &r, 0);
+ }
}
continue;
}
/* Send keep alive message */
- SendMSG(logr_queue, "--MARK--", "ossec-keepalive", LOCALFILE_MQ);
+
+ rand_keepalive_str(keepalive, 700);
+ SendMSG(logr_queue, keepalive, "ossec-keepalive", LOCALFILE_MQ);
/* Zeroing f_check */
-/* @(#) $Id: logcollector.h,v 1.28 2009/11/03 21:07:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/* Read postgresql log format */
void *read_postgresql_log(int pos, int *rc, int drop_it);
+/* read multi line logs. */
+void *read_multiline(int pos, int *rc, int drop_it);
+
/* Read DJB multilog format */
/* Initializes multilog. */
int init_djbmultilog(int pos);
/* Read events from output of command */
void *read_command(int pos, int *rc, int drop_it);
+void *read_fullcommand(int pos, int *rc, int drop_it);
#ifdef WIN32
-/* @(#) $Id: main.c,v 1.27 2009/11/18 19:07:40 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
char *dir = DEFAULTDIR;
+ /* Setuping up random */
+ #ifndef WIN32
+ #ifdef __OpenBSD__
+ srandomdev();
+ #else
+ srandom(time(0));
+ #endif
+ #else
+ srandom(time(0))
+ #endif
+
/* Setting the name */
OS_SetName(ARGV0);
-/* @(#) $Id: read_command.c,v 1.3 2009/11/05 19:55:34 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
}
- snprintf(str, 256, "ossec: output: '%s': ", logff[pos].command);
+ snprintf(str, 256, "ossec: output: '%s': ",
+ (NULL != logff[pos].alias)
+ ? logff[pos].alias
+ : logff[pos].command);
cmd_size = strlen(str);
{
*p = '\0';
}
+
+ /* Removing empty lines. */
+ #ifdef WIN32
+ if(str[0] == '\r' && str[1] == '\0')
+ {
+ continue;
+ }
+ #endif
+ if(str[0] == '\0')
+ {
+ continue;
+ }
+
debug2("%s: DEBUG: Reading command message: '%s'", ARGV0, str);
/* Sending message to queue */
if(drop_it == 0)
{
- if(SendMSG(logr_queue,str,logff[pos].command,
+ if(SendMSG(logr_queue,str,
+ (NULL != logff[pos].alias) ? logff[pos].alias : logff[pos].command,
LOCALFILE_MQ) < 0)
{
merror(QUEUE_SEND, ARGV0);
-/* @(#) $Id: read_djb_multilog.c,v 1.4 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+/* Read the syslog */
+
+
+#include "shared.h"
+#include "logcollector.h"
+
+
+
+/* Read Output of commands */
+void *read_fullcommand(int pos, int *rc, int drop_it)
+{
+ int n = 0;
+ int cmd_size = 0;
+ char *p;
+ char str[OS_MAXSTR+1];
+ char strfinal[OS_MAXSTR+1];
+
+ FILE *cmd_output;
+
+ str[OS_MAXSTR]= '\0';
+ strfinal[OS_MAXSTR]= '\0';
+ *rc = 0;
+
+
+ debug2("%s: DEBUG: Running full command '%s'", ARGV0, logff[pos].command);
+
+
+ cmd_output = popen(logff[pos].command, "r");
+ if(!cmd_output)
+ {
+ merror("%s: ERROR: Unable to execute command: '%s'.",
+ ARGV0, logff[pos].command);
+
+ logff[pos].command = NULL;
+ }
+
+
+ snprintf(str, 256, "ossec: output: '%s':\n",
+ (NULL != logff[pos].alias)
+ ? logff[pos].alias
+ : logff[pos].command);
+ cmd_size = strlen(str);
+
+ n = fread(str + cmd_size, 1, OS_MAXSTR - OS_LOG_HEADER - 256, cmd_output);
+ if(n > 0)
+ {
+ str[cmd_size +n] = '\0';
+
+ /* Getting the last occurence of \n */
+ if ((p = strrchr(str, '\n')) != NULL)
+ {
+ *p = '\0';
+ }
+
+
+ debug2("%s: DEBUG: Reading command message: '%s'", ARGV0, str);
+
+ /* Removing empty lines. */
+ n = 0;
+ p = str;
+ while(*p != '\0')
+ {
+ if(p[0] == '\r')
+ {
+ p++;
+ continue;
+ }
+
+ if(p[0] == '\n' && p[1] == '\n')
+ {
+ p++;
+ }
+ strfinal[n] = *p;
+ n++;
+ p++;
+ }
+ strfinal[n] = '\0';
+
+
+ /* Sending message to queue */
+ if(drop_it == 0)
+ {
+ if(SendMSG(logr_queue,strfinal,
+ (NULL != logff[pos].alias) ? logff[pos].alias : logff[pos].command,
+ LOCALFILE_MQ) < 0)
+ {
+ merror(QUEUE_SEND, ARGV0);
+ if((logr_queue = StartMQ(DEFAULTQPATH,WRITE)) < 0)
+ {
+ ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH);
+ }
+ }
+ }
+ }
+
+ pclose(cmd_output);
+
+ return(NULL);
+}
+
+/* EOF */
-/* @(#) $Id: read_mssql_log.c,v 1.2 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+/* Read the syslog */
+
+
+#include "shared.h"
+#include "logcollector.h"
+
+
+
+/* Read multiline logs. */
+void *read_multiline(int pos, int *rc, int drop_it)
+{
+ int __ms = 0;
+ int linecount;
+ int linesgot = 0;
+ int buffer_size = 0;
+ char *p;
+ char str[OS_MAXSTR + 1];
+ char buffer[OS_MAXSTR +1];
+
+ fpos_t fp_pos;
+
+ buffer[0] = '\0';
+ buffer[OS_MAXSTR] = '\0';
+ str[OS_MAXSTR]= '\0';
+ *rc = 0;
+
+ linecount = atoi(logff[pos].logformat);
+
+ /* Getting initial file location */
+ fgetpos(logff[pos].fp, &fp_pos);
+
+ while(fgets(str, OS_MAXSTR - OS_LOG_HEADER, logff[pos].fp) != NULL)
+ {
+ linesgot++;
+
+ /* Getting the last occurence of \n */
+ if ((p = strrchr(str, '\n')) != NULL)
+ {
+ *p = '\0';
+ }
+
+ /* If we didn't get the new line, because the
+ * size is large, send what we got so far.
+ */
+ else if(strlen(str) >= (OS_MAXSTR - OS_LOG_HEADER - 2))
+ {
+ /* Message size > maximum allowed */
+ __ms = 1;
+ }
+ else
+ {
+ /* Message not complete. Return. */
+ debug1("%s: Message not complete. Trying again: '%s'", ARGV0,str);
+ fsetpos(logff[pos].fp, &fp_pos);
+ break;
+ }
+
+ #ifdef WIN32
+ if ((p = strrchr(str, '\r')) != NULL)
+ {
+ *p = '\0';
+ }
+ #endif
+
+ debug2("%s: DEBUG: Reading message: '%s'", ARGV0, str);
+
+
+ /* Adding to buffer. */
+ buffer_size = strlen(buffer);
+ if(buffer[0] != '\0')
+ {
+ buffer[buffer_size] = ' ';
+ buffer_size++;
+ }
+
+ strncpy(buffer + buffer_size, str, OS_MAXSTR - buffer_size -2);
+
+
+ if(linesgot < linecount)
+ {
+ continue;
+ }
+
+
+ /* Sending message to queue */
+ if(drop_it == 0)
+ {
+ if(SendMSG(logr_queue, buffer, logff[pos].file,
+ LOCALFILE_MQ) < 0)
+ {
+ merror(QUEUE_SEND, ARGV0);
+ if((logr_queue = StartMQ(DEFAULTQPATH,WRITE)) < 0)
+ {
+ ErrorExit(QUEUE_FATAL, ARGV0, DEFAULTQPATH);
+ }
+ }
+ }
+
+ buffer[0] = '\0';
+
+
+ /* Incorrectly message size */
+ if(__ms)
+ {
+ merror("%s: Large message size: '%s'", ARGV0, str);
+ while(fgets(str, OS_MAXSTR - 2, logff[pos].fp) != NULL)
+ {
+ /* Getting the last occurence of \n */
+ if ((p = strrchr(str, '\n')) != NULL)
+ {
+ break;
+ }
+ }
+ __ms = 0;
+ }
+
+ fgetpos(logff[pos].fp, &fp_pos);
+ continue;
+ }
+
+ return(NULL);
+}
+
+/* EOF */
-/* @(#) $Id: read_mysql_log.c,v 1.5 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: read_nmapg.c,v 1.11 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read_postgresql_log.c,v 1.5 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: read_snortfull.c,v 1.19 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read_syslog.c,v 1.24 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read_win_el.c,v 1.21 2009/09/04 19:23:11 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
include ../Config.Make
-LOCAL = compress_log.c main.c manage_files.c monitor_agents.c monitord.c sign_log.c
+LOCAL = compress_log.c main.c manage_files.c monitor_agents.c monitord.c sign_log.c generate_reports.c ../os_maild/sendcustomemail.c
-OBJS = ${OS_SHARED} ${OS_NET} ${OS_REGEX} ${OS_CRYPTO} ${OS_ZLIB}
+OBJS = ${OS_CONFIG} ${OS_SHARED} ${OS_NET} ${OS_REGEX} ${OS_XML} ${OS_CRYPTO} ${OS_ZLIB}
mmonitor:
${CC} ${CFLAGS} ${OS_LINK} ${LOCAL} ${OBJS} -o ${NAME}
-/* @(#) $Id: compress_log.c,v 1.4 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+#include "shared.h"
+#include "monitord.h"
+int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, FILE *fp, struct tm *p);
+char *(monthss[])={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
+ "Sep","Oct","Nov","Dec"};
+
+
+void generate_reports(int cday, int cmon, int cyear,struct tm *p)
+{
+ int s = 0;
+
+ if(!mond.smtpserver)
+ {
+ return;
+ }
+
+ if(mond.reports)
+ {
+ int twait = 0;
+ int childcount = 0;
+ while(mond.reports[s])
+ {
+ pid_t pid;
+ if(mond.reports[s]->emailto == NULL)
+ {
+ s++;
+ continue;
+ }
+
+ /* We create a new process to run the report and send the email.
+ * To avoid crashing monitord if something goes wrong.
+ */
+ pid = fork();
+ if(pid < 0)
+ {
+ merror("%s: ERROR: Fork failed. cause: %d - %s", ARGV0, errno, strerror(errno));
+ s++;
+ continue;
+ }
+ else if(pid == 0)
+ {
+ char fname[256];
+ char aname[256];
+ fname[255] = '\0';
+ aname[255] = '\0';
+ snprintf(fname, 255, "/logs/.report-%d.log", getpid());
+
+ merror("%s: INFO: Starting daily reporting for '%s'", ARGV0, mond.reports[s]->title);
+ mond.reports[s]->r_filter.fp = fopen(fname, "w+");
+ if(!mond.reports[s]->r_filter.fp)
+ {
+ merror("%s: ERROR: Unable to open temporary reports file.", ARGV0);
+ s++;
+ continue;
+ }
+
+
+ /* Opening the log file. */
+ snprintf(aname, 255, "%s/%d/%s/ossec-%s-%02d.log",
+ ALERTS, cyear, monthss[cmon], "alerts", cday);
+ os_strdup(aname, mond.reports[s]->r_filter.filename);
+
+
+ /* Starting report */
+ os_ReportdStart(&mond.reports[s]->r_filter);
+ fflush(mond.reports[s]->r_filter.fp);
+
+ if(ftell(mond.reports[s]->r_filter.fp) < 10)
+ {
+ merror("%s: INFO: Report '%s' empty.", ARGV0, mond.reports[s]->title);
+ }
+ else if(OS_SendCustomEmail(mond.reports[s]->emailto, mond.reports[s]->title,
+ mond.smtpserver, mond.emailfrom, mond.reports[s]->r_filter.fp, p) != 0)
+ {
+ merror("%s: WARN: Unable to send report email.", ARGV0);
+ }
+ fclose(mond.reports[s]->r_filter.fp);
+ unlink(fname);
+ free(mond.reports[s]->r_filter.filename);
+ mond.reports[s]->r_filter.filename = NULL;
+
+ exit(0);
+ }
+ else
+ {
+ /* Sleep between each report. Time is not important in here. */
+ sleep(20);
+ childcount++;
+ }
+
+ s++;
+ }
+
+
+ while (childcount)
+ {
+ int wp;
+ wp = waitpid((pid_t) -1, NULL, WNOHANG);
+ if (wp < 0)
+ {
+ merror(WAITPID_ERROR, ARGV0);
+ }
+ else if(wp == 0)
+ {
+ /* If there is still any report left, sleep 5 and try again.*/
+ sleep(5);
+ twait++;
+
+ if(twait > 2)
+ {
+ merror("%s: WARN: Report taking too long to complete. Waiting for it to finish...", ARGV0);
+ sleep(10);
+ if(twait > 10)
+ {
+ merror("%s: WARN: Report took too long. Moving on...", ARGV0);
+ break;
+ }
+ }
+ }
+ else
+ {
+ childcount--;
+ }
+ }
+ }
+ return;
+}
+
+/* EOF */
-/* @(#) $Id: main.c,v 1.9 2009/11/18 19:07:40 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "shared.h"
+#include "config/config.h"
#include "monitord.h"
+#include "os_net/os_net.h"
int main(int argc, char **argv)
mond.monitor_agents = getDefine_Int("monitord","monitor_agents",0,1);
mond.agents = NULL;
+ mond.smtpserver = NULL;
+ mond.emailfrom = NULL;
+
+
+ c = 0;
+ c|= CREPORTS;
+ if(ReadConfig(c, cfg, &mond, NULL) < 0)
+ {
+ ErrorExit(CONFIG_ERROR, ARGV0, cfg);
+ }
+
+ /* If we have any reports configured, read smtp/emailfrom */
+ if(mond.reports)
+ {
+ OS_XML xml;
+ char *tmpsmtp;
+
+ char *(xml_smtp[])={"ossec_config", "global", "smtp_server", NULL};
+ char *(xml_from[])={"ossec_config", "global", "email_from", NULL};
+
+ if(OS_ReadXML(cfg, &xml) < 0)
+ {
+ ErrorExit(CONFIG_ERROR, ARGV0, cfg);
+ }
+
+ tmpsmtp = OS_GetOneContentforElement(&xml,xml_smtp);
+ mond.emailfrom = OS_GetOneContentforElement(&xml,xml_from);
+
+ if(tmpsmtp && mond.emailfrom)
+ {
+ mond.smtpserver = OS_GetHost(tmpsmtp, 5);
+ if(!mond.smtpserver)
+ {
+ merror(INVALID_SMTP, ARGV0, tmpsmtp);
+ if(mond.emailfrom) free(mond.emailfrom);
+ mond.emailfrom = NULL;
+ merror("%s: Invalid SMTP server. Disabling email reports.", ARGV0);
+ }
+ }
+ else
+ {
+ if(tmpsmtp) free(tmpsmtp);
+ if(mond.emailfrom) free(mond.emailfrom);
+
+ mond.emailfrom = NULL;
+
+ merror("%s: SMTP server or 'email from' missing. Disabling email reports.", ARGV0);
+ }
+
+ OS_ClearXML(&xml);
+ }
/* Exit here if test config is set */
-/* @(#) $Id: manage_files.c,v 1.10 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: monitor_agents.c,v 1.5 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: monitord.c,v 1.9 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/* Day changed, deal with log files */
if(today != p->tm_mday)
{
+ /* Generate reports. */
+ generate_reports(today, thismonth, thisyear, p);
+
manage_files(today, thismonth, thisyear);
today = p->tm_mday;
-/* @(#) $Id: monitord.h,v 1.7 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#ifndef ARGV0
#define ARGV0 "ossec-monitord"
#endif
-
-typedef struct _monitor_config
-{
- short int day_wait;
- short int compress;
- short int sign;
- short int monitor_agents;
- int a_queue;
- char **agents;
-}monitor_config;
+#include "config/reports-config.h"
+
/** Prototypes **/
/*manage_files */
void manage_files(int cday, int cmon, int cyear);
+/* generate reports. */
+void generate_reports(int cday, int cmon, int cyear, struct tm *p);
+
/* monitor_agents */
void monitor_agents();
-/* @(#) $Id: report.c,v 1.4 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
-/* Copyright (C) 2009 Trend Micro Inc.
+/* Copyright (C) 2010 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
r_filter.rule = NULL;
r_filter.level = NULL;
r_filter.location = NULL;
+ r_filter.srcip = NULL;
+ r_filter.user = NULL;
r_filter.related_group = 0;
r_filter.related_rule = 0;
print_version();
break;
case 'h':
- report_help(ARGV0);
+ report_help();
break;
case 'd':
nowDebug();
test_config = 1;
break;
default:
- report_help(ARGV0);
+ report_help();
break;
}
-/* @(#) $Id: sign_log.c,v 1.8 2009/06/24 17:06:27 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: md5_sha1_op.c,v 1.3 2009/06/24 17:06:28 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: md5_sha1_op.h,v 1.3 2009/06/24 17:06:28 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
SRCS = sha1_op.c
sha1_OBJS = sha1_op.o
+CC=$(GCC)
sha1:
-/* @(#) $Id: md32_common.h,v 1.2 2007/09/22 03:29:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Included on ossec */
/* crypto/md32_common.h */
-/* @(#) $Id: sha.h,v 1.1 2006/07/12 18:28:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Included on ossec */
-/* @(#) $Id: sha1_op.c,v 1.7 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: sha1_op.h,v 1.4 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: sha_locl.h,v 1.2 2007/09/22 03:29:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Included on ossec */
-/* @(#) $Id: keys.c,v 1.10 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: msgs.c,v 1.10 2009/08/10 14:27:37 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: alert.c,v 1.5 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: config.c,v 1.2 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: csyslogd.c,v 1.3 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: csyslogd.h,v 1.2 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: main.c,v 1.4 2009/11/18 19:07:40 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: alert.c,v 1.8 2009/06/24 17:06:29 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
*/
int OS_Alert_InsertDB(alert_data *al_data, DBConfig *db_config)
{
+ int i;
unsigned int s_ip = 0, d_ip = 0, location_id = 0;
int *loc_id;
- char sql_query[OS_SIZE_2048 +1];
+ char sql_query[OS_SIZE_8192 +1];
+ char *fulllog = NULL;
/* Clearing the memory before insert */
- memset(sql_query, '\0', OS_SIZE_2048 +1);
+ sql_query[0] = '\0';
+ sql_query[OS_SIZE_8192] = '\0';
/* Converting srcip to int */
/* Escaping strings */
osdb_escapestr(al_data->user);
- osdb_escapestr(al_data->log[0]);
/* We first need to insert the location */
}
+ i = 0;
+ while(al_data->log[i])
+ {
+ fulllog = os_LoadString(fulllog, al_data->log[i]);
+ i++;
+ }
+ osdb_escapestr(fulllog);
+
+
/* Inserting data */
if(db_config->db_type == POSTGDB)
{
/* On postgres we need to escape the user field. */
- snprintf(sql_query, OS_SIZE_2048,
+ snprintf(sql_query, OS_SIZE_8192,
"INSERT INTO "
"data(id, server_id, \"user\", full_log) "
"VALUES ('%u', '%u', '%s', '%s') ",
db_config->alert_id, db_config->server_id,
- al_data->user, al_data->log[0]);
+ al_data->user, fulllog);
}
else
{
- snprintf(sql_query, OS_SIZE_2048,
+ snprintf(sql_query, OS_SIZE_8192,
"INSERT INTO "
"data(id, server_id, user, full_log) "
"VALUES ('%u', '%u', '%s', '%s') ",
db_config->alert_id, db_config->server_id,
- al_data->user, al_data->log[0]);
+ al_data->user, fulllog);
}
+
+ free(fulllog);
+ fulllog = NULL;
/* Inserting into the db */
/* Generating final SQL */
- snprintf(sql_query, OS_SIZE_2048,
+ snprintf(sql_query, OS_SIZE_8192,
"INSERT INTO "
"alert(id,server_id,rule_id,timestamp,location_id,src_ip) "
"VALUES ('%u', '%u', '%u','%u', '%u', '%lu')",
-/* @(#) $Id: config.c,v 1.9 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: db_op.c,v 1.17 2009/12/01 01:49:55 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: db_op.h,v 1.7 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: dbd.c,v 1.6 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: dbd.h,v 1.6 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: main.c,v 1.17 2009/11/18 19:07:40 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-# @(#) $Id: mysql.schema,v 1.8 2009/06/24 17:06:30 dcid Exp $ */
+# @(#) $Id$ */
#
# Copyright (C) 2009 Trend Micro Inc.
# All rights reserved.
#
# This program is a free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
-# License (version 3) as published by the FSF - Free Software
+# License (version 2) as published by the FSF - Free Software
# Foundation.
#
# License details at the LICENSE file included with OSSEC or
server_id SMALLINT UNSIGNED NOT NULL,
user TEXT NOT NULL,
full_log TEXT NOT NULL,
- PRIMARY KEY (id, server_id)
+ timestamp TIMESTAMP NOT NULL,
+ PRIMARY KEY (id, server_id),
+ INDEX time (timestamp)
);
+
CREATE TABLE alert
(
--- @(#) $Id: postgresql.schema,v 1.4 2009/06/24 17:06:30 dcid Exp $ */
+-- @(#) $Id$ */
--
-- Copyright (C) 2009 Trend Micro Inc.
-- All rights reserved.
--
-- This program is a free software; you can redistribute it
-- and/or modify it under the terms of the GNU General Public
--- License (version 3) as published by the FSF - Free Software
+-- License (version 2) as published by the FSF - Free Software
-- Foundation.
--
-- License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: rules.c,v 1.9 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: server.c,v 1.7 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: config.c,v 1.14 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: exec.c,v 1.20 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: execd.c,v 1.39 2009/11/18 19:07:41 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: execd.h,v 1.12 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* More details at the LICENSE file included with OSSEC or
-/* @(#) $Id: win_execd.c,v 1.4 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: config.c,v 1.13 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: mail_list.c,v 1.6 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: mail_list.h,v 1.6 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: maild.c,v 1.34 2009/11/18 19:07:41 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: maild.h,v 1.23 2009/06/24 17:06:30 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
/* Sends an email */
int OS_Sendmail(MailConfig *mail, struct tm *p);
int OS_Sendsms(MailConfig *mail, struct tm *p, MailMsg *sms_msg);
+int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, FILE *fp, struct tm *p);
/* Mail timeout used by the file-queue */
-/* @(#) $Id: os_maild_client.c,v 1.22 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+/* Basic e-mailing operations */
+
+
+#include "shared.h"
+#include "os_net/os_net.h"
+#include "maild.h"
+
+
+/* Return codes (from SMTP server) */
+#define VALIDBANNER "220"
+#define VALIDMAIL "250"
+#define VALIDDATA "354"
+
+
+/* Default values use to connect */
+#define SMTP_DEFAULT_PORT 25
+#define HELOMSG "Helo notify.ossec.net\r\n"
+#define MAILFROM "Mail From: <%s>\r\n"
+#define RCPTTO "Rcpt To: <%s>\r\n"
+#define DATAMSG "DATA\r\n"
+#define FROM "From: OSSEC HIDS <%s>\r\n"
+#define TO "To: <%s>\r\n"
+#define CC "Cc: <%s>\r\n"
+#define SUBJECT "Subject: %s\r\n"
+#define ENDDATA "\r\n.\r\n"
+#define QUITMSG "QUIT\r\n"
+
+
+/* Error messages - Can be translated */
+#define INTERNAL_ERROR "os_maild (1760): ERROR: Memory/configuration error"
+#define BANNER_ERROR "os_sendmail(1762): WARN: Banner not received from server"
+#define HELO_ERROR "os_sendmail(1763): WARN: Hello not accepted by server"
+#define FROM_ERROR "os_sendmail(1764): WARN: Mail from not accepted by server"
+#define TO_ERROR "os_sendmail(1765): WARN: RCPT TO not accepted by server - '%s'."
+#define DATA_ERROR "os_sendmail(1766): WARN: DATA not accepted by server"
+#define END_DATA_ERROR "os_sendmail(1767): WARN: End of DATA not accepted by server"
+
+
+#define MAIL_DEBUG_FLAG 0
+#define MAIL_DEBUG(x,y,z) if(MAIL_DEBUG_FLAG) merror(x,y,z)
+
+
+
+/* OS_SendCustomEmail
+ */
+int OS_SendCustomEmail(char **to, char *subject, char *smtpserver, char *from, FILE *fp, struct tm *p)
+{
+ int socket,i = 0;
+ char *msg;
+
+ char snd_msg[128];
+ char buffer[2049];
+
+ buffer[2048] = '\0';
+
+
+ /* Connecting to the smtp server */
+ socket = OS_ConnectTCP(SMTP_DEFAULT_PORT, smtpserver);
+ if(socket < 0)
+ {
+ return(socket);
+ }
+
+
+ /* Receiving the banner */
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDBANNER, msg)))
+ {
+ merror(BANNER_ERROR);
+ if(msg)
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ MAIL_DEBUG("DEBUG: Received banner: '%s' %s", msg, "");
+ free(msg);
+
+
+
+ /* Sending HELO message */
+ OS_SendTCP(socket,HELOMSG);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDMAIL, msg)))
+ {
+ if(msg)
+ {
+ /* Ugly fix warning :) */
+ /* In some cases (with virus scans in the middle)
+ * we may get two banners. Check for that in here.
+ */
+ if(OS_Match(VALIDBANNER, msg))
+ {
+ free(msg);
+
+ /* Try again */
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDMAIL, msg)))
+ {
+ merror("%s:%s",HELO_ERROR,msg!= NULL?msg:"null");
+ if(msg)
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ }
+ else
+ {
+ merror("%s:%s",HELO_ERROR,msg);
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ }
+ else
+ {
+ merror("%s:%s",HELO_ERROR,"null");
+ close(socket);
+ return(OS_INVALID);
+ }
+ }
+
+ MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", HELOMSG, msg);
+ free(msg);
+
+
+ /* Building "Mail from" msg */
+ memset(snd_msg,'\0',128);
+ snprintf(snd_msg,127, MAILFROM, from);
+ OS_SendTCP(socket, snd_msg);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDMAIL, msg)))
+ {
+ merror(FROM_ERROR);
+ if(msg)
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", snd_msg, msg);
+ free(msg);
+
+
+ /* Building "RCPT TO" msg */
+ while(to[i])
+ {
+ memset(snd_msg,'\0',128);
+ snprintf(snd_msg,127,RCPTTO, to[i]);
+ OS_SendTCP(socket,snd_msg);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDMAIL, msg)))
+ {
+ merror(TO_ERROR, to[i]);
+ if(msg)
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", snd_msg, msg);
+ free(msg);
+
+ i++;
+ }
+
+
+ /* Sending the "DATA" msg */
+ OS_SendTCP(socket,DATAMSG);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+ if((msg == NULL)||(!OS_Match(VALIDDATA, msg)))
+ {
+ merror(DATA_ERROR);
+ if(msg)
+ free(msg);
+ close(socket);
+ return(OS_INVALID);
+ }
+ MAIL_DEBUG("DEBUG: Sent '%s', received: '%s'", DATAMSG, msg);
+ free(msg);
+
+
+ /* Building "From" and "To" in the e-mail header */
+ memset(snd_msg,'\0',128);
+ snprintf(snd_msg,127, TO, to[0]);
+ OS_SendTCP(socket, snd_msg);
+
+ memset(snd_msg,'\0',128);
+ snprintf(snd_msg,127, FROM, from);
+ OS_SendTCP(socket, snd_msg);
+
+
+ /* Adding CCs */
+ if(to[1])
+ {
+ i = 1;
+ while(1)
+ {
+ if(to[i] == NULL)
+ {
+ break;
+ }
+
+ memset(snd_msg,'\0',128);
+ snprintf(snd_msg,127, TO, to[i]);
+ OS_SendTCP(socket,snd_msg);
+
+ i++;
+ }
+ }
+
+
+ /* Sending date */
+ memset(snd_msg,'\0',128);
+
+
+ /* Solaris doesn't have the "%z", so we set the timezone to 0. */
+ #ifdef SOLARIS
+ strftime(snd_msg, 127, "Date: %a, %d %b %Y %T -0000\r\n",p);
+ #else
+ strftime(snd_msg, 127, "Date: %a, %d %b %Y %T %z\r\n",p);
+ #endif
+
+ OS_SendTCP(socket,snd_msg);
+
+
+ /* Sending subject */
+ memset(snd_msg, '\0', 128);
+ snprintf(snd_msg, 127, SUBJECT, subject);
+
+ OS_SendTCP(socket, snd_msg);
+
+
+
+ /* Sending body */
+ fseek(fp, 0, SEEK_SET);
+ while(fgets(buffer, 2048, fp) != NULL)
+ {
+ OS_SendTCP(socket,buffer);
+ }
+
+
+ /* Sending end of data \r\n.\r\n */
+ OS_SendTCP(socket,ENDDATA);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+
+
+ /* Checking msg in here, since it may be null */
+ if(msg)
+ free(msg);
+
+
+ /* quitting and closing socket */
+ OS_SendTCP(socket,QUITMSG);
+ msg = OS_RecvTCP(socket, OS_SIZE_1024);
+
+ if(msg)
+ free(msg);
+
+ memset(snd_msg,'\0',128);
+
+
+ /* Returning 0 (success) */
+ close(socket);
+
+ return(0);
+}
+
+
+
+/* EOF */
-/* @(#) $Id: sendmail.c,v 1.30 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
All rights reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation
OSSEC, os_net library.
-/* @(#) $Id: os_err.h,v 1.7 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_net.c,v 1.34 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: os_net.h,v 1.12 2009/06/24 17:06:31 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
All right reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation
OSSEC, os_regex library.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
int _os_strcmp_last(char *pattern, char *str, int str_len, int size);
int _os_strcmp(char *pattern, char *str, int str_len, int size);
int _os_strmatch(char *pattern, char *str, int str_len, int size);
+int _os_strstr(char *pattern, char *str, int str_len, int size);
/** int OSMatch_Compile(char *pattern, OSMatch *reg, int flags) v0.1
*/
int OSMatch_Compile(char *pattern, OSMatch *reg, int flags)
{
+ int usstrstr = 0;
int i = 0;
int count = 0;
int end_of_string = 0;
new_str_free = new_str;
pt = new_str;
+
/* Getting the number of sub patterns */
while(*pt != '\0')
{
count++;
}
+ else if(*pt == -29)
+ {
+ usstrstr = 1;
+ }
pt++;
}
reg->size[i] = strlen(reg->patterns[i]) -1;
reg->patterns[i][reg->size[i]] = '\0';
}
-
+
/* If string starts with ^, use strncmp */
else if(*new_str == BEGINREGEX)
{
reg->match_fp[i] = _os_strncmp;
reg->size[i] = strlen(reg->patterns[i]);
}
+
+ else if(usstrstr == 1)
+ {
+ reg->match_fp[i] = _os_strstr;
+ reg->size[i] = strlen(reg->patterns[i]);
+ }
+
else
{
reg->match_fp[i] = _OS_Match;
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
return(TRUE);
}
+int _os_strstr(char *pattern, char *str, int str_len, int size)
+{
+ if(strstr(str, pattern) != NULL)
+ {
+ return(TRUE);
+ }
+ return(FALSE);
+}
+
/** Internal matching **/
int _os_strcmp_last(char *pattern, char *str, int str_len, int size)
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*/
-/* @(#) $Id: os_regex_maps.h,v 1.6 2009/06/24 17:06:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
All rights reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation
OSSEC, os_xml library.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_xml.h,v 1.8 2009/06/24 17:06:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_xml_node_access.c,v 1.6 2009/06/24 17:06:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
while(node[i])
{
if(node[i]->element)
+ {
free(node[i]->element);
+ }
if(node[i]->content)
+ {
free(node[i]->content);
+ }
if(node[i]->attributes)
{
int j=0;
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_xml_writer.c,v 1.5 2009/06/24 17:06:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_xml_writer.h,v 1.4 2009/06/24 17:06:32 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_zlib.c,v 1.7 2009/06/24 18:53:06 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: os_zlib.h,v 1.5 2009/06/24 18:53:06 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: zlib-test.c,v 1.5 2009/06/24 18:53:06 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
All rights reserved.
This program is a free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
- License (version 3) as published by the FSF - Free Software
+ License (version 2) as published by the FSF - Free Software
Foundation.
License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: ar-forward.c,v 1.27 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: config.c,v 1.12 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: main.c,v 1.23 2009/11/18 19:07:41 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: manager.c,v 1.47 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: remoted.c,v 1.34 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: remoted.h,v 1.18 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: secure.c,v 1.29 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: sendmsg.c,v 1.4 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: syslog.c,v 1.17 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: syslogtcp.c,v 1.8 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_open_ports.c,v 1.8 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_dev.c,v 1.24 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_files.c,v 1.12 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_if.c,v 1.10 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_pids.c,v 1.29 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_policy.c,v 1.3 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_ports.c,v 1.21 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_readproc.c,v 1.8 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_sys.c,v 1.42 2009/09/29 19:52:25 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: check_rc_trojans.c,v 1.12 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: common.c,v 1.25 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
int rk_check_file(char *file, char *pattern)
{
char *split_file;
+ int full_negate = 0;
+ int pt_result = 0;
FILE *fp;
char buf[OS_SIZE_2048 +1];
else
{
+ full_negate = pt_check_negate(pattern);
/* Checking for a content in the file */
+ debug1("checking file: %s", file);
fp = fopen(file, "r");
if(fp)
{
+ debug1(" starting new file: %s", file);
buf[OS_SIZE_2048] = '\0';
while(fgets(buf, OS_SIZE_2048, fp) != NULL)
{
/* Matched */
- if(pt_matches(buf, pattern))
+ pt_result = pt_matches(buf, pattern);
+ debug1("Buf == \"%s\"", buf);
+ debug1("Pattern == \"%s\"", pattern);
+ debug1("pt_result == %d and full_negate == %d", pt_result, full_negate);
+ if((pt_result == 1 && full_negate == 0) )
{
+ debug1("alerting file %s on line %s", file, buf);
int i = 0;
char _b_msg[OS_SIZE_1024 +1];
return(1);
}
+ else if((pt_result == 0 && full_negate == 1) )
+ {
+ /* found a full+negate match so no longer need to search
+ * break out of loop and amke sure the full negate does
+ * not alertin
+ */
+ debug1("found a complete match for full_negate");
+ full_negate = 0;
+ break;
+ }
}
fclose(fp);
+
+ if(full_negate == 1)
+ {
+ debug1("full_negate alerting - file %s",file);
+ int i = 0;
+ char _b_msg[OS_SIZE_1024 +1];
+
+ /* Generating the alert itself. */
+ _b_msg[OS_SIZE_1024] = '\0';
+ snprintf(_b_msg, OS_SIZE_1024, " File: %s.",
+ file);
+
+ /* Already present. */
+ if(_is_str_in_array(rootcheck.alert_msg, _b_msg))
+ {
+ return(1);
+ }
+
+ while(rootcheck.alert_msg[i] && (i < 255))
+ i++;
+
+ if(!rootcheck.alert_msg[i])
+ os_strdup(_b_msg, rootcheck.alert_msg[i]);
+
+ return(1);
+ }
}
}
}
+/** int pt_check_negate(char *pattern)
+ * Checks if the patterns is all negate values and if so returns 1
+ * else return 0
+ */
+int pt_check_negate(char *pattern)
+{
+ char *mypattern = NULL;
+ os_strdup(pattern, mypattern);
+ char *tmp_pt = mypattern;
+ char *tmp_pattern = mypattern;
+ char *tmp_ret = NULL;
+
+
+ while(tmp_pt != NULL)
+ {
+ /* We first look for " && " */
+ tmp_pt = strchr(tmp_pattern, ' ');
+ if(tmp_pt && tmp_pt[1] == '&' && tmp_pt[2] == '&' && tmp_pt[3] == ' ')
+ {
+ /* Marking pointer to clean it up */
+ tmp_ret = tmp_pt;
+
+ *tmp_pt = '\0';
+ tmp_pt += 4;
+ }
+ else
+ {
+ tmp_pt = NULL;
+ }
+
+ if(*tmp_pattern != '!')
+ {
+ free(mypattern);
+ return 0;
+ }
+
+ tmp_pattern = tmp_pt;
+ }
+
+ debug1("pattern: %s is fill_negate",pattern);
+ free(mypattern);
+ return(1);
+}
/** int pt_matches(char *str, char *pattern)
* Checks if the specific pattern is present on str.
pattern += 2;
if(OS_Regex(pattern, str))
{
+ debug1("pattern: %s matches %s.",pattern, str);
ret_code = 1;
}
}
-/* @(#) $Id: common_rcl.c,v 1.17 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: config.c,v 1.18 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-# @(#) $Id: cis_debian_linux_rcl.txt,v 1.2 2008/07/10 18:03:00 dcid Exp $
+# @(#) $Id$
#
# OSSEC Linux Audit - (C) 2008 Daniel B. Cid - dcid@ossec.net
#
-# @(#) $Id: cis_rhel5_linux_rcl.txt,v 1.5 2009/02/20 15:33:25 dcid Exp $
+# @(#) $Id$
#
# OSSEC Linux Audit - (C) 2008 Daniel B. Cid - dcid@ossec.net
#
-# @(#) $Id: cis_rhel_linux_rcl.txt,v 1.5 2008/08/28 12:07:35 dcid Exp $
+# @(#) $Id$
#
# OSSEC Linux Audit - (C) 2008 Daniel B. Cid - dcid@ossec.net
#
-# @(#) $Id: rootkit_files.txt,v 1.21 2009/01/29 16:53:37 dcid Exp $
+# @(#) $Id$
#
# rootkit_files.txt, (C) Daniel B. Cid
# Imported from the rootcheck project.
# Cback Linux worm
tmp/cback ! cback worm ::/rootkits/cback.php
tmp/derfiq ! cback worm ::/rootkits/cback.php
-*/cback ! cback worm ::/rootkits/cback.php
# aPa Kit (from rkhunter)
-# @(#) $Id: rootkit_trojans.txt,v 1.20 2009/06/03 19:18:32 dcid Exp $
+# @(#) $Id$
#
# rootkit_trojans.txt, (C) Daniel B. Cid
# Imported from the rootcheck project.
sh !proc\.h|/dev/[0-9]|/dev/[hijkz]!
uname !bash|^/bin/sh|file\.h|proc\.h|^/bin/.*sh!
date !bash|^/bin/sh|file\.h|proc\.h|/dev/[^cln]|^/bin/.*sh!
-du !/dev|w0rm|/prof|file\.h!
+du !w0rm|/prof|file\.h!
df !bash|^/bin/sh|file\.h|proc\.h|/dev/[^clurdv]|^/bin/.*sh!
-login !bash|elite|SucKIT|xlogin|vejeta|porcao|lets_log|sukasuk!
+login !elite|SucKIT|xlogin|vejeta|porcao|lets_log|sukasuk!
passwd !bash|file\.h|proc\.h|/dev/ttyo|/dev/[A-Z]|/dev/[b-s,uvxz]!
mingetty !bash|Dimensioni|pacchetto!
chfn !bash|file\.h|proc\.h|/dev/ttyo|/dev/[A-Z]|/dev/[a-s,uvxz]!
chsh !bash|file\.h|proc\.h|/dev/ttyo|/dev/[A-Z]|/dev/[a-s,uvxz]!
mail !bash|file\.h|proc\.h|/dev/[^nu]!
-su !bash|/dev/[d-s,abuvxz]|/dev/[A-D]|/dev/[F-Z]|/dev/[0-9]|satori|vejeta|conf\.inv!
-sudo !bash|satori|vejeta|conf\.inv!
+su !/dev/[d-s,abuvxz]|/dev/[A-D]|/dev/[F-Z]|/dev/[0-9]|satori|vejeta|conf\.inv!
+sudo !satori|vejeta|conf\.inv!
crond !/dev/[^nt]|bash!
gpm !bash|mingetty!
ifconfig !bash|^/bin/sh|/dev/tux|session.null|/dev/[^cludisopt]!
-# @(#) $Id: system_audit_rcl.txt,v 1.3 2008/04/14 18:30:07 dcid Exp $
+# @(#) $Id$
#
# OSSEC Linux Audit - (C) 2007 Daniel B. Cid - dcid@ossec.net
#
# Multiple patterns can be specified by using " && " between them.
# (All of them must match for it to return true).
-
-$php.ini=/var/www/conf/php.ini,/etc/php5/apache2/php.ini;
+$php.ini=/etc/php.ini,/var/www/conf/php.ini,/etc/php5/apache2/php.ini;
$web_dirs=/var/www,/var/htdocs,/home/httpd,/usr/local/apache,/usr/local/apache2,/usr/local/www;
-# @(#) $Id: win_applications_rcl.txt,v 1.3 2007/08/18 01:07:50 dcid Exp $
+# @(#) $Id$
#
# OSSEC Application detection - (C) 2007 Daniel B. Cid - dcid@ossec.net
#
-# @(#) $Id: win_audit_rcl.txt,v 1.2 2009/03/26 15:01:32 dcid Exp $
+# @(#) $Id$
#
# OSSEC Windows Audit - (C) 2007 Daniel B. Cid - dcid@ossec.net
#
-# @(#) $Id: win_malware_rcl.txt,v 1.5 2008/07/21 18:33:20 dcid Exp $
+# @(#) $Id$
#
# OSSEC Windows Malware list - (C) 2007 Daniel B. Cid - dcid@ossec.net
#
-/* @(#) $Id: os_string.c,v 1.12 2007/04/18 02:04:58 dcid Exp $ */
+/* @(#) $Id$ */
/* Included and modified strings.c from the OpenBSD project.
* Copyright bellow.
-/* @(#) $Id: rootcheck-config.c,v 1.11 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: rootcheck.c,v 1.33 2009/07/23 19:31:35 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: rootcheck.h,v 1.34 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/* pt_matches: Checks if pattern is present on string */
int pt_matches(char *str, char *pattern);
+/* pt_check_negate: checks if the patterns is made up
+ * completely of negate matches */
+int pt_check_negate(char *pattern);
/* common is_file: Check if a file exist (using stat, fopen and opendir) */
int is_file(char *file_name);
-/* @(#) $Id: run_rk_check.c,v 1.41 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: unix-process.c,v 1.5 2009/06/24 18:53:07 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: ads_dump.c,v 1.4 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: win-common.c,v 1.15 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: win-process.c,v 1.5 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: agent_op.c,v 1.8 2009/12/01 20:27:01 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*/
char* os_read_agent_name()
{
- int i = 0;
char buf[1024 + 1];
FILE *fp = NULL;
-/* @(#) $Id: debug_op.c,v 1.15 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: dirtree_op.c,v 1.4 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: file-queue.c,v 1.11 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: file_op.c,v 1.32 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: hash_op.c,v 1.5 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: help.c,v 1.10 2009/11/18 19:07:42 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: list_op.c,v 1.17 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: math_op.c,v 1.3 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: mem_op.c,v 1.7 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#include "mem_op.h"
+/* Add pointer to array. */
+void **os_AddPtArray(void *pt, void **array)
+{
+ int i = 0;
+ void **ret = NULL;
+
+ if(array)
+ {
+ while(array[i])
+ {
+ i++;
+ }
+ }
+
+ os_realloc(array, (i + 2)*sizeof(char *), ret);
+ ret[i] = pt;
+ ret[i + 1] = NULL;
+
+ return(ret);
+}
+
+
+/* Add a string to an array. */
+char **os_AddStrArray(char *str, char **array)
+{
+ int i = 0;
+ char **ret = NULL;
+ if(array)
+ {
+ while(array[i])
+ {
+ i++;
+ }
+ }
+
+ os_realloc(array, (i + 2)*sizeof(char *), ret);
+ os_strdup(str, ret[i]);
+ ret[i + 1] = NULL;
+
+ return(ret);
+}
+
+
/* Check if String is on array (Must be NULL terminated) */
int os_IsStrOnArray(char *str, char **array)
{
{
if(at == NULL)
{
- int strsize = 0;
- if((strsize = strlen(str)) < OS_SIZE_2048)
+ at = strdup(str);
+ if(!at)
{
- at = calloc(strsize+1,sizeof(char));
- if(at == NULL)
- {
- merror(MEM_ERROR,ARGV0);
- return(NULL);
- }
- strncpy(at, str, strsize);
- return(at);
- }
- else
- {
- merror(SIZE_ERROR,ARGV0,str);
- return(NULL);
+ merror(MEM_ERROR,ARGV0);
}
+ return(at);
}
else /*at is not null. Need to reallocat its memory and copy str to it*/
{
+ char *newat;
int strsize = strlen(str);
- int atsize = strlen(at);
- int finalsize = atsize+strsize+1;
-
- if((atsize > OS_SIZE_2048) || (strsize > OS_SIZE_2048))
- {
- merror(SIZE_ERROR,ARGV0,str);
- return(NULL);
- }
-
- at = realloc(at, (finalsize)*sizeof(char));
+ int finalsize = strsize + strlen(at) + 1;
- if(at == NULL)
+ newat = realloc(at, finalsize*sizeof(char));
+ if(newat == NULL)
{
+ free(at);
merror(MEM_ERROR,ARGV0);
return(NULL);
}
+ at = newat;
- strncat(at,str,strsize);
-
- at[finalsize-1] = '\0';
+ strncat(at, str, strsize);
+ at[finalsize -1] = '\0';
return(at);
}
+
return(NULL);
}
-/* @(#) $Id: mq_op.c,v 1.25 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: pthreads_op.c,v 1.8 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read-agents.c,v 1.19 2009/08/19 18:35:57 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: read-alert.c,v 1.10 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
os_strdup(p, user);
}
/* It is a log message */
- else if(log_size < 10)
+ else if(log_size < 20)
{
os_clearnl(str,p);
-/* @(#) $Id: regex_op.c,v 1.12 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: report_op.c,v 1.2 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
/** Helper functions. */
+FILE *__g_rtype = NULL;
+void l_print_out(const char *msg, ...)
+{
+ va_list args;
+ va_start(args, msg);
+
+ if(__g_rtype)
+ {
+ (void)vfprintf(__g_rtype, msg, args);
+ (void)fprintf(__g_rtype, "\n");
+ }
+ else
+ {
+ (void)vfprintf(stderr, msg, args);
+ (void)fprintf(stderr, "\n");
+ }
+ va_end(args);
+}
+
/* Sort function used by OSStore sort.
* Returns if d1 > d2.
}
+/* Print output header. */
+void _os_header_print(int t, char *hname)
+{
+ if(!t)
+ {
+ l_print_out("Top entries for '%s':", hname);
+ l_print_out("------------------------------------------------");
+ }
+ else
+ {
+ l_print_out("Related entries for '%s':", hname);
+ l_print_out("------------------------------------------------");
+ }
+}
+
+
/* Compares if the id is present in the string. */
int _os_report_str_int_compare(char *str, int id)
{
}
if(r_filter->location)
{
- if(!OS_Match2(r_filter->location, al_data->location))
+ if(!OS_Match(r_filter->location, al_data->location))
{
return(0);
}
return(0);
}
}
-
+ if(r_filter->srcip)
+ {
+ if(!strstr(al_data->srcip, r_filter->srcip))
+ {
+ return(0);
+ }
+ }
+ if(r_filter->user)
+ {
+ if(!strstr(al_data->user, r_filter->user))
+ {
+ return(0);
+ }
+ }
return(1);
}
}
else
{
- merror("%s: ERROR: Invalid relation '%s'.", ARGV0, filter_by);
+ merror("%s: ERROR: Invalid relation '%s'.", __local_name, filter_by);
return(-1);
}
}
if(!list_entry)
{
if(print_related & REPORT_REL_LOCATION)
- print_out(" location: '%s'", saved_aldata->location);
+ l_print_out(" location: '%s'", saved_aldata->location);
else if(print_related & REPORT_REL_GROUP)
- print_out(" group: '%s'", saved_aldata->group);
+ l_print_out(" group: '%s'", saved_aldata->group);
else if(print_related & REPORT_REL_RULE)
- print_out(" rule: '%d'", saved_aldata->rule);
+ l_print_out(" rule: '%d'", saved_aldata->rule);
else if(print_related & REPORT_REL_SRCIP)
- print_out(" srcip: '%s'", saved_aldata->srcip);
+ l_print_out(" srcip: '%s'", saved_aldata->srcip);
else if(print_related & REPORT_REL_USER)
- print_out(" user: '%s'", saved_aldata->user);
+ l_print_out(" user: '%s'", saved_aldata->user);
else if(print_related & REPORT_REL_LEVEL)
- print_out(" level: '%d'", saved_aldata->level);
+ l_print_out(" level: '%d'", saved_aldata->level);
}
list_entry = OSList_GetNextNode(st_data);
top_list = OSList_Create();
if(!top_list)
{
- merror(MEM_ERROR, ARGV0);
+ merror(MEM_ERROR, __local_name);
return(0);
}
OSList_AddData(top_list, data);
void os_report_printtop(void *topstore_pt, char *hname, int print_related)
{
+ int dopdout = 0;
OSStore *topstore = (OSStore *)topstore_pt;
OSStoreNode *next_node;
- if(!print_related)
- {
- print_out("Top entries for '%s':", hname);
- print_out("------------------------------------------------");
- }
- else
- {
- print_out("Related entries for '%s':", hname);
- print_out("------------------------------------------------");
- }
-
-
next_node = OSStore_GetFirstNode(topstore);
while(next_node)
{
lkey[46] = '\0';
}
- print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size);
+ if(!dopdout)
+ {
+ _os_header_print(print_related, hname);
+ dopdout = 1;
+ }
+ l_print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size);
}
/* Print each destination. */
else
{
- print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size);
+ if(!dopdout)
+ {
+ _os_header_print(print_related, hname);
+ dopdout = 1;
+ }
+ l_print_out("%-48s|%-8d|", (char *)next_node->key, st_data->currently_size);
if(print_related & REPORT_REL_LOCATION)
_os_report_print_related(REPORT_REL_LOCATION, st_data);
}
- print_out(" ");
- print_out(" ");
+ if(dopdout == 1)
+ {
+ l_print_out(" ");
+ l_print_out(" ");
+ }
return;
}
int alerts_filtered = 0;
char *first_alert = NULL;
char *last_alert = NULL;
+ void **data_to_clean = NULL;
time_t tm;
+
+ /* Initating file queue - to read the alerts */
+ os_calloc(1, sizeof(file_queue), fileq);
+
+ if(r_filter->report_type == REPORT_TYPE_DAILY && r_filter->filename)
+ {
+ fileq->fp = fopen(r_filter->filename, "r");
+ if(!fileq->fp)
+ {
+ merror("%s: ERROR: Unable to open alerts file to generate report.", __local_name);
+ return;
+ }
+ if(r_filter->fp)
+ {
+ __g_rtype = r_filter->fp;
+ }
+ }
+ else
+ {
+ fileq->fp = stdin;
+ }
+
+
/* Creating top hashes. */
r_filter->top_user = OSStore_Create();
r_filter->top_srcip = OSStore_Create();
r_filter->top_rule = OSStore_Create();
r_filter->top_group = OSStore_Create();
r_filter->top_location = OSStore_Create();
-
-
- /* Initating file queue - to read the alerts */
- os_calloc(1, sizeof(file_queue), fileq);
- fileq->fp = stdin;
Init_FileQueue(fileq, p, CRALERT_READ_ALL|CRALERT_FP_SET);
al_data = Read_FileMon(fileq, p, 1);
if(!al_data)
{
- verbose("%s: Report completed. Creating output...", ARGV0);
break;
}
alerts_filtered++;
+ data_to_clean = os_AddPtArray(al_data, data_to_clean);
/* Setting first and last alert for summary. */
al_data);
}
+ /* No report available */
+ if(alerts_filtered == 0)
+ {
+ if(!r_filter->report_name)
+ merror("%s: INFO: Report completed and zero alerts post-filter.", __local_name);
+ else
+ merror("%s: INFO: Report '%s' completed and zero alerts post-filter.", __local_name, r_filter->report_name);
+ return;
+ }
+
+
+ if(r_filter->report_name)
+ verbose("%s: INFO: Report '%s' completed. Creating output...", __local_name, r_filter->report_name);
+ else
+ verbose("%s: INFO: Report completed. Creating output...", __local_name);
- print_out(" ");
+ l_print_out(" ");
if(r_filter->report_name)
- print_out("Report '%s' completed.", r_filter->report_name);
+ l_print_out("Report '%s' completed.", r_filter->report_name);
else
- print_out("Report completed. ==");
- print_out("------------------------------------------------");
+ l_print_out("Report completed. ==");
+ l_print_out("------------------------------------------------");
- print_out("->Processed alerts: %d", alerts_processed);
- print_out("->Post-filtering alerts: %d", alerts_filtered);
- print_out("->First alert: %s", first_alert);
- print_out("->Last alert: %s", last_alert);
- print_out(" ");
- print_out(" ");
+ l_print_out("->Processed alerts: %d", alerts_processed);
+ l_print_out("->Post-filtering alerts: %d", alerts_filtered);
+ l_print_out("->First alert: %s", first_alert);
+ l_print_out("->Last alert: %s", last_alert);
+ l_print_out(" ");
+ l_print_out(" ");
OSStore_Sort(r_filter->top_srcip, _os_report_sort_compare);
OSStore_Sort(r_filter->top_user, _os_report_sort_compare);
if(r_filter->related_rule)
os_report_printtop(r_filter->top_rule, "Rule",
r_filter->related_rule);
+
+
+ /* If we have to dump the alerts. */
+ if(data_to_clean)
+ {
+ int i = 0;
+
+ if(r_filter->show_alerts)
+ {
+ l_print_out("Log dump:");
+ l_print_out("------------------------------------------------");
+ }
+ while(data_to_clean[i])
+ {
+ alert_data *md = data_to_clean[i];
+ if(r_filter->show_alerts)
+ l_print_out("%s %s\nRule: %d (level %d) -> '%s'\n%s\n\n", md->date, md->location, md->rule, md->level, md->comment, md->log[0]);
+ FreeAlertData(md);
+ i++;
+ }
+ free(data_to_clean);
+ data_to_clean = NULL;
+ }
}
{
r_filter->location = filter_value;
}
+ else if(strcmp(filter_by, "user") == 0)
+ {
+ r_filter->user = filter_value;
+ }
+ else if(strcmp(filter_by, "srcip") == 0)
+ {
+ r_filter->srcip = filter_value;
+ }
else
{
- merror("%s: ERROR: Invalid filter '%s'.", ARGV0, filter_by);
+ merror("%s: ERROR: Invalid filter '%s'.", __local_name, filter_by);
return(-1);
}
}
}
else
{
- merror("%s: ERROR: Invalid related entry '%s'.", ARGV0, filter_by);
+ merror("%s: ERROR: Invalid related entry '%s'.", __local_name, filter_by);
return(-1);
}
}
-/* @(#) $Id: rules_op.c,v 1.6 2009/06/24 18:53:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#include "rules_op.h"
+/* Chaging path for test rule. */
+#ifdef TESTRULE
+ #undef RULEPATH
+ #define RULEPATH "rules/"
+#endif
+
/** Prototypes **/
int _OS_GetRulesAttributes(char **attributes,
char *xml_same_user = "same_user";
char *xml_same_location = "same_location";
char *xml_same_id = "same_id";
+ char *xml_dodiff = "check_diff";
char *xml_different_url = "different_url";
int i;
- /* Building the rule file name + path */
- i = strlen(RULEPATH) + strlen(rulefile) + 2;
- rulepath = (char *)calloc(i,sizeof(char));
- if(!rulepath)
+ /* If no directory in the rulefile add the default */
+ if((strchr(rulefile, '/')) == NULL)
{
- ErrorExit(MEM_ERROR,__local_name);
+ /* Building the rule file name + path */
+ i = strlen(RULEPATH) + strlen(rulefile) + 2;
+ rulepath = (char *)calloc(i,sizeof(char));
+ if(!rulepath)
+ {
+ ErrorExit(MEM_ERROR,ARGV0);
+ }
+ snprintf(rulepath,i,"%s/%s",RULEPATH,rulefile);
+ }
+ else
+ {
+ os_strdup(rulefile, rulepath);
+ debug1("%s is the rulefile", rulefile);
+ debug1("Not modifing the rule path");
}
- snprintf(rulepath,i,"%s/%s",RULEPATH,rulefile);
/* Reading the XML */
config_ruleinfo->alert_opts |= SAME_EXTRAINFO;
}
else if(strcasecmp(rule_opt[k]->element,
+ xml_dodiff)==0)
+ {
+ config_ruleinfo->context++;
+ config_ruleinfo->context_opts|= SAME_DODIFF;
+ if(!(config_ruleinfo->alert_opts & DO_EXTRAINFO))
+ {
+ config_ruleinfo->alert_opts |= DO_EXTRAINFO;
+ }
+ }
+ else if(strcasecmp(rule_opt[k]->element,
xml_same_dst_port) == 0)
{
config_ruleinfo->context_opts|= SAME_DSTPORT;
config_ruleinfo->alert_opts &=0xfff-DO_LOGALERT;
}
}
+ else if(strcmp("no_ar", rule_opt[k]->content) == 0)
+ {
+ if(!(config_ruleinfo->alert_opts & NO_AR))
+ {
+ config_ruleinfo->alert_opts|= NO_AR;
+ }
+ }
else
{
merror(XML_VALUEERR, __local_name, xml_options,
return(-1);
}
}
+ /* XXX As new features are added into ../analysisd/rules.c
+ * This code needs to be updated to match, but is out of date
+ * it's become a nightmare to correct with out just make the
+ * problem for someone later.
+ *
+ * This hack will allow any crap xml to pass without an
+ * error. The correct fix is to refactor the code so that
+ * ../analysisd/rules* and this code are not duplicates
+ *
else
{
merror(XML_INVELEM, __local_name, rule_opt[k]->element);
OS_ClearXML(&xml);
return(-1);
}
+ */
k++;
}
-/* @(#) $Id: sig_op.c,v 1.8 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: store_op.c,v 1.11 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: validate_op.c,v 1.28 2009/08/05 18:02:13 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: wait_op.c,v 1.5 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
include ../Config.Make
-OBJS = syscheck.c config.c run_realtime.c create_db.c run_check.c ${OS_CONFIG} ${OS_ROOTCHECK} ${OS_SHARED} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_CRYPTO}
+OBJS = syscheck.c config.c seechanges.c run_realtime.c create_db.c run_check.c ${OS_CONFIG} ${OS_ROOTCHECK} ${OS_SHARED} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_CRYPTO}
OBJS2 = syscheck-baseline.c config.c create_db.c run_check.c ${OS_CONFIG} ${OS_ROOTCHECK} ${OS_SHARED} ${OS_XML} ${OS_REGEX} ${OS_NET} ${OS_CRYPTO}
syscheck:
$(CC) $(CFLAGS) ${OS_LINK} $(OBJS) -o ${NAME}
-
-baseline:
- $(CC) $(CFLAGS) ${OS_LINK} $(OBJS2) -o syscheck-baseline
-
clean:
${CLEAN}
build:
-/* @(#) $Id: config.c,v 1.32 2009/11/04 15:19:00 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: create_db.c,v 1.28 2009/10/02 19:28:34 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*
* License details at the LICENSE file included with OSSEC or
#include "os_crypto/md5_sha1/md5_sha1_op.h"
-/* flags for read_dir and read_file */
-#define CREATE_DB 1
-#define CHECK_DB 2
int __counter = 0;
/** Prototypes **/
-int read_dir(char *dir_name, int opts, int flag);
+int read_dir(char *dir_name, int opts, OSMatch *restriction);
/* int check_file(char *file_name)
*/
int check_file(char *file_name)
{
- char buf[MAX_LINE +2];
- buf[MAX_LINE +1] = '\0';
-
- while(fgets(buf, MAX_LINE, syscheck.fp) != NULL)
+ if(OSHash_Get(syscheck.fp, file_name))
{
- if((buf[0] != '#') && (buf[0] != ' ') && (buf[0] != '\n'))
- {
- char *n_buf;
-
- /* Removing the new line */
- n_buf = strchr(buf,'\n');
- if(n_buf == NULL)
- continue;
-
- *n_buf = '\0';
-
-
- /* First 6 characters are for internal use */
- n_buf = buf;
- n_buf+=6;
-
- n_buf = strchr(n_buf, ' ');
- if(n_buf)
- {
- n_buf++;
-
- /* Checking if name matches */
- if(strcmp(n_buf, file_name) == 0)
- return(1);
- }
- }
+ return(1);
}
/* New file */
/* int read_file(char *file_name, int opts, int flag)
* Reads and generates the integrity data of a file.
*/
-int read_file(char *file_name, int opts, int flag)
+int read_file(char *file_name, int opts, OSMatch *restriction)
{
- int check_file_new = 0;
+ char *buf;
+ char sha1s = '+';
struct stat statbuf;
+
/* Checking if file is to be ignored */
if(syscheck.ignore)
{
verbose("%s: Reading dir: %s\n",ARGV0, file_name);
#endif
- return(read_dir(file_name, opts, flag));
+ return(read_dir(file_name, opts, restriction));
+ }
+
+
+ /* restricting file types. */
+ if(restriction)
+ {
+ if(!OSMatch_Execute(file_name, strlen(file_name),
+ restriction))
+ {
+ return(0);
+ }
}
{
os_md5 mf_sum;
os_sha1 sf_sum;
-
-
- /* If check_db, we just need to verify that the file is
- * already present. If not, we add it.
- */
- if(flag == CHECK_DB)
- {
- /* File in the database already */
- fseek(syscheck.fp, 0, SEEK_SET);
- if(check_file(file_name))
- {
- /* Sleeping in here too */
- #ifndef WIN32
- if(__counter >= (3 * syscheck.sleep_after))
- #else
- if(__counter >= (syscheck.sleep_after))
- #endif
- {
- sleep(syscheck.tsleep);
- __counter = 0;
- }
- __counter++;
-
- return(0);
- }
- fseek(syscheck.fp, 0, SEEK_END);
- check_file_new = 1;
- }
+ os_sha1 sf_sum2;
+ os_sha1 sf_sum3;
/* Cleaning sums */
strncpy(mf_sum, "xxx", 4);
strncpy(sf_sum, "xxx", 4);
+ strncpy(sf_sum2, "xxx", 4);
+ strncpy(sf_sum3, "xxx", 4);
/* Generating checksums. */
{
strncpy(mf_sum, "xxx", 4);
strncpy(sf_sum, "xxx", 4);
+
+ }
+
+ if(opts & CHECK_SEECHANGES)
+ {
+ sha1s = 's';
}
}
+ else
+ {
+ if(opts & CHECK_SEECHANGES)
+ sha1s = 'n';
+ else
+ sha1s = '-';
+ }
- /* Adding file */
- fprintf(syscheck.fp,"%c%c%c%c%c%c%d:%d:%d:%d:%s:%s %s\n",
+ buf = OSHash_Get(syscheck.fp, file_name);
+ if(!buf)
+ {
+ char alert_msg[912 +1];
+
+ alert_msg[912] = '\0';
+
+ if(opts & CHECK_SEECHANGES)
+ {
+ char *alertdump = seechanges_addfile(file_name);
+ if(alertdump)
+ {
+ free(alertdump);
+ alertdump = NULL;
+ }
+ }
+
+
+ snprintf(alert_msg, 912, "%c%c%c%c%c%c%d:%d:%d:%d:%s:%s",
opts & CHECK_SIZE?'+':'-',
opts & CHECK_PERM?'+':'-',
opts & CHECK_OWNER?'+':'-',
opts & CHECK_GROUP?'+':'-',
opts & CHECK_MD5SUM?'+':'-',
- opts & CHECK_SHA1SUM?'+':'-',
+ sha1s,
opts & CHECK_SIZE?(int)statbuf.st_size:0,
opts & CHECK_PERM?(int)statbuf.st_mode:0,
opts & CHECK_OWNER?(int)statbuf.st_uid:0,
opts & CHECK_GROUP?(int)statbuf.st_gid:0,
opts & CHECK_MD5SUM?mf_sum:"xxx",
- opts & CHECK_SHA1SUM?sf_sum:"xxx",
- file_name);
+ opts & CHECK_SHA1SUM?sf_sum:"xxx");
+ if(OSHash_Add(syscheck.fp, strdup(file_name), strdup(alert_msg)) <= 0)
+ {
+ merror("%s: ERROR: Unable to add file to db: %s", ARGV0, file_name);
+ }
- /* Send new file */
- if(check_file_new)
- {
- char alert_msg[912 +2];
/* Sending the new checksum to the analysis server */
alert_msg[912 +1] = '\0';
file_name);
send_syscheck_msg(alert_msg);
}
+ else
+ {
+ char alert_msg[OS_MAXSTR +1];
+ char c_sum[256 +2];
+
+ c_sum[0] = '\0';
+ c_sum[256] = '\0';
+ alert_msg[0] = '\0';
+ alert_msg[OS_MAXSTR] = '\0';
+
+ /* If it returns < 0, we will already have alerted. */
+ if(c_read_file(file_name, buf, c_sum) < 0)
+ return(0);
+
+ if(strcmp(c_sum, buf+6) != 0)
+ {
+ /* Sending the new checksum to the analysis server */
+ char *fullalert = NULL;
+ alert_msg[OS_MAXSTR] = '\0';
+ if(buf[5] == 's' || buf[5] == 'n')
+ {
+ fullalert = seechanges_addfile(file_name);
+ if(fullalert)
+ {
+ snprintf(alert_msg, OS_MAXSTR, "%s %s\n%s", c_sum, file_name, fullalert);
+ free(fullalert);
+ fullalert = NULL;
+ }
+ else
+ {
+ snprintf(alert_msg, 912, "%s %s", c_sum, file_name);
+ }
+ }
+ else
+ {
+ snprintf(alert_msg, 912, "%s %s", c_sum, file_name);
+ }
+ send_syscheck_msg(alert_msg);
+ }
+ }
/* Sleeping in here too */
- #ifndef WIN32
- if(__counter >= (3 * syscheck.sleep_after))
- #else
- if(__counter >= (2 * syscheck.sleep_after))
- #endif
+ if(__counter >= (syscheck.sleep_after))
{
sleep(syscheck.tsleep);
__counter = 0;
/* read_dir v0.1
*
*/
-int read_dir(char *dir_name, int opts, int flag)
+int read_dir(char *dir_name, int opts, OSMatch *restriction)
{
int dir_size;
/* Directory should be valid */
if((dir_name == NULL)||((dir_size = strlen(dir_name)) > PATH_MAX))
{
- if(flag == CREATE_DB)
- merror(NULL_ERROR, ARGV0);
+ merror(NULL_ERROR, ARGV0);
return(-1);
}
{
if(errno == ENOTDIR)
{
- if(read_file(dir_name, opts, flag) == 0)
+ if(read_file(dir_name, opts, restriction) == 0)
return(0);
}
- if(flag == CREATE_DB)
- {
- #ifdef WIN32
- int di = 0;
- char *(defaultfilesn[])= {
+ #ifdef WIN32
+ int di = 0;
+ char *(defaultfilesn[])= {
"C:\\autoexec.bat",
"C:\\config.sys",
"C:\\WINDOWS/System32/eventcreate.exe",
"C:\\WINDOWS/System32/Tasks",
NULL
};
- while(defaultfilesn[di] != NULL)
+ while(defaultfilesn[di] != NULL)
+ {
+ if(strcmp(defaultfilesn[di], dir_name) == 0)
{
- if(strcmp(defaultfilesn[di], dir_name) == 0)
- {
- break;
- }
- di++;
+ break;
}
+ di++;
+ }
- if(defaultfilesn[di] == NULL)
- {
- merror("%s: WARN: Error opening directory: '%s': %s ",
- ARGV0, dir_name, strerror(errno));
- }
-
- #else
-
+ if(defaultfilesn[di] == NULL)
+ {
merror("%s: WARN: Error opening directory: '%s': %s ",
- ARGV0,
- dir_name,
- strerror(errno));
- #endif
+ ARGV0, dir_name, strerror(errno));
}
+
+ #else
+
+ merror("%s: WARN: Error opening directory: '%s': %s ",
+ ARGV0,
+ dir_name,
+ strerror(errno));
+ #endif
return(-1);
}
*s_name = '\0';
strncpy(s_name, entry->d_name, PATH_MAX - dir_size -2);
- read_file(f_name, opts, flag);
+ read_file(f_name, opts, restriction);
}
closedir(dp);
}
-/* int check_db()
- * Checks database for new files.
- */
-int check_db()
+/* int run_dbcheck */
+int run_dbcheck()
{
int i = 0;
- /* Read all available directories */
__counter = 0;
do
{
- read_dir(syscheck.dir[i], syscheck.opts[i], CHECK_DB);
+ read_dir(syscheck.dir[i], syscheck.opts[i], syscheck.filerestrict[i]);
i++;
}while(syscheck.dir[i] != NULL);
}
-
/* int create_db
* Creates the file database.
*/
-int create_db(int delete_db)
+int create_db()
{
int i = 0;
-
- syscheck.fp = fopen(syscheck.db, "w+"); /* Read and write */
+
+ /* Creating store data */
+ syscheck.fp = OSHash_Create();
if(!syscheck.fp)
{
- ErrorExit("%s: Unable to create syscheck database "
- "at '%s'. Exiting.",ARGV0,syscheck.db);
+ ErrorExit("%s: Unable to create syscheck database."
+ ". Exiting.",ARGV0);
return(0);
}
-
- /* Creating a local fp only */
- if(delete_db)
+ if(!OSHash_setSize(syscheck.fp, 2048))
{
- unlink(syscheck.db);
+ merror(LIST_ERROR, ARGV0);
+ return(0);
}
__counter = 0;
do
{
- if(read_dir(syscheck.dir[i], syscheck.opts[i], CREATE_DB) == 0)
+ if(read_dir(syscheck.dir[i], syscheck.opts[i], syscheck.filerestrict[i]) == 0)
{
#ifdef WIN32
if(syscheck.opts[i] & CHECK_REALTIME)
-/* @(#) $Id: run_check.c,v 1.49 2009/11/05 15:15:14 dcid Exp $ */
+/* @(#) $Id$ */
-/* Copyright (C) 2009 Trend Micro Inc.
+/* Copyright (C) 2010 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
*/
void send_sk_db()
{
- char buf[MAX_LINE +1];
- int file_count = 0;
-
- buf[MAX_LINE] = '\0';
-
- if(fseek(syscheck.fp, 0, SEEK_SET) == -1)
- {
- ErrorExit(FSEEK_ERROR, ARGV0, "syscheck_db");
- }
-
-
/* Sending scan start message */
if(syscheck.dir[0])
{
sleep(syscheck.tsleep +10);
return;
}
-
-
-
- while(fgets(buf,MAX_LINE, syscheck.fp) != NULL)
- {
- if((buf[0] != '#') && (buf[0] != ' ') && (buf[0] != '\n'))
- {
- char *n_buf;
-
- /* Removing the \n before sending to the analysis server */
- n_buf = strchr(buf,'\n');
- if(n_buf == NULL)
- continue;
-
- *n_buf = '\0';
-
-
- /* First 6 characters are for internal use */
- n_buf = buf;
- n_buf+=6;
-
- send_syscheck_msg(n_buf);
-
-
- /* A count and a sleep to avoid flooding the server.
- * Time or speed are not requirements in here
- */
- file_count++;
-
-
- /* sleep X every Y files */
- if(file_count >= syscheck.sleep_after)
- {
- sleep(syscheck.tsleep);
- file_count = 0;
- }
- }
- }
+ create_db(1);
+
/* Sending scan ending message */
sleep(syscheck.tsleep +10);
/* Will create the db to store syscheck data */
if(syscheck.scan_on_start)
{
- create_db(1);
- fflush(syscheck.fp);
-
- sleep(syscheck.tsleep * 60);
+ sleep(syscheck.tsleep * 15);
send_sk_db();
}
else
/* We need to create the db, if scan on start is not set. */
if(syscheck.scan_on_start == 0)
{
- create_db(1);
- fflush(syscheck.fp);
-
sleep(syscheck.tsleep * 10);
send_sk_db();
sleep(syscheck.tsleep * 10);
#endif
- check_db();
-
-
- /* Set syscheck.fp to the begining of the file */
- fseek(syscheck.fp, 0, SEEK_SET);
-
-
/* Checking for changes */
- run_check();
+ run_dbcheck();
}
}
-/* run_check: v0.1
- * Read the database and check if the binary has changed
- */
-void run_check()
-{
- char c_sum[256 +2];
- char alert_msg[912 +2];
- char buf[MAX_LINE +2];
- int file_count = 0;
-
-
- /* Cleaning buffer */
- memset(buf, '\0', MAX_LINE +1);
- memset(alert_msg, '\0', 912 +1);
- memset(c_sum, '\0', 256 +1);
-
- /* fgets garantee the null termination */
- while(fgets(buf, MAX_LINE, syscheck.fp) != NULL)
- {
- /* Buf should be in the following format:
- * header checksum file_name (checksum space filename)
- */
- char *n_file; /* file read from the db */
- char *n_sum; /* md5sum read from the db */
- char *tmp_c; /* tmp_char */
-
-
- /* Avoiding wrong formats in the database. Alert about them */
- if(buf[0] == '#' || buf[0] == ' ' || buf[0] == '\n')
- {
- merror("%s: Invalid entry in the integrity database: '%s'",
- ARGV0, buf);
- continue;
- }
-
- /* Adding a sleep in here -- avoid floods and extreme CPU usage
- * on the client side -- speed not necessary
- */
- file_count++;
- if(file_count >= (syscheck.sleep_after))
- {
- sleep(syscheck.tsleep);
- file_count = 0;
- }
-
-
- /* Finding the file name */
- n_file = strchr(buf, ' ');
- if(n_file == NULL)
- {
- merror("%s: Invalid entry in the integrity check database.",ARGV0);
- continue;
- }
-
- /* Zeroing the ' ' and messing up with buf */
- *n_file = '\0';
-
-
- /* Setting n_file to the begining of the file name */
- n_file++;
-
-
- /* Removing the '\n' if present and setting it to \0 */
- tmp_c = strchr(n_file,'\n');
- if(tmp_c)
- {
- *tmp_c = '\0';
- }
-
-
- /* Setting n_sum to the begining of buf */
- n_sum = buf;
-
-
- /* Cleaning up c_sum */
- memset(c_sum, '\0', 16);
- c_sum[255] = '\0';
-
-
- /* If it returns < 0, we will already have alerted. */
- if(c_read_file(n_file, n_sum, c_sum) < 0)
- continue;
-
-
- if(strcmp(c_sum, n_sum+6) != 0)
- {
- /* Sending the new checksum to the analysis server */
- alert_msg[912 +1] = '\0';
- snprintf(alert_msg, 912, "%s %s", c_sum, n_file);
- send_syscheck_msg(alert_msg);
-
- continue;
- }
-
- /* FILE OK if reached here */
- }
-}
/* c_read_file
*/
int c_read_file(char *file_name, char *oldsum, char *newsum)
{
- int size = 0, perm = 0, owner = 0, group = 0, md5sum = 0, sha1sum = 0;
+ int size = 0, perm = 0, owner = 0, group = 0, md5sum = 0, sha1sum = 0, seechanges = 0;
struct stat statbuf;
/* sha1 sum */
if(oldsum[5] == '+')
sha1sum = 1;
+
+ else if(oldsum[5] == 's')
+ {
+ sha1sum = 1;
+ seechanges = 1;
+ }
+ else if(oldsum[5] == 'n')
+ {
+ sha1sum = 0;
+ seechanges = 1;
+ }
/* Generating new checksum */
-/* @(#) $Id: run_realtime.c,v 1.12 2009/12/01 15:40:08 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
#ifdef USEINOTIFY
#include <sys/inotify.h>
+#define OS_SIZE_6144 6144
+#define OS_MAXSTR OS_SIZE_6144 /* Size for logs, sockets, etc */
+#else
+#include "shared.h"
#endif
/* Checking sum of the realtime file being monitored. */
int realtime_checksumfile(char *file_name)
{
- char buf[MAX_LINE +2];
- buf[MAX_LINE +1] = '\0';
-
+ char *buf;
- fseek(syscheck.fp, 0, SEEK_SET);
- while(fgets(buf, MAX_LINE, syscheck.fp) != NULL)
+ buf = OSHash_Get(syscheck.fp, file_name);
+ if(buf != NULL)
{
- if((buf[0] != '#') && (buf[0] != ' ') && (buf[0] != '\n'))
- {
- char *n_buf;
-
- /* Removing the new line */
- n_buf = strchr(buf,'\n');
- if(n_buf == NULL)
- continue;
-
- *n_buf = '\0';
-
-
- /* First 6 characters are for internal use */
- n_buf = buf;
- n_buf+=6;
-
- n_buf = strchr(n_buf, ' ');
- if(n_buf)
- {
- n_buf++;
-
- /* Checking if name matches */
- if(strcmp(n_buf, file_name) == 0)
- {
- char c_sum[256 +2];
- c_sum[0] = '\0';
- c_sum[255] = '\0';
+ char c_sum[256 +2];
+
+ c_sum[0] = '\0';
+ c_sum[255] = '\0';
+
+
+ /* If it returns < 0, we will already have alerted. */
+ if(c_read_file(file_name, buf, c_sum) < 0)
+ {
+ return(0);
+ }
+
+
+ if(strcmp(c_sum, buf+6) != 0)
+ {
+ char *fullalert = NULL;
+ char alert_msg[OS_MAXSTR +1];
+ alert_msg[OS_MAXSTR] = '\0';
+ if(buf[5] == 's' || buf[5] == 'n')
+ {
+ fullalert = seechanges_addfile(file_name);
+ if(fullalert)
+ {
+ snprintf(alert_msg, OS_MAXSTR, "%s %s\n%s", c_sum, file_name, fullalert);
+ free(fullalert);
+ fullalert = NULL;
+ }
+ else
+ {
+ snprintf(alert_msg, 912, "%s %s", c_sum, file_name);
+ }
+ }
+ else
+ {
+ snprintf(alert_msg, 912, "%s %s", c_sum, file_name);
+ }
+ send_syscheck_msg(alert_msg);
+
+ return(1);
+ }
+
+ return(0);
-
- /* If it returns < 0, we will already have alerted. */
- if(c_read_file(file_name, buf, c_sum) < 0)
- continue;
-
-
- if(strcmp(c_sum, buf+6) != 0)
- {
- char alert_msg[912 +2];
-
- /* Sending the new checksum to the analysis server */
- alert_msg[912 +1] = '\0';
- snprintf(alert_msg, 912, "%s %s", c_sum, file_name);
- send_syscheck_msg(alert_msg);
-
- return(1);
- }
-
- return(0);
-
- }
- }
- }
}
-
- /* Adding entry if not in there. */
- fseek(syscheck.fp, 0, SEEK_END);
return(0);
}
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+
+#include "shared.h"
+#include "os_crypto/md5/md5_op.h"
+
+
+
+/* Generate diffs alerts. */
+char *gen_diff_alert(char *filename, int alert_diff_time)
+{
+ int n = 0;
+ FILE *fp;
+ char *tmp_str;
+ char buf[OS_MAXSTR +1];
+ char diff_alert[OS_MAXSTR +1];
+
+ buf[OS_MAXSTR] = '\0';
+ diff_alert[OS_MAXSTR] = '\0';
+
+ snprintf(buf, OS_MAXSTR, "%s/local/%s/diff.%d",
+ DIFF_DIR_PATH, filename, alert_diff_time);
+
+ fp = fopen(buf, "r");
+ if(!fp)
+ {
+ merror("%s: ERROR: Unable to generate diff alert.", ARGV0);
+ return(NULL);
+ }
+
+ n = fread(buf, 1, 4096 -1, fp);
+ if(n <= 0)
+ {
+ merror("%s: ERROR: Unable to generate diff alert (fread).", ARGV0);
+ fclose(fp);
+ return(NULL);
+ }
+ else if(n >= 4000)
+ {
+ /* We need to clear the last new line. */
+ buf[n] = '\0';
+ tmp_str = strrchr(buf, '\n');
+ if(tmp_str)
+ *tmp_str = '\0';
+ else
+ {
+ /* Weird diff with only one large line. */
+ buf[256] = '\0';
+ }
+ }
+ else
+ {
+ buf[n] = '\0';
+ }
+
+ n = 0;
+
+
+ /* Getting up to 20 line changes. */
+ tmp_str = buf;
+
+
+ while(tmp_str && (*tmp_str != '\0'))
+ {
+ tmp_str = strchr(tmp_str, '\n');
+ if(!tmp_str)
+ break;
+ else if(n >= 19)
+ {
+ *tmp_str = '\0';
+ break;
+ }
+ n++;
+ tmp_str++;
+ }
+
+
+ /* Creating alert. */
+ snprintf(diff_alert, 4096 -1, "%s%s",
+ buf, n>=19?
+ "\nMore changes..":
+ "");
+
+
+ fclose(fp);
+ return(strdup(diff_alert));
+}
+
+
+int seechanges_dupfile(char *old, char *new)
+{
+ int n;
+ FILE *fpr;
+ FILE *fpw;
+ unsigned char buf[2048 +1];
+
+ buf[2048] = '\0';
+
+ fpr = fopen(old,"r");
+ fpw = fopen(new,"w");
+
+ if(!fpr || !fpw)
+ {
+ return(0);
+ }
+
+ while((n = fread(buf, 1, 2048, fpr)) > 0)
+ {
+ buf[n] = '\0';
+ fwrite(buf, n, 1, fpw);
+
+ }
+
+ fclose(fpr);
+ fclose(fpw);
+ return(1);
+}
+
+
+int seechanges_createpath(char *filename)
+{
+ char *buffer = NULL;
+ char *tmpstr = NULL;
+ char *newdir = NULL;
+
+
+ os_strdup(filename, buffer);
+ newdir = buffer;
+ tmpstr = strchr(buffer +1, '/');
+ if(!tmpstr)
+ {
+ merror("%s: ERROR: Invalid path name: '%s'", ARGV0, filename);
+ free(buffer);
+ return(0);
+ }
+ *tmpstr = '\0';
+ tmpstr++;
+
+
+ while(1)
+ {
+ if(IsDir(newdir) != 0)
+ {
+ #ifndef WIN32
+ if(mkdir(newdir, 0770) == -1)
+ #else
+ if(mkdir(newdir) == -1)
+ #endif
+ {
+ merror(MKDIR_ERROR, ARGV0, newdir);
+ free(buffer);
+ return(0);
+ }
+ }
+
+ if(*tmpstr == '\0')
+ {
+ break;
+ }
+
+ tmpstr[-1] = '/';
+ tmpstr = strchr(tmpstr, '/');
+ if(!tmpstr)
+ {
+ break;
+ }
+ *tmpstr = '\0';
+ tmpstr++;
+ }
+
+ free(buffer);
+ return(1);
+}
+
+
+/* Checks if the file has changed */
+char *seechanges_addfile(char *filename)
+{
+ int date_of_change;
+ char old_location[OS_MAXSTR +1];
+ char tmp_location[OS_MAXSTR +1];
+ char diff_cmd[OS_MAXSTR +1];
+
+ os_md5 md5sum_old;
+ os_md5 md5sum_new;
+
+ old_location[OS_MAXSTR] = '\0';
+ tmp_location[OS_MAXSTR] = '\0';
+ diff_cmd[OS_MAXSTR] = '\0';
+ md5sum_new[0] = '\0';
+ md5sum_old[0] = '\0';
+
+
+ snprintf(old_location, OS_MAXSTR, "%s/local/%s/%s", DIFF_DIR_PATH, filename +1,
+ DIFF_LAST_FILE);
+
+
+ /* If the file is not there, rename new location to last location. */
+ if(OS_MD5_File(old_location, md5sum_old) != 0)
+ {
+ seechanges_createpath(old_location);
+ if(seechanges_dupfile(filename, old_location) != 1)
+ {
+ merror(RENAME_ERROR, ARGV0, filename);
+ }
+ return(NULL);
+ }
+
+
+ /* Get md5sum of the new file. */
+ if(OS_MD5_File(filename, md5sum_new) != 0)
+ {
+ //merror("%s: ERROR: Invalid internal state (missing '%s').",
+ // ARGV0, filename);
+ return(NULL);
+ }
+
+
+ /* If they match, keep the old file and remove the new. */
+ if(strcmp(md5sum_new, md5sum_old) == 0)
+ {
+ return(NULL);
+ }
+
+
+ /* Saving the old file at timestamp and renaming new to last. */
+ date_of_change = File_DateofChange(old_location);
+ snprintf(tmp_location, OS_MAXSTR, "%s/local/%s/state.%d", DIFF_DIR_PATH, filename +1,
+ date_of_change);
+ rename(old_location, tmp_location);
+ if(seechanges_dupfile(filename, old_location) != 1)
+ {
+ merror("%s: ERROR: Unable to create snapshot for %s",ARGV0, filename);
+ return(NULL);
+ }
+
+
+ /* Run diff. */
+ date_of_change = File_DateofChange(old_location);
+ snprintf(diff_cmd, 2048, "diff \"%s\" \"%s\" > \"%s/local/%s/diff.%d\" "
+ "2>/dev/null",
+ tmp_location, old_location,
+ DIFF_DIR_PATH, filename +1, date_of_change);
+ if(system(diff_cmd) != 256)
+ {
+ merror("%s: ERROR: Unable to run diff for %s",
+ ARGV0, filename);
+ return(NULL);
+ }
+
+
+ /* Generate alert. */
+ return(gen_diff_alert(filename, date_of_change));
+
+
+ return(NULL);
+}
+
+
+
+/* EOF */
-/* @(#) $Id: syscheck-baseline.c,v 1.2 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: syscheck.c,v 1.49 2009/11/18 19:07:42 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
#include "rootcheck/rootcheck.h"
-/* Definitions only used in here. */
-#define SYSCHECK_DB SYSCHECK_DIR "/syschecklocal.db"
-#define SYS_WIN_DB "syscheck/syschecklocal.db"
-
int dump_syscheck_entry(config *syscheck, char *entry, int vals, int reg);
- /* Opening syscheck db file */
- os_calloc(1024,sizeof(char), syscheck.db);
- snprintf(syscheck.db,1023,"%s",SYS_WIN_DB);
-
-
/* Printing options */
r = 0;
while(syscheck.registry[r] != NULL)
os_wait();
- /* Start the daemon checking against the syscheck.db */
start_daemon();
syscheck.workdir = DEFAULTDIR;
- /* Creating a temporary fp */
- syscheck.db = (char *)calloc(1024,sizeof(char));
- if(syscheck.db == NULL)
- ErrorExit(MEM_ERROR,ARGV0);
-
- snprintf(syscheck.db,1023,"%s%s-%d%d.tmp",
- syscheck.workdir,
- SYSCHECK_DB,
- (int)time(NULL),
- (int)getpid());
-
-
-
- if (!run_foreground)
+ if(!run_foreground)
{
nowDaemon();
goDaemon();
-/* @(#) $Id: syscheck.h,v 1.16 2009/06/30 17:08:19 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
int create_db();
-/* int check_db()
- * Checks database for new files.
+/* int run_dbcheck()
+ * Checks database for changes.
*/
-int check_db();
+int run_dbcheck();
/** void os_winreg_check()
* Checks the registry for changes.
/* Process real time queue. */
int realtime_process();
+/* Process the content of the file changes. */
+char *seechanges_addfile(char *filename);
+
+/* get checksum changes. */
+int c_read_file(char *file_name, char *oldsum, char *newsum);
+
/** Sends syscheck message.
*/
int send_syscheck_msg(char *msg);
-/* @(#) $Id: win-registry.c,v 1.15 2009/08/31 18:26:04 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
$(CC) $(CFLAGS) ${OS_LINK} ${SUP} syscheck_update.c $(OBJS) -o syscheck_update
$(CC) $(CFLAGS) ${OS_LINK} clear_stats.c $(OBJS) -o clear_stats
$(CC) $(CFLAGS) ${OS_LINK} list_agents.c $(OBJS) -o list_agents
+ $(CC) $(CFLAGS) ${OS_LINK} verify-agent-conf.c $(OS_CONFIG) $(OBJS) ${OS_XML} -o verify-agent-conf
$(CC) $(CFLAGS) ${OS_LINK} ${SUP} agent_control.c $(OBJS) -o agent_control
$(CC) $(CFLAGS) ${OS_LINK} ${SUP} syscheck_control.c $(OBJS) -o syscheck_control
$(CC) $(CFLAGS) ${OS_LINK} ${SUP} rootcheck_control.c $(OBJS) -o rootcheck_control
+ $(CC) $(CFLAGS) ${OS_LINK} ossec-regex.c $(OBJS) -o ossec-regex
clean:
- $(CLEAN) syscheck_update clear_stats list_agents agent_control syscheck_control rootcheck_control
+ $(CLEAN) syscheck_update clear_stats list_agents agent_control syscheck_control rootcheck_control verify-agent-conf ossec-regex
build:
- cp -pr syscheck_update clear_stats list_agents syscheck_control rootcheck_control agent_control ${PT}../bin
+ cp -pr syscheck_update clear_stats list_agents syscheck_control rootcheck_control agent_control verify-agent-conf ossec-regex ${PT}../bin
-/* @(#) $Id: agent_control.c,v 1.11 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: clear_stats.c,v 1.6 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: list_agents.c,v 1.7 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2009 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+/* This tool will clear the project statistics */
+
+#include "shared.h"
+
+#undef ARGV0
+#define ARGV0 "ossec-regex"
+
+
+/** help **/
+void helpmsg()
+{
+ printf("\nOSSEC HIDS %s: ossec-regex pattern\n", ARGV0);
+ exit(1);
+}
+
+
+/** main **/
+int main(int argc, char **argv)
+{
+ char *pattern;
+
+ char msg[OS_MAXSTR +1];
+ memset(msg, '\0', OS_MAXSTR +1);
+ OSRegex regex;
+ OSMatch matcher;
+
+ OS_SetName(ARGV0);
+
+
+ /* user arguments */
+ if(argc != 2)
+ {
+ helpmsg();
+ return(-1);
+ }
+
+ /* User options */
+ if(strcmp(argv[1], "-h") == 0)
+ {
+ helpmsg();
+ return(-1);
+ }
+
+ os_strdup(argv[1], pattern);
+ if(!OSRegex_Compile(pattern, ®ex, 0))
+ {
+ printf("pattern does not compile with OSRegex_Compile\n");
+ return(-1);
+ }
+ if(!OSMatch_Compile(pattern, &matcher, 0))
+ {
+ printf("pattern does not compile with OSMatch_Compile\n");
+ return(-1);
+ }
+
+
+ while((fgets(msg, OS_MAXSTR, stdin)) != NULL)
+ {
+ /* Removing new line. */
+ if(msg[strlen(msg) -1] == '\n')
+ msg[strlen(msg) -1] = '\0';
+
+ /* Make sure we ignore blank lines. */
+ if(strlen(msg) < 2) { continue; }
+
+ if(OSRegex_Execute(msg, ®ex))
+ printf("+OSRegex_Execute: %s\n",msg);
+ /*
+ else
+ printf("-OSRegex_Execute: \n");
+ */
+
+ if(OS_Regex(pattern, msg))
+ printf("+OS_Regex : %s\n", msg);
+ /*
+ else
+ printf("-OS_Regex: \n");
+ */
+
+ if(OSMatch_Execute(msg, strlen(msg), &matcher))
+ printf("+OSMatch_Compile: %s\n", msg);
+
+ if(OS_Match2(pattern, msg))
+ printf("+OS_Match2 : %s\n", msg);
+ }
+ return(0);
+}
+
+
+/* EOF */
-/* @(#) $Id: rootcheck_control.c,v 1.5 2009/06/24 18:53:09 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: syscheck_control.c,v 1.5 2009/08/05 18:02:14 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: syscheck_update.c,v 1.16 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+/* @(#) $Id$ */
+
+/* Copyright (C) 2010 Trend Micro Inc.
+ * All right reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation
+ */
+
+
+#include "shared.h"
+#include "config/localfile-config.h"
+#include "config/config.h"
+#include "logcollector/logcollector.h"
+
+
+#undef ARGV0
+#define ARGV0 "verify-agent-conf"
+
+
+
+/* main: v0.3: 2005/04/04 */
+int main(int argc, char **argv)
+{
+ int modules = 0;
+ logreader_config log_config;
+
+
+ /* Setting the name */
+ OS_SetName(ARGV0);
+
+
+ modules|= CLOCALFILE;
+ modules|= CAGENT_CONFIG;
+ log_config.config = NULL;
+ if(ReadConfig(modules, AGENTCONFIG, &log_config, NULL) < 0)
+ {
+ return(OS_INVALID);
+ }
+
+ logff = log_config.config;
+
+ return(0);
+
+
+}
+
+/* EOF */
-/* @(#) $Id: add-localfile.c,v 1.13 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
}
printf("%s: Adding log file to be monitored: '%s'.\n", name,file);
- printf("%s: Continue? (y/n):", name);
- while(1)
- {
- char u_buffer[256];
- memset(u_buffer, '\0', 256);
- if((fgets(u_buffer, 254, stdin) != NULL) &&
- (strlen(u_buffer) < 250))
- {
- if((u_buffer[0] == 'y') || (u_buffer[0] == 'Y'))
- {
- add = 1;
- break;
- }
- else if((u_buffer[0] == 'n') || (u_buffer[0] == 'N'))
- {
- add = 0;
- break;
- }
- }
- printf("%s: Continue? (y/n):", name);
- }
-
- if(add == 0)
- {
- printf("%s: Action not taken.\n", name);
- fclose(fp);
- return(0);
- }
-
fprintf(fp, "\r\n"
"\r\n"
"<!-- Extra log file -->\r\n"
<html>
<head>
- <META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://www.ossec.net/en/win.html">
+ <META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://www.ossec.net/doc/index.html">
</head>
<body>
- Redirecting to the online documentation at http://www.ossec.net/en/win.html... <br />
+ Redirecting to the online documentation at http://www.ossec.net/doc/index.html... <br />
</body>
</html>
-/* @(#) $Id: extract-win-el.c,v 1.7 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All right reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
--- /dev/null
+REM Generate windows packages
+REM Author: Michael Starks
+REM Based on gen_win.sh by Daniel Cid
+
+REM This program is a free software; you can redistribute it
+REM and/or modify it under the terms of the GNU General Public
+REM License (version 2) as published by the FSF - Free Software
+REM Foundation
+
+REM Enable delayed variable expansion
+SETLOCAL ENABLEDELAYEDEXPANSION
+SET FILE=win-files.txt
+SET WINPKG=win-pkg
+
+REM Check for public domain unix2dos.exe. It can be found here: http://www.efgh.com/software/unix2dos.htm
+IF NOT EXIST unix2dos.exe echo unix2dos.exe not found, exiting... && EXIT 1
+
+REM Generating configs
+unix2dos.exe ossec.conf
+type ossec.conf > ossec-win.conf
+unix2dos.exe help.txt
+type help.txt > help_win.txt
+unix2dos.exe ..\..\etc\internal_options.conf
+type ..\..\etc\internal_options.conf > internal_options-win.conf
+unix2dos.exe ..\..\LICENSE
+type ..\..\LICENSE > LICENSE.txt
+unix2dos.exe ..\..\active-response\win\route-null.cmd
+type ..\..\active-response\win\route-null.cmd > route-null.cmd
+unix2dos.exe ..\..\active-response\win\restart-ossec.cmd
+type ..\..\active-response\win\restart-ossec.cmd > restart-ossec.cmd
+
+REM Going to the source dir
+cd ..
+IF NOT EXIST %WINPKG%\setup mkdir %WINPKG%\setup
+
+FOR /F "tokens=1,2 delims= " %%i in (Win32\%FILE%) DO (
+ REM Fix the slash
+ SET FS1=%%i
+ SET FS1=!FS1:/=\!
+ SET FS2=%%j
+ SET FS2=!FS2:/=\!
+ IF EXIST !FS1!\NUL (
+ xcopy "!FS1!" "%WINPKG%\!FS2!" /E /I /F /Y || echo Error copying !FS1! to "%WINPKG%\!FS2!" && EXIT 1
+ ) ELSE (
+ copy !FS1! "%WINPKG%\!FS2!" || echo Error copying !FS1! to "%WINPKG%\!FS2!" EXIT 1
+ )
+)
+
+REM Final cleanup
+del %WINPKG%\os_crypto\md5\main.c
+del %WINPKG%\os_crypto\blowfish\main.c
+del %WINPKG%\os_crypto\sha1\main.c
+del %WINPKG%\os_crypto\md5_sha1\main.c
+del %WINPKG%\shared\rules_op.c
+
+ENDLOCAL
-** OSSEC Windows Agent v2.3 **
-** Copyright (C) 2009 Trend Micro Inc. **
+** OSSEC Windows Agent v2.5.1 **
+** Copyright (C) 2010 Trend Micro Inc. **
-Thanks for installing 'OSSEC Windows Agent version 1.6'. Before you continue,
+Thanks for installing 'OSSEC Windows Agent version 2.5.1'. Before you continue,
make sure that you have an instance of the OSSEC server running and configured
to accept this system as an agent.
For more information on how to install the server version of OSSEC, look at:
-http://www.ossec.net/main/manual/#installtypes
+http://www.ossec.net/doc/manual/installation/index.html
http://www.ossec.net/wiki/index.php/InstallGuides
** Table of contents **
-1- How to obtain more information?
-2- What this agent does?
-3- Questions/Support?
+1- How to obtain more information
+2- What this agent does
+3- Questions/Support
** Responses **
-1- How to obtain more information?
+1- How to obtain more information
You can obtain more information about OSSEC on the following links:
-http://www.ossec.net/main/manual/ (Manual)
-http://www.ossec.net/wiki/index.php/FAQ (FAQ)
+http://www.ossec.net/doc/manual/index.html
+http://www.ossec.net/doc/faq/index.html (FAQ)
http://www.ossec.net (OSSEC site)
http://www.ossec.net/dcid/ (OSSEC blog)
-2- What this agent does?
+2- What this agent does
The Windows agent does the following tasks:
--Monitors the Windows event log on real time.
+-Monitors the Windows event log in real time.
-Monitors IIS logs (Web, FTP, SMTP) and any other logs present on your
- system (including Symantec Anti-Virus, MySQL, Apache, etc) on real time.
+ system (including Symantec Anti-Virus, MySQL, Apache, etc) in real time.
-Periodically checks the Windows Registry for changes.
--Periodically checks your Windows folders for changes.
+-Periodically, or in real-time, checks your Windows folders for changes.
-Periodically does policy verifications to make sure your system is
configured properly.
-3- Questions/Support?
+3- Questions/Support
Visit the following link for information on how to get help or
support for OSSEC:
-/* @(#) $Id: os_win.h,v 1.8 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
;--------------------------------
;General
-!define VERSION "2.3"
-!define NAME "Ossec HIDS"
+!define MUI_ICON favicon.ico
+!define MUI_UNICON ossec-uninstall.ico
+!define VERSION "2.5.1"
+!define NAME "OSSEC HIDS"
!define /date CDATE "%b %d %Y at %H:%M:%S"
-
Name "${NAME} Windows Agent v${VERSION}"
-BrandingText "Copyright (C) 2009 Trend Micro Inc."
+BrandingText "Copyright (C) 2010 Trend Micro Inc."
OutFile "ossec-win32-agent.exe"
-
-InstallDir $PROGRAMFILES\ossec-agent
-InstallDirRegKey HKLM "ossec" "Install_Dir"
-
+InstallDir "$PROGRAMFILES\ossec-agent"
+InstallDirRegKey HKLM Software\OSSEC ""
;--------------------------------
;Interface Settings
;--------------------------------
;Pages
- !define MUI_ICON favicon.ico
- !define MUI_UNICON ossec-uninstall.ico
+ !define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the install of ${Name}.\r\n\r\nClick next to continue."
-
+ !define MUI_FINISHPAGE_TITLE_3LINES
+ !define MUI_FINISHPAGE_RUN "$INSTDIR\win32ui.exe"
+ !define MUI_FINISHPAGE_RUN_TEXT "Run OSSEC Agent Manager"
+
; Page for choosing components.
!define MUI_COMPONENTSPAGE_TEXT_TOP "Select the options you want to be executed. Click next to continue."
-
- ;!define MUI_COMPONENTSPAGE_TEXT_COMPLIST "text complist"
-
- ;!define MUI_COMPONENTSPAGE_TEXT_INSTTYPE "Select components to install:"
-
- ;!define MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE "text abac"
-
- ;!define MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO "text info oi"
-
!define MUI_COMPONENTSPAGE_NODESC
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
+ ; These have to be defined again to work with the uninstall pages
+ !define MUI_WELCOMEPAGE_TITLE_3LINES
+ !define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
+; Function to stop OSSEC service if running
Function .onInit
- SetOutPath $INSTDIR
IfFileExists $INSTDIR\ossec.conf 0 +3
- MessageBox MB_OKCANCEL "${NAME} is already installed. We will stop it before continuing." IDOK NoAbort
+ MessageBox MB_OKCANCEL "${NAME} is already installed. It will be stopped before continuing." /SD IDOK IDOK NoAbort
Abort
NoAbort:
- ;; Stopping ossec service.
- ExecWait '"net" "stop" "OssecSvc"'
+ ;; Stopping ossec service.
+ nsExec::ExecToStack '"net" "stop" "OssecSvc"'
FunctionEnd
+;--------------------------------
+;Main install section
Section "OSSEC Agent (required)" MainSec
-;Required section.
SectionIn RO
SetOutPath $INSTDIR
ClearErrors
-File ossec-agent.exe default-ossec.conf manage_agents.exe os_win32ui.exe win32ui.exe ossec-rootcheck.exe internal_options.conf setup-windows.exe setup-syscheck.exe setup-iis.exe service-start.exe service-stop.exe doc.html rootkit_trojans.txt rootkit_files.txt add-localfile.exe LICENSE.txt rootcheck\rootcheck.conf rootcheck\db\win_applications_rcl.txt rootcheck\db\win_malware_rcl.txt rootcheck\db\win_audit_rcl.txt help.txt vista_sec.csv route-null.cmd restart-ossec.cmd
-WriteRegStr HKLM SOFTWARE\ossec "Install_Dir" "$INSTDIR"
+File \
+ossec-agent.exe \
+default-ossec.conf \
+manage_agents.exe \
+os_win32ui.exe \
+ossec-rootcheck.exe \
+internal_options.conf \
+setup-windows.exe \
+setup-syscheck.exe \
+setup-iis.exe \
+service-start.exe \
+service-stop.exe \
+doc.html \
+rootkit_trojans.txt \
+rootkit_files.txt \
+add-localfile.exe \
+LICENSE.txt \
+rootcheck\rootcheck.conf \
+rootcheck\db\win_applications_rcl.txt \
+rootcheck\db\win_malware_rcl.txt \
+rootcheck\db\win_audit_rcl.txt \
+help.txt \
+vista_sec.csv \
+route-null.cmd \
+restart-ossec.cmd
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ossec" "DisplayName" "OSSEC Hids Agent"
+WriteRegStr HKLM SOFTWARE\ossec "Install_Dir" "$INSTDIR"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC" "DisplayName" "${NAME} ${VERSION}"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC" "DisplayVersion" "${VERSION}"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC" "DisplayIcon" "${MUI_ICON}"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC" "HelpLink" "http://www.ossec.net/main/support/"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC" "URLInfoAbout" "http://www.ossec.net"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ossec" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ossec" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ossec" "NoRepair" 1
WriteUninstaller "uninstall.exe"
-
; Writing version and install information
FileOpen $0 $INSTDIR\VERSION.txt w
IfErrors done
FileClose $0
done:
-
CreateDirectory "$INSTDIR\rids"
CreateDirectory "$INSTDIR\syscheck"
CreateDirectory "$INSTDIR\shared"
Rename "$INSTDIR\win_applications_rcl.txt" "$INSTDIR\shared\win_applications_rcl.txt"
Rename "$INSTDIR\route-null.cmd" "$INSTDIR\active-response\bin\route-null.cmd"
Rename "$INSTDIR\restart-ossec.cmd" "$INSTDIR\active-response\bin\restart-ossec.cmd"
-Delete "$SMPROGRAMS\ossec\Edit.lnk"
-Delete "$SMPROGRAMS\ossec\Uninstall.lnk"
-Delete "$SMPROGRAMS\ossec\Documentation.lnk"
-Delete "$SMPROGRAMS\ossec\Edit Config.lnk"
-Delete "$SMPROGRAMS\ossec\*.*"
-
-; Remove directories used
-RMDir "$SMPROGRAMS\ossec"
-
-; Creating SMS directory
-CreateDirectory "$SMPROGRAMS\ossec"
-
-CreateShortCut "$SMPROGRAMS\ossec\Manage Agent.lnk" "$INSTDIR\win32ui.exe" "" "$INSTDIR\win32ui.exe" 0
-CreateShortCut "$SMPROGRAMS\ossec\Documentation.lnk" "$INSTDIR\doc.html" "" "$INSTDIR\doc.html" 0
-CreateShortCut "$SMPROGRAMS\ossec\Edit Config.lnk" "$INSTDIR\ossec.conf" "" "$INSTDIR\ossec.conf" 0
-CreateShortCut "$SMPROGRAMS\ossec\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
-
-
-; Install in the services
+Rename "$INSTDIR\os_win32ui.exe" "$INSTDIR\win32ui.exe"
+Delete "$SMPROGRAMS\OSSEC\Edit.lnk"
+Delete "$SMPROGRAMS\OSSEC\Uninstall.lnk"
+Delete "$SMPROGRAMS\OSSEC\Documentation.lnk"
+Delete "$SMPROGRAMS\OSSEC\Edit Config.lnk"
+Delete "$SMPROGRAMS\OSSEC\*.*"
+
+; Remove start menu entry.
+RMDir "$SMPROGRAMS\OSSEC"
+
+; Creating start menu directory
+CreateDirectory "$SMPROGRAMS\OSSEC"
+CreateShortCut "$SMPROGRAMS\OSSEC\Manage Agent.lnk" "$INSTDIR\win32ui.exe" "" "$INSTDIR\win32ui.exe" 0
+CreateShortCut "$SMPROGRAMS\OSSEC\Documentation.lnk" "$INSTDIR\doc.html" "" "$INSTDIR\doc.html" 0
+CreateShortCut "$SMPROGRAMS\OSSEC\Edit Config.lnk" "$INSTDIR\ossec.conf" "" "$INSTDIR\ossec.conf" 0
+CreateShortCut "$SMPROGRAMS\OSSEC\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
+
+; Install in the services (perhaps it would be better to use a plug-in here?)
+;nsExec::ExecToStack '"$INSTDIR\ossec-agent.exe" install-service'
ExecWait '"$INSTDIR\ossec-agent.exe" install-service'
-ExecWait '"$INSTDIR\setup-windows.exe" "$INSTDIR"'
-Exec '"$INSTDIR\os_win32ui.exe" "$INSTDIR"'
+;nsExec::ExecToStack '"$INSTDIR\setup-windows.exe" "$INSTDIR"'
+ExecWait '"$INSTDIR\setup-windows.exe" "$INSTDIR"'
SectionEnd
Section "Scan and monitor IIS logs (recommended)" IISLogs
-ExecWait '"$INSTDIR\setup-iis.exe" "$INSTDIR"'
+nsExec::ExecToStack '"$INSTDIR\setup-iis.exe" "$INSTDIR"'
SectionEnd
Section "Enable integrity checking (recommended)" IntChecking
-ExecWait '"$INSTDIR\setup-syscheck.exe" "$INSTDIR" "enable"'
+nsExec::ExecToStack '"$INSTDIR\setup-syscheck.exe" "$INSTDIR" "enable"'
SectionEnd
-
-
+;--------------------------------
+;Uninstall section
Section "Uninstall"
- ; Stop ossec
- ExecWait '"net" "stop" "OssecSvc"'
+ ;Need a step to check for a running agent manager, otherwise it and the INSTDIR directory will not be removed.
+
+ ; Stop ossec. Perhaps we should look for an exit status here. Also, may be a good place to use a plug-in.
+ nsExec::ExecToStack '"net" "stop" "OssecSvc"'
- ; Uninstall from the services
- Exec '"$INSTDIR\ossec-agent.exe" uninstall-service'
+ ; Uninstall from the services. Again, maybe use a plugin here.
+ nsExec::ExecToStack '"$INSTDIR\ossec-agent.exe" uninstall-service'
; Remove registry keys
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ossec"
- DeleteRegKey HKLM SOFTWARE\ossec
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSSEC"
+ DeleteRegKey HKLM SOFTWARE\OSSEC
- ; Remove files and uninstaller
+ ; Remove files and uninstaller. There have been instances where the ossec-agent directory and executable is left. Why?
Delete "$INSTDIR\ossec-agent.exe"
Delete "$INSTDIR\manage_agents.exe"
Delete "$INSTDIR\ossec.conf"
Delete "$INSTDIR"
; Remove shortcuts, if any
- Delete "$SMPROGRAMS\ossec\*.*"
- Delete "$SMPROGRAMS\ossec\*"
+ Delete "$SMPROGRAMS\OSSEC\*.*"
+ Delete "$SMPROGRAMS\OSSEC\*"
; Remove directories used
- RMDir "$SMPROGRAMS\ossec"
+ RMDir "$SMPROGRAMS\OSSEC"
RMDir "$INSTDIR\shared"
RMDir "$INSTDIR\syscheck"
RMDir "$INSTDIR\rids"
RMDir "$INSTDIR"
SectionEnd
-
-/* @(#) $Id: service-start.c,v 1.5 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: service-stop.c,v 1.4 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: setup-iis.c,v 1.16 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: setup-shared.c,v 1.3 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: setup-shared.h,v 1.4 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: setup-syscheck.c,v 1.5 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
-/* @(#) $Id: setup-win.c,v 1.42 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation
*/
; my template correctly.
!include "MUI.nsh"
-!define VERSION "1.5.1"
+!define VERSION "2.5.1"
!define NAME "Ossec HIDS"
!define /date CDATE "%b %d %Y at %H:%M:%S"
Name "${NAME} Windows Agent v${VERSION}"
-BrandingText "Copyright (C) 2009 Trend Micro Inc."
+BrandingText "Copyright (C) 2010 Trend Micro Inc."
OutFile "win32ui.exe"
-/* @(#) $Id: common.c,v 1.13 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: os_win32ui.c,v 1.10 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: os_win32ui.h,v 1.8 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
-/* @(#) $Id: win32ui.rc,v 1.7 2009/06/24 18:53:11 dcid Exp $ */\r
+/* @(#) $Id$ */\r
\r
/* Copyright (C) 2009 Trend Micro Inc.\r
* All rights reserved.\r
*\r
* This program is a free software; you can redistribute it\r
* and/or modify it under the terms of the GNU General Public\r
- * License (version 3) as published by the FSF - Free Software\r
+ * License (version 2) as published by the FSF - Free Software\r
* Foundation.\r
*\r
* License details at the LICENSE file included with OSSEC or \r
FONT 8, "MS Sans Serif"\r
BEGIN\r
DEFPUSHBUTTON "&Close",UI_ID_CLOSE,90,90,50,14\r
- GROUPBOX " Copyright (C) 2009 Trend Micro Inc.",\r
+ GROUPBOX " Copyright (C) 2010 Trend Micro Inc.",\r
IDC_STATIC,7,7,245,82\r
CTEXT "This program is a free software; you can redistribute it" \\r
" and/or modify it under the terms of the GNU General" \\r
- " Public License (GPL) version 3 as published by the FSF" \\r
+ " Public License (GPL) version 2 as published by the FSF" \\r
" - Free Software Foundation\r\n\r\n" \\r
"For more information, visit us online at http://www.ossec.net",\r
IDC_STATIC,16,18,200,63\r
logcollector/read_postgresql_log.c read_postgresql_log.c
logcollector/read_djb_multilog.c read_djb_multilog.c
logcollector/read_command.c read_command.c
+logcollector/read_fullcommand.c read_fullcommand.c
+logcollector/read_multiline.c read_multiline.c
syscheckd/config.c syscheckd-config.c
syscheckd/create_db.c create_db.c
syscheckd/run_check.c run_check.c
syscheckd/syscheck.c syscheck.c
syscheckd/syscheck.h syscheck.h
syscheckd/win-registry.c win-registry.c
+syscheckd/seechanges.c seechanges.c
rootcheck rootcheck
external/zlib-1.2.3/zlib.h zlib.h
external/zlib-1.2.3/zconf.h zconf.h
-/* @(#) $Id: win_agent.c,v 1.56 2009/12/01 20:27:01 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or
cu_time = time(0);
+ #ifndef ONEWAY
/* Check if the server has responded */
if((cu_time - available_server) > (NOTIFY_TIME - 180))
{
}
}
}
-
+ #else
+ if(0)
+ {
+ }
+ #endif
+
/* Send notification */
else if((cu_time - __win32_curr_time) > (NOTIFY_TIME - 200))
-/* @(#) $Id: win_service.c,v 1.13 2009/06/24 18:53:10 dcid Exp $ */
+/* @(#) $Id$ */
/* Copyright (C) 2009 Trend Micro Inc.
* All rights reserved.
*
* This program is a free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public
- * License (version 3) as published by the FSF - Free Software
+ * License (version 2) as published by the FSF - Free Software
* Foundation.
*
* License details at the LICENSE file included with OSSEC or