pax_global_header00006660000000000000000000000064134602777640014532gustar00rootroot0000000000000052 comment=7493562fce0b43f60e176a0822198722ad234a21 vrfydmn-0.11.0/000077500000000000000000000000001346027776400132765ustar00rootroot00000000000000vrfydmn-0.11.0/.gitignore000066400000000000000000000012721346027776400152700ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .cache nosetests.xml coverage.xml # Translations *.mo *.pot # Django stuff: *.log # Sphinx documentation docs/_build/ # PyBuilder target/ # PyCharme IDE .idea/ vrfydmn-0.11.0/INSTALL000066400000000000000000000022531346027776400143310ustar00rootroot00000000000000Usage ===== Install libmilter and pymilter (the python package that wraps the C library). After that you may create a user milter with group milter. I have provided two init scripts. The vrfydmn.init is for systems that use sysvinit, the vrfydmn.openrc is for Gentoo users (as I am). You may edit these and specify options for the milter. Simply call the milter with --help to get an idea. Place vrfydmn into /usr/local/sbin. If you chose another path, you might need to adopt the path in the init script. You need to run the milter with -f or -l (see --help). In Postfix, you may add the milter with: non_smtpd_milters=inet:[::1]:30072 for scenario one and smtpd_milters=inet:[::1]:30072 for the submission instance. Usually found in master.cf or maybe a second instance. This depends on your system. LDAP ==== You can use LDAP. For this, you need to install python-ldap (with SASL support) For an example config file, see doc/relay_domains.cf Full documentation will come soon. Memcached ========= You can run LDAP combined with memcached. For this, add: -m 127.0.0.1:11211 as argument in the init script. Positive results are stored for one hour, negative for 60 seconds. vrfydmn-0.11.0/LICENSE000066400000000000000000001044621346027776400143120ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {one line to give the program's name and a brief idea of what it does.} Copyright (C) {year} {name of author} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: {project} Copyright (C) {year} {fullname} This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . vrfydmn-0.11.0/README.md000066400000000000000000000047001346027776400145560ustar00rootroot00000000000000vrfydmn ======= Postfilx milter that rejects/fixes manipulated From:-header Background ========== 1st scenario ------------ If you run web servers that host virtual domains, you often define PHP settings that force a fixed enevelope-from address. Unfortunately many websites provide contact formulas that take the sender e-mail address and copy that with the PHP mail function to the From:-header. If you run a mail server that checks SPF/DKIM and finally DMARC, you can get into trouble, if the sender address belongs to a company that enforces a strict DMARC policy. If a remote server (and that could also be yours!) receives such a mail, the mail will be rejected, as your web server (or a relay server that handles mail from the web server) fails the SPF, DKIM and DMARC test. 2nd scenarion ------------- You provde mail services for customers that deliver their mail over submission. If you have infected PCs where bots are going to send mails over users account, they can fake the sender addresses. vrfydmn ======= This is a little milter that can i.e. run on a web server or a submission server. In the first scenario described, you may like to run the milter with a fix option. In this mode, it restores the From:-header with the envelope-from address and inserts a ne Reply-To:-header with the former From:-header. This will keep formulas working. For the second scenario described, you may want to run the milter with a hard reject, if the From:-address was faked. At the current stage of this milter, it reads a simple map file (I am using Postfix) containing all domains that the mail server is the final destionation. Each time a mail is sent, the From:-header is decoded and the e-mail address is split into local part and domain, where only the domain is taken for comparison. In fact, all domains from the map file are compared to the domain, which makes it easier with subdomains. If a domain was found in the mapped file, mail can pass, else it will either be rejected or modified depended of the mode the milters runs with. As domain maps might be very large, the file is only read at startup and kept in memory. You can send a -HUP signal to the milter to reload its maps and send a -USR1 signal to dump all domains to syslog (or stdout, if running in debug mode). For both scenarios described above, you can find a samlpe picture of my current mail system, which demonstrates the usecases Features ======== I might integrate SQL servers as well for lookups. vrfydmn-0.11.0/TODO000066400000000000000000000000271346027776400137650ustar00rootroot00000000000000- write documentation vrfydmn-0.11.0/doc/000077500000000000000000000000001346027776400140435ustar00rootroot00000000000000vrfydmn-0.11.0/doc/Example-Mailsystem.png000066400000000000000000002152411346027776400202760ustar00rootroot00000000000000PNG  IHDRJT+qֲsRGB pHYs  @IDATx @U>%q5tJd[dlR"5RMh.98L-J,,hJJ*I!SA,=.ō-]9zN/ P(@ PIx#R(@ PA P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@ P P(@ P ,@I P(@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lcR YҶ̕+x[*7_?}d{޶|YyZy)\(5ؠ|Wo crlKERm^YA:,Id+,Gڎ)[I`nO]&"ʝmEBܯC&!׿#2Э;Lo7:&1\ΆjjJu!;7ɶt.y p G)j–={dOɅcrc2McV^2&%7wܕ}d~5;,Pv )uD7ݕ7_fU6tO:{}=_9! ͪU^>W&m_/ ϊ xJlb|YC rYe<{Vő:9L8h }E}SqpJrV;7ֽ]2EwHW|Er_A^r:$*-;Vz_W/mKj9h˘eށ_9Ξ:*\\gRӷW`ji 9rv cw76ܩ?ksJm;BGU~|mwю}=/?'ezn/ڰUSᇶ1o=NgVvuk,}G5F׽*굋gAJEf'9)fᅰJۡg`1]k_]gmrzaymn:X #}m/~v;9:~ J.BJXTXòGˬd;UnT濣s|&V׫r!9oΧHin驐?7~CĤrX8S+˗=3ߖS=yjr]cH_˞0x@b?R 둗Bt^,t& *q2ÐڶD{G:+MVޏ&]HzҒ7GMɎmѓ>}Z_z]ǒ7WnifF\u.]7}/U]/a(ђys6w};a0紡8A%aPv&sz)i󺆒[ĵX",(ҕlH4L{?>rqºiYï&[g]:ƥ" <یF%y@@O8?=/>z6$^\&>zrz22<*yXqvC3%T6IߓntZ[ O,4s4G#:nO~eJcĿ\5ƴǨiuy=|F5~sJsfgWt{;7|(,#6⸖nG. SHELL = /bin/sh SOURCES = vrfydmn.8.txt vrfydmn_ldap.5.txt # Substitutions HTMLS= $(patsubst %.txt,%.html,$(SOURCES)) MANS= $(patsubst %.txt,%.man,$(SOURCES)) # Build Targets all: html man html: $(HTMLS) man: $(MANS) # Build commands %.html: %.txt asciidoc -b html5 $< %.man: %.txt a2x --doctype manpage --format manpage $< # Defaults .PHONY: clean clean: rm -f *.html *.1 *.5 *.8 vrfydmn-0.11.0/doc/man/000077500000000000000000000000001346027776400146165ustar00rootroot00000000000000vrfydmn-0.11.0/doc/man/man8/000077500000000000000000000000001346027776400154615ustar00rootroot00000000000000vrfydmn-0.11.0/doc/man/man8/vrfydmn.8000066400000000000000000000071501346027776400172420ustar00rootroot00000000000000.\" Manpage for vrfydmn. .\" Contact c@roessner.co to correct errors or typos. .TH man 8 "18 Dec 2014" "0.4" "vrfydmn man page" .SH NAME vrfydmn \- Milter that rejects a forged or modified RFC5322 from address .SH SYNOPSIS vrfydmn OPTIONS -f, --file FLATFILE and/or -l, --ldap LDAP_CONFIG .PP vrfydmn -h, --help .SH DESCRIPTION vrfydmn is a milter that can check a RFC5322 from address and compare it to a list of domains coming from a flat file or a LDAP connection. The domains provided should reflect the domains that your MX is a final destination for. If an address with a foreign domain component was found, the milter can either reject the mail or copy the given address to a RFC5322 Reply-To header (if none already was specified) and it restores the RCF5322 from header with the envelope-from (MAIL FROM) address. .PP The purpose is to reject mail that might be phishing mail due to stolen mail accounts or to prevent mail loss in cases, where the given address was under DMARC policy, i.e. Yahoo or AOL. .PP Web servers that provide hosting for several domains might have dozens of contact forms. Often they use a given e-mail address provides by a website visitor to use this address as a RFC5322 from address. If the web server is forwarding mail to a relay server that delivers mail to the internet, mails might get lost, as a remote MX might enforce DMARC policies. In such a case, a bounced mail could not be sent back to the original sender. .PP Normal use is on web servers, where you might already provide an enevelope from address with sendmail(8) -f or on the submission (port 587) side. .SH OPTIONS .TP .B -u, --user USER (default: milter) Run the milter with user USER .TP .B -g, --group GROUP (default: milter) Run the milter with group GROUP .TP .B -s, --socket SOCKET (default: inet6:30072@[::1]) Specify the socket the miler is listening on. This may be either an IPv4 or IPv6 socket. .TP Examples: .TP inet6:30072@[::1] .TP inet:10000@127.0.0.1 .TP .B -p, --pid PIDFILE (default: none) Specify a pid file, which is created upon startup. .TP .B -f, --file FLATEFILE (default: none) This file typically is a \fBpostfix\fR(8) map, i.e. relay_domains file. It should be a map with 2 columns. First column is the domain (the key) and the second column represents some value. The value is totally ignored in vrfydmn! If a flat file was given, the file can be refreshed during runtime by sending the SIGHUP signal and the result can be dumped to syslog (or standard out, if -d, --debug was given) with the SIGUSR1 signal. .TP .B -l, --ldap LDAP_CONFIG (default: none) This option specifies a LDAP configuration file. Settings found in this file will enable a persistent LDAP connection. See \fBvrfydmn_ldap\fR(5) for the syntax and available options .TP .B -m, --memcached SOCKET (default: none) A memcached can be wrapped around a LDAP connection. SOCKET is typically 127.0.0.1:11211. Adopt it to your needs, if you want to enable support for this option. .TP .B -f, --fix Instead of rejecting mails with a forged/modified RFC5322 from header, copy this header to a Reply-To field (if none already exists) and restore the from header field with the envelope-from (MAIL FROM) mail address. This option is recommended for web servers. .TP .B -d, --debug Run the milter in forground. In this mode, all information concerning an e-mail session will be dumped to standard out. It also will print out the result of the check. .SH SEE ALSO vrfydmn_ldap(5) .SH BUGS Normally RFC5322 from address may of the form mailbox-list. As this is a very uncommon case, the milter currently only picks the last found address for testing. .SH AUTHOR Christian Roessner (c@roessner.co) vrfydmn-0.11.0/doc/relay_domains.cf000066400000000000000000000005721346027776400172070ustar00rootroot00000000000000host = ldap://ldap.example.com/ usetls = Yes cacert = /etc/ssl/certs/ca-certificates.crt cert = /etc/ssl/certs/foo.example.com.pem key = /etc/ssl/private/foo.example.com.key.pem reqcert = demand base = ou=mailDomains,ou=it,dc=example,dc=com bindmethod = sasl saslmech = EXTERNAL scope = base filter = (&(objectClass=rnsMSPostfixGroup)(rnsMSVirtDomain=*%s)) result_attrs = ou vrfydmn-0.11.0/doc/vrfydmn.8000066400000000000000000000130421346027776400156210ustar00rootroot00000000000000'\" t .\" Title: vrfydmn .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 02/09/2015 .\" Manual: vrfydmn Manual .\" Source: vrfydmn 0.4 .\" Language: English .\" .TH "VRFYDMN" "8" "02/09/2015" "vrfydmn 0\&.4" "vrfydmn Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" vrfydmn \- reject an email message if the RFC5322 From:\-address does not comply\&. .SH "SYNOPSIS" .sp \fBvrfydmn\fR [\fIOPTIONS\fR] \fIFILE\fR .SH "DESCRIPTION" .sp In email everyone is free to specify any RFC5322 From:\-header address\&. Miscreants \(em virus authors, spammers and phishers \(em are aware of this fact\&. They forge the RFC5322 From:\-header address on purpose to impersonate someone that suits their goal\&. .sp Average users are not aware of this fact\&. They tend to believe a message really was sent by the person indicated in the RFC5322 From:\-header address\&. .sp vrfydmn verifies RFC5322 From:\-headers in mail messages\&. It compares a messages From:\-header field to a list of permitted sender domains assigned to the sender\&. If the address does not meet the expectations vrfydmn may either rectify the RFC5322 From:\-header or reject the message\&. .sp This program was created to control and reject phishing abuse on SMTP submission ports\&. It serves also to prevent mail loss in cases, when the given address was under DMARC policy, i\&.e\&. Yahoo or AOL\&. .SH "OPTIONS" .PP \fB\-u, \-\-user\fR \fIuser\fR (default: \fImilter\fR) .RS 4 Run vrfydmn as user \fIuser\fR\&. .RE .PP \fB\-g, \-\-group\fR \fIgroup\fR (default: \fImilter\fR) .RS 4 Run vrfydmn as group \fIuser\fR\&. .RE .PP \fB\-s, \-\-socket\fR \fIsocket\fR (default: \fIinet6:30072@[::1]\fR) .RS 4 Specifes the socket vrfydmn should listen on for incoming verification requests\&. The socket consists of three parts \- \fIprotocol\fR, \fIport\fR and \fIaddress\fR\&. .RE .PP \fIprotocol\fR .RS 4 Use \fIinet\fR as prefix to indicate an IPv4 socket e\&.g\&. \fIinet:10000@127\&.0\&.0\&.1\fR or \fIinet6\fR as prefix to indicate an IPv6 socket e\&.g\&. \fIinet6:30072@[::1]\fR\&. .RE .PP \fIport\fR .RS 4 Use numbers to indicate the port vrfydmn should establish its socket on e\&.g\&. \fI30072\fR\&. .RE .PP \fIaddress\fR .RS 4 Specify an IP address\&. The address type must correspond to the \fIprotocol\fR choosen\&. IPv6 addresses must be enclosed in square brackets e\&.g\&. \fI[address]\fR\&. .RE .PP \fB\-p, \-\-pid\fR \fIpidfile\fR (default: none) .RS 4 Specifies the name of a file in which vrfydmn should note its process id\&. .RE .PP \fB\-f, \-\-file\fR \fIfile\fR (default: none) .RS 4 This file typically is a postfix(8) map, i\&.e\&. relay_domains file\&. It should be a map with 2 columns\&. First column is the domain (the key) and the second column represents some value\&. The value is totally ignored in vrfydmn! If a flat file was given, the file can be refreshed during runtime by sending the SIGHUP signal and the result can be dumped to syslog (or standard out, if \-d, \-\-debug was given) with the SIGUSR1 signal\&. .RE .PP \fB\-l, \-\-ldap\fR \fIfile\fR (default: none) .RS 4 Specifies the path to a configuration file\&. The file holds options for LDAP queries\&. If specified vrfydmn will establish a persistent LDAP connection\&. See vrfydmn_ldap(5) for details\&. .RE .PP \fB\-m, \-\-memcached\fR \fIsocket\fR (default: none) .RS 4 Specifies a TCP socket to a memcache server\&. If enabled LDAP query results will be cached in the memcache\&. The socket must be specified as \fIaddress\fR and \fIport\fR separated by a colon e\&.g\&. \fI127\&.0\&.0\&.1:11211\fR\&. .RE .PP \fB\-f, \-\-fix\fR .RS 4 If specified vrfydmn will not reject messages with RFC5322 From:\-headers that fail verification\&. Instead it will attempt to fix them\&. It will copy the erroneous header to a Reply\-To:\-header (only if none already exists)\&. Then it will replace the existing From:\-header with the envelope\-sender address (MAIL From)\&. This option is recommended for web servers\&. .RE .PP \fB\-d, \-\-debug\fR .RS 4 This option is mainly for debugging and development purposes\&. If specified vrfydmn will not detach\&. It will run in foreground and output its activities to stdout\&. .RE .SH "SEE ALSO" .sp vrfydmn_ldap(5) .SH "BUGS" .sp There are no known bugs so far\&. Please submit bugs to https://github\&.com/croessner/vrfydmn/issues\&. .SH "AUTHOR" .sp Christian Roessner wrote the program\&. .sp Patrick Ben Koetter wrote this man page\&. .SH "RESOURCES" .sp vrfydmn\(cqs home is at https://github\&.com/croessner/vrfydmn\&. .SH "COPYING" .sp Copyright (C) 2014\-2015 Christian Roessner\&. Free use of this software is granted under the terms of the GNU General Public License (GPL)\&. vrfydmn-0.11.0/doc/vrfydmn.8.html000066400000000000000000000543171346027776400165760ustar00rootroot00000000000000 vrfydmn(8)

