diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..03f7dabd64f2b32a4d77397f939a25d73eb3bbfb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +app +vendor diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ec5bbda6c8c9d0ce4a1df38abe3b5a94b89f8c95..37d799fd01e21b67ccd879a8142a83b9459e4bbd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1 @@ -stages: - - test - -test: - stage: test - image: composer:1.10.1 - script: - - composer install --prefer-dist --no-ansi --no-progress --no-interaction - cache: - paths: - - vendor/ - - app/ +include: "https://git.autistici.org/ai3/build-container/raw/master/common.yml" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8ead4316408e2f349adc50e353a4c37627a5c4f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM composer:1.10.1 as build + +ADD . /build +WORKDIR /build +RUN /build/install.sh + +FROM registry.git.autistici.org/ai3/docker/apache2-php-base:master + +COPY --from=build /build/app/ /opt/noblogs/www + +COPY docker/htaccess /opt/noblogs/www/.htaccess +COPY docker/wp-config.php /opt/noblogs/www/wp-config.php +COPY docker/wp-cache-config.php /opt/noblogs/www/wp-content/wp-cache-config.php +COPY docker/conf /tmp/conf +COPY docker/build.sh /tmp/build.sh +COPY docker/post-upgrade.sh /post-upgrade.sh + +RUN /tmp/build.sh && rm /tmp/build.sh + diff --git a/docker/LICENSE b/docker/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e963df8294069543e782fd72aa71832dca1571ca --- /dev/null +++ b/docker/LICENSE @@ -0,0 +1,622 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000000000000000000000000000000000000..dba006660f12c8b0a1114f9e825dd9cf0f5c354a --- /dev/null +++ b/docker/README.md @@ -0,0 +1,44 @@ +Docker image for noblogs +======================== + +Assumptions: + +* the MySQL database is provided externally +* wp-content/blogs.dir (local storage) is provided externally +* wp-content/cache (wp-supercache render cache) is provided externally + +The idea is that we provide a single JSON configuration file, and in +return we get a container exposing a HTTP endpoint for noblogs.org. + +The container is generic: secrets and other configuration parameters +are loaded from the JSON configuration file using a custom +wp-config.php. + +## Disable a ModSecurity rule + +For this and other customizations, just edit the contents of +conf/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf and +add whatever directives are necessary. + +If you just want to disable a specific rule ID (for example 123456), +something like the following will do: + +``` +SecRuleRemoveById 123456 +``` + +## Whitelist a URL in ModSecurity + +The syntax to whitelist a URL (i.e. disable the ModSecurity engine on +a path-based criteria) is not trivial to come up with: if you want to +whitelist /some/url.php, you'll have to modify +conf/modsecurity/local.cf and add a directive like the following: + +``` +SecRule REQUEST_URI "@beginsWith /some/url.php" "id:1,ctl:ruleEngine=Off" +``` + +Pay attention to use a new *id* (1 in the example above) and pick one +that isn't already taken, or you will create a broken Docker image that +can't start (this is a configuration syntax error). + diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..b76f0feaba72b47c65a1ca0b81f5b95327533159 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,95 @@ +#!/bin/sh +# +# Install script for git.autistici.org/ai/website +# inside a Docker container. +# +# The installation procedure requires installing some +# dedicated packages, so we have split it out to a script +# for legibility. + +# Packages that are only used to build the site. These will be +# removed once we're done. +BUILD_PACKAGES="rsync" + +# Packages required to serve the website and run the services. +# We have to keep the python3 packages around in order to run +# chaperone (installed via pip). +PACKAGES=" + libapache2-mod-xsendfile + libapache2-mod-security2 + modsecurity-crs + php-xml + php-mysql + php-memcached + php-mbstring + + noblogs-cli +" + +# Additional Apache modules to enable. +APACHE_MODULES_ENABLE=" + rewrite + security2 + xsendfile +" + +# Additional config snippets to enable for Apache. +APACHE_CONFIG_ENABLE=" + modsecurity-custom +" + +# Sites to enable. +APACHE_SITES=" + noblogs.org + noblogs.ai-cdn.net +" + +# The default bitnami/minideb image defines an 'install_packages' +# command which is just a convenient helper. Define our own in +# case we are using some other Debian image. +if [ "x$(which install_packages)" = "x" ]; then + install_packages() { + env DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends "$@" + } +fi + +set -e + +apt-get -q update +install_packages ${BUILD_PACKAGES} ${PACKAGES} + +# Install the configuration, overlayed over /etc. +rsync -a /tmp/conf/ /etc/ + +# Setup apache. +a2enmod -q ${APACHE_MODULES_ENABLE} +a2enconf -q ${APACHE_CONFIG_ENABLE} +a2ensite ${APACHE_SITES} + +# Set up modsecurity. +# The file is named 00modsecurity.conf so it is loaded first. +mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/00modsecurity.conf + +# This needs to be writable for mod security to be able to start. +install -d -m 1777 /var/log/apache2 + +# Ensure that the mount points exist. +mkdir -p /opt/noblogs/www/wp-content/blogs.dir +mkdir -p /opt/noblogs/www/wp-content/cache +mkdir -p /var/lib/php/uploads + +# Remove Akismet e HelloDolly (plugins but from wp-core) + +rm -rf /opt/noblogs/www/wp-content/plugins/akismet/ +rm /opt/noblogs/www/wp-content/plugins/hello.php + +# Create a symlink for the bp-default theme. +ln -s ../plugins/buddypress/bp-themes/bp-default /opt/noblogs/www/wp-content/themes/bp-default + +# Remove packages used for installation. +apt-get remove -y --purge ${BUILD_PACKAGES} +apt-get autoremove -y +apt-get clean +rm -fr /var/lib/apt/lists/* +rm -fr /tmp/conf + diff --git a/docker/conf/apache2/conf-available/modsecurity-custom.conf b/docker/conf/apache2/conf-available/modsecurity-custom.conf new file mode 100644 index 0000000000000000000000000000000000000000..10340f5598b16b57d19302aa5104042a299f950e --- /dev/null +++ b/docker/conf/apache2/conf-available/modsecurity-custom.conf @@ -0,0 +1,10 @@ +<IfModule mod_status.c> +<IfModule security2_module> + + # Disable mod_security on /server-status handler. + <Location /server-status> + SecRuleEngine Off + </Location> + +</IfModule> +</IfModule> diff --git a/docker/conf/apache2/mods-enabled/mpm_event.conf b/docker/conf/apache2/mods-enabled/mpm_event.conf new file mode 100644 index 0000000000000000000000000000000000000000..1695c14992b5015bc58bb183ba5f7a1b7446d22a --- /dev/null +++ b/docker/conf/apache2/mods-enabled/mpm_event.conf @@ -0,0 +1,5 @@ +<IfModule mpm_event_module> + MaxRequestWorkers 1024 + ThreadsPerChild 128 + ThreadLimit 128 +</IfModule> diff --git a/docker/conf/apache2/sites-available/noblogs.ai-cdn.net.conf b/docker/conf/apache2/sites-available/noblogs.ai-cdn.net.conf new file mode 100644 index 0000000000000000000000000000000000000000..993c36e937caf92bd86ca748c944f636ba8b253f --- /dev/null +++ b/docker/conf/apache2/sites-available/noblogs.ai-cdn.net.conf @@ -0,0 +1,10 @@ +<VirtualHost *:${APACHE_PORT}> + ServerName noblogs.ai-cdn.net + + DocumentRoot /opt/noblogs/www + <Directory /opt/noblogs/www> + Options FollowSymLinks + AllowOverride All + Require all granted + </Directory> +</VirtualHost> diff --git a/docker/conf/apache2/sites-available/noblogs.org.conf b/docker/conf/apache2/sites-available/noblogs.org.conf new file mode 100644 index 0000000000000000000000000000000000000000..77e27ce5cbd4e42c04671e03776e207f2102f9ca --- /dev/null +++ b/docker/conf/apache2/sites-available/noblogs.org.conf @@ -0,0 +1,26 @@ +<VirtualHost *:${APACHE_PORT}> + + ServerName noblogs.org + ServerAlias *.noblogs.org + + DocumentRoot /opt/noblogs/www + + SetEnvIf X-Forwarded-Proto https HTTPS=on + + <Directory /opt/noblogs/www> + Options FollowSymLinks Indexes + AllowOverride All + Require all granted + + RewriteEngine On + + XSendFile On + XSendFilePath /opt/noblogs/www/wp-content + </Directory> + + <Directory /opt/noblogs/www/wp-content> + Options -Indexes + </Directory> + +</VirtualHost> + diff --git a/docker/conf/chaperone.d/clean-sessions.service b/docker/conf/chaperone.d/clean-sessions.service new file mode 100644 index 0000000000000000000000000000000000000000..ab03897f87fc367faea30ca5ee7dddb71346274f --- /dev/null +++ b/docker/conf/chaperone.d/clean-sessions.service @@ -0,0 +1,5 @@ +clean_sessions.service: { + type: cron, + interval: "10,40 * * * *", + command: "/usr/bin/find /var/lib/php/sessions -mindepth 1 -type f -mtime +1 -delete", +} diff --git a/docker/conf/chaperone.d/startup.conf b/docker/conf/chaperone.d/startup.conf new file mode 100644 index 0000000000000000000000000000000000000000..847ae6a9380e047745187321f1ee51522baf52ab --- /dev/null +++ b/docker/conf/chaperone.d/startup.conf @@ -0,0 +1,8 @@ +noblogs_upgrade.service: { + type: oneshot, + stdout: inherit, + command: "/post-upgrade.sh", + ignore_failures: true, + process_timeout: 7200, + exit_kills: false, +} diff --git a/docker/conf/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf b/docker/conf/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf new file mode 100644 index 0000000000000000000000000000000000000000..3bb2ced0b93a0dd6f21f8b755368f1195b93c944 --- /dev/null +++ b/docker/conf/modsecurity/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf @@ -0,0 +1,80 @@ +# Do not inspect the 'pwd' arg of wp-login.php requests (disable all +# CRS rules). +# +# Already included in the set of exceptions when tx.crs_exclusions_wordpress=1 +# is set in crs-setup.conf. +#SecRule REQUEST_FILENAME "@endsWith /wp-login.php" \ +# "id:1000,\ +# phase:2,\ +# pass,\ +# nolog,\ +# ctl:ruleRemoveTargetByTag=CRS;ARGS:pwd" + +SecRule REQUEST_URI "@beginsWith /wp-admin/site-health.php" \ + "id:1001,\ + pass,\ + nolog,\ + ctl:ruleEngine=Off" + +SecRule REQUEST_FILENAME "@endsWith /wp-admin/themes.php" \ + "id:1002,\ + phase:2,\ + pass,\ + nolog,\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:newcontent" + +# The ability to edit CSS triggers XSS rules when editing posts. +# Disable all CRS rules on the wp-json API endpoint. +SecRule REQUEST_URI "@beginsWith /wp-json/wp/v2/posts/" \ + "id:1003,\ + phase:2,\ + pass,\ + nolog,\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:content" + +# Make the eventlist plugin work (SIGH for the lack of regexps). +SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \ + "id:1004,\ + phase:2,\ + pass,\ + nolog,\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[1][title],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[1][cat_filter],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[1][num_events],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[1][location_length],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[2][title],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[2][cat_filter],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[2][num_events],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[2][location_length],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[3][title],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[3][cat_filter],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[3][num_events],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[3][location_length],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[4][title],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[4][cat_filter],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[4][num_events],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[4][location_length],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[5][title],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[5][cat_filter],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[5][num_events],\ + ctl:ruleRemoveTargetByTag=CRS;ARGS:widget-event_list_widget[5][location_length]" + +# More eventlist plugin workarounds. +SecRule REQUEST_FILENAME "@endsWith /wp-admin/admin-ajax.php" \ + "id:1005,\ + phase:2,\ + pass,\ + nolog,\ + ctl:ruleRemoveByTag=language-powershell" + +# Filter out certain args (all URIs) for the pgp email plugin. +SecRule REQUEST_URI "@beginsWith /" \ + "id:1006,\ + phase:2,\ + pass,\ + nolog,\ + ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:message_from_name,\ + ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:message_from_mail,\ + ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:message_body,\ + ctl:ruleRemoveTargetByTag=attack-sqli;ARGS:text" + diff --git a/docker/conf/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf b/docker/conf/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf new file mode 100644 index 0000000000000000000000000000000000000000..8d1e5cf34646009ce5bf6f6e8a8fe371d2782bb6 --- /dev/null +++ b/docker/conf/modsecurity/crs/RESPONSE-999-EXCLUSION-RULES-AFTER-CRS.conf @@ -0,0 +1,38 @@ +# Disable mod_security rules in this file. + +SecRuleRemoveById 960015 + +# Oracle error messages. +SecRuleRemoveById 951120 + +# Wordpress generates badly encoded mime/multipart uploads +# for its own file upload functionality... +# Drop the REQBODY_ERROR and MULTIPART_UNMATCHED_BOUNDARY rules. +SecRuleRemoveById 200002 200004 + +# Matches an Apache directory listing. +SecRuleRemoveById 950130 + +# XSS rules that have too many false positives. +SecRuleRemoveById 941160 +SecRuleRemoveById 941180 + +# ModSec Rule Exclusion: 920273 : Invalid character in request (outside of very strict set) +# ModSec Rule Exclusion: 942432 : Restricted SQL Character Anomaly Detection (args): +# number of special characters exceeded (2) (severity: NONE/UNKOWN) +SecRuleRemoveById 920273 +SecRuleRemoveById 942432 + +# Presence of PHP code in the output +SecRuleRemoveByID 953110 +SecRuleRemoveByID 953120 + +# Filters dangerous file extensions in the URL. +SecRuleRemoveByID 920440 + +# Having '../' in the response body. +SecRuleRemoveByID 930110 + +# CR/LF + HTTP method name. +SecRuleRemoveByID 921110 + diff --git a/docker/conf/modsecurity/crs/crs-setup.conf b/docker/conf/modsecurity/crs/crs-setup.conf new file mode 100644 index 0000000000000000000000000000000000000000..5ebc48862142c1a4e016bcf344b024f72911eea9 --- /dev/null +++ b/docker/conf/modsecurity/crs/crs-setup.conf @@ -0,0 +1,841 @@ +# ------------------------------------------------------------------------ +# OWASP ModSecurity Core Rule Set ver.3.1.0 +# Copyright (c) 2006-2018 Trustwave and contributors. All rights reserved. +# +# The OWASP ModSecurity Core Rule Set is distributed under +# Apache Software License (ASL) version 2 +# Please see the enclosed LICENSE file for full details. +# ------------------------------------------------------------------------ + + +# +# -- [[ Introduction ]] -------------------------------------------------------- +# +# The OWASP ModSecurity Core Rule Set (CRS) is a set of generic attack +# detection rules that provide a base level of protection for any web +# application. They are written for the open source, cross-platform +# ModSecurity Web Application Firewall. +# +# See also: +# https://coreruleset.org/ +# https://github.com/SpiderLabs/owasp-modsecurity-crs +# https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project +# + + +# +# -- [[ System Requirements ]] ------------------------------------------------- +# +# CRS requires ModSecurity version 2.8.0 or above. +# We recommend to always use the newest ModSecurity version. +# +# The configuration directives/settings in this file are used to control +# the OWASP ModSecurity CRS. These settings do **NOT** configure the main +# ModSecurity settings (modsecurity.conf) such as SecRuleEngine, +# SecRequestBodyAccess, SecAuditEngine, SecDebugLog, and XML processing. +# +# The CRS assumes that modsecurity.conf has been loaded. It is bundled with +# ModSecurity. If you don't have it, you can get it from: +# 2.x: https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v2/master/modsecurity.conf-recommended +# 3.x: https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v3/master/modsecurity.conf-recommended +# +# The order of file inclusion in your webserver configuration should always be: +# 1. modsecurity.conf +# 2. crs-setup.conf (this file) +# 3. rules/*.conf (the CRS rule files) +# +# Please refer to the INSTALL file for detailed installation instructions. +# + + +# +# -- [[ Mode of Operation: Anomaly Scoring vs. Self-Contained ]] --------------- +# +# The CRS can run in two modes: +# +# -- [[ Anomaly Scoring Mode (default) ]] -- +# In CRS3, anomaly mode is the default and recommended mode, since it gives the +# most accurate log information and offers the most flexibility in setting your +# blocking policies. It is also called "collaborative detection mode". +# In this mode, each matching rule increases an 'anomaly score'. +# At the conclusion of the inbound rules, and again at the conclusion of the +# outbound rules, the anomaly score is checked, and the blocking evaluation +# rules apply a disruptive action, by default returning an error 403. +# +# -- [[ Self-Contained Mode ]] -- +# In this mode, rules apply an action instantly. This was the CRS2 default. +# It can lower resource usage, at the cost of less flexibility in blocking policy +# and less informative audit logs (only the first detected threat is logged). +# Rules inherit the disruptive action that you specify (i.e. deny, drop, etc). +# The first rule that matches will execute this action. In most cases this will +# cause evaluation to stop after the first rule has matched, similar to how many +# IDSs function. +# +# -- [[ Alert Logging Control ]] -- +# In the mode configuration, you must also adjust the desired logging options. +# There are three common options for dealing with logging. By default CRS enables +# logging to the webserver error log (or Event viewer) plus detailed logging to +# the ModSecurity audit log (configured under SecAuditLog in modsecurity.conf). +# +# - To log to both error log and ModSecurity audit log file, use: "log,auditlog" +# - To log *only* to the ModSecurity audit log file, use: "nolog,auditlog" +# - To log *only* to the error log file, use: "log,noauditlog" +# +# Examples for the various modes follow. +# You must leave one of the following options enabled. +# Note that you must specify the same line for phase:1 and phase:2. +# + +# Default: Anomaly Scoring mode, log to error log, log to ModSecurity audit log +# - By default, offending requests are blocked with an error 403 response. +# - To change the disruptive action, see RESPONSE-999-EXCEPTIONS.conf.example +# and review section 'Changing the Disruptive Action for Anomaly Mode'. +# - In Apache, you can use ErrorDocument to show a friendly error page or +# perform a redirect: https://httpd.apache.org/docs/2.4/custom-error.html +# +SecDefaultAction "phase:1,log,noauditlog,pass" +SecDefaultAction "phase:2,log,noauditlog,pass" + +# Example: Anomaly Scoring mode, log only to ModSecurity audit log +# - By default, offending requests are blocked with an error 403 response. +# - To change the disruptive action, see RESPONSE-999-EXCEPTIONS.conf.example +# and review section 'Changing the Disruptive Action for Anomaly Mode'. +# - In Apache, you can use ErrorDocument to show a friendly error page or +# perform a redirect: https://httpd.apache.org/docs/2.4/custom-error.html +# +# SecDefaultAction "phase:1,nolog,auditlog,pass" +# SecDefaultAction "phase:2,nolog,auditlog,pass" + +# Example: Self-contained mode, return error 403 on blocking +# - In this configuration the default disruptive action becomes 'deny'. After a +# rule triggers, it will stop processing the request and return an error 403. +# - You can also use a different error status, such as 404, 406, et cetera. +# - In Apache, you can use ErrorDocument to show a friendly error page or +# perform a redirect: https://httpd.apache.org/docs/2.4/custom-error.html +# +# SecDefaultAction "phase:1,log,auditlog,deny,status:403" +# SecDefaultAction "phase:2,log,auditlog,deny,status:403" + +# Example: Self-contained mode, redirect back to homepage on blocking +# - In this configuration the 'tag' action includes the Host header data in the +# log. This helps to identify which virtual host triggered the rule (if any). +# - Note that this might cause redirect loops in some situations; for example +# if a Cookie or User-Agent header is blocked, it will also be blocked when +# the client subsequently tries to access the homepage. You can also redirect +# to another custom URL. +# SecDefaultAction "phase:1,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'" +# SecDefaultAction "phase:2,log,auditlog,redirect:'http://%{request_headers.host}/',tag:'Host: %{request_headers.host}'" + + +# +# -- [[ Paranoia Level Initialization ]] --------------------------------------- +# +# The Paranoia Level (PL) setting allows you to choose the desired level +# of rule checks that will add to your anomaly scores. +# +# With each paranoia level increase, the CRS enables additional rules +# giving you a higher level of security. However, higher paranoia levels +# also increase the possibility of blocking some legitimate traffic due to +# false alarms (also named false positives or FPs). If you use higher +# paranoia levels, it is likely that you will need to add some exclusion +# rules for certain requests and applications receiving complex input. +# +# - A paranoia level of 1 is default. In this level, most core rules +# are enabled. PL1 is advised for beginners, installations +# covering many different sites and applications, and for setups +# with standard security requirements. +# At PL1 you should face FPs rarely. If you encounter FPs, please +# open an issue on the CRS GitHub site and don't forget to attach your +# complete Audit Log record for the request with the issue. +# - Paranoia level 2 includes many extra rules, for instance enabling +# many regexp-based SQL and XSS injection protections, and adding +# extra keywords checked for code injections. PL2 is advised +# for moderate to experienced users desiring more complete coverage +# and for installations with elevated security requirements. +# PL2 comes with some FPs which you need to handle. +# - Paranoia level 3 enables more rules and keyword lists, and tweaks +# limits on special characters used. PL3 is aimed at users experienced +# at the handling of FPs and at installations with a high security +# requirement. +# - Paranoia level 4 further restricts special characters. +# The highest level is advised for experienced users protecting +# installations with very high security requirements. Running PL4 will +# likely produce a very high number of FPs which have to be +# treated before the site can go productive. +# +# Rules in paranoia level 2 or higher will log their PL to the audit log; +# example: [tag "paranoia-level/2"]. This allows you to deduct from the +# audit log how the WAF behavior is affected by paranoia level. +# +# It is important to also look into the variable +# tx.enforce_bodyproc_urlencoded (Enforce Body Processor URLENCODED) +# defined below. Enabling it closes a possible bypass of CRS. +# +# Uncomment this rule to change the default: +# +#SecAction \ +# "id:900000,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.paranoia_level=1" + + +# It is possible to execute rules from a higher paranoia level but not include +# them in the anomaly scoring. This allows you to take a well-tuned system on +# paranoia level 1 and add rules from paranoia level 2 without having to fear +# the new rules would lead to false positives that raise your score above the +# threshold. +# This optional feature is enabled by uncommenting the following rule and +# setting the tx.executing_paranoia_level. +# Technically, rules up to the level defined in tx.executing_paranoia_level +# will be executed, but only the rules up to tx.paranoia_level affect the +# anomaly scores. +# By default, tx.executing_paranoia_level is set to tx.paranoia_level. +# tx.executing_paranoia_level must not be lower than tx.paranoia_level. +# +# Please notice that setting tx.executing_paranoia_level to a higher paranoia +# level results in a performance impact that is equally high as setting +# tx.paranoia_level to said level. +# +#SecAction \ +# "id:900001,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.executing_paranoia_level=1" + + +# +# -- [[ Enforce Body Processor URLENCODED ]] ----------------------------------- +# +# ModSecurity selects the body processor based on the Content-Type request +# header. But clients are not always setting the Content-Type header for their +# request body payloads. This will leave ModSecurity with limited vision into +# the payload. The variable tx.enforce_bodyproc_urlencoded lets you force the +# URLENCODED body processor in these situations. This is off by default, as it +# implies a change of the behaviour of ModSecurity beyond CRS (the body +# processor applies to all rules, not only CRS) and because it may lead to +# false positives already on paranoia level 1. However, enabling this variable +# closes a possible bypass of CRS so it should be considered. +# +# Uncomment this rule to change the default: +# +#SecAction \ +# "id:900010,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.enforce_bodyproc_urlencoded=1" + + +# +# -- [[ Anomaly Mode Severity Levels ]] ---------------------------------------- +# +# Each rule in the CRS has an associated severity level. +# These are the default scoring points for each severity level. +# These settings will be used to increment the anomaly score if a rule matches. +# You may adjust these points to your liking, but this is usually not needed. +# +# - CRITICAL severity: Anomaly Score of 5. +# Mostly generated by the application attack rules (93x and 94x files). +# - ERROR severity: Anomaly Score of 4. +# Generated mostly from outbound leakage rules (95x files). +# - WARNING severity: Anomaly Score of 3. +# Generated mostly by malicious client rules (91x files). +# - NOTICE severity: Anomaly Score of 2. +# Generated mostly by the protocol rules (92x files). +# +# In anomaly mode, these scores are cumulative. +# So it's possible for a request to hit multiple rules. +# +# (Note: In this file, we use 'phase:1' to set CRS configuration variables. +# In general, 'phase:request' is used. However, we want to make absolutely sure +# that all configuration variables are set before the CRS rules are processed.) +# +#SecAction \ +# "id:900100,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.critical_anomaly_score=5,\ +# setvar:tx.error_anomaly_score=4,\ +# setvar:tx.warning_anomaly_score=3,\ +# setvar:tx.notice_anomaly_score=2" + + +# +# -- [[ Anomaly Mode Blocking Threshold Levels ]] ------------------------------ +# +# Here, you can specify at which cumulative anomaly score an inbound request, +# or outbound response, gets blocked. +# +# Most detected inbound threats will give a critical score of 5. +# Smaller violations, like violations of protocol/standards, carry lower scores. +# +# [ At default value ] +# If you keep the blocking thresholds at the defaults, the CRS will work +# similarly to previous CRS versions: a single critical rule match will cause +# the request to be blocked and logged. +# +# [ Using higher values ] +# If you want to make the CRS less sensitive, you can increase the blocking +# thresholds, for instance to 7 (which would require multiple rule matches +# before blocking) or 10 (which would require at least two critical alerts - or +# a combination of many lesser alerts), or even higher. However, increasing the +# thresholds might cause some attacks to bypass the CRS rules or your policies. +# +# [ New deployment strategy: Starting high and decreasing ] +# It is a common practice to start a fresh CRS installation with elevated +# anomaly scoring thresholds (>100) and then lower the limits as your +# confidence in the setup grows. You may also look into the Sampling +# Percentage section below for a different strategy to ease into a new +# CRS installation. +# +# [ Anomaly Threshold / Paranoia Level Quadrant ] +# +# High Anomaly Limit | High Anomaly Limit +# Low Paranoia Level | High Paranoia Level +# -> Fresh Site | -> Experimental Site +# ------------------------------------------------------ +# Low Anomaly Limit | Low Anomaly Limit +# Low Paranoia Level | High Paranoia Level +# -> Standard Site | -> High Security Site +# +# Uncomment this rule to change the defaults: +# +#SecAction \ +# "id:900110,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.inbound_anomaly_score_threshold=5,\ +# setvar:tx.outbound_anomaly_score_threshold=4" + +# +# -- [[ Application Specific Rule Exclusions ]] ---------------------------------------- +# +# Some well-known applications may undertake actions that appear to be +# malicious. This includes actions such as allowing HTML or Javascript within +# parameters. In such cases the CRS aims to prevent false positives by allowing +# administrators to enable prebuilt, application specific exclusions on an +# application by application basis. +# These application specific exclusions are distinct from the rules that would +# be placed in the REQUEST-900-EXCLUSION-RULES-BEFORE-CRS configuration file as +# they are prebuilt for specific applications. The 'REQUEST-900' file is +# designed for users to add their own custom exclusions. Note, using these +# application specific exclusions may loosen restrictions of the CRS, +# especially if used with an application they weren't designed for. As a result +# they should be applied with care. +# To use this functionality you must specify a supported application. To do so +# uncomment rule 900130. In addition to uncommenting the rule you will need to +# specify which application(s) you'd like to enable exclusions for. Only a +# (very) limited set of applications are currently supported, please use the +# filenames prefixed with 'REQUEST-903' to guide you in your selection. +# Such filenames use the following convention: +# REQUEST-903.9XXX-{APPNAME}-EXCLUSIONS-RULES.conf +# +# It is recommended if you run multiple web applications on your site to limit +# the effects of the exclusion to only the path where the excluded webapp +# resides using a rule similar to the following example: +# SecRule REQUEST_URI "@beginsWith /wordpress/" setvar:tx.crs_exclusions_wordpress=1 + +# +# Modify and uncomment this rule to select which application: +# +SecAction \ + "id:900130,\ + phase:1,\ + nolog,\ + pass,\ + t:none,\ + setvar:tx.crs_exclusions_wordpress=1" + +# +# -- [[ HTTP Policy Settings ]] ------------------------------------------------ +# +# This section defines your policies for the HTTP protocol, such as: +# - allowed HTTP versions, HTTP methods, allowed request Content-Types +# - forbidden file extensions (e.g. .bak, .sql) and request headers (e.g. Proxy) +# +# These variables are used in the following rule files: +# - REQUEST-911-METHOD-ENFORCEMENT.conf +# - REQUEST-912-DOS-PROTECTION.conf +# - REQUEST-920-PROTOCOL-ENFORCEMENT.conf + +# HTTP methods that a client is allowed to use. +# Default: GET HEAD POST OPTIONS +# Example: for RESTful APIs, add the following methods: PUT PATCH DELETE +# Example: for WebDAV, add the following methods: CHECKOUT COPY DELETE LOCK +# MERGE MKACTIVITY MKCOL MOVE PROPFIND PROPPATCH PUT UNLOCK +# Uncomment this rule to change the default. +#SecAction \ +# "id:900200,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.allowed_methods=GET HEAD POST OPTIONS'" + +# Content-Types that a client is allowed to send in a request. +# Default: application/x-www-form-urlencoded|multipart/form-data|text/xml|\ +# application/xml|application/soap+xml|application/x-amf|application/json|\ +# application/octet-stream|text/plain +# Uncomment this rule to change the default. +#SecAction \ +# "id:900220,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.allowed_request_content_type=application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/soap+xml|application/x-amf|application/json|application/octet-stream|text/plain'" + +# Content-Types charsets that a client is allowed to send in a request. +# Default: utf-8|iso-8859-1|iso-8859-15|windows-1252 +# Uncomment this rule to change the default. +# Use "|" to separate multiple charsets like in the rule defining +# tx.allowed_request_content_type. +#SecAction \ +# "id:900270,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.allowed_request_content_type_charset=utf-8|iso-8859-1|iso-8859-15|windows-1252'" + +# Allowed HTTP versions. +# Default: HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/2.0 +# Example for legacy clients: HTTP/0.9 HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/2.0 +# Note that some web server versions use 'HTTP/2', some 'HTTP/2.0', so +# we include both version strings by default. +# Uncomment this rule to change the default. +#SecAction \ +# "id:900230,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.allowed_http_versions=HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/2.0'" + +# Forbidden file extensions. +# Guards against unintended exposure of development/configuration files. +# Default: .asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/ +# Example: .bak/ .config/ .conf/ .db/ .ini/ .log/ .old/ .pass/ .pdb/ .sql/ +# Uncomment this rule to change the default. +#SecAction \ +# "id:900240,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.restricted_extensions=.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'" + +# Forbidden request headers. +# Header names should be lowercase, enclosed by /slashes/ as delimiters. +# Blocking Proxy header prevents 'httpoxy' vulnerability: https://httpoxy.org +# Default: /proxy/ /lock-token/ /content-range/ /translate/ /if/ +# Uncomment this rule to change the default. +#SecAction \ +# "id:900250,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.restricted_headers=/proxy/ /lock-token/ /content-range/ /translate/ /if/'" + +# File extensions considered static files. +# Extensions include the dot, lowercase, enclosed by /slashes/ as delimiters. +# Used in DoS protection rule. See section "Anti-Automation / DoS Protection". +# Default: /.jpg/ /.jpeg/ /.png/ /.gif/ /.js/ /.css/ /.ico/ /.svg/ /.webp/ +# Uncomment this rule to change the default. +#SecAction \ +# "id:900260,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.static_extensions=/.jpg/ /.jpeg/ /.png/ /.gif/ /.js/ /.css/ /.ico/ /.svg/ /.webp/'" + + +# +# -- [[ HTTP Argument/Upload Limits ]] ----------------------------------------- +# +# Here you can define optional limits on HTTP get/post parameters and uploads. +# This can help to prevent application specific DoS attacks. +# +# These values are checked in REQUEST-920-PROTOCOL-ENFORCEMENT.conf. +# Beware of blocking legitimate traffic when enabling these limits. +# + +# Block request if number of arguments is too high +# Default: unlimited +# Example: 255 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900300,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.max_num_args=255" + +# Block request if the length of any argument name is too high +# Default: unlimited +# Example: 100 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900310,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.arg_name_length=100" + +# Block request if the length of any argument value is too high +# Default: unlimited +# Example: 400 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900320,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.arg_length=400" + +# Block request if the total length of all combined arguments is too high +# Default: unlimited +# Example: 64000 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900330,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.total_arg_length=64000" + +# Block request if the file size of any individual uploaded file is too high +# Default: unlimited +# Example: 1048576 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900340,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.max_file_size=1048576" + +# Block request if the total size of all combined uploaded files is too high +# Default: unlimited +# Example: 1048576 +# Uncomment this rule to set a limit. +#SecAction \ +# "id:900350,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.combined_file_sizes=1048576" + + +# +# -- [[ Easing In / Sampling Percentage ]] ------------------------------------- +# +# Adding the Core Rule Set to an existing productive site can lead to false +# positives, unexpected performance issues and other undesired side effects. +# +# It can be beneficial to test the water first by enabling the CRS for a +# limited number of requests only and then, when you have solved the issues (if +# any) and you have confidence in the setup, to raise the ratio of requests +# being sent into the ruleset. +# +# Adjust the percentage of requests that are funnelled into the Core Rules by +# setting TX.sampling_percentage below. The default is 100, meaning that every +# request gets checked by the CRS. The selection of requests, which are going +# to be checked, is based on a pseudo random number generated by ModSecurity. +# +# If a request is allowed to pass without being checked by the CRS, there is no +# entry in the audit log (for performance reasons), but an error log entry is +# written. If you want to disable the error log entry, then issue the +# following directive somewhere after the inclusion of the CRS +# (E.g., RESPONSE-999-EXCEPTIONS.conf). +# +# SecRuleUpdateActionById 901150 "nolog" +# +# ATTENTION: If this TX.sampling_percentage is below 100, then some of the +# requests will bypass the Core Rules completely and you lose the ability to +# protect your service with ModSecurity. +# +# Uncomment this rule to enable this feature: +# +#SecAction "id:900400,\ +# phase:1,\ +# pass,\ +# nolog,\ +# setvar:tx.sampling_percentage=100" + + +# +# -- [[ Project Honey Pot HTTP Blacklist ]] ------------------------------------ +# +# Optionally, you can check the client IP address against the Project Honey Pot +# HTTPBL (dnsbl.httpbl.org). In order to use this, you need to register to get a +# free API key. Set it here with SecHttpBlKey. +# +# Project Honeypot returns multiple different malicious IP types. +# You may specify which you want to block by enabling or disabling them below. +# +# Ref: https://www.projecthoneypot.org/httpbl.php +# Ref: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SecHttpBlKey +# +# Uncomment these rules to use this feature: +# +#SecHttpBlKey XXXXXXXXXXXXXXXXX +#SecAction "id:900500,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.block_search_ip=1,\ +# setvar:tx.block_suspicious_ip=1,\ +# setvar:tx.block_harvester_ip=1,\ +# setvar:tx.block_spammer_ip=1" + + +# +# -- [[ GeoIP Database ]] ------------------------------------------------------ +# +# There are some rulesets that inspect geolocation data of the client IP address +# (geoLookup). The CRS uses geoLookup to implement optional country blocking. +# +# To use geolocation, we make use of the MaxMind GeoIP database. +# This database is not included with the CRS and must be downloaded. +# You should also update the database regularly, for instance every month. +# The CRS contains a tool to download it to util/geo-location/GeoIP.dat: +# util/upgrade.py --geoip +# +# This product includes GeoLite data created by MaxMind, available from: +# http://www.maxmind.com. +# +# Ref: http://blog.spiderlabs.com/2010/10/detecting-malice-with-modsecurity-geolocation-data.html +# Ref: http://blog.spiderlabs.com/2010/11/detecting-malice-with-modsecurity-ip-forensics.html +# +# Uncomment this rule to use this feature: +# +#SecGeoLookupDB /usr/share/GeoIP/GeoLiteCity.dat + + +# +# -=[ Block Countries ]=- +# +# Rules in the IP Reputation file can check the client against a list of high +# risk country codes. These countries have to be defined in the variable +# tx.high_risk_country_codes via their ISO 3166 two-letter country code: +# https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements +# +# If you are sure that you are not getting any legitimate requests from a given +# country, then you can disable all access from that country via this variable. +# The rule performing the test has the rule id 910100. +# +# This rule requires SecGeoLookupDB to be enabled and the GeoIP database to be +# downloaded (see the section "GeoIP Database" above.) +# +# By default, the list is empty. A list used by some sites was the following: +# setvar:'tx.high_risk_country_codes=UA ID YU LT EG RO BG TR RU PK MY CN'" +# +# Uncomment this rule to use this feature: +# +#SecAction \ +# "id:900600,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.high_risk_country_codes='" + + +# +# -- [[ Anti-Automation / DoS Protection ]] ------------------------------------ +# +# Optional DoS protection against clients making requests too quickly. +# +# When a client is making more than 100 requests (excluding static files) within +# 60 seconds, this is considered a 'burst'. After two bursts, the client is +# blocked for 600 seconds. +# +# Requests to static files are not counted towards DoS; they are listed in the +# 'tx.static_extensions' setting, which you can change in this file (see +# section "HTTP Policy Settings"). +# +# For a detailed description, see rule file REQUEST-912-DOS-PROTECTION.conf. +# +# Uncomment this rule to use this feature: +# +#SecAction \ +# "id:900700,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:'tx.dos_burst_time_slice=60',\ +# setvar:'tx.dos_counter_threshold=100',\ +# setvar:'tx.dos_block_timeout=600'" + + +# +# -- [[ Check UTF-8 encoding ]] ------------------------------------------------ +# +# The CRS can optionally check request contents for invalid UTF-8 encoding. +# We only want to apply this check if UTF-8 encoding is actually used by the +# site; otherwise it will result in false positives. +# +# Uncomment this rule to use this feature: +# +#SecAction \ +# "id:900950,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.crs_validate_utf8_encoding=1" + + +# +# -- [[ Blocking Based on IP Reputation ]] ------------------------------------ +# +# Blocking based on reputation is permanent in the CRS. Unlike other rules, +# which look at the indvidual request, the blocking of IPs is based on +# a persistent record in the IP collection, which remains active for a +# certain amount of time. +# +# There are two ways an individual client can become flagged for blocking: +# - External information (RBL, GeoIP, etc.) +# - Internal information (Core Rules) +# +# The record in the IP collection carries a flag, which tags requests from +# individual clients with a flag named IP.reput_block_flag. +# But the flag alone is not enough to have a client blocked. There is also +# a global switch named tx.do_reput_block. This is off by default. If you set +# it to 1 (=On), requests from clients with the IP.reput_block_flag will +# be blocked for a certain duration. +# +# Variables +# ip.reput_block_flag Blocking flag for the IP collection record +# ip.reput_block_reason Reason (= rule message) that caused to blocking flag +# tx.do_reput_block Switch deciding if we really block based on flag +# tx.reput_block_duration Setting to define the duration of a block +# +# It may be important to know, that all the other core rules are skipped for +# requests, when it is clear that they carry the blocking flag in question. +# +# Uncomment this rule to use this feature: +# +#SecAction \ +# "id:900960,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.do_reput_block=1" +# +# Uncomment this rule to change the blocking time: +# Default: 300 (5 minutes) +# +#SecAction \ +# "id:900970,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# setvar:tx.reput_block_duration=300" + + +# +# -- [[ Collection timeout ]] -------------------------------------------------- +# +# Set the SecCollectionTimeout directive from the ModSecurity default (1 hour) +# to a lower setting which is appropriate to most sites. +# This increases performance by cleaning out stale collection (block) entries. +# +# This value should be greater than or equal to: +# tx.reput_block_duration (see section "Blocking Based on IP Reputation") and +# tx.dos_block_timeout (see section "Anti-Automation / DoS Protection"). +# +# Ref: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#wiki-SecCollectionTimeout + +# Please keep this directive uncommented. +# Default: 600 (10 minutes) +SecCollectionTimeout 600 + + +# +# -- [[ Debug Mode ]] ---------------------------------------------------------- +# +# To enable rule development and debugging, CRS has an optional debug mode +# that does not block a request, but instead sends detection information +# back to the HTTP client. +# +# This functionality is currently only supported with the Apache web server. +# The Apache mod_headers module is required. +# +# In debug mode, the webserver inserts "X-WAF-Events" / "X-WAF-Score" +# response headers whenever a debug client makes a request. Example: +# +# # curl -v 'http://192.168.1.100/?foo=../etc/passwd' +# X-WAF-Events: TX:930110-OWASP_CRS/WEB_ATTACK/DIR_TRAVERSAL-REQUEST_URI, +# TX:930120-OWASP_CRS/WEB_ATTACK/FILE_INJECTION-ARGS:foo, +# TX:932160-OWASP_CRS/WEB_ATTACK/RCE-ARGS:foo +# X-WAF-Score: Total=15; sqli=0; xss=0; rfi=0; lfi=10; rce=5; php=0; http=0; ses=0 +# +# To enable debug mode, include the RESPONSE-981-DEBUG.conf file. +# This file resides in a separate folder, as it is not compatible with +# nginx and IIS. +# +# You must specify the source IP address/network where you will be running the +# tests from. The source IP will BYPASS all CRS blocking, and will be sent the +# response headers as specified above. Be careful to only list your private +# IP addresses/networks here. +# +# Tip: for regression testing of CRS or your own ModSecurity rules, you may +# be interested in using the OWASP CRS regression testing suite instead. +# View the file util/regression-tests/README for more information. +# +# Uncomment these rules, filling in your CRS path and the source IP address, +# to enable debug mode: +# +#Include /usr/share/modsecurity-crs/util/debug/RESPONSE-981-DEBUG.conf +#SecRule REMOTE_ADDR "@ipMatch 192.168.1.100" \ +# "id:900980,\ +# phase:1,\ +# nolog,\ +# pass,\ +# t:none,\ +# ctl:ruleEngine=DetectionOnly,\ +# setvar:tx.crs_debug_mode=1" + + +# +# -- [[ End of setup ]] -------------------------------------------------------- +# +# The CRS checks the tx.crs_setup_version variable to ensure that the setup +# has been loaded. If you are not planning to use this setup template, +# you must manually set the tx.crs_setup_version variable before including +# the CRS rules/* files. +# +# The variable is a numerical representation of the CRS version number. +# E.g., v3.0.0 is represented as 300. +# +SecAction \ + "id:900990,\ + phase:1,\ + nolog,\ + pass,\ + t:none,\ + setvar:tx.crs_setup_version=310" diff --git a/docker/conf/modsecurity/local.conf b/docker/conf/modsecurity/local.conf new file mode 100644 index 0000000000000000000000000000000000000000..ed7a27384633c3d2b561ddb9cdb19ce9e9b1cd7e --- /dev/null +++ b/docker/conf/modsecurity/local.conf @@ -0,0 +1,20 @@ +# Uncomment the following line to enable enforcement. By default, +# mod_security runs in DetectionOnly mode. +SecRuleEngine On + +# Allow large request bodies (this should be the +# default, but something overrides it?) +SecRequestBodyLimit 131072000 + +# Increase PCRE limits. +SecPcreMatchLimit 500000 +SecPcreMatchLimitRecursion 500000 + +# Do not log the actual HTTP transactions. +SecAuditEngine Off +SecAuditLog /dev/null + +SecStatusEngine Off + +# Raise limit on body also without files attached +SecRequestBodyNoFilesLimit 131072000 diff --git a/docker/conf/php/7.3/fpm/conf.d/99-noblogs.ini b/docker/conf/php/7.3/fpm/conf.d/99-noblogs.ini new file mode 100644 index 0000000000000000000000000000000000000000..2943b9d234fac1581fc7ec232c5395bd6412acb0 --- /dev/null +++ b/docker/conf/php/7.3/fpm/conf.d/99-noblogs.ini @@ -0,0 +1,14 @@ +[PHP] +memory_limit = 256M +upload_max_filesize = 50M +post_max_size = 50M + +session.cookie_secure = 1 +session.cookie_httponly = 1 +session.save_handler = memcached +session.save_path = "127.0.0.1:7108" +memcached.sess_consistent_hash = 1 +memcached.sess_binary = 1 + +opcache.enable = 1 + diff --git a/docker/conf/php/7.3/fpm/pool.d/www.conf b/docker/conf/php/7.3/fpm/pool.d/www.conf new file mode 100644 index 0000000000000000000000000000000000000000..2deb81cc83d613cec114479dbf78441722b15ea7 --- /dev/null +++ b/docker/conf/php/7.3/fpm/pool.d/www.conf @@ -0,0 +1,28 @@ +[www] +listen = /run/php/php7.3-fpm.sock + +pm = dynamic +pm.max_children = 75 +pm.start_servers = 10 +pm.min_spare_servers = 10 +pm.max_spare_servers = 20 +pm.max_requests = 1000 + +pm.status_path = /status + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +catch_workers_output = yes + +chdir = / + +; Already enabled by default - do not enable twice. +; php_admin_value[opcache.enable] = 1 +php_admin_value[opcache.memory_consumption] = 64 +php_admin_value[opcache.interned_strings_buffer] = 16 +php_admin_value[opcache.max_accelerated_files] = 4000 +php_admin_value[opcache.validate_timestamps] = 0 + diff --git a/docker/htaccess b/docker/htaccess new file mode 100644 index 0000000000000000000000000000000000000000..81fc235dd1a7a606262de362d3057e33ae1758a1 --- /dev/null +++ b/docker/htaccess @@ -0,0 +1,79 @@ +RewriteEngine On +RewriteBase / +#Uncommenbt to lock WP + +#RewriteCond %{REQUEST_URI} ^(.*)?register.*$ [OR] +#RewriteCond %{REQUEST_URI} ^(.*)?wp-comment-post\.php(.*)$ [OR] +#RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR] +#RewriteCond %{REQUEST_URI} ^(.*)?wp-post\.php(.*)$ [OR] +#RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ +#RewriteRule ^(.*)$ http://cavallette.noblogs.org/2013/11/8487 [R,L] + +RewriteRule ^index\.php$ - [L] + +#### moved blogs. +RewriteCond %{HTTP_HOST} ^ventitre\.noblogs\.org [NC] +RewriteRule ^/?(.*) http://www.ventitre.org/$1 [L,R=301,NE] +#### + +#avoid inspection of queries log +RewriteRule ^/noblogs_queries.* /ancheno [L,R=404] + +# uploaded files +RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] +RewriteCond %{HTTP_X_FORWARDED_PROTO} https [NC] +RewriteRule ^gallery/([0-9]+)/(previews|previews-med)/(.*)$ https://noblogs.org/oldgal/$1/$2/$3 [R=301,L] +RewriteRule ^gallery/([0-9]+)/(previews|previews-med)/(.*)$ http://noblogs.org/oldgal/$1/$2/$3 [R=301,L] +#RewriteRule ^gallery/([0-9]+)/(previews|previews-med)/(.*)$ oldgal/$1/$2/$3 [L] +RewriteRule ^gallery/[0-9]+/(.*)$ wp-includes/ms-files.php?file=2010/08/$1 [L] +RewriteRule ^resource/[^/]+/preview/(.*)$ wp-includes/ms-files.php?file=2010/08/$1 [L] +RewriteRule ^resource/[^/]+/download/(.*)$ wp-includes/ms-files.php?file=2010/08/$1 [L] + +# BEGIN WPSuperCache +<IfModule mod_rewrite.c> +AddDefaultCharset UTF-8 +# Commented in order to cache more +# RewriteCond %{REQUEST_URI} !^.*[^/]$ +RewriteCond %{REQUEST_URI} !^.*//.*$ +RewriteCond %{REQUEST_METHOD} !POST +RewriteCond %{QUERY_STRING} !.*=.* +RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$ +RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC] +RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] +RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* +RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* +RewriteCond %{HTTP:Accept-Encoding} gzip +#RewriteCond %{HTTP:X-Forwarded-Proto} !^https$ +RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/%{HTTP:X-Forwarded-Proto}/$1/index.html.gz -f +RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/%{HTTP:X-Forwarded-Proto}/$1/index.html.gz" [L] + +#Commented in order to cache more +#RewriteCond %{REQUEST_URI} !^.*[^/]$ +RewriteCond %{REQUEST_URI} !^.*//.*$ +RewriteCond %{REQUEST_METHOD} !POST +RewriteCond %{QUERY_STRING} !.*=.* +RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$ +RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC] +RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] +RewriteCond %{HTTP_USER_AGENT} !^.*(2.0\ MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800).* +RewriteCond %{HTTP_user_agent} !^(w3c\ |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda\ |xda-).* +RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/%{HTTP:X-Forwarded-Proto}/$1/index.html -f +#RewriteCond %{HTTP:X-Forwarded-Proto} !^https$ +RewriteRule ^(.*) "/wp-content/cache/supercache/%{HTTP_HOST}/%{HTTP:X-Forwarded-Proto}/$1/index.html" [L] +</IfModule> + +# END WPSuperCache + +# BEGIN WordPress +RewriteCond %{REQUEST_FILENAME} -f [OR] +RewriteCond %{REQUEST_FILENAME} -d +RewriteRule ^ - [L] +RewriteRule . index.php [L] +# END WordPress + +# BEGIN noblogs + +# .git doesn't exist +RedirectMatch 404 /\\.git(/|$) + +# END noblogs diff --git a/docker/post-upgrade.sh b/docker/post-upgrade.sh new file mode 100755 index 0000000000000000000000000000000000000000..a2d017afea26ce8211b5c47626545c790337bba6 --- /dev/null +++ b/docker/post-upgrade.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Script that runs after an upgrade to the Noblogs Docker image, to +# update the database schema. +# +# It detects if an upgrade needs to be run by looking at the Wordpress +# version, and the contents of the guard file +# /opt/noblogs/data/.noblogs_db_schema_version. + +guard_file=/opt/noblogs/www/wp-content/blogs.dir/.db_schema_version +wp_version_file=/opt/noblogs/www/wp-includes/version.php + +cur_schema_version=0 +if [ -e $guard_file ]; then + cur_schema_version=`cat $guard_file` +fi + +if [ ! -e $wp_version_file ]; then + echo "Error: Wordpress version.php not found in $wp_version_file" >&2 + exit 1 +fi + +new_schema_version=`awk '$1 == "$wp_db_version" {print $3}' < $wp_version_file | tr -d ';'` +if [ -z "$new_schema_version" ]; then + echo "Error: failed to parse db schema version from version.php" >&2 + exit 1 +fi + +echo "Wordpress database schema: cur=${cur_schema_version}, new=${new_schema_version}" + +if [ $cur_schema_version -lt $new_schema_version ]; then + echo "Wordpress database upgrade required!" + on-local-blogs upgrade + + # Note: we'd really like to exit on failure here, but we're not + # sure we can trust the exit status code of that PHP script... + + echo "Wordpress database upgrade done" + + echo $new_schema_version > $guard_file + + noblogs remove-network-upgrade-message + + echo "network upgrade message removed" +fi + +exit 0 \ No newline at end of file diff --git a/docker/wp-cache-config.php b/docker/wp-cache-config.php new file mode 100644 index 0000000000000000000000000000000000000000..9984019a10b9f9ca896cb95b3d9d72534e66d8f3 --- /dev/null +++ b/docker/wp-cache-config.php @@ -0,0 +1,103 @@ +<?php +/* +WP-Cache Config Sample File + +See wp-cache.php for author details. +*/ + +$cache_compression = 0; // Super cache compression +$cache_enabled = true; +$super_cache_enabled = true; +$cache_max_time = 3600; //in seconds +//$use_flock = true; // Set it true or false if you know what to use +$cache_path = WP_CONTENT_DIR . '/cache/'; +$file_prefix = 'wp-cache-'; +$ossdlcdn = 1; + +// Array of files that have 'wp-' but should still be cached +$cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' ); + +$cache_rejected_uri = array('wp-.*\\.php', 'index\\.php'); +$cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' ); + +$cache_rebuild_files = 1; + +// Disable the file locking system. +// If you are experiencing problems with clearing or creating cache files +// uncommenting this may help. +$wp_cache_mutex_disabled = 1; + +// Just modify it if you have conflicts with semaphores +$sem_id = 942817292; + +if ( '/' != substr($cache_path, -1)) { + $cache_path .= '/'; +} + +$wp_cache_mobile = 0; +$wp_cache_mobile_whitelist = 'Stand Alone/QNws'; +$wp_cache_mobile_browsers = 'Android, 2.0 MMP, 240x320, AvantGo, BlackBerry, Blazer, Cellphone, Danger, DoCoMo, Elaine/3.0, EudoraWeb, hiptop, IEMobile, iPhone, iPod, KYOCERA/WX310K, LG/U990, MIDP-2.0, MMEF20, MOT-V, NetFront, Newt, Nintendo Wii, Nitro, Nokia, Opera Mini, Palm, Playstation Portable, portalmmm, Proxinet, ProxiNet, SHARP-TQ-GX10, Small, SonyEricsson, Symbian OS, SymbianOS, TS21i-10, UP.Browser, UP.Link, Windows CE, WinWAP'; + +// change to relocate the supercache plugins directory +$wp_cache_plugins_dir = WPCACHEHOME . 'plugins'; +// set to 1 to do garbage collection during normal process shutdown instead of wp-cron +$wp_cache_shutdown_gc = 0; +$wp_super_cache_late_init = 0; + +// uncomment the next line to enable advanced debugging features +$wp_super_cache_advanced_debug = 0; +$wp_super_cache_front_page_text = ''; +$wp_super_cache_front_page_clear = 0; +$wp_super_cache_front_page_check = 0; +$wp_super_cache_front_page_notification = '0'; + +$wp_cache_object_cache = 0; +$wp_cache_anon_only = 0; +$wp_supercache_cache_list = 0; +$wp_cache_debug_to_file = 0; +$wp_super_cache_debug = 0; +$wp_cache_debug_level = 5; +$wp_cache_debug_ip = ''; +$wp_cache_debug_log = ''; +$wp_cache_debug_email = ''; +$wp_cache_pages[ "search" ] = 0; +$wp_cache_pages[ "feed" ] = 0; +$wp_cache_pages[ "category" ] = 0; +$wp_cache_pages[ "home" ] = 0; +$wp_cache_pages[ "frontpage" ] = 0; +$wp_cache_pages[ "tag" ] = 0; +$wp_cache_pages[ "archives" ] = 0; +$wp_cache_pages[ "pages" ] = 0; +$wp_cache_pages[ "single" ] = 0; +$wp_cache_pages[ "author" ] = 0; +$wp_cache_hide_donation = 1; +$wp_cache_not_logged_in = 1; +$wp_cache_clear_on_post_edit = 0; +$wp_cache_hello_world = 0; +$wp_cache_mobile_enabled = 1; +$wp_cache_cron_check = 0; +$wp_cache_mfunc_enabled = 0; +$wp_cache_make_known_anon = 0; +$wp_cache_refresh_single_only = 0; +$wp_cache_mod_rewrite = 0; +$wp_supercache_304 = 0; +$wp_cache_front_page_checks = 0; +$wp_cache_disable_utf8 = 0; +$wp_cache_no_cache_for_get = 0; +$cache_scheduled_time = "00:00"; +$wp_cache_preload_interval = 600; +$cache_schedule_type = 'interval'; +$wp_cache_preload_posts = 0; +$wp_cache_preload_on = 0; +$wp_cache_preload_taxonomies = 0; +$wp_cache_preload_email_me = 0; +$wp_cache_preload_email_volume = 'none'; +$wp_cache_mobile_prefixes = ''; +$cached_direct_pages = array(); +$wpsc_served_header = false; +$cache_gc_email_me = 0; +$wpsc_save_headers = 0; +$cache_schedule_interval = 'daily'; +$wp_super_cache_comments = 1; +$wpsc_version = 169; +?> diff --git a/docker/wp-config.php b/docker/wp-config.php new file mode 100644 index 0000000000000000000000000000000000000000..277d10a280c834e4c9ac9e51b143c78937275ed9 --- /dev/null +++ b/docker/wp-config.php @@ -0,0 +1,166 @@ +<?php + +/** + * First of all, read our own configuration file. + * + * Store the result in an associative array '$noblogs_config'. + */ +$noblogs_config = json_decode(file_get_contents('/etc/noblogs/config.json'), true); + +/** + * The base configurations of the WordPress. + * + * This file has the following configurations: MySQL settings, Table Prefix, + * Secret Keys, WordPress Language, and ABSPATH. You can find more information + * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing + * wp-config.php} Codex page. You can get the MySQL settings from your web host. + * + * This file is used by the wp-config.php creation script during the + * installation. You don't have to use the web site, you can just copy this file + * to "wp-config.php" and fill in the values. + * + * @package WordPress + */ +define('BP_ENABLE_USERNAME_COMPATIBILITY_MODE',true); +define('FORCE_SSL_ADMIN', true); +define('FORCE_SSL_LOGIN', true); +if ( !defined('WP_CACHE') ) { + define('WP_CACHE', true); +} +if ( ! defined('WPCACHEHOME') ){ + define( 'WPCACHEHOME', dirname(__FILE__) . '/wp-content/plugins/wp-super-cache/'); +} +define('WP_ALLOW_MULTISITE', true); +define('MULTISITE', true); +define('SUBDOMAIN_INSTALL', true); +$base = '/'; +define('DOMAIN_CURRENT_SITE', 'noblogs.org'); +define('PATH_CURRENT_SITE', '/'); +define('SITE_ID_CURRENT_SITE', 1); +define('BLOG_ID_CURRENT_SITE', 1); +define('DISALLOW_FILE_MODS', true); +//define('DISALLOW_FILE_EDIT', false); +define('DISABLE_WP_CRON', true); +//AI patch: set to true if you want to activate query profiling +define('AI_DB_PROFILER', false); +//disable automatic updates +define( 'AUTOMATIC_UPDATER_DISABLED', true ); + +// Use Apache's mod_xsendfile for static content. +define('WPMU_SENDFILE', true); + +// ** MySQL settings - You can get this info from your web host ** // +/** The name of the database for WordPress */ +define('DB_NAME', 'noblogs'); + +/** MySQL database username */ +define('DB_USER', 'noblogsdb'); + +/** MySQL database password */ +define('DB_PASSWORD', 'non e questa'); + +/** MySQL hostname */ +define('DB_HOST', 'localhost'); + +/** Database Charset to use in creating database tables. */ +define('DB_CHARSET', 'utf8mb4'); + +/* Use ludicrous instead of HyperDB. */ +define('R2DB_USE_LUDICROUSDB', true); + +/** SMTP settings. Check wp-includes/class-phpmailer.php for possible values for some fields. */ +define('SMTP_HOST', 'mail-frontend.investici.org'); +define('SMTP_PORT', '10025'); +define('SMTP_SECURE', ''); +define('SMTP_AUTH', false); +define('SMTP_USER', ''); +define('SMTP_PASS', ''); +define('SMTP_FROM', 'noreply@autistici.org'); +define('SMTP_NAME', 'NoBlogs'); +define('SMTP_DEBUG', 0); + +/**#@+ + * Authentication Unique Keys and Salts. + * + * Change these to different unique phrases! + * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} + * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. + * + * @since 2.6.0 + */ +define('AUTH_KEY', $noblogs_config['secrets']['auth_key']); +define('SECURE_AUTH_KEY', $noblogs_config['secrets']['secure_auth_key']); +define('LOGGED_IN_KEY', $noblogs_config['secrets']['logged_in_key']); +define('NONCE_KEY', $noblogs_config['secrets']['nonce_key']); +define('AUTH_SALT', $noblogs_config['secrets']['auth_salt']); +define('SECURE_AUTH_SALT', $noblogs_config['secrets']['secure_auth_salt']); +define('LOGGED_IN_SALT', $noblogs_config['secrets']['logged_in_salt']); +define('NONCE_SALT', $noblogs_config['secrets']['nonce_salt']); + +/**#@-*/ + +/** + * WordPress Database Table prefix. + * + * You can have multiple installations in one database if you give each a unique + * prefix. Only numbers, letters, and underscores please! + */ +$table_prefix = 'wp_'; + +/** + * WordPress Localized Language, defaults to English. + * + * Change this to localize WordPress. A corresponding MO file for the chosen + * language must be installed to wp-content/languages. For example, install + * de.mo to wp-content/languages and set WPLANG to 'de' to enable German + * language support. + */ +define ('WPLANG', ''); + +/** + * For developers: WordPress debugging mode. + * + * Change this to true to enable the display of notices during development. + * It is strongly recommended that plugin and theme developers use WP_DEBUG + * in their development environments. + */ + +/* NoSpam API endpoint (internal). */ +define('NOSPAM_API_URL', 'http://nospam.investici.org:9001'); + +/* + * A/I Patch: get more replicas of the partitions in the flexihash calculations. + */ +define('R2DB_FLEXIHASH_REPLICAS', 128); + +/* + * A/I patch: global recaptcha key. + */ +if (array_key_exists('recaptcha', $noblogs_config)) { + define('GLOBAL_RECAPTCHA_KEY', $noblogs_config['recaptcha']['key']); + define('GLOBAL_RECAPTCHA_PRIVATE_KEY', $noblogs_config['recaptcha']['private_key']); +} + +/* + * A/I Patch: print debug info on demand when the debug cookie is set. + */ +if (array_key_exists('debug_cookie_name', $noblogs_config) && + !empty($_COOKIE[$noblogs_config['debug_cookie_name']])) { + define('WP_DEBUG', true); + define('WP_DEBUG_LOG', true); + define('WP_DEBUG_DISPLAY', false); + define('AI_LOG_HYPERDB',true); +} else { + define('WP_DEBUG', false); + define('AI_LOG_HYPERDB',false); +} + +/* That's all, stop editing! Happy blogging. */ + +/** Absolute path to the WordPress directory. */ +if ( !defined('ABSPATH') ) { + define('ABSPATH', dirname(__FILE__) . '/'); +} + +/** Sets up WordPress vars and included files. */ +require_once(ABSPATH . 'wp-settings.php'); diff --git a/install.sh b/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..a789f34e1e8e9daa27133d54eef43646c93b72db --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e +umask 022 + +composer install --prefer-dist --no-ansi --no-progress --no-interaction + +# remove useless files +find app -name 'composer.json' -delete +find app -name 'PATCHES.txt' -delete +find app -name 'readme.*' -delete +find app -name 'license.*' -delete + +exit 0