commit 7d611c05fd68ecf6c6149b0a608a58288bb779f6 Author: Manuel 'soma' Munz Date: Wed Sep 25 14:57:21 2013 +0200 Import r143 from https://svn.physik.uni-augsburg.de/svn/fail2ban-p2p/trunk diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/README b/README new file mode 100644 index 0000000..f29d137 --- /dev/null +++ b/README @@ -0,0 +1,41 @@ +README + +this is the repository for fail2ban-p2p. Fail2ban-p2p is a standalone +application written in python that will exchange IPs of attackers detected +by fail2ban (http://www.fail2ban.org) using a p2p-network. + +Basic concept: + +* Every node in the p2p-network is connected to at least one other 'friend' +* friends exchange their public keys to verify messages signed with the + senders private key. +* Nodes send each other messages when one of them detected an attacker +* Nodes also pass along this information to spread it in the network +* You can assign different trustlevels for friends and a threshold that is + required to ban an attacker locally. + +Documentation: + +See folder doc/ for documentation about installation and configuration + + +Directory structure: + +config sample configuration +debian necessary files for creating packages for debian +doc/ home of all documentation +fail2ban-p2p/ classes and functions +scripts/ scripts for building fail2ban-p2p releases +tests/ testcases, if any + +Short coding styleguide: + +- One class per file +- One directory per package +- One tab = 4 spaces +- lower-case variables, if it consists of multiple words, beginning of every + new word is upper-case, e.g.: + donauDampfSchiffFahrtsGesellschaft, protocolVersion, tmp +- the above is also true for function names +- class names behave similarly, except for the fact that they begin with a + capital letter. diff --git a/config/fail2ban-p2p.conf b/config/fail2ban-p2p.conf new file mode 100644 index 0000000..16af546 --- /dev/null +++ b/config/fail2ban-p2p.conf @@ -0,0 +1,11 @@ +[Node] +name=mynodename +addresses=0.0.0.0 +port=1337 +ownermail=foo@bar.de +bantime=7200 +threshold=80 + +[Logging] +logfile=/var/log/fail2ban-p2p.log +loglevel=INFO diff --git a/config/testnet/node1/fail2ban-p2p.conf b/config/testnet/node1/fail2ban-p2p.conf new file mode 100644 index 0000000..9e74e40 --- /dev/null +++ b/config/testnet/node1/fail2ban-p2p.conf @@ -0,0 +1,11 @@ +[Node] +name=node1 +addresses=localhost +port=10001 +ownermail=node1@bar.de +bantime=7200 +threshold=80 + +[Logging] +logfile=/tmp/fail2ban-p2p-node1.log +loglevel=DEBUG diff --git a/config/testnet/node1/friends/node2 b/config/testnet/node1/friends/node2 new file mode 100644 index 0000000..b78b97e --- /dev/null +++ b/config/testnet/node1/friends/node2 @@ -0,0 +1,10 @@ +port = 10002 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCeEaRZRyQKMIxYIt7ZYc8wgMu +M9X8wIuQW4TeoX3Hp7NpDmej92YXqAR8Aed4Q9XvCrU+Oq+YApNjI33s9UDu3z42 +NPTvKfHPis6XJBa0Uln+bMREWI0v/fILG0mW0CVMrhyRRPeVGVjC1x8TexNzojsx +Ixcd7wC4G6f+Kwpn7wIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node1/private.pem b/config/testnet/node1/private.pem new file mode 100644 index 0000000..2f3f247 --- /dev/null +++ b/config/testnet/node1/private.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC34Wy9nn4kiwhK1oFDIuFpzT0cFZhNiwEtSIkQuK2QlNJiBU2t +14S+ZVsMAej7VmyEeQs1G2rCFtEu1KE54oEaQaq06PEsnwGki1PAOmO/T7MCX+w/ +xcQu0m/Wvh8ydbia5mMa37tPDoddiO209yJMYMZKWTc1zGNaf1iy9eWIJQIDAQAB +AoGAfnDzPjxjDyvPau6vegPdLsyjbdFnpkKkb4gGQEpNhzLeq+prrNObAvVdMxeJ +JnMaMcmuLDmLIqVf+CzcJJqdHM93sPrJXN9qTKh05BNK3S8qc+Ns1RTVF93QyWHi +b9q4K6YyT7EInC7Ve5TP9/uH6ouYDwHanToXJTZGNVq6uI0CQQDewo0SNzzV7bDY +pkQ197GvcRYMejkoZQqdGNYx+JDKe0eoC8D+ON6LX6u9T+HPKSG6HxdwlVTuTmKX +ZxO11yQnAkEA01Gtbb7Ok9OD+jM13BtLPoSKS4uQNV5jOvogpStu5OGdNx2Yoima +jueUeFK9HLzMLDJmjWQvin0QsD9+t6Dk0wJACjGO8RF0CDobSJ67KlkOWX/sSV/i +c7XD+ZJkYt8ECTABBHCdQUTq8ifLnRslsywnrfO0R+OdglY17sW5wi15KwJBAL+c +gxZM+oGePECFaOQBN7QjeEbR8NwDjxSuMyWxgWc2kFimlH0OHmBP6hdEZsgFBVla +BhVU76qyhoxZtqwIzxMCQQC2MAX7u73wlcI+S1rJNSBuKCGD7G9nQagm+bddkdcw +hJrn7KaKr6SlEVntgvgMz/vgo4DLewBiRDdZTX6Vw/Js +-----END RSA PRIVATE KEY----- diff --git a/config/testnet/node1/public.pem b/config/testnet/node1/public.pem new file mode 100644 index 0000000..34362d5 --- /dev/null +++ b/config/testnet/node1/public.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC34Wy9nn4kiwhK1oFDIuFpzT0c +FZhNiwEtSIkQuK2QlNJiBU2t14S+ZVsMAej7VmyEeQs1G2rCFtEu1KE54oEaQaq0 +6PEsnwGki1PAOmO/T7MCX+w/xcQu0m/Wvh8ydbia5mMa37tPDoddiO209yJMYMZK +WTc1zGNaf1iy9eWIJQIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node2/fail2ban-p2p.conf b/config/testnet/node2/fail2ban-p2p.conf new file mode 100644 index 0000000..442f5dc --- /dev/null +++ b/config/testnet/node2/fail2ban-p2p.conf @@ -0,0 +1,11 @@ +[Node] +name=node2 +addresses=0.0.0.0 +port=10002 +ownermail=node2@bar.de +bantime=7200 +threshold=80 + +[Logging] +logfile=/tmp/fail2ban-p2p-node2.log +loglevel=DEBUG diff --git a/config/testnet/node2/friends/node1 b/config/testnet/node2/friends/node1 new file mode 100644 index 0000000..17e3039 --- /dev/null +++ b/config/testnet/node2/friends/node1 @@ -0,0 +1,10 @@ +port = 10001 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC34Wy9nn4kiwhK1oFDIuFpzT0c +FZhNiwEtSIkQuK2QlNJiBU2t14S+ZVsMAej7VmyEeQs1G2rCFtEu1KE54oEaQaq0 +6PEsnwGki1PAOmO/T7MCX+w/xcQu0m/Wvh8ydbia5mMa37tPDoddiO209yJMYMZK +WTc1zGNaf1iy9eWIJQIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node2/friends/node3 b/config/testnet/node2/friends/node3 new file mode 100644 index 0000000..4993b21 --- /dev/null +++ b/config/testnet/node2/friends/node3 @@ -0,0 +1,11 @@ +port = 10003 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0K7I6d7DfFILfabjFZYDmYJk8 +KlEHkEPNFkCLJSt0NlOGxMt9yqqNWi3pht+6a3uW0nfqU6NZc3fxpnFOHvXfI8Rl +cBRPdaGUJs2A3qbEfKVSUAF+L8Zq7XI6oHyEAjc59/tFaGQHtnK9ntJqhIIZNiDT +jrDAxZ8412gntLtLpQIDAQAB +-----END PUBLIC KEY----- + diff --git a/config/testnet/node2/friends/node4 b/config/testnet/node2/friends/node4 new file mode 100644 index 0000000..216b076 --- /dev/null +++ b/config/testnet/node2/friends/node4 @@ -0,0 +1,10 @@ +port = 10004 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLEqAEUCL+IM36ijGxRwx5AqpU +J3hc7mT6MCNtLmaLoC36lC+fzmp6PKIaEdLeurQ21nj9GFLN7tSvVXZdaHWo5V2Q +06HgcO6lGi8wjoT8Gw3E2H1dCAgjm2pFON2uDfruqgQqnHL2/Bd7div0c+utfplv +zqdwrm+BQ1yyD8PTLQIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node2/private.pem b/config/testnet/node2/private.pem new file mode 100644 index 0000000..a7b2da2 --- /dev/null +++ b/config/testnet/node2/private.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDCeEaRZRyQKMIxYIt7ZYc8wgMuM9X8wIuQW4TeoX3Hp7NpDmej +92YXqAR8Aed4Q9XvCrU+Oq+YApNjI33s9UDu3z42NPTvKfHPis6XJBa0Uln+bMRE +WI0v/fILG0mW0CVMrhyRRPeVGVjC1x8TexNzojsxIxcd7wC4G6f+Kwpn7wIDAQAB +AoGBAIicIUaF9vi2CSTSo2k9uzDNQZq1Qz9YqzHveHlEjK0ye2/zdI7Ufl1j5DKQ +y9/KF4Dizss2Qp/QP2VHS3CoIMHze2eeEEt7Qu8ZJhJGYRjGQ3rS1s4V3vr+TGyv +sabhYDVPGOxG0XBlMU4ZAWCwx3aiSorqiN5ryF1vd0Kc8bUhAkEA42LkXHikbBty +MKjPUrsqjZpv+BF7rXnNuPeHGoP48cUG66yRr7XfVRyO90AfamiUlj0AX8aNTJCy +OATnQ7ABNwJBANrxAAHhGPRGB/Z2GfTy9WonNimZQWWSt6PhIag72sYl3vsWfKdu +LVmM+u6WVVSmmp6CQnv2RClEaOnqrS8bCwkCQEm4xlE0zBpAy8T69jzcce93ItZK +1M5pr0lI94ShRRUdzCCc0p8lWEM//xoqsATP41zSakyjEyy/vQhsjo5jggECQHjm +qJhhEwShP3hsEz1ehQMPkCs8hA5xDJOkmI9sLg1JkG6bJk7W2pge79qcjZZnQe7S +A6Csh0s6iazSeLwQdPECQQCeQVUc2RN36ImChnEJxmtcSpgQfat1F/FKuOvozuvp +fZs5pVYgwzIhM2B499bYzc+b1r0e5JYmo4oqbrt3FDEe +-----END RSA PRIVATE KEY----- diff --git a/config/testnet/node2/public.pem b/config/testnet/node2/public.pem new file mode 100644 index 0000000..70e2125 --- /dev/null +++ b/config/testnet/node2/public.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCeEaRZRyQKMIxYIt7ZYc8wgMu +M9X8wIuQW4TeoX3Hp7NpDmej92YXqAR8Aed4Q9XvCrU+Oq+YApNjI33s9UDu3z42 +NPTvKfHPis6XJBa0Uln+bMREWI0v/fILG0mW0CVMrhyRRPeVGVjC1x8TexNzojsx +Ixcd7wC4G6f+Kwpn7wIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node3/fail2ban-p2p.conf b/config/testnet/node3/fail2ban-p2p.conf new file mode 100644 index 0000000..4959362 --- /dev/null +++ b/config/testnet/node3/fail2ban-p2p.conf @@ -0,0 +1,11 @@ +[Node] +name=node3 +addresses=0.0.0.0 +port=10003 +ownermail=node3@bar.de +bantime=7200 +threshold=80 + +[Logging] +logfile=/tmp/fail2ban-p2p-node3.log +loglevel=DEBUG diff --git a/config/testnet/node3/friends/node2 b/config/testnet/node3/friends/node2 new file mode 100644 index 0000000..b78b97e --- /dev/null +++ b/config/testnet/node3/friends/node2 @@ -0,0 +1,10 @@ +port = 10002 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCeEaRZRyQKMIxYIt7ZYc8wgMu +M9X8wIuQW4TeoX3Hp7NpDmej92YXqAR8Aed4Q9XvCrU+Oq+YApNjI33s9UDu3z42 +NPTvKfHPis6XJBa0Uln+bMREWI0v/fILG0mW0CVMrhyRRPeVGVjC1x8TexNzojsx +Ixcd7wC4G6f+Kwpn7wIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node3/friends/node4 b/config/testnet/node3/friends/node4 new file mode 100644 index 0000000..216b076 --- /dev/null +++ b/config/testnet/node3/friends/node4 @@ -0,0 +1,10 @@ +port = 10004 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLEqAEUCL+IM36ijGxRwx5AqpU +J3hc7mT6MCNtLmaLoC36lC+fzmp6PKIaEdLeurQ21nj9GFLN7tSvVXZdaHWo5V2Q +06HgcO6lGi8wjoT8Gw3E2H1dCAgjm2pFON2uDfruqgQqnHL2/Bd7div0c+utfplv +zqdwrm+BQ1yyD8PTLQIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node3/private.pem b/config/testnet/node3/private.pem new file mode 100644 index 0000000..04050b2 --- /dev/null +++ b/config/testnet/node3/private.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQD0K7I6d7DfFILfabjFZYDmYJk8KlEHkEPNFkCLJSt0NlOGxMt9 +yqqNWi3pht+6a3uW0nfqU6NZc3fxpnFOHvXfI8RlcBRPdaGUJs2A3qbEfKVSUAF+ +L8Zq7XI6oHyEAjc59/tFaGQHtnK9ntJqhIIZNiDTjrDAxZ8412gntLtLpQIDAQAB +AoGAapl5IlWG/p2x1WAOrv91mx6pR78hyS+OqkcAvr7njcD6Dmh0fuKwOy4XxVCA +9J5gQqR4ffEt66uhvfpwlS6nIH3neVVqV5zfe12jbh55zKeZoYXe1zDYENKk7B4g +f5BgNVaepiL7ssM98fe0a/hgbc01xUjk4IYdS+eEAd2lvoECQQD8wZIxLrKpiUDl +O4M8LTCcMEirfaORN+XaCYGzIontArMmccsKn9oZkbBcIKnR5IOW4ZkIxpu5qKCv +nv3tqTR5AkEA903q7h+nQTSPjQZOyZfc8h3YXYq3TFsKQkb7+ALZ1DbNQxigwOLM +T79BiKQMYnrioC5r0RaeM76aHdZSPYlNjQJBAPrb0BH6TB6R+BPLxkuyej16epWi +I/ZcaUfHCbBWRlgyxsYQSLnpv5iDDWvSi1mjmKrmi3G3VRWmdJz5iwMXXdkCQFCk +xPZPth/KPwFyzCBq+C6v0s12HZ21llvUf/f5HgVYtYiqsEkV7CAZMwqWzD8U6W/o +k1oEcSRYhDM0n27XpkUCQQDaWG5P9s3tZ69hc83BCr3iHtXNtbgA9/zj8zwCTmD2 +nrBJTDMNyNqpdl8lcTC1Vzgv+Ha5u+1UDIzxmsigm0SM +-----END RSA PRIVATE KEY----- diff --git a/config/testnet/node3/public.pem b/config/testnet/node3/public.pem new file mode 100644 index 0000000..bc6f129 --- /dev/null +++ b/config/testnet/node3/public.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0K7I6d7DfFILfabjFZYDmYJk8 +KlEHkEPNFkCLJSt0NlOGxMt9yqqNWi3pht+6a3uW0nfqU6NZc3fxpnFOHvXfI8Rl +cBRPdaGUJs2A3qbEfKVSUAF+L8Zq7XI6oHyEAjc59/tFaGQHtnK9ntJqhIIZNiDT +jrDAxZ8412gntLtLpQIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node4/fail2ban-p2p.conf b/config/testnet/node4/fail2ban-p2p.conf new file mode 100644 index 0000000..034f71f --- /dev/null +++ b/config/testnet/node4/fail2ban-p2p.conf @@ -0,0 +1,11 @@ +[Node] +name=node4 +addresses=0.0.0.0 +port=10004 +ownermail=node4@bar.de +bantime=7200 +threshold=80 + +[Logging] +logfile=/tmp/fail2ban-p2p-node4.log +loglevel=DEBUG diff --git a/config/testnet/node4/friends/node2 b/config/testnet/node4/friends/node2 new file mode 100644 index 0000000..b78b97e --- /dev/null +++ b/config/testnet/node4/friends/node2 @@ -0,0 +1,10 @@ +port = 10002 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCeEaRZRyQKMIxYIt7ZYc8wgMu +M9X8wIuQW4TeoX3Hp7NpDmej92YXqAR8Aed4Q9XvCrU+Oq+YApNjI33s9UDu3z42 +NPTvKfHPis6XJBa0Uln+bMREWI0v/fILG0mW0CVMrhyRRPeVGVjC1x8TexNzojsx +Ixcd7wC4G6f+Kwpn7wIDAQAB +-----END PUBLIC KEY----- diff --git a/config/testnet/node4/friends/node3 b/config/testnet/node4/friends/node3 new file mode 100644 index 0000000..4993b21 --- /dev/null +++ b/config/testnet/node4/friends/node3 @@ -0,0 +1,11 @@ +port = 10003 +trustlevel = 80 +address = 127.0.0.1 + +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD0K7I6d7DfFILfabjFZYDmYJk8 +KlEHkEPNFkCLJSt0NlOGxMt9yqqNWi3pht+6a3uW0nfqU6NZc3fxpnFOHvXfI8Rl +cBRPdaGUJs2A3qbEfKVSUAF+L8Zq7XI6oHyEAjc59/tFaGQHtnK9ntJqhIIZNiDT +jrDAxZ8412gntLtLpQIDAQAB +-----END PUBLIC KEY----- + diff --git a/config/testnet/node4/private.pem b/config/testnet/node4/private.pem new file mode 100644 index 0000000..8c887f7 --- /dev/null +++ b/config/testnet/node4/private.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXwIBAAKBgQDLEqAEUCL+IM36ijGxRwx5AqpUJ3hc7mT6MCNtLmaLoC36lC+f +zmp6PKIaEdLeurQ21nj9GFLN7tSvVXZdaHWo5V2Q06HgcO6lGi8wjoT8Gw3E2H1d +CAgjm2pFON2uDfruqgQqnHL2/Bd7div0c+utfplvzqdwrm+BQ1yyD8PTLQIDAQAB +AoGBAKbxb9U74BiU9WCzfTilFQ7ibw5xyFR1s1OugWE/lRPSIhpu+lvhAM3uzMCr +yHRMftzaImrHNUOQxQ5DLuSJfLdedB8ar/P5lwJn6bGt7N9XqzCSCE0x8fvfsGBM +Vtc5ed+DA/WgiWcqQ1aPDCgRV8f1tVxOCabQqKqpXVxqSYNNAkEA7Rcn/BpSKQ/G +a0/JmcRVpjMEKivXpz/JC6twGHkfa7PqbgmfyCC1acWWjerhHwN60IA58grVtakA +2tAOiEjrowJBANtE58flh3DPZN9UIYrSxEPkUQD9020S9rMO0M8H9yvqXajEq7ek +BvelBNTHZZy0MM91KtdLgaFVt4pndq5OMu8CQQDJvRtr26WvhNnMNB8R9Ur/2Ycg +rx+YE6FpiZ4fZOkEhxniOdQ4wQQ8lUFvTr3x2s8lHQaxWuDP65drmP/UnV/LAkEA +iGwTpVxaa0at5QFMKTo/IFqCR5KlI7zjvr4eDmFPWIRlp2ZNzGECcLu8CMLSpq+5 +mqm0cOUqjv1sx3Dd907yAwJBAK2bdFJIm+IAt5vv82s2m2/WEXUmvJg8t8/ICOuj +atOa2zNDL3T0aP0saXENBkudlbujMUnmAw4FNnWDQuhiLAA= +-----END RSA PRIVATE KEY----- diff --git a/config/testnet/node4/public.pem b/config/testnet/node4/public.pem new file mode 100644 index 0000000..4c01ecd --- /dev/null +++ b/config/testnet/node4/public.pem @@ -0,0 +1,6 @@ +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLEqAEUCL+IM36ijGxRwx5AqpU +J3hc7mT6MCNtLmaLoC36lC+fzmp6PKIaEdLeurQ21nj9GFLN7tSvVXZdaHWo5V2Q +06HgcO6lGi8wjoT8Gw3E2H1dCAgjm2pFON2uDfruqgQqnHL2/Bd7div0c+utfplv +zqdwrm+BQ1yyD8PTLQIDAQAB +-----END PUBLIC KEY----- diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..4e231ab --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +fail2ban-p2p for Debian +----------------------- + + + + -- Manuel Munz Wed, 07 Nov 2012 16:40:08 +0100 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 0000000..63609ee --- /dev/null +++ b/debian/README.source @@ -0,0 +1,9 @@ +fail2ban-p2p for Debian +----------------------- + + + + + + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b0cba86 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,56 @@ +fail2ban-p2p (0.1.2) precise; urgency=low + + * Better input filtering and error messages for invalid messages + * document classes and functions in code + * add sphinx for generating documentation + * reorder modules to resolve circular imports + * general cleanups + * client: fix an exception when the message received from the server was not valid json + + -- Manuel Munz Fri, 24 May 2013 15:23:49 +0200 + +fail2ban-p2p (0.1.1) precise; urgency=low + + * 0.1.1 Fix problem with table dump in fail2ban-p2p-client + + -- Manuel Munz Tue, 16 Apr 2013 18:00:24 +0200 + +fail2ban-p2p (0.1.0) precise; urgency=low + + * fix trustlevels handling + * pull banlists from friends when starting the node + + -- Manuel Munz Thu, 11 Apr 2013 16:14:53 +0200 + +fail2ban-p2p (0.0.5-1) oneiric; urgency=low + + * Change in message protocol. Use JSON encoded messages now. + * Warning: This beraks compatibility with earlier versions. + + -- Manuel Munz Thu, 21 Mar 2013 18:42:32 +0100 + +fail2ban-p2p (0.0.4-1) oneiric; urgency=low + + * removed dummy signature check, fixes crash when 'signature' was sent as signature + * fix permissions on private keyfile + * more log output + + -- Manuel Munz Wed, 23 Jan 2013 16:07:55 +0100 + +fail2ban-p2p (0.0.3-1) oneiric; urgency=low + + * Update to 0.0.3 + + -- Manuel Munz Wed, 23 Jan 2013 15:53:43 +0100 + +fail2ban-p2p (0.0.2-1) oneiric; urgency=low + + * Update to 0.0.2 + + -- Manuel Munz Wed, 23 Jan 2013 15:53:30 +0100 + +fail2ban-p2p (0.0.1-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- Manuel Munz Wed, 07 Nov 2012 16:40:08 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..98e8023 --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: fail2ban-p2p +Section: net +Priority: optional +Maintainer: Manuel Munz +Build-Depends: debhelper (>= 8.0.0), python (>= 2.5.4-1~) +Build-Depends-Indep: python-central (>= 0.5.6) +XS-Python-Version: current, >= 2.4 +Standards-Version: 3.9.2 +#Homepage: +#Vcs-Git: git://git.debian.org/collab-maint/fail2ban-p2p.git +#Vcs-Browser: http://git.debian.org/?p=collab-maint/fail2ban-p2p.git;a=summary + +Package: fail2ban-p2p +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, python-m2crypto, python-argparse, adduser +XB-Python-Version: ${python:Versions} +Description: Distribute attacker information from fail2ban via a p2p network + Fail2ban-p2p can be used to distribute information about atackers in a + p2p/f2f network to ban these attackers on all hosts. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..6ed6485 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,26 @@ +This package was originally debianized by Manuel Munz + on Wed Nov 11 15:50:00 HST 2012 + +Copyright: 2012- Manuel Munz/Johannes Fürmann + +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 2 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, write to the +Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +MA 02110-1301, USA. + +On Debian systems, the complete text of the GNU General Public +License, version 2, can be found in /usr/share/common-licenses/GPL-2. + +The Debian packaging is (C) 2011-, Manuel Munz +and is licensed under the GPL, see above. + diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/emacsen-install.ex b/debian/emacsen-install.ex new file mode 100644 index 0000000..ce784d1 --- /dev/null +++ b/debian/emacsen-install.ex @@ -0,0 +1,45 @@ +#! /bin/sh -e +# /usr/lib/emacsen-common/packages/install/fail2ban-p2p + +# Written by Jim Van Zandt , borrowing heavily +# from the install scripts for gettext by Santiago Vila +# and octave by Dirk Eddelbuettel . + +FLAVOR=$1 +PACKAGE=fail2ban-p2p + +if [ ${FLAVOR} = emacs ]; then exit 0; fi + +echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR} + +#FLAVORTEST=`echo $FLAVOR | cut -c-6` +#if [ ${FLAVORTEST} = xemacs ] ; then +# SITEFLAG="-no-site-file" +#else +# SITEFLAG="--no-site-file" +#fi +FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile" + +ELDIR=/usr/share/emacs/site-lisp/${PACKAGE} +ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE} + +# Install-info-altdir does not actually exist. +# Maybe somebody will write it. +if test -x /usr/sbin/install-info-altdir; then + echo install/${PACKAGE}: install Info links for ${FLAVOR} + install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz +fi + +install -m 755 -d ${ELCDIR} +cd ${ELDIR} +FILES=`echo *.el` +cp ${FILES} ${ELCDIR} +cd ${ELCDIR} + +cat << EOF > path.el +(setq load-path (cons "." load-path) byte-compile-warnings nil) +EOF +${FLAVOR} ${FLAGS} ${FILES} +rm -f *.el path.el + +exit 0 diff --git a/debian/emacsen-remove.ex b/debian/emacsen-remove.ex new file mode 100644 index 0000000..2fe16e1 --- /dev/null +++ b/debian/emacsen-remove.ex @@ -0,0 +1,15 @@ +#!/bin/sh -e +# /usr/lib/emacsen-common/packages/remove/fail2ban-p2p + +FLAVOR=$1 +PACKAGE=fail2ban-p2p + +if [ ${FLAVOR} != emacs ]; then + if test -x /usr/sbin/install-info-altdir; then + echo remove/${PACKAGE}: removing Info links for ${FLAVOR} + install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/fail2ban-p2p.info.gz + fi + + echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR} + rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE} +fi diff --git a/debian/emacsen-startup.ex b/debian/emacsen-startup.ex new file mode 100644 index 0000000..d5c596f --- /dev/null +++ b/debian/emacsen-startup.ex @@ -0,0 +1,25 @@ +;; -*-emacs-lisp-*- +;; +;; Emacs startup file, e.g. /etc/emacs/site-start.d/50fail2ban-p2p.el +;; for the Debian fail2ban-p2p package +;; +;; Originally contributed by Nils Naumann +;; Modified by Dirk Eddelbuettel +;; Adapted for dh-make by Jim Van Zandt + +;; The fail2ban-p2p package follows the Debian/GNU Linux 'emacsen' policy and +;; byte-compiles its elisp files for each 'emacs flavor' (emacs19, +;; xemacs19, emacs20, xemacs20...). The compiled code is then +;; installed in a subdirectory of the respective site-lisp directory. +;; We have to add this to the load-path: +(let ((package-dir (concat "/usr/share/" + (symbol-name flavor) + "/site-lisp/fail2ban-p2p"))) +;; If package-dir does not exist, the fail2ban-p2p package must have +;; removed but not purged, and we should skip the setup. + (when (file-directory-p package-dir) + (setq load-path (cons package-dir load-path)) + (autoload 'fail2ban-p2p-mode "fail2ban-p2p-mode" + "Major mode for editing fail2ban-p2p files." t) + (add-to-list 'auto-mode-alist '("\\.fail2ban-p2p$" . fail2ban-p2p-mode)))) + diff --git a/debian/fail2ban-p2p-doc.docs b/debian/fail2ban-p2p-doc.docs new file mode 100644 index 0000000..d4f4542 --- /dev/null +++ b/debian/fail2ban-p2p-doc.docs @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/fail2ban-p2p-doc.install b/debian/fail2ban-p2p-doc.install new file mode 100644 index 0000000..d4f4542 --- /dev/null +++ b/debian/fail2ban-p2p-doc.install @@ -0,0 +1 @@ +#DOCS# diff --git a/debian/fail2ban-p2p.cron.d.ex b/debian/fail2ban-p2p.cron.d.ex new file mode 100644 index 0000000..a803d33 --- /dev/null +++ b/debian/fail2ban-p2p.cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the fail2ban-p2p package +# +0 4 * * * root [ -x /usr/bin/fail2ban-p2p_maintenance ] && /usr/bin/fail2ban-p2p_maintenance diff --git a/debian/fail2ban-p2p.debhelper.log b/debian/fail2ban-p2p.debhelper.log new file mode 100644 index 0000000..2d92aa3 --- /dev/null +++ b/debian/fail2ban-p2p.debhelper.log @@ -0,0 +1,12 @@ +dh_installdirs +dh_installdocs +dh_installlogrotate +dh_pycentral +dh_installinit +dh_link +dh_compress +dh_fixperms +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb diff --git a/debian/fail2ban-p2p.default b/debian/fail2ban-p2p.default new file mode 100644 index 0000000..f10a5ce --- /dev/null +++ b/debian/fail2ban-p2p.default @@ -0,0 +1,13 @@ +# Defaults for fail2ban-p2p initscript +# sourced by /etc/init.d/fail2ban-p2p +# installed at /etc/default/fail2ban-p2p by the maintainer scripts + +# +# This is a POSIX shell fragment +# + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="" + +# Set this to true to start the daemon at boot +START_DAEMON=false diff --git a/debian/fail2ban-p2p.doc-base.EX b/debian/fail2ban-p2p.doc-base.EX new file mode 100644 index 0000000..342d607 --- /dev/null +++ b/debian/fail2ban-p2p.doc-base.EX @@ -0,0 +1,20 @@ +Document: fail2ban-p2p +Title: Debian fail2ban-p2p Manual +Author: +Abstract: This manual describes what fail2ban-p2p is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/fail2ban-p2p/fail2ban-p2p.sgml.gz + +Format: postscript +Files: /usr/share/doc/fail2ban-p2p/fail2ban-p2p.ps.gz + +Format: text +Files: /usr/share/doc/fail2ban-p2p/fail2ban-p2p.text.gz + +Format: HTML +Index: /usr/share/doc/fail2ban-p2p/html/index.html +Files: /usr/share/doc/fail2ban-p2p/html/*.html diff --git a/debian/fail2ban-p2p.postinst.debhelper b/debian/fail2ban-p2p.postinst.debhelper new file mode 100644 index 0000000..a702624 --- /dev/null +++ b/debian/fail2ban-p2p.postinst.debhelper @@ -0,0 +1,15 @@ +# Automatically added by dh_pycentral +rm -f /var/lib/pycentral/fail2ban-p2p.pkgremove +if which pycentral >/dev/null 2>&1; then + pycentral pkginstall fail2ban-p2p + if grep -qs '^fail2ban-p2p$' /var/lib/pycentral/delayed-pkgs; then + sed -i '/^fail2ban-p2p$/d' /var/lib/pycentral/delayed-pkgs + fi +fi +# End automatically added section +# Automatically added by dh_installinit +if [ -x "/etc/init.d/fail2ban-p2p" ]; then + update-rc.d fail2ban-p2p defaults 99 >/dev/null + invoke-rc.d fail2ban-p2p start || exit $? +fi +# End automatically added section diff --git a/debian/fail2ban-p2p.postrm.debhelper b/debian/fail2ban-p2p.postrm.debhelper new file mode 100644 index 0000000..337ed64 --- /dev/null +++ b/debian/fail2ban-p2p.postrm.debhelper @@ -0,0 +1,5 @@ +# Automatically added by dh_installinit +if [ "$1" = "purge" ] ; then + update-rc.d fail2ban-p2p remove >/dev/null +fi +# End automatically added section diff --git a/debian/fail2ban-p2p.preinst.debhelper b/debian/fail2ban-p2p.preinst.debhelper new file mode 100644 index 0000000..f5e60b7 --- /dev/null +++ b/debian/fail2ban-p2p.preinst.debhelper @@ -0,0 +1,8 @@ +# Automatically added by dh_pycentral +case "$1" in + install|upgrade) + mkdir -p /var/lib/pycentral + echo '# the presence of this file allows calling pkgremove on upgrade' \ + > /var/lib/pycentral/fail2ban-p2p.pkgremove +esac +# End automatically added section diff --git a/debian/fail2ban-p2p.prerm.debhelper b/debian/fail2ban-p2p.prerm.debhelper new file mode 100644 index 0000000..9b32660 --- /dev/null +++ b/debian/fail2ban-p2p.prerm.debhelper @@ -0,0 +1,50 @@ +# Automatically added by dh_installinit +if [ -x "/etc/init.d/fail2ban-p2p" ]; then + invoke-rc.d fail2ban-p2p stop || exit $? +fi +# End automatically added section +# Automatically added by dh_pycentral +case "$1" in remove|upgrade) + pkgremove=y +esac +if [ -f /var/lib/pycentral/fail2ban-p2p.pkgremove ] || [ -f /var/lib/pycentral/pkgremove ]; then + pkgremove=y +fi +if [ "$pkgremove" = y ]; then +if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then + pycentral pkgremove fail2ban-p2p +else + flist=$(tempfile) + slist=$(tempfile) + dpkg -L fail2ban-p2p | tee $flist | \ + while read n; do + case "$n" in + /usr/share/pyshared/*) + n2=${n#/usr/share/pyshared/*} + case "$n" in + *.py) echo "p $n";; + *) [ -d "$n" ] && echo "d $n2" || echo "f $n2" + esac + ;; + *) continue + esac + done > $slist + if [ -s $slist ]; then + for d in /usr/lib/python[0-9].[0-9]/????-packages; do + case "$d" in */python2.1/*|*/python2.2/*) continue; esac + while read t n; do + case "$t" in + p) rm -f $d/$n $d/${n}[co];; + d) rmdir $d/$n 2>/dev/null || true;; + *) rm -f $d/$n + esac + done < $slist + done + fi + awk '/\/usr\/share\/pyshared/ {next} /\.py$/ {print $0"c\n" $0"o"}' $flist \ + | xargs -r rm -f >&2 + rm -f $flist $slist +fi +rm -f /var/lib/pycentral/fail2ban-p2p.pkgremove +fi +# End automatically added section diff --git a/debian/fail2ban-p2p.substvars b/debian/fail2ban-p2p.substvars new file mode 100644 index 0000000..333cfe3 --- /dev/null +++ b/debian/fail2ban-p2p.substvars @@ -0,0 +1,3 @@ +python:Versions=current, >= 2.4 +python:Depends=python (>= 2.4), python-central (>= 0.6.11) +misc:Depends= diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..3611e88 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +fail2ban-p2p_0.0.1-1_all.deb net optional diff --git a/debian/init.d b/debian/init.d new file mode 100644 index 0000000..dc445b7 --- /dev/null +++ b/debian/init.d @@ -0,0 +1,161 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: fail2ban-p2p +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: Manuel Munz + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=fail2ban-p2p # Introduce a short description here +NAME=fail2ban-p2p # Introduce the short server's name here +DAEMON=/usr/bin/fail2ban-p2p.py # Introduce the server's location here +DAEMON_ARGS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +if [ ! "$START_DAEMON" = "true" ]; then + echo "Fail2ban-p2p is not started. Enable it by editing /etc/default/fail2ban-p2p" + exit 0 +fi + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. +. /lib/lsb/init-functions + +# +# Function that starts the daemon/service +# +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon -m -c fail2ban-p2p -g fail2ban-p2p -b --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon -c fail2ban-p2p -g fail2ban-p2p -m -b --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + $DAEMON_ARGS \ + || return 2 + # Add code here, if necessary, that waits for the process to be ready + # to handle requests from services started subsequently which depend + # on this one. As a last resort, sleep for some time. +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --name ${NAME}.py + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + # Wait for children to finish too if this is a daemon that forks + # and if the daemon is only ever run from this initscript. + # If the above conditions are not satisfied then add some other code + # that waits for the process to drop all resources that could be + # needed by services started subsequently. A last resort is to + # sleep for some time. + start-stop-daemon --stop --quiet --oknodo --retry=0/10/KILL/9 --exec $DAEMON + [ "$?" = 2 ] && return 2 + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +#VERBOSE="yes" +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + do_start + do_stop + return 0 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/manpage.1.ex b/debian/manpage.1.ex new file mode 100644 index 0000000..0782450 --- /dev/null +++ b/debian/manpage.1.ex @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH FAIL2BAN-P2P SECTION "November 7, 2012" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +fail2ban-p2p \- program to do something +.SH SYNOPSIS +.B fail2ban-p2p +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B fail2ban-p2p +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBfail2ban-p2p\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +fail2ban-p2p was written by . +.PP +This manual page was written by Manuel Munz , +for the Debian project (and may be used by others). diff --git a/debian/manpage.sgml.ex b/debian/manpage.sgml.ex new file mode 100644 index 0000000..ba626cd --- /dev/null +++ b/debian/manpage.sgml.ex @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + November 7, 2012"> + + SECTION"> + manu@somakoma.de"> + + FAIL2BAN-P2P"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff --git a/debian/manpage.xml.ex b/debian/manpage.xml.ex new file mode 100644 index 0000000..56b78ed --- /dev/null +++ b/debian/manpage.xml.ex @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff --git a/debian/menu.ex b/debian/menu.ex new file mode 100644 index 0000000..b3239f7 --- /dev/null +++ b/debian/menu.ex @@ -0,0 +1,2 @@ +?package(fail2ban-p2p):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\ + title="fail2ban-p2p" command="/usr/bin/fail2ban-p2p" diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..493c32b --- /dev/null +++ b/debian/postinst @@ -0,0 +1,42 @@ +#!/bin/sh +# postinst script for fail2ban-p2p +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + [ -z "$SERVER_USER" ] && SERVER_USER="fail2ban-p2p" + # fix permissions on /etc/fail2ban-p2p + chown $SERVER_USER:adm /etc/fail2ban-p2p > /dev/null + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm.ex b/debian/postrm.ex new file mode 100644 index 0000000..170d16d --- /dev/null +++ b/debian/postrm.ex @@ -0,0 +1,37 @@ +#!/bin/sh +# postrm script for fail2ban-p2p +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..2ccd367 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,76 @@ +#!/bin/sh +# preinst script for fail2ban-p2p +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + # see http://www.debian.org/doc/manuals/securing-debian-howto/ch9.en.html + # Sane defaults: + [ -z "$SERVER_HOME" ] && SERVER_HOME="/var/run/fail2ban-p2p" + [ -z "$SERVER_USER" ] && SERVER_USER="fail2ban-p2p" + [ -z "$SERVER_NAME" ] && SERVER_NAME="Fail2ban-p2p user" + [ -z "$SERVER_GROUP" ] && SERVER_GROUP="fail2ban-p2p" + + # create user + # 1. create group if not existing + if ! getent group | grep -q "^$SERVER_GROUP:" ; then + echo -n "Adding group $SERVER_GROUP.." + addgroup --quiet --system $SERVER_GROUP 2>/dev/null ||true + echo "..done" + fi + # 2. create homedir if not existing + test -d $SERVER_HOME || mkdir $SERVER_HOME + # 3. create user if not existing + if ! getent passwd | grep -q "^$SERVER_USER:"; then + echo -n "Adding system user $SERVER_USER.." + adduser --quiet \ + --system \ + --ingroup $SERVER_GROUP \ + --no-create-home \ + --disabled-password \ + $SERVER_USER 2>/dev/null || true + echo "..done" + fi + # 4. adjust passwd entry + usermod -c "$SERVER_NAME" \ + -d $SERVER_HOME \ + -g $SERVER_GROUP \ + $SERVER_USER + # 5. adjust file and directory permissions + if ! dpkg-statoverride --list $SERVER_HOME >/dev/null + then + chown -R $SERVER_USER:adm $SERVER_HOME + chmod u=rwx,g=rxs,o= $SERVER_HOME + fi + # create logfile and make it owned by the user + test -f /var/log/fail2ban-p2p.log || touch /var/log/fail2ban-p2p.log + chown $SERVER_USER:adm /var/log/fail2ban-p2p.log > /dev/null + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/prerm.ex b/debian/prerm.ex new file mode 100644 index 0000000..f013994 --- /dev/null +++ b/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for fail2ban-p2p +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d088749 --- /dev/null +++ b/debian/rules @@ -0,0 +1,65 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DESTDIR=$(CURDIR)/debian/fail2ban-p2p + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + +build: + +clean: clean-inits + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + rm -rf build + # Does not hurt to ask distutils to do their duty + python setup.py clean + # Enforce removal of *.pyc files. Apparently dh_clean does + # not perform find on provided filename patterns. + find . -name \*.pyc -exec rm -f {} \; + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Install the package into debian/fail2ban-p2p. + python setup.py install --root=$(DESTDIR) --no-compile --install-layout=deb + +# +# Just to comply with policy 4.8 +binary-arch: + +# Build architecture-independent files here. +binary-indep: install + dh_testdir + dh_testroot + #dh_installchangelogs ChangeLog + dh_installdocs + dh_installlogrotate + dh_pycentral + dh_installinit -- defaults 99 + #dh_installman man/*.1 + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep +.PHONY: build clean binary-indep binary-arch binary install configure copy-inits clean-inits diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian/watch.ex b/debian/watch.ex new file mode 100644 index 0000000..3913d0a --- /dev/null +++ b/debian/watch.ex @@ -0,0 +1,23 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + +# Uncomment to examine a Webpage +# +#http://www.example.com/downloads.php fail2ban-p2p-(.*)\.tar\.gz + +# Uncomment to examine a Webserver directory +#http://www.example.com/pub/fail2ban-p2p-(.*)\.tar\.gz + +# Uncommment to examine a FTP server +#ftp://ftp.example.com/pub/fail2ban-p2p-(.*)\.tar\.gz debian uupdate + +# Uncomment to find new files on sourceforge, for devscripts >= 2.9 +# http://sf.net/fail2ban-p2p/fail2ban-p2p-(.*)\.tar\.gz + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html fail2ban-p2p-(.*)\.tar\.gz diff --git a/doc/BUGS b/doc/BUGS new file mode 100644 index 0000000..7bae0f4 --- /dev/null +++ b/doc/BUGS @@ -0,0 +1 @@ +Please report bugs at https://svn.physik.uni-augsburg.de/projects/fail2ban-p2p/ diff --git a/doc/CONFIG b/doc/CONFIG new file mode 100644 index 0000000..0f41c15 --- /dev/null +++ b/doc/CONFIG @@ -0,0 +1,36 @@ += fail2ban-p2p.conf = + +Default location is /etc/fail2ban-p2p/fail2ban-p2p.conf. +This file holds the information for your node. Following things must be configured: + +== Node == + +{{{ +[Node] +name=mynodename +addresses=127.0.0.1,10.0.0.1 +port=1337 +ownermail=foo@bar.de +bantime=7200 +threshold=80 +}}} + + * name: Name of your Node, this is only used fpr informational purposes. In the + mesh the node is identified by its uid (hash of public key) + * addresses: A comma seperated list of listen addresses + * port: Listening port + * ownermail: Your email address (not used for now) + * bantime: how long in seconds fail2ban-p2p keeps banned hosts in its internal database + * threshold: Minimum trustlevel a ban for a host needs to take action (block it) + +== Logging == + +{{{ +[Logging] +logfile=/var/log/fail2ban-p2p.log +loglevel=INFO +}}} + + * logfile: The file where fail2ban-p2p logs to + * loglevel: How verbose log output is, can be: + DEBUG, INFO, WARN, ERROR, BAN diff --git a/doc/INSTALL b/doc/INSTALL new file mode 100644 index 0000000..61edb7c --- /dev/null +++ b/doc/INSTALL @@ -0,0 +1,117 @@ +If packages for your distribution are available use them. If not use the +manual installation described below. + +== Depencies == + + * python + * python-m2crypt + * python-argparse + +== Installation on Debian based systems == + + * Download the latest deb package + * install depencies: apt-get install python-m2crypt python-argparse + * install fail2ban-p2p: dpkg -i fail2ban-p2p-.deb + +== Manual instalation == + +Download the latest tarball and extract it. After changing into the +fail2ban-p2p directory execute "python setup.py install", this will +install fail2ban-p2p.py and fail2ban-p2p-client.py to /usr/local/bin. +Modules will be installed to /usr/share/fail2ban-p2p/fail2ban-p2p. + +== Configuration == + +The default configuration directory is /etc/fail2ban-p2p. You can specify +another directory with the -c command line option. See the CONFIG file in +this directory for a explanation of all config options. + +== Setup == + +In order to use fail2ban-p2p you need to create a keypair for your node, +exchange public keys with at least one friend and setup fail2ban to work +with fail2ban-p2p. + +1.) Creating a keypair for your node and exchange it with friend(s) + +If no keypair is found in the configuration directory it will be created +at the first start of fail2ban-p2p.py or when using the -K command line +option. This needs to be done by a user who has write permissions in +the configuration directory. + +Two files are created: private.pem and public.pem. private.pem is your +private key, keep this secret. public.pem needs to be shared with at least +one friend. But before you share it add something like this in public.pem +before the key: + +address = 1.2.3.4 +port = 1337 +trustlevel = 80 + +This is the information how your node is reachable. + +address Use your IP address or dns name here. + To listen on all addresses use 0.0.0.0 +port The port your node listens ons (see fail2ban-p2p.conf) +trustlevel This is something your friend is allowed to edit + to give you more or less trust. Its a percentage, so use + something between 0 and 100. + +Now send the edited public.pem to your friend(s). For every friend that you +want to add get his private.pem and place it in /friends. Rename +the file to the name you want to use for this friend. + +2.) Integration with fail2ban + +To properly work and be able to exchange information with the fail2ban-daemon +you need to integrate fail2ban and fail2ban-p2p. Information about attackers +needs to be exchanged in two directions: + +2.1.) From fail2ban-p2p to fail2ban + +Fail2ban gets its information about attackers by watching the fail2ban-p2p +logfile. To setup fail2ban to watch the fail2ban-p2p log file do the following: + + * Make fail2ban-p2p log into /var/log/fail2ban-p2p.log (this is the default) + * Add a jail for fail2ban-p2p like this in /etc/fail2ban/jails.conf: + + [ssh-p2p] + enabled = true + port = ssh + filter = sshd-p2p + logpath = /var/log/fail2ban-p2p.log + bantime = 120 + findtime = 120 + maxretry = 1 + + See the fail2ban manual for explanation of these options. You probably + want to increase the bantime. It is important to leave maxretry at 1 (block + a host after 1 entry for it was found in /var/log/fail2ban-p2p.log). + + * Add a filter sshd-p2p.conf in /etc/fail2ban/filter.d/sshd-p2p.conf + + [Definition] + failregex = ^(.*)BAN(\t)*$ + +2.2.) From fail2ban to fail2ban-p2p + + * Setup an action to execute "fail2ban-p2p-client.py -b " to sent + the attacker IP from fail2ban to fail2ban-p2p. + For an example see doc/fail2ban/action.d/fail2ban-p2p.conf. + You might want to correct the path to client.py and also specify a + configuration directory for fail2ban-p2p with the -c option if you do + use a custom config directory. + + * add this action to a jail, e.g. for the predefined ssh jail in jail.conf: + + [ssh] + enabled = true + port = ssh + filter = sshd + logpath = /var/log/auth.log + action = iptables[name=SSH, port=ssh, protocol=tcp] + fail2ban-p2p[name=SSH] + maxretry = 2 + + This will ban the offending ip with the iptables action and also send + a notice to fail2ban-p2p that fail2ban has blocked an ip. diff --git a/doc/fail2ban/action.d/fail2ban-p2p.conf b/doc/fail2ban/action.d/fail2ban-p2p.conf new file mode 100644 index 0000000..02280f3 --- /dev/null +++ b/doc/fail2ban/action.d/fail2ban-p2p.conf @@ -0,0 +1,21 @@ +# Fail2Ban configuration file +# +# Author: Manuel Munz (manu at somakoma dot de) +# + +[Definition] +# Option: actionban +# Notes.: command executed when banning an IP. Take care that the +# command is executed with Fail2Ban user rights. +# Tags: IP address +# number of failures +#