SYNOPSIS

vrfydmn [OPTIONS] FILE

DESCRIPTION

In email everyone is free to specify any RFC5322 From:-header address. Miscreants — virus authors, spammers and phishers — are aware of this fact. They forge the RFC5322 From:-header address on purpose to impersonate someone that suits their goal.

Average users are not aware of this fact. They tend to believe a message really was sent by the person indicated in the RFC5322 From:-header address.

vrfydmn verifies RFC5322 From:-headers in mail messages. It compares a messages From:-header field to a list of permitted sender domains assigned to the sender. If the address does not meet the expectations vrfydmn may either rectify the RFC5322 From:-header or reject the message.

This program was created to control and reject phishing abuse on SMTP submission ports. It serves also to prevent mail loss in cases, when the given address was under DMARC policy, i.e. Yahoo or AOL.

OPTIONS

-u, --user user (default: milter)

Run vrfydmn as user user.

-g, --group group (default: milter)

Run vrfydmn as group user.

-s, --socket socket (default: inet6:30072@[::1])

Specifes the socket vrfydmn should listen on for incoming verification requests. The socket consists of three parts - protocol, port and address.

protocol

Use inet as prefix to indicate an IPv4 socket e.g. inet:10000@127.0.0.1 or inet6 as prefix to indicate an IPv6 socket e.g. inet6:30072@[::1].

port

Use numbers to indicate the port vrfydmn should establish its socket on e.g. 30072.

address

Specify an IP address. The address type must correspond to the protocol choosen. IPv6 addresses must be enclosed in square brackets e.g. [address].

-p, --pid pidfile (default: none)

Specifies the name of a file in which vrfydmn should note its process id.

-f, --file file (default: none)

This file typically is a postfix(8) map, i.e. relay_domains file. It should be a map with 2 columns. First column is the domain (the key) and the second column represents some value. The value is totally ignored in vrfydmn! If a flat file was given, the file can be refreshed during runtime by sending the SIGHUP signal and the result can be dumped to syslog (or standard out, if -d, --debug was given) with the SIGUSR1 signal.

-l, --ldap file (default: none)

Specifies the path to a configuration file. The file holds options for LDAP queries. If specified vrfydmn will establish a persistent LDAP connection. See vrfydmn_ldap(5) for details.

-m, --memcached socket (default: none)

Specifies a TCP socket to a memcache server. If enabled LDAP query results will be cached in the memcache. The socket must be specified as address and port separated by a colon e.g. 127.0.0.1:11211.

-f, --fix

If specified vrfydmn will not reject messages with RFC5322 From:-headers that fail verification. Instead it will attempt to fix them. It will copy the erroneous header to a Reply-To:-header (only if none already exists). Then it will replace the existing From:-header with the envelope-sender address (MAIL From). This option is recommended for web servers.

-d, --debug

This option is mainly for debugging and development purposes. If specified vrfydmn will not detach. It will run in foreground and output its activities to stdout.

SEE ALSO

vrfydmn_ldap(5)

BUGS

There are no known bugs so far. Please submit bugs to https://github.com/croessner/vrfydmn/issues.

AUTHOR

Christian Roessner <c@roessner.co> wrote the program.

Patrick Ben Koetter <p@sys4.de> wrote this man page.

RESOURCES

vrfydmn’s home is at https://github.com/croessner/vrfydmn.

COPYING

Copyright (C) 2014-2015 Christian Roessner. Free use of this software is granted under the terms of the GNU General Public License (GPL).


vrfydmn-0.11.0/doc/vrfydmn.8.txt000066400000000000000000000101501346027776400164340ustar00rootroot00000000000000vrfydmn(8) =========== :doctype: manpage :man source: vrfydmn :man version: 0.4 :man manual: vrfydmn Manual NAME ---- vrfydmn - reject an email message if the RFC5322 From:-address does not comply. SYNOPSIS -------- *vrfydmn* ['OPTIONS'] 'FILE' DESCRIPTION ----------- In email everyone is free to specify any RFC5322 From:-header address. Miscreants -- virus authors, spammers and phishers -- are aware of this fact. They forge the RFC5322 From:-header address on purpose to impersonate someone that suits their goal. Average users are not aware of this fact. They tend to believe a message really was sent by the person indicated in the RFC5322 From:-header address. vrfydmn verifies RFC5322 From:-headers in mail messages. It compares a messages From:-header field to a list of permitted sender domains assigned to the sender. If the address does not meet the expectations vrfydmn may either rectify the RFC5322 From:-header or reject the message. This program was created to control and reject phishing abuse on SMTP submission ports. It serves also to prevent mail loss in cases, when the given address was under DMARC policy, i.e. Yahoo or AOL. OPTIONS ------- *-u, --user* 'user' (default: 'milter'):: Run vrfydmn as user 'user'. *-g, --group* 'group' (default: 'milter'):: Run vrfydmn as group 'user'. *-s, --socket* 'socket' (default: 'inet6:30072@[::1]'):: Specifes the socket vrfydmn should listen on for incoming verification requests. The socket consists of three parts - 'protocol', 'port' and 'address'. 'protocol':: Use 'inet' as prefix to indicate an IPv4 socket e.g. 'inet:10000@127.0.0.1' or 'inet6' as prefix to indicate an IPv6 socket e.g. 'inet6:30072@[::1]'. 'port':: Use numbers to indicate the port vrfydmn should establish its socket on e.g. '30072'. 'address':: Specify an IP address. The address type must correspond to the 'protocol' choosen. IPv6 addresses must be enclosed in square brackets e.g. '[address]'. *-p, --pid* 'pidfile' (default: none):: Specifies the name of a file in which vrfydmn should note its process id. *-f, --file* 'file' (default: none):: This file typically is a postfix(8) map, i.e. relay_domains file. It should be a map with 2 columns. First column is the domain (the key) and the second column represents some value. The value is totally ignored in vrfydmn! If a flat file was given, the file can be refreshed during runtime by sending the SIGHUP signal and the result can be dumped to syslog (or standard out, if -d, --debug was given) with the SIGUSR1 signal. *-l, --ldap* 'file' (default: none):: Specifies the path to a configuration file. The file holds options for LDAP queries. If specified vrfydmn will establish a persistent LDAP connection. See vrfydmn_ldap(5) for details. *-m, --memcached* 'socket' (default: none):: Specifies a TCP socket to a memcache server. If enabled LDAP query results will be cached in the memcache. The socket must be specified as 'address' and 'port' separated by a colon e.g. '127.0.0.1:11211'. *-f, --fix*:: If specified vrfydmn will not reject messages with RFC5322 From:-headers that fail verification. Instead it will attempt to fix them. It will copy the erroneous header to a Reply-To:-header (only if none already exists). Then it will replace the existing From:-header with the envelope-sender address (MAIL From). This option is recommended for web servers. *-d, --debug*:: This option is mainly for debugging and development purposes. If specified vrfydmn will not detach. It will run in foreground and output its activities to stdout. SEE ALSO -------- vrfydmn_ldap(5) BUGS ---- There are no known bugs so far. Please submit bugs to . AUTHOR ------ Christian Roessner wrote the program. Patrick Ben Koetter wrote this man page. RESOURCES --------- vrfydmn's home is at . COPYING ------- Copyright \(C) 2014-2015 Christian Roessner. Free use of this software is granted under the terms of the GNU General Public License (GPL). // vim: set ft=asciidoc: vrfydmn-0.11.0/doc/vrfydmn_ldap.5000066400000000000000000000123771346027776400166300ustar00rootroot00000000000000'\" t .\" Title: vrfydmn_ldap .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 02/09/2015 .\" Manual: vrfydmn Manual .\" Source: vrfydmn_ldap 0.4 .\" Language: English .\" .TH "VRFYDMN_LDAP" "5" "02/09/2015" "vrfydmn_ldap 0\&.4" "vrfydmn Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" vrfydmn_ldap \- lookup RFC5322 From:\-addresses in an LDAP database\&. .SH "SYNOPSIS" .sp \fBvrfydmn\fR \-l \fIldap:///etc/vrfydmn/ldap\&.cfg\fR .SH "DESCRIPTION" .sp vrfydmn uses lists and tables to lookup mail related informations\&. A lookup tables may be an LDAP database\&. .sp In order to use LDAP lookups, specify a path to a file holding LDAP connection and query configuration\&. The path must be given when \fBvrfydmn\fR is invoked on command line: .sp \fBvrfydmn\fR \-l \fIldap:///etc/vrfydmn/ldap\&.cfg\fR .SH "OPTIONS" .PP \fBbase\fR (default: None) .RS 4 The RFC2253 base DN at which to conduct the search, e\&.g\&. .sp .if n \{\ .RS 4 .\} .nf base = ou=maildomains,dc=example,dc=com .fi .if n \{\ .RE .\} .RE .PP \fBbindmethod\fR (default: None) .RS 4 The method used when binding to the LDAP server\&. Valid options are simple or sasl\&. .RE .PP \fBcacert\fR (default: None) .RS 4 Specifies the file that contains certificates for all of the Certificate Authorities the client will recognize\&. .sp .if n \{\ .RS 4 .\} .nf cacert = /etc/ssl/certs/cacerts\&.pem .fi .if n \{\ .RE .\} .RE .PP \fBcert\fR (default: None) .RS 4 Specifies the file that contains the client certificate\&. .sp .if n \{\ .RS 4 .\} .nf cert = /etc/ssl/certs/mail\&.example\&.com\-crt\&.pem .fi .if n \{\ .RE .\} .RE .PP \fBfilter\fR (default: None) .RS 4 The RFC2254 filter used to search the directory, e\&.g\&. .sp .if n \{\ .RS 4 .\} .nf filter = (domain=*) .fi .if n \{\ .RE .\} .RE .PP \fBhost\fR (default: None) .RS 4 The name of the host running the LDAP server, e\&.g\&. .sp .if n \{\ .RS 4 .\} .nf host = 127\&.0\&.0\&.1, ldap\&.example\&.com .fi .if n \{\ .RE .\} .RE .PP \fBkey\fR (default: None) .RS 4 Specifies the file that contains the private key that matches the certificate stored in the cert file\&. Currently, the private key must not be protected with a password, so it is of critical importance that the key file is protected carefully\&. .sp .if n \{\ .RS 4 .\} .nf key = /etc/ssl/private/mail\&.example\&.com\-key\&.pem .fi .if n \{\ .RE .\} .RE .PP \fBreqcert\fR (default: \fBdemand\fR) .RS 4 Specifies what checks to perform on server certificates in a TLS session, if any\&. The can be specified as one of the following keywords: .PP \fBnever\fR .RS 4 The client will not request or check any server certificate\&. .RE .PP \fBallow\fR .RS 4 The server certificate is requested\&. If no certificate is provided, the session proceeds normally\&. If a bad certificate is provided, it will be ignored and the session proceeds normally\&. .RE .PP \fBtry\fR .RS 4 The server certificate is requested\&. If no certificate is provided, the session proceeds normally\&. If a bad certificate is provided, the session is immediately terminated\&. .RE .PP \fBdemand\fR .RS 4 The server certificate is requested\&. If no certificate is provided, or a bad certificate is provided, the session is immediately terminated\&. This is the default setting\&. .RE .RE .PP \fBresult_attrs\fR (default: None) .RS 4 The name of the attribute whose value the query should return\&. .sp .if n \{\ .RS 4 .\} .nf result_attrs = domain .fi .if n \{\ .RE .\} .RE .PP \fBsaslmech\fR (default: None) .RS 4 The mechanism outgoing\(cqs LDAP client should use, when it sasl\-binds to the remote LDAP server\&. Valid options are currently PLAIN or EXTERNAL\&. .RE .PP \fBscope\fR (default: None) .RS 4 The LDAP search scope: sub, base, or one\&. .RE .PP \fBusetls\fR (default: No) .RS 4 A Boolean option to enable or disable usage of TLS when connecting to the LDAP server\&. Valid options are Yes or No\&. .RE .SH "SEE ALSO" .sp vrfydmn(8) .SH "BUGS" .sp There are no known bugs so far\&. Please submit bugs to https://github\&.com/croessner/vrfydmn/issues\&. .SH "AUTHOR" .sp Christian Roessner wrote the program\&. .sp Patrick Ben Koetter wrote this man page\&. .SH "RESOURCES" .sp vrfydmn\(cqs home is at https://github\&.com/croessner/vrfydmn\&. .SH "COPYING" .sp Copyright (C) 2014\-2015 Christian Roessner\&. Free use of this software is granted under the terms of the GNU General Public License (GPL)\&. vrfydmn-0.11.0/doc/vrfydmn_ldap.5.html000066400000000000000000000546671346027776400176030ustar00rootroot00000000000000 vrfydmn_ldap(5)

SYNOPSIS

vrfydmn -l ldap:///etc/vrfydmn/ldap.cfg

DESCRIPTION

vrfydmn uses lists and tables to lookup mail related informations. A lookup tables may be an LDAP database.

In order to use LDAP lookups, specify a path to a file holding LDAP connection and query configuration. The path must be given when vrfydmn is invoked on command line:

vrfydmn -l ldap:///etc/vrfydmn/ldap.cfg

OPTIONS

base (default: None)

The RFC2253 base DN at which to conduct the search, e.g.

base = ou=maildomains,dc=example,dc=com
bindmethod (default: None)

The method used when binding to the LDAP server. Valid options are simple or sasl.

cacert (default: None)

Specifies the file that contains certificates for all of the Certificate Authorities the client will recognize.

cacert = /etc/ssl/certs/cacerts.pem
cert (default: None)

Specifies the file that contains the client certificate.

cert = /etc/ssl/certs/mail.example.com-crt.pem
filter (default: None)

The RFC2254 filter used to search the directory, e.g.

filter = (domain=*)
host (default: None)

The name of the host running the LDAP server, e.g.

host = 127.0.0.1, ldap.example.com
key (default: None)

Specifies the file that contains the private key that matches the certificate stored in the cert file. Currently, the private key must not be protected with a password, so it is of critical importance that the key file is protected carefully.

key = /etc/ssl/private/mail.example.com-key.pem
reqcert (default: demand)

Specifies what checks to perform on server certificates in a TLS session, if any. The <level> can be specified as one of the following keywords:

never

The client will not request or check any server certificate.

allow

The server certificate is requested. If no certificate is provided, the session proceeds normally. If a bad certificate is provided, it will be ignored and the session proceeds normally.

try

The server certificate is requested. If no certificate is provided, the session proceeds normally. If a bad certificate is provided, the session is immediately terminated.

demand

The server certificate is requested. If no certificate is provided, or a bad certificate is provided, the session is immediately terminated. This is the default setting.

result_attrs (default: None)

The name of the attribute whose value the query should return.

result_attrs = domain
saslmech (default: None)

The mechanism outgoing’s LDAP client should use, when it sasl-binds to the remote LDAP server. Valid options are currently PLAIN or EXTERNAL.

scope (default: None)

The LDAP search scope: sub, base, or one.

usetls (default: No)

A Boolean option to enable or disable usage of TLS when connecting to the LDAP server. Valid options are Yes or No.

SEE ALSO

vrfydmn(8)

BUGS

There are no known bugs so far. Please submit bugs to https://github.com/croessner/vrfydmn/issues.

AUTHOR

Christian Roessner <c@roessner.co> wrote the program.

Patrick Ben Koetter <p@sys4.de> wrote this man page.

RESOURCES

vrfydmn’s home is at https://github.com/croessner/vrfydmn.

COPYING

Copyright (C) 2014-2015 Christian Roessner. Free use of this software is granted under the terms of the GNU General Public License (GPL).


vrfydmn-0.11.0/doc/vrfydmn_ldap.5.txt000066400000000000000000000072431346027776400174420ustar00rootroot00000000000000vrfydmn_ldap(5) =============== :doctype: manpage :man source: vrfydmn_ldap :man version: 0.4 :man manual: vrfydmn Manual NAME ---- vrfydmn_ldap - lookup RFC5322 From:-addresses in an LDAP database. SYNOPSIS -------- *vrfydmn* -l 'ldap:///etc/vrfydmn/ldap.cfg' DESCRIPTION ----------- vrfydmn uses lists and tables to lookup mail related informations. A lookup tables may be an LDAP database. In order to use LDAP lookups, specify a path to a file holding LDAP connection and query configuration. The path must be given when *vrfydmn* is invoked on command line: *vrfydmn* -l 'ldap:///etc/vrfydmn/ldap.cfg' OPTIONS ------- *base* (default: None):: The RFC2253 base DN at which to conduct the search, e.g. base = ou=maildomains,dc=example,dc=com *bindmethod* (default: None):: The method used when binding to the LDAP server. Valid options are simple or sasl. *cacert* (default: None):: Specifies the file that contains certificates for all of the Certificate Authorities the client will recognize. cacert = /etc/ssl/certs/cacerts.pem *cert* (default: None):: Specifies the file that contains the client certificate. cert = /etc/ssl/certs/mail.example.com-crt.pem *filter* (default: None):: The RFC2254 filter used to search the directory, e.g. filter = (domain=*) *host* (default: None):: The name of the host running the LDAP server, e.g. host = 127.0.0.1, ldap.example.com *key* (default: None):: Specifies the file that contains the private key that matches the certificate stored in the cert file. Currently, the private key must not be protected with a password, so it is of critical importance that the key file is protected carefully. key = /etc/ssl/private/mail.example.com-key.pem *reqcert* (default: *demand*):: Specifies what checks to perform on server certificates in a TLS session, if any. The can be specified as one of the following keywords: *never*;; The client will not request or check any server certificate. *allow*;; The server certificate is requested. If no certificate is provided, the session proceeds normally. If a bad certificate is provided, it will be ignored and the session proceeds normally. *try*;; The server certificate is requested. If no certificate is provided, the session proceeds normally. If a bad certificate is provided, the session is immediately terminated. *demand*;; The server certificate is requested. If no certificate is provided, or a bad certificate is provided, the session is immediately terminated. This is the default setting. *result_attrs* (default: None):: The name of the attribute whose value the query should return. result_attrs = domain *saslmech* (default: None):: The mechanism outgoing's LDAP client should use, when it sasl-binds to the remote LDAP server. Valid options are currently PLAIN or EXTERNAL. *scope* (default: None):: The LDAP search scope: sub, base, or one. *usetls* (default: No):: A Boolean option to enable or disable usage of TLS when connecting to the LDAP server. Valid options are Yes or No. SEE ALSO -------- vrfydmn(8) BUGS ---- There are no known bugs so far. Please submit bugs to . AUTHOR ------ Christian Roessner wrote the program. Patrick Ben Koetter wrote this man page. RESOURCES --------- vrfydmn's home is at . COPYING ------- Copyright \(C) 2014-2015 Christian Roessner. Free use of this software is granted under the terms of the GNU General Public License (GPL). // vim: set ft=asciidoc: vrfydmn-0.11.0/vrfydmn000077500000000000000000001073531346027776400147220ustar00rootroot00000000000000#!/usr/bin/python3 """ vrfdmn - a milter service for postfix Copyright (C) 2019 R.N.S. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ import sys import os import pwd import grp import signal import Milter import threading import traceback import argparse import syslog as _syslog try: # noinspection PyUnresolvedReferences import ldap # noinspection PyUnresolvedReferences import ldap.sasl # noinspection PyUnresolvedReferences from ldap.ldapobject import ReconnectLDAPObject except ImportError: no_module_ldap = True else: no_module_ldap = False try: # noinspection PyUnresolvedReferences,PyPep8Naming import MySQLdb as mdb except ImportError: no_module_sql = True else: no_module_sql = False try: # noinspection PyUnresolvedReferences import memcache except ImportError: no_module_memcache = True else: no_module_memcache = False try: # noinspection PyUnresolvedReferences import setproctitle setproctitle.setproctitle("vrfydmn") except ImportError: pass from syslog import * from syslog import syslog as syslog from getopt import getopt from email.header import decode_header from email.utils import parseaddr from threading import Thread from queue import Queue NAME = "vrfydmn" # Defaults BINDADDR = "[::1]" PORT = 30072 MILTERUSER = "milter" MILTERGROUP = "milter" LDAP_TIMEOUT = 60 MAX_SQL_CONNECT_RETRIES = 3 VERSION = "0.11.0" __version__ = VERSION __author__ = "Christian Roessner " __copyright__ = "Copyright (C) 2011 R.N.S." # noinspection PyUnresolvedReferences class Cfg(object): """Helper class for some configuration parameters""" action = Milter.REJECT hold = False workerQueue = Queue() ldap_con = None sql_con = None memcached_con = None # noinspection PyIncorrectDocstring,PyUnresolvedReferences class VrfyDmnMilter(Milter.Base): """ Milter that comares the domain component of an email address read from the From:-header and compares it to a list of Postfix domains. If a match is found, mail is allowed to pass, else the mail is rejected. """ def __init__(self): self.__id = Milter.uniqueID() self.__ipname = None self.__ip = None self.__port = None self.__reject = False self.__dryrun_reject = False self.__email = "" self.__mail_from = "" self.__original_from = "" self.__add_header = True self.__has_sender = False self.__header = None # noinspection PyUnusedLocal @Milter.noreply def connect(self, ipname, family, hostaddr): """connect callback """ self.__ip = hostaddr[0] self.__ipname = ipname self.__port = hostaddr[1] if config.debug: print("id=%i connect from %s[%s]:%s" % (self.__id, self.__ipname, self.__ip, self.__port)) return Milter.CONTINUE # noinspection PyUnusedLocal @Milter.noreply def envfrom(self, mailfrom, *dummy): """Callback that is called when MAIL FROM: is recognized. This also is the most earliest time, where we can collect nearly all connection specific information. """ self.__mail_from = parseaddr(mailfrom)[1] self.__header = dict() return Milter.CONTINUE @Milter.noreply def header(self, name, hval): """header callback gets called for each header """ if config.debug: print("%s: %s" % (name, hval)) if name.lower() == "from": self.__original_from = hval self.__header[name.lower()] = hval # Mailinglists... if name.lower() == "sender": self.__header[name.lower()] = hval if name.lower() == "reply-to": self.__add_header = False return Milter.CONTINUE def eoh(self): """eoh - end of header. Gets called after all headers have been proccessed""" # We must check for a Sender header field if "sender" in self.__header: hval = "sender" else: hval = "from" # Extract email from most right tuple decoded_from = decode_header(self.__header[hval])[-1] # Try to find the email address and to cut off garbage decoded_from_parts = decoded_from[0].split() email = "" for component in iter(decoded_from_parts): # NOTE: Asume the last occurence of an "@" represents the # email address. # NOTE: RFC5322 allows a mailbox-list for the From field! # Currently this fact is ignored! if "@" in component: email = component email = parseaddr(email)[1] self.__email = email # From: <> found, skip this mail if email == "": if config.debug: print("id=%i %s return_value=skip" % (self.__id, self.getsymval('i'))) syslog(LOG_INFO, "%s: return_value=skip" % self.getsymval('i')) return Milter.CONTINUE # Cut local part from email _from_domain = email.split("@") if len(_from_domain) == 1: if config.debug: print("id=%i %s unhandled=<%s> return_value=skip" % (self.__id, self.getsymval('i'), email)) syslog(LOG_INFO, "%s: unhandled=<%s> return_value=skip" % ( self.getsymval('i'), email)) return Milter.CONTINUE else: from_domain = _from_domain[1] # Remember, if a domain was found found = False if config.fix: self.__dryrun_reject = True elif config.opposite: self.__reject = False else: self.__reject = True if config.ldap: response = Queue() Cfg.workerQueue.put((response, Cfg.ldap_con.query_ldap, # func (from_domain if not config.email else email,))) # *args result = response.get() if result is True or result is None: found = True if config.fix: self.__dryrun_reject = False elif config.opposite: self.__reject = True else: self.__reject = False if not found and config.sql: response = Queue() Cfg.workerQueue.put((response, Cfg.sql_con.query_sql, # func (from_domain if not config.email else email,))) # *args result = response.get() if result is True or result is None: found = True if config.fix: self.__dryrun_reject = False elif config.opposite: self.__reject = True else: self.__reject = False if not found and config.file: if PfDomains.domains: # Honor sub domains for key_domain in iter(PfDomains.domains): if key_domain in from_domain: if config.fix: self.__dryrun_reject = False elif config.opposite: self.__reject = True else: self.__reject = False break result = "continue" if self.__reject: if Cfg.action == Milter.CONTINUE: if Cfg.hold: result = "quarantine" else: result = "continue" elif Cfg.action == Milter.REJECT: result = "reject" if config.debug: print("id=%i %s header_from=<%s> mail_from=<%s> return_value=%s" % (self.__id, self.getsymval('i'), email, self.__mail_from, result)) syslog(LOG_INFO, "%s: header_from=<%s> mail_from=<%s> return_value=%s" % (self.getsymval('i'), email, self.__mail_from, result)) if self.__reject: if Cfg.action == Milter.REJECT: self.setreply("554", xcode="5.7.0", msg="Reject Queue-ID: %s - " "RFC5322 from address: <%s>" % (self.getsymval('i'), self.__email)) return Milter.REJECT return Milter.CONTINUE def eom(self): """eom - end of message. If --fix was given at the command line, we replace the broken From:-header with the MAIL FROM value""" if self.__reject and Cfg.hold: self.quarantine("%s: header_from=<%s> mail_from=<%s>" % (self.getsymval("i"), self.__email, self.__mail_from)) if self.__dryrun_reject and \ self.__email != self.__mail_from: self.chgheader("From", 0, "<%s>" % self.__mail_from) if config.debug: print("id=%i %s header_from=<%s> mail_from=<%s>" % (self.__id, self.getsymval('i'), self.__email, self.__mail_from)) syslog(LOG_INFO, "%s: header_from=<%s> mail_from=<%s>" % (self.getsymval('i'), self.__email, self.__mail_from)) if self.__add_header: self.addheader("Reply-To", self.__original_from) decoded_from = decode_header(self.__original_from) new_from = " ".join([s for s, _ in decoded_from]) if config.debug: print("id=%i %s reply_to: %s" % (self.__id, self.getsymval('i'), new_from)) syslog(LOG_INFO, "%s: reply_to: %s" % (self.getsymval('i'), new_from)) return Milter.CONTINUE def close(self): """close callback""" if config.debug: print("id=%i disconnect from %s[%s]:%s" % (self.__id, self.__ipname, self.__ip, self.__port)) return Milter.CONTINUE # noinspection PyMethodParameters,PyShadowingNames class MetaPfDomains(type): """ PfDomains is a central store for all postfix domains that the milter recognizes as trusted domains """ _domains = list() __lock = threading.Lock() def _set_postfix_domains(meta, pf_file): generated_list = list() try: with open(pf_file) as fd: while True: raw_line = fd.readline() if raw_line == "": break line = raw_line.strip() # Skip comments and empty lines if line.startswith("#"): continue if line == "": continue key_domain = line.split()[0] generated_list.append(key_domain) # Make operation thread safe with MetaPfDomains.__lock: meta._domains = generated_list except OSError as e: # Unable to read Postfix domains! if config.debug: print('Unable to read %s: %s' % (pf_file, e), file=sys.stderr) syslog(LOG_ERR, 'Unable to read %s: %s' % (pf_file, e)) def _get_postfix_domains(meta): return meta._domains domains = property(_get_postfix_domains, _set_postfix_domains) class PfDomains(object): """We use a meta class, as the "domains" variable shall not be world readable and writeable. This is a class with classmethods and properties """ __metaclass__ = MetaPfDomains # noinspection PyShadowingNames class Domains(object): """ Base mixin class for all kinds of lists of domains. Each database driver must derive from this base class. The constructor requires at least a configuration file, which is directly parsed and evaluated. The result is a dictionary that is stored internally. Each driver itself knows how to deal with the values found. As the base class implements an iterator and a representation method, the values being processed by each driver are returned as a list of domains. We do not keep database connections open, as a list of domains normally does not float too often. Additionally the amount of domains will never be too large, so we can read all data at once and keep it in memory. """ def __init__(self, cffile): self._filecontent = {} self._cf_read_err = False try: with open(cffile, "r") as fd: while True: line = fd.readline() if line == "": break if line.lstrip().startswith("#"): continue if line.strip() == "": continue if line.count('=') >= 1: idx = line.find('=') k = line[0:idx].strip().lower() v = line[idx+1:].strip() else: k = line.strip().lower() v = [] if k != "": self._filecontent[k] = v except Exception as e: # Unable to read config file if config.debug: print('Unable to read %s: %s' % (cffile, e), file=sys.stderr) syslog(LOG_ERR, 'Unable to read %s: %s' % (cffile, e)) self._cf_read_err = True # noinspection PyShadowingNames class LDAPDomains(Domains): """ The LDAPDomains driver connects to a list of LDAP servers. It supports simple and SASL authentication, as well as TLS connections. """ def __init__(self, cffile): Domains.__init__(self, cffile) self.__con = None if self._cf_read_err: return self.__host = ["ldap://127.0.0.1/"] self.__base = "" self.__bindmethod = "simple" self.__binddn = None self.__bindpw = None self.__saslmech = None self.__authz_id = "" self.__filter = "(objectClass=*)" self.__result_attrs = [] self.__scope = "sub" self.__usetls = "no" self.__cipher = "TLSv1" self.__reqcert = "never" self.__cert = None self.__key = None self.__cacert = None for k, v in self._filecontent.items(): if k == "host": self.__host = v.split(',') for idx, server in enumerate(self.__host): self.__host[idx] = server.strip() elif k == "base": self.__base = v elif k == "bindmethod": self.__bindmethod = v elif k == "binddn": self.__binddn = v elif k == "bindpw": self.__bindpw = v elif k == "saslmech": self.__saslmech = v elif k == "authzid": self.__authz_id = v elif k == "filter": self.__filter = v elif k == "result_attrs": self.__result_attrs = v.split(',') for idx, attr in enumerate(self.__result_attrs): self.__result_attrs[idx] = attr.strip() elif k == "scope": self.__scope = v elif k == "usetls": self.__usetls = v elif k == "cipher": self.__cipher = v elif k == "reqcert": self.__reqcert = v elif k == "cert": self.__cert = v elif k == "key": self.__key = v elif k == "cacert": self.__cacert = v else: raise Exception("Unsupported parameter %s: %s" % (k, v)) tls = False sasl = False # Do we connect with TLS? reqcert = None if self.__usetls.lower() in ("yes", "true", "1"): if self.__reqcert in ("never", "allow", "try", "demand"): if self.__reqcert == "never": reqcert = ldap.OPT_X_TLS_NEVER elif self.__reqcert == "allow": reqcert = ldap.OPT_X_TLS_ALLOW elif self.__reqcert == "try": reqcert = ldap.OPT_X_TLS_TRY elif self.__reqcert == "demand": reqcert = ldap.OPT_X_TLS_DEMAND else: raise Exception("Unsupported TLS reqcert Option %s" % self.__reqcert) ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, reqcert) ldap.set_option(ldap.OPT_X_TLS_CIPHER_SUITE, self.__cipher) if self.__cacert is not None: ldap.set_option(ldap.OPT_X_TLS_CACERTFILE, self.__cacert) if self.__cert is not None: ldap.set_option(ldap.OPT_X_TLS_CERTFILE, self.__cert) if self.__key is not None: ldap.set_option(ldap.OPT_X_TLS_KEYFILE, self.__key) tls = True # Are we SASL binding to our servers? auth_tokens = None if self.__bindmethod == "sasl": if self.__saslmech.lower() == "digest-md5": auth_tokens = ldap.sasl.digest_md5(self.__binddn, self.__bindpw) elif self.__saslmech.lower() == "cram-md5": auth_tokens = ldap.sasl.cram_md5(self.__binddn, self.__bindpw) elif self.__saslmech.lower() == "external": auth_tokens = ldap.sasl.external(self.__authz_id) elif self.__saslmech.lower() == "gssapi": auth_tokens = ldap.sasl.gssapi(self.__authz_id) else: raise Exception("Unsupported SASL mech %s" % self.__saslmech) sasl = True con = None for server in iter(self.__host): try: con = ReconnectLDAPObject(server, retry_max=1000000) if tls: con.start_tls_s() if sasl: con.sasl_interactive_bind_s("", auth_tokens) else: con.simple_bind_s(self.__binddn, self.__bindpw) except Exception as ldap_err: if config.debug: print("Some LDAP error happened: {0}".format(ldap_err)) traceback.print_exc() continue break self.__con = con # This method is synchronized with Queue() def query_ldap(self, from_domain): if self.__con is None: return if config.memcached: result = Cfg.memcached_con.get(from_domain) if result is not None: result = bool(result) if result: text = "continue" else: text = "reject" if config.debug: print("cached_result: %s=%s" % (from_domain, text)) syslog(LOG_INFO, "cached_result: %s=%s" % (from_domain, text)) return result if self.__scope in ("sub", "subtree"): scope = ldap.SCOPE_SUBTREE elif self.__scope in ("one", "onelevel"): scope = ldap.SCOPE_ONELEVEL elif self.__scope in ("base", "exact"): scope = ldap.SCOPE_BASE else: raise Exception("Unsupported LDAP scope %s" % self.__scope) ldap_filter = "" if "%s" in self.__filter.lower(): filter_parts = self.__filter.split("%s") ldap_filter = from_domain.join(filter_parts) if config.debug: print("====> LDAP-filter: %s" % ldap_filter) result = self.__con.search_st(self.__base, scope, ldap_filter, self.__result_attrs, timeout=LDAP_TIMEOUT) # Temporarily store the result tmp_lst = list() # result - list of tuples for row in iter(result): for res_attrs in row[1].values()[0]: tmp_lst.append(res_attrs) if config.debug: print("----> res_attrs = %s" % res_attrs) if tmp_lst: if config.memcached: Cfg.memcached_con.set(from_domain, True, time=3600) return True else: if config.memcached: Cfg.memcached_con.set(from_domain, False, time=60) return False # noinspection PyShadowingNames class SQLDomains(Domains): """SQL class. Currently only MySQL ist supported """ def __init__(self, cffile): Domains.__init__(self, cffile) self.__con = None if self._cf_read_err: return self.__host = "localhost" self.__dbname = None self.__dbuser = None self.__dbpass = None self.__query = None for k, v in self._filecontent.items(): if k == "host": self.__host = v elif k == "port": self.__port = int(v) elif k == "dbuser": self.__dbuser = v elif k == "dbpass": self.__dbpass = v elif k == "dbname": self.__dbname = v elif k == "query": self.__query = v # Initially connect, retry on errors; see below self.connect() def connect(self): con = None try: con = mdb.connect(self.__host, self.__dbuser, self.__dbpass, self.__dbname) except Exception as m_err: if config.debug: print("Some MySQL/MariaDB error happened: {0}".format(m_err)) traceback.print_exc() self.__con = con def query_sql(self, from_domain): if self.__con is None: return None if self.__query is None: return None if config.memcached: result = Cfg.memcached_con.get(from_domain) if result is not None: result = bool(result) if result: text = "continue" else: text = "reject" if config.debug: print("cached_result: %s=%s" % (from_domain, text)) syslog(LOG_INFO, "cached_result: %s=%s" % (from_domain, text)) return result for retries in xrange(MAX_SQL_CONNECT_RETRIES): try: cur = self.__con.cursor() cur.execute(self.__query % from_domain) break except Exception as e: if e[0] == 2006: # Lost connection, try reconnect syslog(LOG_ERR, "SQL connection lost ({}/{}): code={} msg={}".format( retries+1, MAX_SQL_CONNECT_RETRIES, e[0], e[1])) self.connect() else: syslog(LOG_ERR, "SQL error: %s" % str(e)) return None else: return None domains = cur.fetchall() if config.debug: print("SQL result for %s: %s" % (from_domain, str(domains))) # Domain was found on SQL server, count > 0 if len(domains) > 0: if config.memcached: Cfg.memcached_con.set(from_domain, True, time=3600) return True # ... not found else: if config.memcached: Cfg.memcached_con.set(from_domain, False, time=3600) return False # noinspection PyUnresolvedReferences def runner(): """Starts the milter loop""" Milter.factory = VrfyDmnMilter flags = Milter.CHGHDRS + Milter.ADDHDRS + Milter.QUARANTINE Milter.set_flags(flags) Milter.runmilter(NAME, config.socket, timeout=300) # noinspection PyShadowingNames def db_runner(): """Implements a bi-directional queue that allows all milter threads to communicate with one single thread that does all DB operations. """ db_running = False if config.memcached: Cfg.memcached_con = memcache.Client([config.memcached], debug=0) if config.ldap: Cfg.ldap_con = LDAPDomains(config.ldap) if Cfg.ldap_con is not None: db_running = True if config.sql: Cfg.sql_con = SQLDomains(config.sql) if Cfg.sql_con is not None: db_running = True if db_running: while True: req = Cfg.workerQueue.get() if not req: # Nothing more to process; skip continue # Queue, func, *args response, func, args = req try: result = func(*args) except Exception as gen_err: print("Oops! Some error happened: {0}".format(gen_err)) traceback.print_exc() result = None response.put(result) # noinspection PyProtectedMember,PyUnresolvedReferences if __name__ == "__main__": parser = argparse.ArgumentParser(epilog="vrfydmn - verify domain milter") parser.add_argument("--socket", "-s", type=str, default="inet6:{0}@{1}".format(PORT, BINDADDR), help="IPv4, IPv6 or unix socket (default: %(default)s)") parser.add_argument("--syslog_name", "-n", type=str, default=NAME, help="Syslog name (default: %(default)s)") parser.add_argument("--syslog_facility", "-N", type=str, default="mail", help="Syslog facility (default: %(default)s)") parser.add_argument("--user", "-u", type=str, default=MILTERUSER, help="Run milter as this user (default: %(default)s)") parser.add_argument("--group", "-g", type=str, default=MILTERGROUP, help="Run milter with this group " "(default: %(default)s)") parser.add_argument("--pid", "-p", type=str, default=None, help="Path for an optional PID file") parser.add_argument("--debug", "-d", default=False, action="store_true", help="Run in foreground with debugging turned on") parser.add_argument("--file", "-f", type=str, default=None, help="Postfix domains map file") parser.add_argument("--ldap", "-l", type=str, default=None, help="Config file for a LDAP connection") parser.add_argument("--sql", "-S", type=str, default=None, help="Config file for a SQL connection (Currently " "MySQL only)") parser.add_argument("--memcached", "-m", type=str, default=None, help="Memcache socket") parser.add_argument("--fix", "-F", default=False, action="store_true", help="Replace broken From:-header with envelope sender") parser.add_argument("--opposite", "-O", default=False, action="store_true", help="Reject mail, if a sender uses our domain") parser.add_argument("--action", "-a", default="reject", choices=["accept", "reject", "quarantine"], help="If test fails: accept, reject or quarantine. " "The --fix option implies 'accept' " "(default: %(default)s)") parser.add_argument("--email", "-e", default=False, action="store_true", help="Use email as search key, not only the domain") config = parser.parse_args() if config.file: if not os.path.exists(config.file): print('No such file: %s' % config.file, file=sys.stderr) sys.exit(os.EX_USAGE) # Read list of domains PfDomains.domains = config.file if config.ldap: if no_module_ldap: config.ldap = None print("Missing python module ldap!", file=sys.stderr) if config.sql: if no_module_sql: config.sql = None print("Missing python module for SQL!", file=sys.stderr) if not (config.file or config.ldap or config.sql): print("You must specify at least one of --file, --ldap or --sql", file=sys.stderr) sys.exit(1) if config.memcached: if no_module_memcache: config.memcached = None print("Missing python module memcache!", file=sys.stderr) if config.action: if config.action == "accept": Cfg.action = Milter.CONTINUE elif config.action == "reject": Cfg.action = Milter.REJECT elif config.action == "quarantine": Cfg.action = Milter.CONTINUE Cfg.hold = True if config.fix and config.opposite: print("Do not use --fix and --opposite together", file=sys.stderr) sys.exit(os.EX_USAGE) if config.fix: Cfg.action = Milter.CONTINUE Cfg.hold = False facility_name = "LOG_" + config.syslog_facility.upper() if config.debug: print("Log facility_name: {}".format(facility_name)) facility = getattr(_syslog, facility_name, LOG_MAIL) if config.debug: print("Log facility: {}".format(facility)) openlog(config.syslog_name, LOG_PID, facility) try: uid = pwd.getpwnam(config.user)[2] gid = grp.getgrnam(config.group)[2] except KeyError as e: print("User or group not known: {0}".format(e.message), file=sys.stderr) sys.exit(1) try: # Needs Python >=2.7 os.initgroups(config.user, gid) except Exception as _: pass try: os.setgid(gid) except OSError as e: print('Could not set effective group id: %s' % e, file=sys.stderr) sys.exit(1) try: os.setuid(uid) except OSError as e: print('Could not set effective user id: %s' % e, file=sys.stderr) sys.exit(1) if config.debug: print("Switched user to %s, group to %s" % (uid, gid)) print("Staying in foreground...") else: try: pid = os.fork() except OSError as e: print("First fork failed: (%d) %s" % (e.errno, e.strerror), file=sys.stderr) sys.exit(1) if pid == 0: os.setsid() try: pid = os.fork() except OSError as e: print("Second fork failed: (%d) %s" % (e.errno, e.strerror), file=sys.stderr) sys.exit(1) if pid == 0: os.chdir("/") os.umask(0) else: # noinspection PyProtectedMember os._exit(0) else: # noinspection PyProtectedMember os._exit(0) # In daemon mode, we redirect stdin, stdout and stderr to /dev/null sys.stdin = open(os.devnull, "r").fileno() sys.stdout = open(os.devnull, "w").fileno() sys.stderr = open(os.devnull, "w").fileno() try: if config.pid: with open(config.pid, "w") as fd: fd.write(str(os.getpid())) except IOError as e: if config.debug: print("Cannot create PID file: (%d) %s" % (e.errno, e.strerror), file=sys.stderr) def finish(signum, frame): _ = frame syslog(LOG_NOTICE, "%s-%s milter shutdown. Caught signal %d" % (NAME, VERSION, signum)) def reload_postfix_domains(signum, frame): _ = frame if config.debug: print("%s-%s milter reload Postfix domains. Caught signal %d" % (NAME, VERSION, signum)) syslog(LOG_NOTICE, "%s-%s milter reload Postfix domains. Caught signal %d" % (NAME, VERSION, signum)) if config.file: PfDomains.domains = config.file # Go back to sleep signal.pause() def print_postfix_domains(signum, frame): _ = signum, frame if config.file: # noinspection PyTypeChecker all_domains = ", ".join(PfDomains.domains) # max syslog line length offset = 1536 str_sgmts = [] max_len = len(all_domains) d = "..." for i in xrange(0, max_len, offset): if i == 0: str_sgmts.append(all_domains[i:i+offset].strip() + d) if i > 0 and i+offset < max_len: str_sgmts.append(d + all_domains[i:i+offset].strip() + d) if i > 0 and i+offset >= max_len: str_sgmts.append(d + all_domains[i:i+offset].strip()) for part in iter(str_sgmts): if config.debug: print("%s-%s milter Postfix domains: [%s]" % (NAME, VERSION, part)) syslog(LOG_NOTICE, "%s-%s milter Postfix domains: [%s]" % (NAME, VERSION, part)) # Go back to sleep signal.pause() signal.signal(signal.SIGINT, finish) signal.signal(signal.SIGQUIT, finish) signal.signal(signal.SIGTERM, finish) signal.signal(signal.SIGHUP, reload_postfix_domains) signal.signal(signal.SIGUSR1, print_postfix_domains) signal.siginterrupt(signal.SIGHUP, False) signal.siginterrupt(signal.SIGUSR1, False) syslog(LOG_NOTICE, "%s-%s milter startup" % (NAME, VERSION)) milter_t = Thread(target=runner) milter_t.daemon = True milter_t.start() # Worker thread for all kinds of databases db_runner_t = Thread(target=db_runner) db_runner_t.daemon = True db_runner_t.start() # Waiting for SIGNAL to terminate process signal.pause() try: if config.pid and os.path.exists(config.pid): os.unlink(config.pid) except IOError as e: if config.debug: print("Cannot remove PID file: (%d) %s" % (e.errno, e.strerror), file=sys.stderr) sys.exit(1) sys.exit(0) # vim: expandtab ts=4 sw=4 vrfydmn-0.11.0/vrfydmn-generate-report.sh000077500000000000000000000013461346027776400204270ustar00rootroot00000000000000#!/bin/bash #set -x export PATH="/bin:/sbin:/usr/bin:/usr/sbin" MAILFROM="postmaster@example.com" DISPLAYNAME="Postmaster" RCPTTO="operator@yoursite.tld" #------------- CONFIG=${1:-"/etc/postfix"} QUEUE=$(postconf -h -c $CONFIG queue_directory) TIMESTAMP=$(date +"%Y-%m-%d - %H:%M") queue_empty() { if [[ -z "$(find $QUEUE/hold -type f)" ]]; then return 0 else return 1 fi } send_report() { if ! queue_empty; then ( echo "Envelope-sender address:" echo "------------------------" postqueue -c $CONFIG -p \ | awk '/^[a-zA-Z0-9]+\!/ { print $NF; }' \ | sort \ | uniq ) | mail -s "Postfix $CONFIG hold queue ($TIMESTAMP)" $RCPTTO \ -- -f $MAILFROM -F $DISPLAYNAME fi } send_report exit 0 # vim: ts=4 sw=4 vrfydmn-0.11.0/vrfydmn.init000077500000000000000000000024371346027776400156610ustar00rootroot00000000000000#! /bin/bash ### BEGIN INIT INFO # Provides: vrfydmn # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start vrfydmn daemon # Description: Start up vrfydmn, a anti-spoofing milter for Postfix ### END INIT INFO . /lib/lsb/init-functions NAME=vrfydmn COMMAND="/usr/local/sbin/${NAME}" PIDFILE="/var/run/vrfydmn/vrfydmn.pid" start_daemon() { mkdir -p /var/run/${NAME} chown milter:milter /var/run/${NAME} echo "Starting ${NAME}" start-stop-daemon --start --pidfile "${PIDFILE}" \ --exec ${COMMAND} -- -p "${PIDFILE}" -f /etc/postfix/relay_domains return $? } stop_daemon() { echo "Stopping ${NAME}" killproc -p ${PIDFILE} ${COMMAND} return $? } case "$1" in start) start_daemon exit $? ;; stop) stop_daemon exit $? ;; restart) $0 stop && $0 start ;; reload) echo "${NAME}: Reloading Postfix domain maps" kill -SIGHUP $(cat ${PIDFILE}) ;; status) status_of_proc -p ${PIDFILE} vrfydmn vrfydmn && exit 0 || exit $? ;; *) echo "Usage: ${NAME} {start|stop|restart|reload|status}" >&2 ;; esac exit 0 vrfydmn-0.11.0/vrfydmn.openrc000077500000000000000000000013361346027776400162010ustar00rootroot00000000000000#!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ command="/usr/local/sbin/vrfydmn" PIDDIR="/run/${SVCNAME}" PIDFILE="${PIDDIR}/${SVCNAME}.pid" depend() { use mta logger net } start() { if [ ! -d "${PIDDIR}" ] ; then checkpath -q -d -o milter:milter -m 0755 "${PIDDIR}" || return 1 fi ebegin "Starting ${SVCNAME}" start-stop-daemon --start --pidfile "${PIDFILE}" \ --exec ${command} -- -p "${PIDFILE}" ${OPTIONS} eend $? } stop() { ebegin "Stopping ${SVCNAME}" start-stop-daemon --stop --pidfile "${PIDFILE}" \ --retry 30 \ --exec ${command} eend $? }