diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index e9a977f9..00000000 --- a/AUTHORS.md +++ /dev/null @@ -1,43 +0,0 @@ -Cryptsetup was originally written in 2004 by Jana Saout - -LUKS extensions are written in 2006 by Clemens Fruhwirth - -Tomb is written and maintained since 2007 by [Denis "Jaromil" Roio](https://jaromil.dyne.org) - -Tomb includes code and advices by Anathema, Boyska, Hellekin O. Wolf, -Daniel Rodriguez, Parazyd, Alexandre Pujol, AitorATuin, Narrat, Artur -Malimonov and Chris Vogel. - -The 'gtomb' GUI based on Zenity is written by Parazyd and Daniel Dias Rodrigues. - -The Qt5 desktop tray GUI is written by Gianluca Montecchi. - -Python Tomb wrappers are contributed by Reiven and Boyska. - -The Docker Tomb wrapper is contributed by Greg Tczap and Jens Rischbieth. - -Artwork is contributed by Jordi aka Mon Mort and Logan VanCuren. - -Gettext internationalization and Spanish translation is contributed by -Daniel Rodriguez and Francisco Serrador. French translation by -Hellekin and Roy Lockhart, Russian translation by fsLeg and AHOHNMYC, -German translation by Jerry Polfer, Italian translation by -Massimiliano Augello and Swedish translation by PLJ / Kosovoper, -general fixes contributed by Daniel Dias Rodrigues. - -Testing, reviews and documentation contributed by Dreamer, Vlax, -Shining the Translucent, Mancausoft, Asbesto Molesto, Nignux, TheJH, -The Grugq, Reiven, GDrooid, Alphazo, Brian May, fsLeg, Narrat, Jerry -Polfer, Jim Turner, Maxime Arthaud, RobertMX, mhogomchungu Mandeep -Bhutani, Emil Lundberg, Joel Montes de Oca, Armin Mesbah, Arusekk, -Stephan Schindel, Asbjørn Apeland, Victor Calvert, bjonnh, SargoDevel, -AitorATuin, Alexis Danizan, Sven Geuer, Greg Tczap, Aaron Janse, Mark -Mykkanen, Alexis Danizan, Steve Litt, James R, Matthieu Crapet, Selene -ToyKeeper, Valentin Heidelberg and... the Linux Action Show! - -Tomb includes an implementation of the "Password-Based Key Derivation -Function v2" based on GCrypt and written by Anthony Thyssen, with -fixes contributed by AitorATuin. - -Some of the Tomb developers can be contacted via [GitHub discussions](https://github.com/dyne/Tomb/discussions) -or over Telegram via the [Dyne.org Chat Channel](https://t.me/dyne_chat). diff --git a/COPYING b/COPYING deleted file mode 100644 index 94a9ed02..00000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/ChangeLog.md b/ChangeLog.md deleted file mode 100644 index 44d4f156..00000000 --- a/ChangeLog.md +++ /dev/null @@ -1,348 +0,0 @@ -# Tomb ChangeLog - -## 2.10 -### Sep 2023 - -This release adds optional support for Argon2 KDF brute-force -protection and introduces support for doas as an alternative to sudo -for privilege escalation. It also improves support for BTRFS formatted -Tombs, adds zram detection as swap memory, updates documentation and -translations and cleans up the script code. - -## 2.9 -### Jan 2021 - -This release fixes all bugs introduced by the unfortunate 2.8 release -series in 2020 as well introduces support for BTRFS formatted -Tombs. The fixes are for password insertion to work on all desktops, -as well the fix to a regression when using old Zsh versions. The new -feature is activated by the '--filesystem' flag on 'lock' commands. -It only supports BTRFS as internal filesystem of a Tomb instead of the -default EXT4; resizing works as well to create and send or receive -subvolumes and snapshots inside a Tomb. There are also some cleanups, -small error handling improvements and no more need for suid actions by -'forge' and 'dig' commands. - - - -## 2.8.1 -### Nov 2020 - -This is a minor bugfix release. It fixes two bugs introduced by the -previous release: the release of loopback devices and a typo affecting -password insertion in text-only mode. It also provides a cosmetic fix -for the output of 'tomb list' that now displays correct sizes. At -last, the docker wrapper has been included in extras/ to be shipped in -Tomb. The span of CVE-2020-28638 has been assessed with more precision -and KNOWN_BUGS updated accordingly. - -## 2.8 -### Nov 2020 - -This new release updates the documentation, improves usability and -fixes two bugs. A bug has been found (CVE-2020-28638) to corrupt -passwords entered using pinentry-curses on desktops using a X11 -DISPLAY, the documentation in KNOWN_BUGS outlines how to fix -regressions. Another bug has been fixed to prevent mounting tombs that -are already opened, a situation leading to potential data loss. -Changes mentioned lead to a small internal refactoring and cleanup, -leading to a change in the way volumes appear in /dev/mapper. Along -the usability improvements are the support of GNUPGHOME environment -variable to support non-standard GnuPG home locations as well updated -translations and the fact that debug messages are now written to -stderr, making it easier to parse stdout. - -## 2.7 -### Oct 2019 - -Fixed getent parsing of passwd and notation of conditionals -normalised. A few other minor fixes and documentation improvements. - - -## 2.6 -### May 2019 - -This release adds new features and provides an important fix for usage -of Tomb with cryptsetup 2.1 and future versions; it also fixes a -whitespace bug in KDF passwords, all fixes are documented in -KNOWN_BUGS. A notable new feature is the libsphinx integration for -password-authenticated key agreement (PAKE). Another feature is the -integration of cloakify to support new cloak/uncloak commands that -hide keys inside long text files. Also support for gpg sub-keys has -been added and overall gpg asymmetric key protection is improved. - - - -## 2.5 -### January 2018 - -This is mostly a bugfix release, including two internal -refactorings. An important change is the re-introduction (since v2.3) -of ownership change of all files inside tombs, to facilitate single -user usage, which is now default and can be prevented using the '-p' -flag on 'open' commands. The first refactoring concerns the test -units, now using the 'sharness' framework. The other refactoring -concerns 'post-hooks' now renamed to 'exec-hooks' and launched on -'open' and 'close' commands with a defined set of arguments. Another -internal change concerns the use of 'findmnt' instead of parsing the -output of 'mount -l', which grants compatibility with more recent -versions of util-linux. A fix was made to the 'slam' command for a -better process detection and the introduction of a new 'ps' command to -just list processes using tombs. Another fix was made to support tomb -hidden filenames (starting with a dot) without any extension. Some -more minor fixes were made to messaging and translations, plus all the -documentation is updated. - - -## 2.4 -### April 2017 - -This release introduces a major new feature with support for -asymmetric encryption of Tomb keys using public/private GPG key -pairs. It is now possible to protect a Tomb key using a GPG key (which -can also be password-less for automations) as well encrypt a Tomb key -for multiple recipients (list of GPG ids). Other improvements include: -a fix to the 'slam' command with better detection of running programs -using 'lsof' (new optional dependency); a fix to 'forge' key creation -to really use 512 bits long keys to really trigger usage of AES256; -correct support for opening tombs in read-only mode; update of the -Tomber python wrapper in extras. Documentation has been updated. - -## 2.3 -### January 2017 - -Fix to bug occurring when using ZSh version 5.3 or higher. Fix to -inclusion of final newline in keys generated with 2.2, only affecting -third-party software. Removed chmod/chown of tombs when open. Enhanced -continuous integration script with regression tests with usage of old -stable versions of Tomb and shellcheck linting. Improved parser and -post-hooks to avoid usage of external binaries (grep and cat) also -improving security when decrypting keys. Fix for clean execution via -sudo nopasswd. Updated extras/gtomb to latest stable version. Various -documentation updates about kdf, using images as keys, deniability and -gpg-agent usage. New experimental port to Android platforms in extras. - -## 2.2 -### December 2015 - -New Qt5 desktop tray in extras/qt-tray. -New Zenity based Gtk interface in extras/gtomb (experimental). -Better resizing procedure recovers from failure without starting over -with a new dig. Fixes for correct handling of bind-hooks mountpoints -containing whitespaces, implying a refactoring of how the mtab is -parsed, along with workaround for Debian bugs. Updated all strings to -report MiB sizes. Fix to correctly show last time opened. Fix to EUID -detection and to installed manpage permissions. - -## 2.1.1 -### August 2015 - -Added translations to Italian and Swedish. -Minor documentation updates. - - -## 2.1 -### July 2015 - -All users updating should close their tombs first, then update and -reopen them with this new version. However, lacking to do so will not -cause any data loss, just an unclean umount of tombs. - -This new stable release including several bugfixes to smooth the user -experience in various situations. Documentation is reviewed and -extended and translations are updated. - -More in detail, fixes to: mountpoint removal, language localization, -gtk-2 pinentry themeing, udisk2 compatibility (/run/media/$USER -mountpoint support), handling of key failures, kdf documentation, -swish-e file contents search and encrypted swap detection. - -Deniability is improved by allowing any filename to be used for tombs -(also without .tomb extension). Code has been overall cleaned up. - - -## 2.0.1 -### December 2014 - -Fix for usage with GnuPG 1.4.11, a problem affecting long term -GNU/Linux distribution releases like Ubuntu 12.04 and Mint 13. -Minor messaging fixes. - -## 2.0 -### November 2014 - -Tomb goes international: now translated to Russian, French, Spanish -and German. - -The usability has improved: steganographed images can now be used -directly as keys using `-k`. Tomb now works also across ssh -connections: it is possible to pipe cleartext secrets from stdin using -`-k cleartext` but that requires the --unsafe flag. - -The security is also improved by avoiding most uses of temporary -files. The privilege escalation model has been simplified and sudo is -called only when needed. All code has been refactored for readability -and integration with zsh features. Signal handlers are now in place, -global arrays are used to keep track of temp files. Namespace has been -revisioned and corrected, described in [HACKING](docs/HACKING.txt). - -## 1.5.3 -### June 2014 - -Various usability fixes and documentation updates. Password changing -and key changing procedures have been refactored and dev-mode -operation from scripts has been tested against a few new wrappers -being developed. A strings file is made available for translators. - -## 1.5.2 -### February 2014 - -Removed automatic guessing of key file besides tomb to encourage -users to keep tomb and key separated, but also to simplify the -code in key retrieval and avoid a bug occurring in the previous -version. - -## 1.5.1 -### February 2014 - -Fix to stdin piping of keys, which were not correctly processed -nor were deleted from volatile memory (tmpfs). - -Version is now updated accordingly. - -## 1.5 -### January 2014 - -Minor bugfixes to documentation, error handling, support for -multiple and encrypted swap partitions and qr code engraving. - -This release also includes some minor code refactoring of -load_key() and loop mount checks. Also the tray app is updated -to gtk-3 and works simply with a tomb name as argument. - -Documentation was updated accordingly. - -## 1.4 -### June 2013 - -This release fixes an important bug affecting Tomb 1.3.* which -breaks backward compatibility with older tombs and invalidates -keys created using 1.3 or 1.3.1. For more information about it -read the file KNOWN_BUGS. - -New features are also included: -indexing and search of file contents, engraving of keys into paper -printable QRCodes for backup purposes and improvements in key -encryption. A setkey command is added to change the key file that -is locking a Tomb. - -This release restores backward compatibility -with tombs created before the 1.3 release series. - -## 1.3.1 (DEPRECATED, see [KNOWN_BUGS](KNOWN_BUGS.md)) -### June 2013 - -Major bugfixes following the recent refactoring. - -This release fixes various advanced commands as search/index, KDF key -protection against dictionary attacks and steganographic hiding of -keys. It provides compatibility across GnuPG 1.4.11 and .12 which -broke the decoding of keys. Usage of commandline option is made -consistent and full paths are honored. - -A new test suite is included and documentation is updated accordingly. - -## 1.3 (DEPRECATED, see [KNOWN_BUGS](KNOWN_BUGS.md)) -### May 2013 - -A refactoring of Tomb's main script internals was made, including -a new messaging system, machine parsable output, cleaner code and -updated compatibility to Debian 7. A new search feature lets users -index and run fast filename searches in their open tombs. Creation -of tombs is broken out in three steps (dig, forge and lock). - -Source distribution includes experimental add-ons for a python -GUI, KDF key encryption and a key "undertaker". Documentation was -updated. - - -## 1.2 -### Nov 2011 - -Includes an Important fix to password parsing for spaces and -extended chars, plus a new 'passwd' command to change a key's -password. Tomb now checks for swap to avoid its usage (see SWAP -section in manpage) and warns the user when the tomb is almost -full. - -## 1.1 -### May 2011 - -Fixes to mime types, icons and desktop integration. - -A new 'list' command provides an overview on all tombs currently open. - -Now a tomb cannot be mounted multiple times, the message console has -colors and better messages. - -Different mount options (like read-only) can also be specified by hand on the commandline. - -## 1.0 -### March 2011 - -Clean and stable. Now passwords are handled exclusively using -pinentry. Also support for steganography of keys (bury and exhume) -was added to the commandline. - -Commandline and desktop operations are well separated so that tomb can be used via remote terminal. - -A new command 'slam' immediately closes a tomb killing all processes that keep it busy. - -## 0.9.2 -### February 2011 - -The tomb-open wizard now correctly guides you through the creation -of new tombs and helps when saving the keys on external USB -storage devices. The status tray now reliably closes its tomb. - -## 0.9.1 -### February 2011 - -Sourcecode cleanup, debugging and testing. - -Integrated some feedback after filing Debian's ITP and RFS. - -## 0.9 -### January 2011 - -Tomb is now a desktop application following freedesktop standards: -it provides a status tray and integrates with file managers. - -The main program has been thoroughly tested and many bugs were fixed. - -## August 2010 - -The first usable version of Tomb goes public among hacker friends - -## During the year 2009 - -Tomb has been extensively tested, perfectioned and documented -after being used by its author. - -## Sometime in 2007 - -[MKNest](http://code.dyne.org/dynebolic/tree/dyneII/startup/bin/mknest) -was refactored to work on the Debian distribution and since -then renamed to Tomb. [dyne:bolic](http://www.dynebolic.org) specific dependencies where -removed, keeping Zsh as the shell script it is written with. - -## Back in 2005 - -The "nesting" feature of [dyne:bolic](http://www.dynebolic.org) -GNU/Linux lets users encrypt their home in a file, using a shell script and a graphical -interface called Taschino. - -Taschino included a shell script wrapping cryptsetup to encrypt -loopback mounted partitions with the algo AES-256 (cbc-essiv -mode): this script was called 'mkNest' and its the ancestor of -Tomb. diff --git a/INSTALL.md b/INSTALL.md deleted file mode 100644 index 0855e5b2..00000000 --- a/INSTALL.md +++ /dev/null @@ -1,203 +0,0 @@ -# TOMB INSTALLATION INSTRUCTIONS - -## Install required tools - -Tomb needs a few programs to be installed on a system in order to work: - - * zsh - * file - * sudo - * gnupg - * cryptsetup - * pinentry-curses (and/or -gtk-2, -x11, -qt) - -Most systems provide these tools in their package collection, for -instance on Debian/Ubuntu one can use `apt-get install` on Fedora and -CentOS one can use `yum install` and `pacman` on Arch. - -## Install Tomb - -To install Tomb simply download the source distribution (the tar.gz file) -from https://files.dyne.org/tomb and decompress it. From a terminal: - - cd Downloads - tar xvfz Tomb-2.4.tar.gz (correct with actual file name) - -Then enter its directory and run 'make install' as root, this will install -Tomb into /usr/local: - - cd Tomb-2.4 (correct with actual directory name) - sudo make install - -After installation one can read the commandline help or read the manual: - - tomb -h (print a short help on the commandline) - man tomb (show the full usage manual) - -# Basic usage - -Once installed one can proceed creating a tomb, for instance: - - tomb dig -s 10 secrets.tomb (dig a 10MB Tomb) - tomb forge -k secrets.tomb.key (create a new key and set its password) - tomb lock -k secrets.tomb.key secrets.tomb (format the tomb, lock it with key) - -When this is done, the tomb can be opened with: - - tomb open -k secrets.tomb.key secrets.tomb (will ask for password) - -The key can also be hidden in an image, to be used as key later - - tomb bury -k secrets.tomb.key nosferatu.jpg (hide the key in a jpeg image) - tomb open -k nosferatu.jpg secrets.tomb (use the jpeg image to open the tomb) - -Or backed up to a QRCode that can be printed on paper and hidden in -books. QRCodes can be scanned with any mobile application, resulting -into a block of text that can be used with `-k` just as a normal key. - - tomb engrave -k secrets.tomb.key (also an image will work) - -There are some more things that tomb can do for you, make sure you -have a look at the manpage and at the commandline help to find out -more. - -# Optional tools - -Tomb can use some optional tools to extend its functionalities: - -executable | function ----------- | --------------------------------------------------- - lsof | slam a tomb (close even if open programs) - dcfldd | show progress while digging tombs and keys - steghide | bury and exhume keys inside images - resizefs | extend the size of existing tomb volumes - qrencode | engrave keys into printable qrcode sheets - mlocate | fast search of file names inside tombs - swish++ | fast search of file contents inside tombs - unoconv | fast search of contents in PDF and DOC files - lesspipe | fast search of contents in compressed archives - haveged | fast entropy generation for key forging - -As for requirements, also optional tools may be easy to install using -the packages provided by each distribution. - -Once any of the above is installed Tomb will find the tool automatically. - -# Extras - -Tomb comes with a bunch of extra tools that contribute to enhance its -functionality or integrate it into particular system environments. - -## extras/gtk-tray - -The Gtk tray adds a nifty tomb skull into the desktop toolbar: one can -use it to close, slam and explore the open tomb represented by it. - -When using pinentry-gtk-2 it also adds a little skull on the password -input, useful to not confuse it with other password inputs. - -To have it change directory `extras/gtk-tray` then - - 1. make sure libnotify and gtk+-2.0 dev packages are available - 2. run `make` inside the directory to build `tomb-gtk-tray` - 3. run `sudo make install` (default PREFIX is `/usr/local`) - 4. start `tomb-gtk-tray tombname` after the tomb is open - -Of course, one can include the launch of tomb-gtk-tray scripts. - -## extras/qt-tray - -The QT tray adds a tomb tray in a QT desktop toolbar. It requires at -least QT libraries of version 5.4 or above. -Build with 'qmake' and then 'make'. - -## extras/kdf-keys - -The KDF wrapper programs allows one to use KDF rounds on passwords in -order to obstruct dictionary based and similar brute-forcing attacks. - -In case an attacker comes in possession of both a tomb and its key, -the easy to memorize password can be guessed by rapidly trying -different combinations. With KDF every try will require a significant -amount of computation that will slow down the process avoiding tight -loops and in fact making such attacks very onerous and almost -impossible. - -To have it enter `extras/kdf-keys` then - - 1. make sure libgcrypt dev packages are available - 2. run `make` inside the directory to build tomb-kdb-* executables - 3. run `sudo make install` (default PREFIX is `/usr/local`) - 4. use `--kdf 100` when forging a key (tune the number to your cpu) - -KDF keys are recognized automatically by Tomb, which will always need -the `extras/kdf-keys` program to be installed on a machine in order to -open the Tomb. - -Please note that it doesn't makes much sense to use KDF keys and -steganography, since the latter will invalidate the brute-forcing -protection. For details on the issue see [KNOWN_BUGS.md](KNOWN_BUGS). - -## extras/translations/ - -There are translations available for Tomb and they are installed by -default. If you wish to update them manually navigate to extras/po -and run 'make install' as root: - - cd extras/translations - sudo make install - -## extras/gtomb/ - -This is a minimalistic graphical user interface scripted in ZSh -depending from Zenity to display dialog boxes. It covers all basic -operations in Tomb and facilitates the setup of hooks. - - cd extras/gtomb - ./gtomb - -# Tomb support in other applications - -Can Tomb be used by other applications? - -Sure as Hell it can! Licensing issues aside ([GNU GPLv3+](COPYING) -terms) Tomb provides machine-readable output and interaction via some -flags: - -flag | function ---------------- | ------------------------------------------------ - --no-color | avoids coloring output to allow parsing - --unsafe | allows passwords options and cleartext key from stdin - --tomb-pwd | specify the key password as argument - --tomb-old-pwd | specify the old key password as argument - -k cleartext | reads the unencrypted key from stdin - -Yet please consider that these flags may introduce vulnerabilities and -other people logged on the same system can easily log your passwords -while such commands are executing. -We only recommend using the pinentry to input your passwords. - -At the time of writing another free software graphical application -supports opening and closing Tombs via a plugin installed by -default: [zuluCrypt](https://mhogomchungu.github.io/zuluCrypt/). One -needs to activate the Tomb plugin included in the zuluCrypt source to -be able to create, open and close tombs. Beware zuluCrypt may miss -advanced Tomb functionalities that are only available from the -command-line. - -## Python - -![](extras/images/python_for_tomb.png) - -A Python wrapper is under development and already usable, but it -introduces some vulnerabilities mentioned above. Find it in -`extras/tomber`. For more information see [PYTHON](extras/PYTHON.md). - -## Let us know! - -If you plan to develop any kind of wrapper for Tomb you are welcome to -let us know. Tomb is really meant to be maintained as a minimal tool -for long-term compatibility when handling something so delicate as our -secrets. For anything else we rely on your own initiative. - -Happy hacking! ;^) diff --git a/KNOWN_BUGS.md b/KNOWN_BUGS.md deleted file mode 100644 index 4ea71dbe..00000000 --- a/KNOWN_BUGS.md +++ /dev/null @@ -1,107 +0,0 @@ -# Password bug in X11 when using pinentry-curses -## Issue with Tomb version 2.6 and 2.7 - -This bug affects systems with a running X11 DISPLAY, but where only -pinentry-ncurses is installed. It wrongly reads the input password: no -matter what string is chosen, the password becomes: - -tomb [W] Detected DISPLAY, but only pinentry-curses is found. - -Following the fix in Tomb 2.8 affected users will need to use the line -above as password to open their tomb and should change their key with -a new password using 'tomb passwd'. - -# Cryptsetup change of default to luks2 -## Issue opening tombs with cryptsetup >2.0 - -Tomb uses the cryptsetup LUKS volume header default to type luks1 -which has been for long the default in cryptsetup. But starting from -cryptsetup v2.1 a new default has been introduced (luks2) and the ---type option added to specify the old luks1. - -Using Tomb version 2.6 (and future releases) the problem opening tombs -using recent GNU/Linux distributions is fixed. - -# Whitespace in KDF passwords -## Issue affecting passwords used with PBKDF2 keys (<2.6) - - Up until and including Tomb's version 2.5 the PBKDF2 wrapper for keys - in Tomb has a bug affecting passwords that contain whitespace. Since - the passwords are trimmed at the first whitespace, this makes them - weaker, while fortunately the KDF transformation still applies. - - This issue is fixed in Tomb version 2.6: all users adopting KDF keys - that have passwords containing whitespace should change them, - knowing that their "old password" is trimmed until the whitespace. - - Users adopting GPG keys or plain (without KDF wrapper) can ignore - this bug. - -# Vulnerability to password bruteforcing -## Issue affecting keys used in steganography - - An important part of Tomb's security model is to *make it hard for - attackers to enter in possession of both key and data storage*: once - that happens, bruteforcing the password can be relatively easy. - - Protection from bruteforcing is provided by the KDF module that can - be optionally compiled in `extras/kdf-keys` and installed. - - If a key is buried in an image and then the image is stolen, the KDF - protection does not works because *attackers can bruteforce easily - using steghide dictionary attacks*: once found the password is the - same for the steg crypto and the key crypto. - - Users should keep in mind these issues when planning their encryption - scheme and, when relying on steganography, keep the image always - mixed in the same folder with many more images since that will be the - multiplier making it slightly harder to bruteforce their password. - - In most cases consider that *password bruteforce is a feasible attack - vector on keys*. If there are doubts about a key being compromised is - a good practice to change it using the `setkey` command on a secure - machine, possibly while off-line or in single user mode. - -# Ending newline in tomb keys -## 2.2 - - When used to forge new keys, Tomb version 2.2 incorrectly added a new - line ('\n', 0x0A) character at the end of each key's secret sequence - before encoding it with GnuPG. This does not affect Tomb regression - and compatibility with other Tomb versions as this final newline is - ignored in any case, but third party software may have - problems. Those writing a software that supports opening Tomb files - should always ignore the final newline when present in the secret - material obtained after decoding the key with the password. - -# Versioning and stdin key -## 1.5 - - Due to distraction tomb version 1.5 displays its version as 1.4. - Also version 1.5 did not work when using -k - to pipe keys from - stdin, plus left the encrypted keys laying around in RAM (tmpfs). - This was a minor vulnerability fixed in 1.5.1. - - -# Key compatibility broken -## 1.3 and 1.3.1 - - Due to an error in the creation and decoding of key files, release - versions 1.3 and 1.3.1 cannot open older tombs, plus the tombs created - with them will not be opened with older and newer versions of Tomb. - - This bug was fixed in commit 551a7839f500a9ba4b26cd63774019d91615cb16 - - Those who have created tombs with older versions can simply upgrade - to release 1.4 (and any other following release) to fix this issue - and be able to operate their tombs normally. - - Those who have used Tomb 1.3 or 1.3.1 to create new tombs should use - Tomb version 1.3.1 (available from https://files.dyne.org/tomb) to - open them and then migrate the contents into a new tomb created using - the latest stable Tomb version. - - This bug was due to a typo in the code which appended a GnuPG status - string to the content of keys. All users of Tomb 1.3.* should pay - particular attention to this issue, however that release series was - out as latest for less than a month. diff --git a/Makefile b/Makefile deleted file mode 100644 index 6fb506dc..00000000 --- a/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -PROG = tomb -PREFIX ?= /usr/local -MANDIR ?= ${PREFIX}/share/man - -deps: - @[ -r /etc/debian_version ] && { \ - apt-get install -qy zsh cryptsetup file gnupg pinentry-curses; } - @[ -r /etc/fedora-release ] ^^ { \ - yum install -y zsh cryptsetup file gnupg pinentry-curses; } - -all: - @echo - @echo "Tomb is a script and does not need compilation, it can be simply executed." - @echo - @echo "To install it in /usr/local together with its manpage use 'make install'." - @echo - @echo "To run Tomb one needs to have some tools installed on the system:" - @echo "Sudo, cryptsetup, pinentry and gnupg." - @echo - -install: - install -Dm755 ${PROG} ${DESTDIR}${PREFIX}/bin/${PROG} - install -Dm644 doc/${PROG}.1 ${DESTDIR}${MANDIR}/man1/${PROG}.1 - @echo - @echo "Tomb is installed succesfully. To install language translations, make sure" - @echo "gettext is also installed, then 'cd extras/translations' and 'make install' there." - @echo - @echo "Look around the extras/ directory, it contains other interesting modules." - @echo - -test: - make -C extras/test - -lint: - shellcheck -s bash -e SC1058,SC1073,SC1072,SC1009 tomb diff --git a/README.md b/README.md deleted file mode 100644 index 4b40c540..00000000 --- a/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# Tomb: The Linux Crypto Undertaker - -[![Build Status](https://github.com/dyne/tomb/actions/workflows/linux.yml/badge.svg)](https://github.com/dyne/Tomb/actions) - - -Minimalistic command line tool based on Linux dm-crypt and LUKS, trusted by hackers since 2007. - -You can keep your volumes secure and easily manageable with simple commands. - -![tomb's logo](https://github.com/dyne/Tomb/blob/master/extras/images/monmort.png) - -``` - $ tomb dig -s 100 secret.tomb - $ tomb forge secret.tomb.key - $ tomb lock secret.tomb -k secret.tomb.key -``` -To open it, do -``` - $ tomb open secret.tomb -k secret.tomb.key -``` -And after you are done -``` - $ tomb close -``` -Or, if you are in a hurry, kill all processes with open files inside your tomb and close it. -``` - $ tomb slam -``` -## [Get started on dyne.org/software/tomb](https://dyne.org/software/tomb) - - - -All information is found on our website. - -Use only stable and signed releases in production! - -### 💾 [Download from files.dyne.org/tomb](https://files.dyne.org/tomb/) - -Tomb's development is community-based! - -## How can you help - -Donations are very welcome on [dyne.org/donate](https://www.dyne.org/donate) - -Translations are also welcome: see our simple [translation guide](https://github.com/dyne/Tomb/blob/master/extras/translations/README.md) - -Tomb's code is short and readable: don't be afraid to inspect it! If you plan to submit a PR, please remember that this is a minimalist tool, and the code should be short and readable. Also, first, read our small intro to [Tomb's coding style](doc/HACKING.txt). - -We have a [space for issues](https://github.com/dyne/Tomb/issues) open for detailed bug reports. Always include the Tomb version being used when filing a case, please. - -There is also a [space for discussion](https://github.com/dyne/Tomb/discussions) of new features, desiderata and whatnot on github. - -# Licensing - -Tomb is Copyright (C) 2007-2024 by the Dyne.org Foundation and maintained by [Jaromil](https://github.com/jaromil). The [AUTHORS](AUTHORS.md) file contains more information on all the developers involved. The license is GNU Public License v3. - -## [More info on dyne.org/software/tomb](https://dyne.org/software/tomb) - diff --git a/doc/HACKING.txt b/doc/HACKING.txt deleted file mode 100644 index 5cabb84b..00000000 --- a/doc/HACKING.txt +++ /dev/null @@ -1,128 +0,0 @@ -Style guidelines -=============== - -Indentation ------------ - -Code must be indented using hard tabs. - -Naming ------- - -Short version: $GLOBAL, $local, func_name() - -Variables must be declared and scoped. - -GLOBAL_VARIABLES # are uppercase unless there's a good reason not to. - # (e.g., path as a special meaning in Zsh) - -local samplevar # are lowercase and scoped to the function # name - # should be readable. Do not make unnecessary - # shortcuts that would impede others to read fluidly - -# Please comment your functions before coding them: it helps -# clear the mind on the objective. If it does too much, you -# probably want to split it. Any reusable code should be -# isolated. -any_function() {} - -_internals() {} # Prepend an _ if the function is clearly internal, - # that is, if it's only called within the scope of - # another function. - - -Sample code: - -# Sample public command. -# -# It shows developers how to write readable code. -# Returns 0 on success, or fails -public_command() { - local tombpath="$1" # First argument is the path to the tomb - local orientation="${2:-South}" # Second optional argument - local something is happening - - [[ -z $tombpath ]] && { - _failure "Usage public_command tombpath [orientation=South]" } - - case $orientation in - (South|North|East|West) break;; - (*) - _failure "orientation must be one of South, North, East, or West." - ;; - esac - - _check_swap # Ensure the available memory is safe - _plot $tombpath # Set TOMB{PATH,DIR,FILE,NAME} - - for is in $TOMBLOOPDEVS; do - [[ -k $is ]] && { - happening+="$is " - } || { - something+="$is " - } - done - - _message "You gotta sort your bones." - - return 0 -} - - -Reporting to the user ---------------------- - -There are some nifty messaging functions to use. They all come with -shortcuts that you can use during development or for temporary -messages. The long name is to be used for translatable strings. - -They display formatted messages, using colors when available. - -DEBUG=1 make the _verbose messages visible. -QUIET=1 suppresses all messages (but the _verbose messages if DEBUG=1). - -Here is the deal: - -Name (Shortcut) Return When to use -================================================================================= -_verbose (xxx) You need to check the current state of the program. - -_message (say) You want to tell the user about what's going on. - You can pass -n (shortcut: act) for inline messages. - -_warning (no) You want to inform the user about an error condition. - -_success (yes) You want to tell the user about a successful result. - -_failure (die) exit 1 You want to exit the program with a fatal error. - You may pass a different exit code as exitval. - -All messaging function take a single "message" argument. -_failure takes an exit code as an optional exitval environment variable. - -Additionally you can use _print to pass translatable string without decoration. - -Examples: - - _verbose "Showing translatable debug message" - xxx "This is temporary debug" - _message "The program is doing something" - _message -n "Inline messages " - echo "are useful" - _success "All is fine" - _warning "Something's wrong" - _print "Did I really say that?" - _failure "Fatal error: exiting with default exit code 1" - _message "This is not reached, nor the next 'die' command" - exitval=127 die "I am Jack's dead corpse." - -Will display something like: - - tomb [D] Showing translatable debug message - tomb [D] This is temporary debug - tomb . The program is doing something - tomb > Inline messages are useful - tomb (*) All is fine - tomb [W] Something's wrong - Did I really say that? - tomb [E] Fatal error: exiting with default exit code 1 diff --git a/doc/KEY_SPECIFICATIONS.txt b/doc/KEY_SPECIFICATIONS.txt deleted file mode 100644 index 78ea036b..00000000 --- a/doc/KEY_SPECIFICATIONS.txt +++ /dev/null @@ -1,34 +0,0 @@ -Overview -========= - -What is a key? -It is a gpg symmetrically encrypted, ascii-armored file. -The encryption key is a function (see below, on KDF section) of your tomb -passphrase. - -Layout -====== - -Before coming to the gpg part, there could be some "header" lines specifying -metatada. They're done like this: -_FIELD_params_params_and_more_params_ - -where FIELD should be the description for the header. -Pay much attention to the fact that there should ONLY be ASCII characters there, -to avoid encoding issues and whatever. Needs something more? Use base64encode. -(Of course, you're free to pack params into a single field, base64encoding -whatever you want). -And every header field should be in only one line. - -KDF -=== - -Key Derivation Functions, are functions which will make your key stronger -spending some CPU time: the basic idea is that you have to compute that function -just once in a while, but an attacker that wants to bruteforce has to compute it -for every passphrase he's checking. This will make the bruteforce much more -expensive. - -The header line format is _KDF_$method_$params_$params_... where $method is the -method we are using (ie: scrypt) and params is something that it needs (ie: -salt). diff --git a/doc/LinuxHDEncSettings.txt b/doc/LinuxHDEncSettings.txt deleted file mode 100644 index c738edfc..00000000 --- a/doc/LinuxHDEncSettings.txt +++ /dev/null @@ -1,404 +0,0 @@ - -Linux hard disk encryption settings - - This page intends to educate the reader about the existing weaknesses - of the public-IV on-disk format commonly used with cryptoloop and - dm-crypt (used in IV-plain mode). This page aims to facilitate risk - calculation when utilising Linux hard disk encryption. The attacks - presented on this page may pose a thread to you, but at the same time - may be totally irrelevant for others. At the end of this document, the - reader should be able to make a good choice according to his security - needs. - - A good quote with respect to this topic is ''All security involves - trade-offs'' from Beyond Fear (Bruce Schneier). You should keep in mind - that perfect security is unachievable and by all means shouldn't be - your goal. For instance, when using pass phrase based cryptography, you - have to trust in that the underlying system is secure, the computer - system has not been tampered with, and nobody is watching you. The most - obvious weakness is the last one, but even if you make sure nobody nor - any camera is around, how about the keyboard you're typing on? Has it - been manipulated while you have been getting your lunch? - - So security comes for a price, and the price when designing - cryptography security algorithms is performance. You will be introduced - to the fastest of all setups available, the "public-IV", which - sacrifices security properties for speed. After that we will talk about - ESSIV, the newest of IV modes implemented. It comes for a small price, - but it can deal with watermarking for a relatively small price. Then - you'll be introduced to the draft specifications of the Security in - Storage Working Group ([18]SISWG). Currently SISWG is considering EME - and LRW for standardisation. EME along with it's cousin CMC seems to - provide the best security level, but imposes additional encryption - steps. Plumb-IV is discussed only for reference, because it has the - same performance penalty as CMC, but in contrast suffers from - weaknesses of CBC encryption. - - As convention, this document will use the term "blocks", when it - refers to a single block of plain or cipher text (usually 16 byte), - and will use the term "sectors", when it refers to a 512-byte wide hard - disk block. - -CBC Mode: The basic level - - Most hard disk encryption systems utilise CBC to encrypt bulk data. - Good descriptions on CBC and other common cipher modes are available at - * [19]Wikipedia - * [20]Connected: An Internet Encyclopedia - * [21]NIST: Recommendation for Block Cipher Modes of Operation (CBC - is at PDF Page 17) - - Please make sure you're familiar with CBC before proceeding. - - Since CBC encryption is a recursive algorithm, the encryption of the - n-th block requires the encryption of all preceding blocks, 0 till n-1. - Thus, if we would run the whole hard disk encryption in CBC mode, one - would have to re-encrypt the whole hard disk, if the first computation - step changed, this is, when the first plain text block changed. Of - course, this is an undesired property, therefore the CBC chaining is - cut every sector and restarted with a new initialisation vector (IV), - so we can encrypt sectors individually. The choice of the sector as - smallest unit matches with the smallest unit of hard disks, where a - sector is also atomic in terms of access. - - For reference, I will give a formal definition of CBC encryption and - decryption. Note, that decryption is not recursive, in contrast to - encryption, since it's a function only of C[n-1] and C[n]. - Encryption: - C[-1] = IV - C[n] = E(P[n] ⊕ C[n-1]) - Decryption: - C[-1] = IV - P[n] = C[n-1] ⊕ D(C[n]) - The next sections will deal with how this IV is chosen. - -The IV Modes - -The "public-IV" - - The IV for sector n is simply the 32-bit version of the number n - encoded in little-endian padded with zeros to the block-size of the - cipher used, if necessary. This is the most simple IV mode, but at the - same the most vulnerable. - -ESSIV - - E(Sector|Salt) IV, short ESSIV, derives the IV from key material via - encryption of the sector number with a hashed version of the key - material, the salt. ESSIV does not specify a particular hash algorithm, - but the digest size of the hash must be an accepted key size for the - block cipher in use. As the IV depends on a none public piece of - information, the key, the sequence of IV is not known, and the attacks - based on this can't be launched. - -plumb IV - - The IV is computed by hashing (or MAC-ing) the plain text from the - second block till the last. Additionally, the sector number and the key - are used as input as well. If a byte changes in the plain text of the - blocks 2 till n, the first block is influenced by the change of the IV. - As the first encryption effects all subsequent encryption steps due to - the nature of CBC, the whole sector is changed. - - Decryption is possible because CBC is not recursive for decryption. The - prerequisites for a successful CBC decryption are two subsequent cipher - blocks. The former one is decrypted and the first one is XOR-ed into - the decryption result yielding the original plain text. Therefore - independent of the IV scheme, decryption is possible from the 2nd to - the last block. After the recovery of these plain text blocks, the IV - can be computed, and finally the first block can be decrypted as well. - - The only weakness of this scheme is it's performance. It has to process - data twice: first for obtaining the IV, and then to produce the CBC - encryption with this IV. With the same performance penalty CMC is able - to achieve better security properties (CMC is discussed later), thus - plumb-IV will remain unimplemented. - -The attack arsenal - -Content leaks - - This attack can be mounted against any system operating in CBC Mode. It - rests on the property, that in CBC decryption, the preceding cipher - block's influence is simple, that is, it's XORed into the plain text. - The preceding cipher block, C[n-1], is readily available on disk (for n - > 0) or may be deduced from the IV (for n = 0). If an attacker finds - two blocks with identical cipher text, he knows that both cipher texts - have been formed according to: - C[m] = E(P[m] ⊕ C[m-1] ) - C[n] = E(P[n] ⊕ C[n-1] ) - Since he found that C[m] = C[n], it holds - P[m] ⊕ C[m-1] = P[n] ⊕ C[n-1] - which can be rewritten as - C[m-1] ⊕ C[n-1] = P[n] ⊕ P[m] - The left hand side is known to the attacker by reading the preceding - cipher text from disk. If one of the blocks is the first block of a - sector, the IV must be examined instead (when it's available as it is - in public-IV). The attacker is now able to deduce the difference - between the plain texts by examining the difference of C[m-1] and - C[n-1]. If one of the plain text blocks happens to be zero, the - difference yields the original content of the other related plain text - block. - - Another information is available to the attacker. Any succeeding - identical pair of cipher text, that follows the initial identical - cipher pair, is equal. No information about the content of those pairs - can be extracted, since the information is extracted from the - respective preceding cipher blocks, but those are all required to be - equal. - - Let's have a look at the chance of succeeding with this attack. - Assuming the output of a cipher forms an uniform distribution, the - chance, p, of finding an identical block is 2^-blocksize. For instance, - p = 1/2^128 for a 128-bit cipher. Because the number of possible pairs - develops as an arithmetic series in n, the number of sectors, the - chance of not finding two identical blocks is given by - (1-p)^n(n-1)/2 - As p is very small, but in contrast the power is very big, we apply the - logarithm to get meaningful answers, that is - n(n-1)/2 ln (1-p) - An example: The number of cipher blocks available on 200GB disk with - known C[n-1] is 200GB × 1024^2 KB/GB × 64/1KB ^1. Or in other words, a - 128-bit block is 16 bytes, so the number of 16-byte blocks in a 200GB - hard disk is 13.4 billion. Therefore, n = 1.342e10. For a 128-bit - cipher, p = 2^-128. Hence, - ln(1-p) = -2.939e-39 - n(n-1)/2 = 9.007e19 - - n(n-1)/2 ln (1-p) = -2.647e-19 - 1-e^-2.776e-13 = 2.647e-19 - The last term is the chance of finding at least one pair of identical - cipher blocks. But how does this number grow in n? Obviously - exponentially. Plotting a few a decimal powers shows that the chance - for finding at least on identical cipher pair flips to 1 around n = - 10^20 (n = 10^40 for a 256-bit cipher). This inflection point is reached - for a 146 million TB storage (or a hundred thousand trillion trillions - TB storage for a 256-bit cipher). - - ^1The blocks with available preceding cipher blocks is 62/1KB for all - non-public IV schemes, i.e. ESSIV/plumb IV - -Data existence leak: The Watermark - - No IV format discussed on this page allows the user to deny the - existence of encrypted data. Neither cryptoloop nor dm-crypt is an - implementation of a deniable cryptography system. But the problem is - more serious with public-IV. - - With public IV and the predicable difference it introduces in the first - blocks of a sequence of plain text, data can be watermarked, which - means, the watermarked data is detectable even when the key has not - been recovered. As shown in the paragraph above, the existence of two - blocks with identical cipher text is very unlikely and coincidence can - be excluded, which is relevant when somebody tries to demonstrate - before the law that certain data is in an encrypted partition. - - As the IV progresses with a foreseeable pattern and is guaranteed to - change the least significant bit ever step, we can build identical pair - of cipher text by writing three consecutive sectors each with a flipped - LSB relative to the previous. (The reason it's three instead of two is, - that the second least significant bit might change as well.) This - "public-IV"-driven CBC encryption will output exactly the same cipher - text for two consecutive sectors. An attacker can search the disk for - identical consecutive blocks to find the watermark. This can be done in - a single pass, and is much more feasible than finding to identical - blocks, that are scattered on the disk, as in the previous attack. A - few bits of information can be encoded into the watermarks, which might - serve as tag to prove the existence copyright infringing material. - - A complete description of watermarking can be found in [22]Encrypted - Watermarks and Linux Laptop Security. The attack can be defeated by - using ESSIV. - -Data modification leak - - CBC encryption is recursive, so the n-th block depends on all previous - blocks. But the other way round would also be nice. Why? The weakness - becomes visible, if storage on a remote computer is used, or more - likely, the hard disk exhibits good forensic properties. The point is, - the attacker has to have access to preceding (in time) cipher text of a - sector, either by recording it from the network, or by using forensic - methods. - - An attacker can now guess data modification patterns by examining the - historic data. If a sector is overwritten with a partial changed plain - text, there is an amount of bytes at the beginning, which are - unchanged. This point of change^2 is directly reflected in the cipher - text. So an attacker can deduce the point of the change in plain text - by finding the point where the cipher text starts to differ. - - This weakness is present in public-IV and ESSIV. - - ^2aligned to the cipher block size boundaries - -Malleable plain text - - The decryption structure of CBC is the source of this weakness. - Malleability (with respect to cryptography) is defined as a - modification of the cipher text that will resulting in a predictable - change in plain text. To put it formally, there is a function f(C), - that, if applied to the cipher text, C' = f(C), will result in a known - function f', which will predict the resulting plain text, P' = D(C'), - correctly assuming P is known, that is P' = f'(P). - - As we can see in it's definition, CBC decryption depends on C[n-1]. An - attacker can flip arbitrary bits in the plain text by flipping bit in - C[n-1]. More formally^3, if - P = P[1] || P[2] || ... || P[i] || ... || P[n] - C = E[CBC](P) - C = C[1] || C[2] || ... || C[i-1] || ... || C[n] - the function - f(C[1] || ... || C[n]) = C[1] || ... || C[i-1] XOR M || ... || C[n] - follows the function f', which predicts the resulting plain text - correctly as, - f'(P[1] || ... || P[n]) = P[1] || ... || P[i] XOR M || ... || P[n] - The first block of the CBC cipher text stream is not malleable, because - it depends on the IV, which is not modifiable for an attacker. - - ^3The IV parameter for E[CBC] has been intentionally omitted. - -Movable - - On the expense of one block decrypting to garbage, an attacker can move - around plain text as he likes. CBC decryption depends on two variables, - C[n-1] and C[n]. Both can be modified at free will. To make meaningful - modifications, an attacker has to replace the pair C[n-1] and C[n] with - other cipher text pair from disk. The first block C[n-1] will decrypt - to garbage, but the second block C[n] will yield a copy of the plain - text of the copied cipher block. This attack is also known as - copy&paste attack. This attack is mountable against any CBC setup. The - only limitation is, the first block, C[0], can't be replaced with - something meaningful, as C[-1] can't be modified, because it's the IV. - -CMC and EME: Tweakable wide block cipher modes - - CMC is a new chaining mode. It stands for ''CBC-Mask-CBC''. It works by - processing the data in three steps, first CBC, then masking the cipher - text, and then another CBC step, but this time backwards. The last step - introduces a dependency from the last block to the first block. The - authors of the CMC paper provide a prove for the security of this mode, - making a secure 128-bit cipher a secure 4096-bit cipher (sector size). - As in normal CBC, this scheme also takes an IV, but the authors call it - tweak. - - EME is CMC's cousin. EME has also been authored by Haveli and Rogaway - as well been authored for the same purpose. The difference to CMC is, - that EME is parallelizable, that is, all operations of the underlying - cipher can be evaluated in parallel. To introduce an interdependency - among the resulting cipher blocks, the encryption happens in two - stages. Between these stages a mask is computed from all intermediate - blocks and applied to each intermediate block. This step causes an - interdependency among the cipher blocks. After applying the mask, - another encryption step diffuses the mask. - - The interdependency among the resulting blocks allow CMC and EME to be - nonmovable, nonmalleable, to prevent content leaks and in-sector data - modification patterns. The tweaks are encrypted by both cipher modes, - thus both are nonwatermarkable. - - For simplicity, the EME description above omitted the pre- and post- - whitening steps as well as the multiplications in GF(2^128). An - in-depth specification can be found at the [23]Cryptology ePrint - Archive. An applicable draft specification for EME-32-AES can be found - at [24]SISWG. I have written an EME-32-AES test implementation for - Linux 2.6. It's available [25]here. The CMC paper is available from the - [26]Cryptology ePrint Archive as well. - -LRW: A tweakable narrow block cipher mode - - EME as well as CMC are comparatively secure cipher modes, but heavy in - terms of performance. LRW tries to cope with most of security - requirements, and at the same time provide a good performance. LRW is a - narrow block cipher mode, that is, it operates only on one block, - instead of a whole sector. To make a cipher block tied to a location on - disk (to make it unmovable), a logical index is included in the - computation. For LRW you have to provide two keys, one for the cipher - and one for the cipher mode. The second key is multiplied with a - logical index under GF(2^128) and used as pre- and post- whitening for - encryption. With those whitening steps the block is effectively tied to - a logical index. The logical index is usually the absolute position on - disk measured with the block size of the cipher algorithm. The - different choice of the measuring unit is the only different between - the logical index and the public-IV. - - The LRW draft is available from the [27]SISWG mailing list archive. - -Summarising - - The following table shows a comparison between the security properties - of different encryption setups and their computational costs. The - number of cipher calls, XOR operations and additional operations are - stated in terms of encryption blocks, n. - IV mode cipher mode content leaks watermarkable malleable movable - modification detection^5 cipher calls XOR ops additional op. - public-IV CBC Yes Yes Yes Yes Yes n n None - ESSIV CBC Yes No Yes Yes Yes n+1 n None - Plumb-IV1^4 CBC Yes No Yes Yes No 2n-1 2n None - public-IV CMC No No No No No 2n+1 2n+1 1 LW GF ⊗ - public-IV EME No No No No No 2n+1 5n 3n-1 LW GF ⊗ - public-IV LRW No No No No Yes n 2n n HW GF ⊗ - - Legend: - * LW GF ⊗: light-weight Galois field multiplication, that is, a - multiplication with a constant x^2^i, which can be computed in - θ(1). - * HW GF ⊗: heavy-weight Galois field multiplication, that is, a - multiplication with an arbitrary constant, which can be computed in - θ(bits). - - ^4plumb-IV1 uses CBC-MAC instead of hashing, so we can make a good - comparison with other ciphers in terms of cipher/XOR calls. - ^5detectable partial in-sector modification - __________________________________________________________________ - - Clemens Fruhwirth, , also author of LUKS and ESSIV, porter of - cryptoloop, aes-i586 for 2.6., twofish-i586, and implementor of - EME-32-AES. This text is an excerpt of my diploma thesis. - -This page has been reviewed by - - Dr. Ernst Molitor - Arno Wagner - James Hughes , "Security in Storage Working Group" chair - - Additional thanks to Pascal Brisset, for pointing out an error in the - Bernoulli estimation in an earlier version of this document, further - Adam J. Richter for pointing out an error in the KB/GB ratio. - - Content and design, Copyright © 2004-2008 Clemens Fruhwirth, unless - stated otherwise - Original design by [28]haran | Additional art by [29]LinuxArt | | Blog - by [30]NanoBlogger - -References - - 1. http://clemens.endorphin.org/ - 2. http://clemens.endorphin.org/credits - 3. http://clemens.endorphin.org/aboutme - 4. http://clemens.endorphin.org/cryptography - 5. http://blog.clemens.endorphin.org/ - 6. http://clemens.endorphin.org/patches - 7. http://clemens.endorphin.org/archive - 8. http://clemens.endorphin.org/Cryptoloop_Migration_Guide - 9. http://clemens.endorphin.org/LUKS - 10. http://clemens.endorphin.org/AFsplitter - 11. http://clemens.endorphin.org/lo-tracker - 12. http://blog.clemens.endorphin.org/2008/12/luks-on-disk-format-revision-111.html - 13. http://blog.clemens.endorphin.org/2008/11/xmonad-gridselect.html - 14. http://blog.clemens.endorphin.org/2008/11/workaround-for-bittorrent-traffic.html - 15. http://blog.clemens.endorphin.org/2008/09/i-love-lolcat-meme.html - 16. http://blog.clemens.endorphin.org/2008/09/counter-steganography-research.html - 17. http://clemens.endorphin.org/cryptography - 18. http://www.siswg.org/ - 19. http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation - 20. http://www.freesoft.org/CIE/Topics/143.htm - 21. http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf - 22. http://www.tcs.hut.fi/~mjos/doc/wisa2004.pdf - 23. http://eprint.iacr.org/2003/147/ - 24. http://grouper.ieee.org/groups/1619/email/pdf00011.pdf - 25. http://article.gmane.org/gmane.linux.kernel.device-mapper.dm-crypt/544 - 26. http://eprint.iacr.org/2003/148/ - 27. http://grouper.ieee.org/groups/1619/email/msg00160.html - 28. http://www.oswd.org/user/profile/id/3013 - 29. http://www.linuxart.com/ - 30. http://nanoblogger.sourceforge.net/ diff --git a/doc/Luks_on_disk_format.pdf b/doc/Luks_on_disk_format.pdf deleted file mode 100644 index 032111b2..00000000 Binary files a/doc/Luks_on_disk_format.pdf and /dev/null differ diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index cec83dbc..00000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ - -man_MANS = tomb.1 tomb-open.1 tomb-status.1 - -EXTRA_DIST = tomb.1 tomb-open.1 tomb-status.1 Luks_on_disk_format.pdf \ - New_methods_in_HD_encryption.pdf TKS1-draft.pdf - diff --git a/doc/New_methods_in_HD_encryption.pdf b/doc/New_methods_in_HD_encryption.pdf deleted file mode 100644 index e952d2b8..00000000 Binary files a/doc/New_methods_in_HD_encryption.pdf and /dev/null differ diff --git a/doc/TKS1-draft.pdf b/doc/TKS1-draft.pdf deleted file mode 100644 index cc0470b3..00000000 Binary files a/doc/TKS1-draft.pdf and /dev/null differ diff --git a/doc/TODO.org b/doc/TODO.org deleted file mode 100644 index b5606a4c..00000000 --- a/doc/TODO.org +++ /dev/null @@ -1,129 +0,0 @@ - -TODO and Roadmap for Tomb - -you are welcome to send patches to jaromil@dyne.org - -Issue tracking is now handled via GitHub, see http://github.com/dyne/Tomb - -Roadmap notes: - -* Release 3.0 - -*** [#A] integrate the zenroom for custom crypto functions - https://decodeproject.github.io/lua-zenroom - -*** [#A] study cryptsetup 2.0 and integrate it - - In particular kernel keystore functionalities - -*** [#A] support BtrFS and snapshots -*** [#B] modular encryption system support - - to go beyond dm-crypt/cryptsetup - - ecryptfs, tc-play - - needs tomb marks appended at end of tombs - -*** [#B] udev rules to avoid usb automount of keyplug in gnome -*** [#B] sign and verify tomb script integrity -*** [#B] analyse and show tomb entropy using libdisorder -*** [#B] use inotify on tomb - inotify can also count when was the last time tomb was used and - unmount it automatically after a timeout, see how much free space - is left and warn when the space is almost finished - -*** DONE [#A] system to split passwords in parts - CLOSED: [2018-01-03 Wed 19:48] - - solved with secrets.dyne.org -*** DONE [#B] make a graphical tomb undertaker (gnome-druid in glade?) - CLOSED: [2018-01-03 Wed 19:49] - - solved by gtomb and qtomb - - -** Notes from #CybRes - - -*** mlocall per swap )vecna) rompigli il caz su github -*** steganografia migliore con outguess? (vecna) -*** velocita' creazione : fallocate -l 10G (scuall8907@gm) - - -* DONE Release 2.0 :100%: - -** [#A] support for ZFS filesystem (revisioning, bitrot) -** [#A] support for partition-based tombs -** DONE [#B] Internationalization using gettext - - Started generating the strings, still need to figure out how to - install it - -** DONE [#B] better tomb locksmith code for key management -** DONE [#B] backup keys on qrcodes -** DONE [#B] indeep security analysis of possible vulnerabilities -** [#C] more gtk dialogs for configurations? keep it minimal! - - - - -* DONE Release 1.0 :100%: - -** TODO [#C] make one single status handle more tombs -** TODO [#C] decorate creation wizard with ASCII art - -** DONE [#B] remove gnome dependencies from tomb core :jaromil: - - gksu is deeply connected to gnome in all its packages. actually - libgksu2-dev is and that doesn't helps. - - gksu binary is a very simple and dirty code, we should have - tomb-ask to use the libgksu library for privilege escalation, but - then this would add the dependency into C linking... - - the solution is for now to detect if gksu is present, else fallback - to sudo and provide it an interface to ask the password graphically - via pinentry - -** DONE [#B] SLAM tomb and kill all applications using it :anathema: - - using lsof and fuser(1) we can do that easily - - we should ask user confirmation when closing a tomb if to slam - - tomb-askpass will become tomb-ask managing such user interaction, - using libassuan and pinentry from the gpg project. - -** DONE [#B] fix operation without DISPLAY (over SSH) :hellekin: -** DONE [#A] steganography to store tomb key :jaromil: - - steghide can hide keys in JPG, BMP, WAV or AU files it also takes - care of compressing end encrypting the key file so we don't - necessarily need gpg... it has Serpent and AES256 (CBC) - -** DONE [#A] use a posix thread instead of fork for status close :jaromil: -** DONE [#A] use a config file to map bind mounts :jaromil: - - done as file 'bind-hooks' inside tom. also 'post-hooks' is executed - as user in case symlinks are needed and so - - using mount -o bind we can trigger actions to be made after mounting - a tomb so that personal directories appear in the home folder. - -** DONE [#A] desktop integration the freedesktop way :jaromil: -** DONE [#B] debian packaging with desktop integration :jaromil: -** DONE [#A] Avoid overwriting key on exhume on same filename -** DONE [#A] Should refuse opening a tomb that is already open :jaromil: - - -* TODO Porting to MS/Windows - - using FReeOTFE http://www.freeotfe.org - - or at least make it compatible with http://www.sdean12.org/SecureTrayUtil.htm - -* TODO Porting to Apple/OSX - - still to be investigated what's there that supports cryptsetup-luks volumes. hditool, tcplay... - diff --git a/doc/bertini_thesis.pdf b/doc/bertini_thesis.pdf deleted file mode 100644 index 65cb16fa..00000000 Binary files a/doc/bertini_thesis.pdf and /dev/null differ diff --git a/doc/literate/Makefile b/doc/literate/Makefile deleted file mode 100644 index 92f7fdb1..00000000 --- a/doc/literate/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -all: - ./shocco ../../tomb > index.html - pygmentize -S default -f html > style.css diff --git a/doc/literate/docco.css b/doc/literate/docco.css deleted file mode 100644 index aa714226..00000000 --- a/doc/literate/docco.css +++ /dev/null @@ -1,359 +0,0 @@ -/*--------------------- Typography ----------------------------*/ - -@font-face { - font-family: 'aller-light'; - src: url('public/fonts/aller-light.eot'); - src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'), - url('public/fonts/aller-light.woff') format('woff'), - url('public/fonts/aller-light.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'aller-bold'; - src: url('public/fonts/aller-bold.eot'); - src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'), - url('public/fonts/aller-bold.woff') format('woff'), - url('public/fonts/aller-bold.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: 'novecento-bold'; - src: url('public/fonts/novecento-bold.eot'); - src: url('public/fonts/novecento-bold.eot?#iefix') format('embedded-opentype'), - url('public/fonts/novecento-bold.woff') format('woff'), - url('public/fonts/novecento-bold.ttf') format('truetype'); - font-weight: normal; - font-style: normal; -} - -/*--------------------- Layout ----------------------------*/ -html { height: 100%; } -body { - font-family: "aller-light"; - font-size: 14px; - line-height: 18px; - color: #30404f; - margin: 0; padding: 0; - height:100%; -} -#container { min-height: 100%; } - -a { - color: #000; -} - -b, strong { - font-weight: normal; - font-family: "aller-bold"; -} - -p { - margin: 15px 0 0px; -} - .annotation ul, .annotation ol { - margin: 25px 0; - } - .annotation ul li, .annotation ol li { - font-size: 14px; - line-height: 18px; - margin: 10px 0; - } - -h1, h2, h3, h4, h5, h6 { - color: #112233; - line-height: 1em; - font-weight: normal; - font-family: "novecento-bold"; - text-transform: uppercase; - margin: 30px 0 15px 0; -} - -h1 { - margin-top: 40px; -} - -hr { - border: 0; - background: 1px #ddd; - height: 1px; - margin: 20px 0; -} - -pre, tt, code { - font-size: 12px; line-height: 16px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; -} - .annotation pre { - display: block; - margin: 0; - padding: 7px 10px; - background: #fcfcfc; - -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); - -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); - box-shadow: inset 0 0 10px rgba(0,0,0,0.1); - overflow-x: auto; - } - .annotation pre code { - border: 0; - padding: 0; - background: transparent; - } - - -blockquote { - border-left: 5px solid #ccc; - margin: 0; - padding: 1px 0 1px 1em; -} - .sections blockquote p { - font-family: Menlo, Consolas, Monaco, monospace; - font-size: 12px; line-height: 16px; - color: #999; - margin: 10px 0 0; - white-space: pre-wrap; - } - -ul.sections { - list-style: none; - padding:0 0 5px 0;; - margin:0; -} - -/* - Force border-box so that % widths fit the parent - container without overlap because of margin/padding. - - More Info : http://www.quirksmode.org/css/box.html -*/ -ul.sections > li > div { - -moz-box-sizing: border-box; /* firefox */ - -ms-box-sizing: border-box; /* ie */ - -webkit-box-sizing: border-box; /* webkit */ - -khtml-box-sizing: border-box; /* konqueror */ - box-sizing: border-box; /* css3 */ -} - - -/*---------------------- Jump Page -----------------------------*/ -#jump_to, #jump_page { - margin: 0; - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 16px Arial; - cursor: pointer; - text-align: right; - list-style: none; -} - -#jump_to a { - text-decoration: none; -} - -#jump_to a.large { - display: none; -} -#jump_to a.small { - font-size: 22px; - font-weight: bold; - color: #676767; -} - -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 10px 15px; - margin:0; -} - -#jump_wrapper { - display: none; - padding:0; -} - -#jump_to:hover #jump_wrapper { - display: block; -} - -#jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; -} - -#jump_page .source { - display: block; - padding: 15px; - text-decoration: none; - border-top: 1px solid #eee; -} - -#jump_page .source:hover { - background: #f5f5ff; -} - -#jump_page .source:first-child { -} -/*---------------------- (> 1025px) ---------------------*/ -@media only screen and (min-width: 1025px) { - - body { - font-size: 16px; - line-height: 24px; - } - - #background { - width: 525px; - } - ul.sections > li > div.annotation { - max-width: 525px; - min-width: 525px; - padding: 10px 25px 1px 50px; - } - ul.sections > li > div.content { - padding: 9px 15px 16px 25px; - } -} - -/*---------------------- Syntax Highlighting -----------------------------*/ - -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -/* - -github.com style (c) Vasily Polovnyov - -*/ - -pre code { - display: block; padding: 0.5em; - color: #000; - background: #f8f8ff -} - -pre .comment, -pre .template_comment, -pre .diff .header, -pre .javadoc { - color: #408080; - font-style: italic -} - -pre .keyword, -pre .assignment, -pre .literal, -pre .css .rule .keyword, -pre .winutils, -pre .javascript .title, -pre .lisp .title, -pre .subst { - color: #954121; - /*font-weight: bold*/ -} - -pre .number, -pre .hexcolor { - color: #40a070 -} - -pre .string, -pre .tag .value, -pre .phpdoc, -pre .tex .formula { - color: #219161; -} - -pre .title, -pre .id { - color: #19469D; -} -pre .params { - color: #00F; -} - -pre .javascript .title, -pre .lisp .title, -pre .subst { - font-weight: normal -} - -pre .class .title, -pre .haskell .label, -pre .tex .command { - color: #458; - font-weight: bold -} - -pre .tag, -pre .tag .title, -pre .rules .property, -pre .django .tag .keyword { - color: #000080; - font-weight: normal -} - -pre .attribute, -pre .variable, -pre .instancevar, -pre .lisp .body { - color: #008080 -} - -pre .regexp { - color: #B68 -} - -pre .class { - color: #458; - font-weight: bold -} - -pre .symbol, -pre .ruby .symbol .string, -pre .ruby .symbol .keyword, -pre .ruby .symbol .keymethods, -pre .lisp .keyword, -pre .tex .special, -pre .input_number { - color: #990073 -} - -pre .builtin, -pre .constructor, -pre .built_in, -pre .lisp .title { - color: #0086b3 -} - -pre .preprocessor, -pre .pi, -pre .doctype, -pre .shebang, -pre .cdata { - color: #999; - font-weight: bold -} - -pre .deletion { - background: #fdd -} - -pre .addition { - background: #dfd -} - -pre .diff .change { - background: #0086b3 -} - -pre .chunk { - color: #aaa -} - -pre .tex .formula { - opacity: 0.5; -} diff --git a/doc/literate/public/fonts/aller-bold.eot b/doc/literate/public/fonts/aller-bold.eot deleted file mode 100755 index 1b32532a..00000000 Binary files a/doc/literate/public/fonts/aller-bold.eot and /dev/null differ diff --git a/doc/literate/public/fonts/aller-bold.ttf b/doc/literate/public/fonts/aller-bold.ttf deleted file mode 100755 index dc4cc9c2..00000000 Binary files a/doc/literate/public/fonts/aller-bold.ttf and /dev/null differ diff --git a/doc/literate/public/fonts/aller-bold.woff b/doc/literate/public/fonts/aller-bold.woff deleted file mode 100755 index fa16fd0a..00000000 Binary files a/doc/literate/public/fonts/aller-bold.woff and /dev/null differ diff --git a/doc/literate/public/fonts/aller-light.eot b/doc/literate/public/fonts/aller-light.eot deleted file mode 100755 index 40bd654b..00000000 Binary files a/doc/literate/public/fonts/aller-light.eot and /dev/null differ diff --git a/doc/literate/public/fonts/aller-light.ttf b/doc/literate/public/fonts/aller-light.ttf deleted file mode 100755 index c2c72902..00000000 Binary files a/doc/literate/public/fonts/aller-light.ttf and /dev/null differ diff --git a/doc/literate/public/fonts/aller-light.woff b/doc/literate/public/fonts/aller-light.woff deleted file mode 100755 index 81a09d18..00000000 Binary files a/doc/literate/public/fonts/aller-light.woff and /dev/null differ diff --git a/doc/literate/public/fonts/novecento-bold.eot b/doc/literate/public/fonts/novecento-bold.eot deleted file mode 100755 index 98a9a7fb..00000000 Binary files a/doc/literate/public/fonts/novecento-bold.eot and /dev/null differ diff --git a/doc/literate/public/fonts/novecento-bold.ttf b/doc/literate/public/fonts/novecento-bold.ttf deleted file mode 100755 index 2af39b08..00000000 Binary files a/doc/literate/public/fonts/novecento-bold.ttf and /dev/null differ diff --git a/doc/literate/public/fonts/novecento-bold.woff b/doc/literate/public/fonts/novecento-bold.woff deleted file mode 100755 index de558b5a..00000000 Binary files a/doc/literate/public/fonts/novecento-bold.woff and /dev/null differ diff --git a/doc/literate/public/stylesheets/normalize.css b/doc/literate/public/stylesheets/normalize.css deleted file mode 100644 index 73abb76f..00000000 --- a/doc/literate/public/stylesheets/normalize.css +++ /dev/null @@ -1,375 +0,0 @@ -/*! normalize.css v2.0.1 | MIT License | git.io/normalize */ - -/* ========================================================================== - HTML5 display definitions - ========================================================================== */ - -/* - * Corrects `block` display not defined in IE 8/9. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -nav, -section, -summary { - display: block; -} - -/* - * Corrects `inline-block` display not defined in IE 8/9. - */ - -audio, -canvas, -video { - display: inline-block; -} - -/* - * Prevents modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/* - * Addresses styling for `hidden` attribute not present in IE 8/9. - */ - -[hidden] { - display: none; -} - -/* ========================================================================== - Base - ========================================================================== */ - -/* - * 1. Sets default font family to sans-serif. - * 2. Prevents iOS text size adjust after orientation change, without disabling - * user zoom. - */ - -html { - font-family: sans-serif; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ - -ms-text-size-adjust: 100%; /* 2 */ -} - -/* - * Removes default margin. - */ - -body { - margin: 0; -} - -/* ========================================================================== - Links - ========================================================================== */ - -/* - * Addresses `outline` inconsistency between Chrome and other browsers. - */ - -a:focus { - outline: thin dotted; -} - -/* - * Improves readability when focused and also mouse hovered in all browsers. - */ - -a:active, -a:hover { - outline: 0; -} - -/* ========================================================================== - Typography - ========================================================================== */ - -/* - * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, - * Safari 5, and Chrome. - */ - -h1 { - font-size: 2em; -} - -/* - * Addresses styling not present in IE 8/9, Safari 5, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/* - * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/* - * Addresses styling not present in Safari 5 and Chrome. - */ - -dfn { - font-style: italic; -} - -/* - * Addresses styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - - -/* - * Corrects font family set oddly in Safari 5 and Chrome. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, serif; - font-size: 1em; -} - -/* - * Improves readability of pre-formatted text in all browsers. - */ - -pre { - white-space: pre; - white-space: pre-wrap; - word-wrap: break-word; -} - -/* - * Sets consistent quote types. - */ - -q { - quotes: "\201C" "\201D" "\2018" "\2019"; -} - -/* - * Addresses inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/* - * Prevents `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* ========================================================================== - Embedded content - ========================================================================== */ - -/* - * Removes border when inside `a` element in IE 8/9. - */ - -img { - border: 0; -} - -/* - * Corrects overflow displayed oddly in IE 9. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* ========================================================================== - Figures - ========================================================================== */ - -/* - * Addresses margin not present in IE 8/9 and Safari 5. - */ - -figure { - margin: 0; -} - -/* ========================================================================== - Forms - ========================================================================== */ - -/* - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/* - * 1. Corrects color not being inherited in IE 8/9. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/* - * 1. Corrects font family not being inherited in all browsers. - * 2. Corrects font size not being inherited in all browsers. - * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome - */ - -button, -input, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 2 */ - margin: 0; /* 3 */ -} - -/* - * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -button, -input { - line-height: normal; -} - -/* - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Corrects inability to style clickable `input` types in iOS. - * 3. Improves usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/* - * Re-set default cursor for disabled elements. - */ - -button[disabled], -input[disabled] { - cursor: default; -} - -/* - * 1. Addresses box sizing set to `content-box` in IE 8/9. - * 2. Removes excess padding in IE 8/9. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/* - * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. - * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome - * (include `-moz` to future-proof). - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; /* 2 */ - box-sizing: content-box; -} - -/* - * Removes inner padding and search cancel button in Safari 5 and Chrome - * on OS X. - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* - * Removes inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/* - * 1. Removes default vertical scrollbar in IE 8/9. - * 2. Improves readability and alignment in all browsers. - */ - -textarea { - overflow: auto; /* 1 */ - vertical-align: top; /* 2 */ -} - -/* ========================================================================== - Tables - ========================================================================== */ - -/* - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} \ No newline at end of file diff --git a/doc/literate/shocco b/doc/literate/shocco deleted file mode 100755 index f6ff25c5..00000000 --- a/doc/literate/shocco +++ /dev/null @@ -1,481 +0,0 @@ -#!/bin/sh -# **shocco** is a quick-and-dirty, literate-programming-style documentation -# generator written for and in __POSIX shell__. It borrows liberally from -# [Docco][do], the original Q&D literate-programming-style doc generator. -# -# `shocco(1)` reads shell scripts and produces annotated source documentation -# in HTML format. Comments are formatted with Markdown and presented -# alongside syntax highlighted code so as to give an annotation effect. This -# page is the result of running `shocco` against [its own source file][sh]. -# -# shocco is built with `make(1)` and installs under `/usr/local` by default: -# -# git clone git://github.com/rtomayko/shocco.git -# cd shocco -# make -# sudo make install -# # or just copy 'shocco' wherever you need it -# -# Once installed, the `shocco` program can be used to generate documentation -# for a shell script: -# -# shocco shocco.sh -# -# The generated HTML is written to `stdout`. -# -# [do]: http://jashkenas.github.com/docco/ -# [sh]: https://github.com/rtomayko/shocco/blob/master/shocco.sh#commit - -# Usage and Prerequisites -# ----------------------- - -# The most important line in any shell program. -set -e - -# There's a lot of different ways to do usage messages in shell scripts. -# This is my favorite: you write the usage message in a comment -- -# typically right after the shebang line -- *BUT*, use a special comment prefix -# like `#/` so that its easy to pull these lines out. -# -# This also illustrates one of shocco's corner features. Only comment lines -# padded with a space are considered documentation. A `#` followed by any -# other character is considered code. -# -#/ Usage: shocco [-t ] [<source>] -#/ Create literate-programming-style documentation for shell scripts. -#/ -#/ The shocco program reads a shell script from <source> and writes -#/ generated documentation in HTML format to stdout. When <source> is -#/ '-' or not specified, shocco reads from stdin. - -# This is the second part of the usage message technique: `grep` yourself -# for the usage message comment prefix and then cut off the first few -# characters so that everything lines up. -expr -- "$*" : ".*--help" >/dev/null && { - grep '^#/' <"$0" | cut -c4- - exit 0 -} - -# A custom title may be specified with the `-t` option. We use the filename -# as the title if none is given. -test "$1" = '-t' && { - title="$2" - shift;shift -} - -# Next argument should be the `<source>` file. Grab it, and use its basename -# as the title if none was given with the `-t` option. -file="$1" -: ${title:=$(basename "$file")} - -# These are replaced with the full paths to real utilities by the -# configure/make system. -MARKDOWN='/usr/bin/markdown_py' -PYGMENTIZE='/usr/bin/pygmentize' - -# On GNU systems, csplit doesn't elide empty files by default: -CSPLITARGS=$( (csplit --version 2>/dev/null | grep -i gnu >/dev/null) && echo "--elide-empty-files" || true ) - -# We're going to need a `markdown` command to run comments through. This can -# be [Gruber's `Markdown.pl`][md] (included in the shocco distribution) or -# Discount's super fast `markdown(1)` in C. Try to figure out if either are -# available and then bail if we can't find anything. -# -# [md]: http://daringfireball.net/projects/markdown/ -# [ds]: http://www.pell.portland.or.us/~orc/Code/discount/ -command -v "$MARKDOWN" >/dev/null || { - if command -v Markdown.pl >/dev/null - then alias markdown='Markdown.pl' - elif test -f "$(dirname $0)/Markdown.pl" - then alias markdown="perl $(dirname $0)/Markdown.pl" - else echo "$(basename $0): markdown command not found." 1>&2 - exit 1 - fi -} - -# Check that [Pygments][py] is installed for syntax highlighting. -# -# This is a fairly hefty prerequisite. Eventually, I'd like to fallback -# on a simple non-highlighting preformatter when Pygments isn't available. For -# now, just bail out if we can't find the `pygmentize` program. -# -# [py]: http://pygments.org/ -command -v "$PYGMENTIZE" >/dev/null || { - echo "$(basename $0): pygmentize command not found." 1>&2 - exit 1 -} - -# Work and Cleanup -# ---------------- - -# Make sure we have a `TMPDIR` set. The `:=` parameter expansion assigns -# the value if `TMPDIR` is unset or null. -: ${TMPDIR:=/tmp} - -# Create a temporary directory for doing work. Use `mktemp(1)` if -# available; but, since `mktemp(1)` is not POSIX specified, fallback on naive -# (and insecure) temp dir generation using the program's basename and pid. -: ${WORK:=$( - if command -v mktemp 1>/dev/null 2>&1 - then - mktemp -d "$TMPDIR/$(basename $0).XXXXXXXXXX" - else - dir="$TMPDIR/$(basename $0).$$" - mkdir "$dir" - echo "$dir" - fi - )} - -# We want to be absolutely sure we're not going to do something stupid like -# use `.` or `/` as a work dir. Better safe than sorry. -test -z "$WORK" -o "$WORK" = '/' && { - echo "$(basename $0): could not create a temp work dir." - exit 1 -} - -# We're about to create a ton of shit under our `$WORK` directory. Register -# an `EXIT` trap that cleans everything up. This guarantees we don't leave -# anything hanging around unless we're killed with a `SIGKILL`. -trap "rm -rf $WORK" 0 - -# Preformatting -# ------------- -# -# Start out by applying some light preformatting to the `<source>` file to -# make the code and doc formatting phases a bit easier. The result of this -# pipeline is written to a temp file under the `$WORK` directory so we can -# take a few passes over it. - -# Get a pipeline going with the `<source>` data. We write a single blank -# line at the end of the file to make sure we have an equal number of code/comment -# pairs. - -# Folding.el support: turn {{{ folds }}} into titles -jrml -(cat "$file" \ - | sed -e 's/^# {{{/# #/' -e 's/^# }}}.*/# --------------/' \ - | awk ' -/function.*\(\) {$/ { print "# ### " $2; print $0; next } -/\(\) {$/ { print "# ### " $1; print $0; next } -{print $0}' \ - && printf "\n\n# \n\n") | - -# We want the shebang line and any code preceding the first comment to -# appear as the first code block. This inverts the normal flow of things. -# Usually, we have comment text followed by code; in this case, we have -# code followed by comment text. -# -# Read the first code and docs headers and flip them so the first docs block -# comes before the first code block. -( - lineno=0 - codebuf=;codehead= - docsbuf=;docshead= - while read -r line - do - # Issue a warning if the first line of the script is not a shebang - # line. This can screw things up and wreck our attempt at - # flip-flopping the two headings. - lineno=$(( $lineno + 1 )) - test $lineno = 1 && ! expr "$line" : "#!.*" >/dev/null && - echo "$(basename $0): $(file):1 [warn] shebang! line missing." 1>&2 - - # Accumulate comment lines into `$docsbuf` and code lines into - # `$codebuf`. Only lines matching `/#(?: |$)/` are considered doc - # lines. - if expr "$line" : '# ' >/dev/null || test "$line" = "#" - then docsbuf="$docsbuf$line -" - else codebuf="$codebuf$line -" - fi - - # If we have stuff in both `$docsbuf` and `$codebuf`, it means - # we're at some kind of boundary. If `$codehead` isn't set, we're at - # the first comment/doc line, so store the buffer to `$codehead` and - # keep going. If `$codehead` *is* set, we've crossed into another code - # block and are ready to output both blocks and then straight pipe - # everything by `exec`'ing `cat`. - if test -n "$docsbuf" -a -n "$codebuf" - then - if test -n "$codehead" - then docshead="$docsbuf" - docsbuf="" - printf "%s" "$docshead" - printf "%s" "$codehead" - echo "$line" - exec cat - else codehead="$codebuf" - codebuf= - fi - fi - done - - # We made it to the end of the file without a single comment line, or - # there was only a single comment block ending the file. Output our - # docsbuf or a fake comment and then the codebuf or codehead. - echo "${docsbuf:-#}" - echo "${codebuf:-"$codehead"}" -) | - -# Remove comment leader text from all comment lines. Then prefix all -# comment lines with "DOCS" and interpreted / code lines with "CODE". -# The stream text might look like this after moving through the `sed` -# filters: -# -# CODE #!/bin/sh -# CODE #/ Usage: shocco <file> -# DOCS Docco for and in POSIX shell. -# CODE -# CODE PATH="/bin:/usr/bin" -# CODE -# DOCS Start by numbering all lines in the input file... -# ... -# -# Once we pass through `sed`, save this off in our work directory so -# we can take a few passes over it. -sed -n ' - s/^/:/ - s/^:[ ]\{0,\}# /DOCS /p - s/^:[ ]\{0,\}#$/DOCS /p - s/^:/CODE /p -' > "$WORK/raw" - -# Now that we've read and formatted our input file for further parsing, -# change into the work directory. The program will finish up in there. -cd "$WORK" - -# First Pass: Comment Formatting -# ------------------------------ - -# Start a pipeline going on our preformatted input. -# Replace all CODE lines with entirely blank lines. We're not interested -# in code right now, other than knowing where comments end and code begins -# and code begins and comments end. -sed 's/^CODE.*//' < raw | - -# Now squeeze multiple blank lines into a single blank line. -# -# __TODO:__ `cat -s` is not POSIX and doesn't squeeze lines on BSD. Use -# the sed line squeezing code mentioned in the POSIX `cat(1)` manual page -# instead. -cat -s | - -# At this point in the pipeline, our stream text looks something like this: -# -# DOCS Now that we've read and formatted ... -# DOCS change into the work directory. The rest ... -# DOCS in there. -# -# DOCS First Pass: Comment Formatting -# DOCS ------------------------------ -# -# Blank lines represent code segments. We want to replace all blank lines -# with a dividing marker and remove the "DOCS" prefix from docs lines. -sed ' - s/^$/##### DIVIDER/ - s/^DOCS //' | - -# The current stream text is suitable for input to `markdown(1)`. It takes -# our doc text with embedded `DIVIDER`s and outputs HTML. -$MARKDOWN | - -# Now this where shit starts to get a little crazy. We use `csplit(1)` to -# split the HTML into a bunch of individual files. The files are named -# as `docs0000`, `docs0001`, `docs0002`, ... Each file includes a single -# doc *section*. These files will sit here while we take a similar pass over -# the source code. -( - csplit -sk \ - $CSPLITARGS \ - -f docs \ - -n 4 \ - - '/<h5>DIVIDER<\/h5>/' '{9999}' \ - 2>/dev/null || - true -) - - -# Second Pass: Code Formatting -# ---------------------------- -# -# This is exactly like the first pass but we're focusing on code instead of -# comments. We use the same basic technique to separate the two and isolate -# the code blocks. - -# Get another pipeline going on our performatted input file. -# Replace DOCS lines with blank lines. -sed 's/^DOCS.*//' < raw | - -# Squeeze multiple blank lines into a single blank line. -cat -s | - -# Replace blank lines with a `DIVIDER` marker and remove prefix -# from `CODE` lines. -sed ' - s/^$/# DIVIDER/ - s/^CODE //' | - -# Now pass the code through `pygmentize` for syntax highlighting. We tell it -# the the input is `sh` and that we want HTML output. -$PYGMENTIZE -l sh -f html -O encoding=utf8 | - -# Post filter the pygments output to remove partial `<pre>` blocks. We add -# these back in at each section when we build the output document. -sed ' - s/<div class="highlight"><pre>// - s/^<\/pre><\/div>//' | - -# Again with the `csplit(1)`. Each code section is written to a separate -# file, this time with a `codeXXX` prefix. There should be the same number -# of `codeXXX` files as there are `docsXXX` files. -( - DIVIDER='/<span class="c"># DIVIDER</span>/' - csplit -sk \ - $CSPLITARGS \ - -f code \ - -n 4 - \ - "$DIVIDER" '{9999}' \ - 2>/dev/null || - true -) - -# At this point, we have separate files for each docs section and separate -# files for each code section. - -# HTML Template -# ------------- - -# Create a function for apply the standard [Docco][do] HTML layout, using -# [jashkenas][ja]'s gorgeous CSS for styles. Wrapping the layout in a function -# lets us apply it elsewhere simply by piping in a body. -# -# [ja]: http://github.com/jashkenas/ -# [do]: http://jashkenas.github.com/docco/ -layout () { - cat <<HTML -<!DOCTYPE html> -<html> -<head> - <meta http-equiv='content-type' content='text/html;charset=utf-8'> - <title>$1 - - - - - -
-
- - - - - - - - - - -

$1

$(cat)
-
- - -HTML -} - -# Recombining -# ----------- - -# Alright, we have separate files for each docs section and separate -# files for each code section. We've defined a function to wrap the -# results in the standard layout. All that's left to do now is put -# everything back together. - -# Before starting the pipeline, decide the order in which to present the -# files. If `code0000` is empty, it should appear first so the remaining -# files are presented `docs0000`, `code0001`, `docs0001`, and so on. If -# `code0000` is not empty, `docs0000` should appear first so the files -# are presented `docs0000`, `code0000`, `docs0001`, `code0001` and so on. -# -# Ultimately, this means that if `code0000` is empty, the `-r` option -# should not be provided with the final `-k` option group to `sort`(1) in -# the pipeline below. -if stat -c"%s" /dev/null >/dev/null 2>/dev/null ; then - # GNU stat - [ "$(stat -c"%s" "code0000")" = 0 ] && sortopt="" || sortopt="r" -else - # BSD stat - [ "$(stat -f"%z" "code0000")" = 0 ] && sortopt="" || sortopt="r" -fi - -# Start the pipeline with a simple list of split out temp filename. One file -# per line. -ls -1 docs[0-9]* code[0-9]* 2>/dev/null | - -# Now sort the list of files by the *number* first and then by the type. The -# list will look something like this when `sort(1)` is done with it: -# -# docs0000 -# code0000 -# docs0001 -# code0001 -# docs0002 -# code0002 -# ... -# -sort -n -k"1.5" -k"1.1$sortopt" | - -# And if we pass those files to `cat(1)` in that order, it concatenates them -# in exactly the way we need. `xargs(1)` reads from `stdin` and passes each -# line of input as a separate argument to the program given. -# -# We could also have written this as: -# -# cat $(ls -1 docs* code* | sort -n -k1.5 -k1.1r) -# -# I like to keep things to a simple flat pipeline when possible, hence the -# `xargs` approach. -xargs cat | - - -# Run a quick substitution on the embedded dividers to turn them into table -# rows and cells. This also wraps each code block in a `
` -# so that the CSS kicks in properly. -{ - DOCSDIVIDER='
DIVIDER
' - DOCSREPLACE='
' - CODEDIVIDER='# DIVIDER' - CODEREPLACE='
'
-    sed "
-        s@${DOCSDIVIDER}@${DOCSREPLACE}@
-        s@${CODEDIVIDER}@${CODEREPLACE}@
-    "
-}                                            |
-
-# Pipe our recombined HTML into the layout and let it write the result to
-# `stdout`.
-layout "$title"
-
-# More
-# ----
-#
-# **shocco** is the third tool in a growing family of quick-and-dirty,
-# literate-programming-style documentation generators:
-#
-#   * [Docco][do] - The original. Written in CoffeeScript and generates
-#     documentation for CoffeeScript, JavaScript, and Ruby.
-#   * [Rocco][ro] - A port of Docco to Ruby.
-#
-# If you like this sort of thing, you may also find interesting Knuth's
-# massive body of work on literate programming:
-#
-#   * [Knuth: Literate Programming][kn]
-#   * [Literate Programming on Wikipedia][wi]
-#
-# [ro]: http://rtomayko.github.com/rocco/
-# [do]: http://jashkenas.github.com/docco/
-# [kn]: http://www-cs-faculty.stanford.edu/~knuth/lp.html
-# [wi]: http://en.wikipedia.org/wiki/Literate_programming
-
-# Copyright (C) [Ryan Tomayko ](http://tomayko.com/about)
-# This is Free Software distributed under the MIT license. -: diff --git a/doc/tomb.1 b/doc/tomb.1 deleted file mode 100644 index 2fe888d6..00000000 --- a/doc/tomb.1 +++ /dev/null @@ -1,640 +0,0 @@ -.TH tomb 1 "Jun 25, 2023" "tomb" - -.SH NAME -Tomb \- the Crypto Undertaker - -.SH SYNOPSIS -.B -.IP "tomb [options] command [arguments]" - -.SH DESCRIPTION - -Tomb is an application to manage the creation and access of encrypted -storage files: it can be operated from commandline and it can -integrate with a user's graphical desktop. - -Tomb generates encrypted storage files to be opened and closed using -their associated keys, which are also protected with a password chosen -by the user. To create, open and close tombs a user will need super -user rights to execute the tomb commandline utility. - -A tomb is like a locked folder that can be safely transported and -hidden in a filesystem; it encourages users to keep their keys -separate from tombs, for instance keeping a tomb file on your computer -harddisk and its key file on a USB stick. - - -.SH COMMANDS - -.B -.IP "dig" -Generates a file that can be used as a tomb and will occupy as much -space as its desired initial size, the unlocked \fI.tomb\fR file can -then be locked using a \fIkey\fR. It takes a mandatory \fI-s\fR option -which is the size in megabytes (MiB). Tombs are digged using random -data gathered from a non-blocking source (/dev/urandom). For very -large tombs this may take up too much time and entropy, then it is -possible to use \fIfallocate(1)\fR being aware it does not pre-fill -with random data, decreasing the tomb's security. - -.B -.IP "forge" -Creates a new \fIkey\fR and prompts the user for a \fIpassword\fR to protect -its usage using symmetric encryption. This operation uses random data from a -non-blocking source (/dev/urandom) and it may take long only in some cases; to -switch using a blocking source the \fI--use-random\fR flag can be used. The -\fI-g\fR option switches on the use of a GPG key instead of a password -(asymmetric encryption), then the \fI-r\fR option indicates the recipient key; -more recipient GPG ids can be indicated (comma separated). The default cipher -to protect the key is AES256, a custom one can be specified using the \fI-o\fR -option, for a list of supported ciphers use \fI-v\fR. For additional protection -against dictionary attacks on keys, the \fI--kdf\fR option can be used when -forging a key, making sure that the binaries in \fIextras/kdf\fR were compiled -and installed on the system. - -.B -.IP "lock" -Initializes and locks an empty tomb (made with \fIdig\fR) using a key -(made with \fIforge\fR), making it ready for usage. After this -operation, the tomb can only be opened in possession of the key and -knowing its password. As in any other command requiring a key, the -option \fI-k\fR should be used to specify a key file; in case of -encryption to GPG recipients the \fI-g\fR flag should be used followed -by \fI-r\fR and the recipient's secret GPG key id. The \fI-o\fR -option can be used to specify the cipher specification: default is -"aes-xts-plain64", old versions of Tomb used "aes-cbc-essiv:sha256". -If you are looking for something exotic, also try -"serpent-xts-plain64". More options may be found in cryptsetup(8) and -Linux documentation. The \fI--filesystem\fR option can be used to -specify an alternative filesystem used to format the tomb, -in place of the default "ext4". This operation requires root -privileges to loopback mount, format the tomb (using LUKS and mkfs), -then set the key in its first LUKS slot. - -.RS -Supported filesystems for \fI--filesystem\fR: -.PD 0 -.IP "ext3" 15 -using operating system defaults -.IP "ext4" -using operating system defaults -.IP "btrfs" -for tombs >= 47MB using operating system defaults -.IP "btrfsmixedmode" -for tombs >=18MB btrfs mixed mode (see mkfs.btrfs(8)) -.IP "ext3maxinodes" -ext3 with a maximum of inodes (for many small files) -.IP "ext4maxinodes" -ext4 with a maximum of inodes (for many small files) -.PD -.RE - -.B -.IP "open" -Opens an existing \fItomb file\fR (first argument) using a key -(\fI-k\fR) which can also be hidden inside a \fIjpeg image\fR (see -\fIbury\fR/\fIexhume\fR) or a long text file -(see\fIcloak\fR/\fIuncloak\fR). If a second argument is given it will -indicate the \fImountpoint\fR where the tomb should be made -accessible, else the tomb is mounted in a directory inside /media (if -not available it uses /run/media/$USER). The option \fI-o\fR can be -used to pass mount(8) options (default: rw,noatime,nodev). The -\fI-g\fR option is needed when using GPG encryption to recipients. - -.B -.IP "list" -List all the tombs found open, including information about the time -they were opened and the hooks that they mounted. If the first -argument is present, then shows only the tomb named that way or -returns an error if it's not found. If the option -\fI--get-mountpoint\fR is used then print a simple list of currently -open tomb mountpoint paths. - -.B -.IP "ps" -List all the processes found running inside the tombs that are open, -printing out their PIDs and owners. This is useful to have an overview -of programs that are keeping the tombs busy and would eventually be -killed by the \fIslam\fR command. The lsof(8) utility is used -internally to enumerate processes running in one or all tombs. - -.B -.IP "index" -Creates or updates the search indexes of all tombs currently open: -enables use of the \fIsearch\fR command using simple word patterns on -file names. Indexes are created using mlocate/plocate's updatedb(8) and -swish-e(1) if they are found on the system. Indexes allow one to search -very fast for filenames and contents inside a tomb, they are stored -inside it and are not accessible if the Tomb is closed. To avoid -indexing a specific tomb simply touch a \fI.noindex\fR file in it. - -.B -.IP "search" -Takes any string as argument and searches for them through all tombs -currently open and previously indexed using the \fIindex\fR command. -The search matches filenames if mlocate/plocate is installed and then also -file contents if swish++ is present on the system, results are listed -on the console. - -.B -.IP "close" -Closes a currently open tomb. If more tombs are open, the first -argument should be used to specify the name of the tomb to be closed, -or \fIall\fR to close all currently open tombs. This command fails if -the tomb is in use by running processes (to force close, see -\fIslam\fR below). - -.B -.IP "slam" -Closes a tomb like the command \fIclose\fR does, but it doesn't fail -even if the tomb is in use by other application processes: it looks -for and closes each of them (in order: TERM, HUP, KILL). This command may -provoke unsaved data loss, but assists users to face surprise -situations. It requires \fIlsof\fR else it falls back to \fIclose\fR. - - -.B -.IP "passwd" -Changes the password protecting a key file specified using -\fI-k\fR. With keys encrypted for GPG recipients use \fI-g\fR followed -by \fI-r\fR to indicate the new recipient key, or a comma separated -list.. The user will need to know the key's current password, or -possess at least one of the current recipients GPG secret keys, -because the key contents will be decoded and reencoded using the new -passwords or keys. If the key file is broken (missing headers) this -function also attempts its recovery. - -.B -.IP "setkey" -Changes the key file that locks a tomb, substituting the old one with -a new one. Both the old and the new key files are needed for this -operation and their passwords or GPG recipient(s) secret keys must be -available. The new key must be specified using the \fI-k\fR option, -the first argument should be the old key and the second and last -argument the tomb file. Use the \fI-g\fR option to unlock the tomb -with a GPG key, the \fI-r\fR to indicate the recipient or a comma -separated list for more than one recipient. - -.B -.IP "resize" -Increase the size of a tomb file to the amount specified by the -\fI-s\fR option, which is the new size in megabytes (MiB). Full access -to the tomb using a key (\fI-k\fR) and its password is required. Tombs -can only grow and can never be made smaller. This command makes use of -the cryptsetup(8) resize feature and the resize2fs command: its much -more practical than creating a new tomb and moving everything into -it. There is no data-loss if a failure occurs during resize: the -command can be re-launched and the resize operation will complete. - -.B -.IP "engrave" -This command transforms a tomb key into an image that can be printed -on paper and physically stored as backup, i.e. hidden in a book. It -Renders a QRCode of the tomb key, still protected by its password: a -PNG image (extension \fI.qr.png\fR) will be created in the current -directory and can be later printed (fits an A4 or Letter format). To -recover an engraved key one can use any QRCode reader on a smartphone: -save it into a file and then use that file as a key (\fI-k\fR). - -.B -.IP "bury" -Hides a tomb key (\fI-k\fR) inside a \fIjpeg image\fR (first argument) -using \fIsteganography\fR: the image will change in a way that cannot -be noticed by human eye and hardly detected by data analysis. This -option is useful to backup tomb keys in unsuspected places; it depends -from the availability of \fIsteghide\fR. Use the \fI-g\fR flag and -\fI-r\fR option followed by recipient id to use GPG asymmetric -encryption. - -.B -.IP "exhume" -This command recovers from jpeg images the keys that were previously -hidden into them using \fIbury\fR. Exhume requires a key filename -(\fI-k\fR) and a \fIjpeg image\fR file (first argument) known to be -containing a key. If the right key password is given, the key will be -exhumed. If the password is not known, it is very hard to verify if a -key is buried in any image or not. - -.B -.IP "cloak" -Hides a tomb key (\fI-k\fR) inside a \fIlong plain-text file\fR (first -argument) using \fIsteganography\fR: the text will change in a way -that can hardly be noticed by human eye and hardly detected by data -analysis. This option is useful to backup tomb keys in unsuspected -places; it depends from the availability of \fIcloakify\fR and -consequently \fIpython2\fR. This function does not support asymmetric -encryption using the \fI-g\fR flag. - -.B -.IP "uncloak" -This command recovers from long plain-text files the keys that were -previously hidden into them using \fIcloak\fR. Cloak requires a key -filename (\fI-k\fR) and a \fIplain-text\fR file (first argument) known -to be containing a key. If the right key password is given, the key -will be exhumed. If the password is not known, it is quite hard to -verify if a key is buried in a text or not. - -.SH OPTIONS -.B -.B -.IP "-k \fI\fR" -For all operations requiring a key, this option specifies the location -of the key file to use. Arguments can also be \fIjpeg image\fR files -where keys have been hidden using the \fIbury\fR or \fIcloak\fR -commands, or text files retrieved from \fIengraved\fR QR codes. If the -\fIkeyfile\fR argument is "-" (dash), Tomb will read the key from -stdin (blocking). -.B -.IP "-n" -Skip processing of exec-hooks and bind-hooks if found inside the tomb. -See the \fIHOOKS\fR section in this manual for more information. -.B -.IP "-p" -When opening a tomb, preserves the ownership of all files and -directories contained in it. Normally the \fIopen\fR command changes -the ownership of a tomb's contents to the UID and GID of the user who -has successfully opened it: it is a usability feature in case a tomb is -used by a single user across different systems. This flag deactivates -this behaviour. -.B -.IP "-o" -Manually specify mount options to be used when opening a tomb instead -of the default \fIrw,noatime,nodev\fR, i.e. to mount a tomb read-only -(ro) to prevent any modification of its data. Can also be used to -change the symmetric encryption algorithm for keys during \fIforge\fR -operations (default \fIAES256\fR) or the LUKS encryption method during -\fIlock\fR operations (default \fIaes-xts-plain64\fR). -.B -.IP "-f" -Force flag, currently used to override swap checks, might be -overriding more wimpy behaviours in future, but make sure you know -what you are doing if you force an operation. -.B -.IP "-s \fI\fR" -When digging or resizing a tomb, this option must be used to specify -the \fIsize\fR of the new file to be created. Units are megabytes (MiB). -.B -.IP "-g" -Tell tomb to use a asymmetric GnuPG key encryption instead of a -symmetric passphrase to protect a tomb key. This option can be -followed by \fI-r\fR when the command needs to specify recipient(s). -.B -.IP "-r \fI[,]\fR" -Provide a new set of recipient(s) to encrypt a tomb key. \fIgpg_ids\fR -can be one or more GPG key ID, comma separated. All GPG keys must be -trusted keys in GPG. -.B -.IP "--kdf \fI\fR" -Activate the KDF feature against dictionary attacks when creating a key: forces -a delay of \fI\fR times every time this key is used. The actual time -to wait depends on the CPU speed (default) or the RAM size (argon2) of the -computer where the key is used. Using 5 or 10 is a sane amount for modern -computers, the value is multiplied by 1 million. -.B -.IP "--kdftype \fIargon2 | pbkdf2\fR" -Adopt the \fIargon2\fR algorithm for KDF, stressing the RAM capacity rather -than the CPU speed of the computer decrypting the tomb. Requires the -\fIargon2\fR binary by P-H-C to be installed, as packaged by most distros. -Default is \fIpbkdf2\fR. -.B -.IP "--kdfmem \fI\fR" -In case of \fIargon2\fR KDF algorithm, this value specifies the size of RAM -used: it consists of a number which is the elevated power of two in kilobytes. -Default is 18 which is 250 MiB (2^18 = 262,144 kilobytes). -.B -.IP "--sudo \fI\fR" -Select a different tool than sudo for privilege escalation. -Alternatives supported so far are: pkexec, doas, sup, sud. For any -alternative to work the executable must be included in the current -PATH. -.B -.IP "--sphx-user \fI\fR" -Activate the SPHINX feature for password-authenticated key agreement. -This option indicates the \fI\fR used to retrieve the -password from a sphinx oracle key reachable via TCP/IP. -.B -.IP "--sphx-host \fI\fR" -Activate the SPHINX feature for password-authenticated key agreement. -This option indicates the \fI\fR used to retrieve the password -from a sphinx oracle daemon reachable via TCP/IP. This is not the -network address of the daemon, which is configured in /etc/sphinx - -.B -.IP "-h" -Display a help text and quit. -.B -.IP "-v" -Display version and quit. -.B -.IP "-q" -Run more quietly -.B -.IP "-D" -Print more information while running, for debugging purposes - -.SH DEV MODE -.B -.IP "--no-color" -Suppress colors in console output (needed for string parsing by -wrappers). -.B -.IP "--unsafe" -Enable using dev-mode arguments, i.e. to pass passwords from -commandline options. This is mostly used needed for execution by -wrappers and testing suite. -.B -.IP "--use-random" -Use a blocking random source. Tomb uses by default /dev/urandom since -the non-blocking source of Linux kernel doesn't degrades the quality -of random. -.B -.IP "--tomb-pwd " -Use string as password when needed on tomb. -.B -.IP "--tomb-old-pwd " -Use string as old password when needed in tomb commands requiring -multiple keys, like \fIpasswd\fR or \fIsetkey\fR. -.B -.IP "-U" -Switch to this user ID when dropping privileges. -.B -.IP "-G" -Switch to this group ID when dropping privileges. -.B -.IP "-T" -Switch to this TTY terminal when dropping privileges. - -.SH HOOKS - -Hooks are special files that can be placed inside the tomb and trigger -actions when it is opened and closed; there are two kinds of such -files: \fIbind-hooks\fR and \fIexec-hooks\fR can be placed in the -base root of the tomb. - -.B -.IP "bind-hooks" -This hook file consists of a simple text file named \fIbind-hooks\fR -containing a two column list of paths to files or directories inside -the tomb. The files and directories will be made directly -accessible by the tomb \fIopen\fR command inside the current user's -home directory. Tomb uses internally the "mount \-o bind" command to -bind locations inside the tomb to locations found in $HOME. In the -first column are indicated paths relative to the tomb and in the -second column are indicated paths relative to $HOME contents, for -example: -.EX - mail mail - .gnupg .gnupg - .fmrc .fetchmailrc - .mozilla .mozilla -.EE - -.B -.IP "exec-hooks" -This hook file gets executed as user by tomb with the first argument -determining the step of execution (\fIopen\fR or \fIclose\fR) and the second -being the full path to the mountpoint. The \fIexec-hooks\fR file should be -executable (ELF or shell script) and present inside the Tomb. Tomb -executes this hook as user and adds the name, loopback device and -dev-mapper device paths as additional arguments for the \fIclose\fR -command. - -.SH PRIVILEGE ESCALATION - -The tomb commandline tool needs to acquire super user rights to -execute most of its operations: so it uses sudo(8) or other configured -tools, while pinentry(1) is adopted to collect passwords from the -user. Tomb executes as super user only when required. - -To be made available on multi user systems, the superuser execution of -the tomb script can be authorized for users without jeopardizing the -whole system's security: just add such a line to \fI/etc/sudoers\fR: - -.EX - username ALL=NOPASSWD: /usr/local/bin/tomb -.EE - -To avoid that tomb execution is logged by \fIsyslog\fR also add: - -.EX - Cmnd_Alias TOMB = /usr/local/bin/tomb - Defaults!TOMB !syslog -.EE - -.SH PASSWORD INPUT - -Password input is handled by the pinentry program: it can be text -based or graphical and is usually configured with a symlink. When -using Tomb in X11 it is better to use a graphical pinentry-gtk2 or -pinentry-qt because it helps preventing keylogging by other X -clients. When using it from a remote ssh connection it might be -necessary to force use of pinentry-curses for instance by unsetting -the DISPLAY environment var. - - -.SH SWAP - -On execution of certain commands Tomb will complain about swap memory -on disk when present and \fIabort if your system has swap -activated\fR. You can disable this behaviour using the -\fI--force\fR. Before doing that, however, you may be interested in -knowing the risks of doing so: -.IP \(bu -During such operations a lack of available memory could cause the swap -to write your secret key on the disk. -.IP \(bu -Even while using an opened tomb, another application could occupy too -much memory so that the swap needs to be used, this way it is possible -that some contents of files contained into the tomb are physically -written on your disk, not encrypted. -.P - -If you don't need swap, execute \fI swapoff -a\fR. If you really need -it, you could make an encrypted swap partition. Tomb doesn't detect if -your swap is encrypted, and will complain anyway. - -.SH DENIABILITY - -The possibility to have an encrypted volume which is invisible and -cannot be detected is called "deniability". The cryptographic layer of -the device mapper in Linux (dm-crypt) does not implement -deniability. Tomb is just a wrapper on top of that and it doesn't add -cryptographic deniability. However a certain way of using tomb can -facilitate a weak sort of deniability outside of the scenario of -seized devices and forensic analysis of files and blocks on disc. - -For instance to eliminate any trace of tomb usage from the shell -history ZSh users can activate the "HISTIGNORESPACE" feature and -prefix all invocations of tomb with a blank space, including two lines -in ".zshrc": - -.EX - export HISTIGNORESPACE=1 - alias tomb=' tomb' -.EE - -.SH PASSWORD INPUT - -Tomb uses the external program "pinentry" to let users type the key password -into a terminal or a graphical window. This program works in conjunction with -"gpg-agent", a daemon running in background to facilitate secret key -management with gpg. It is recommended one runs "gpg-agent" launching it from -the X session initialization ("~/.xsession" or "~/.xinitrc" files) with this -command: - -.EX - eval $(gpg-agent --daemon --write-env-file "${HOME}/.gpg-agent-info") -.EE - -In the future it may become mandatory to run gpg-agent when using tomb. - -.SH SHARE A TOMB -A tomb key can be encrypted with more than one recipient. Therefore, a -tomb can be shared between different users. The recipients are given -using the \fI-r\fR (or/and \fI-R\fR) option and if multiple each GPG -key ID must be separated by a comma (\fI,\fR). Sharing a tomb is a -very sensitive action and the user needs to trust that all the GPG -public keys used are kept safe. If one of them its stolen or lost, it -will be always possible to use it to access the tomb key unless all -its copies are destroyed. The \fI-r\fR option can be used in the tomb -commands: \fIopen\fR, \fIforge\fR \fIsetkey\fR, \fIpasswd\fR, -\fIbury\fR, \fIexhume\fR and \fIresize\fR. - -.SH SPHINX (PAKE) - -Using the package libsphinx -.UR https://github.com/stef/libsphinx -.UE -and its python client/daemon implementation pwdsphinx -.UR https://github.com/stef/pwdsphinx -.UE -is possible to store and retrieve safely the password that locks the -tomb. Using this feature will make it impossible to retrieve the -password without the oracle sphinx server running and reachable. Each -key entry needs a username and a domain specified on creation and -a password that locks it. - -SPHINX makes it impossible to maliciously retrieve the password -locking the tomb key without an attacker accessing both the -server, the sphinx password and the tomb key file. - -.SH EXAMPLES - -.IP \(bu -Create a 128MB large "secret" tomb and its keys, then open it: - -.EX - tomb dig -s 128 secret.tomb - - tomb forge secret.tomb.key - - tomb lock secret.tomb -k secret.tomb.key - - tomb open secret.tomb -k secret.tomb.key -.EE - -.IP \(bu -Open a Tomb using the key from a remote SSH shell, without saving any -local copy of it: - -.EX - ssh user@my.shell.net 'cat .secrets/tomb.key' | tomb open secret.tomb -k - -.EE - -.IP \(bu -Open a Tomb on a remote server passing the unencrypted local key on stdin via SSH, -without saving any remote copy of it: - -.EX - gpg -d .secrets/tomb.key | ssh server tomb open secret.tomb -k cleartext --unsafe -.EE - -.IP \(bu -Create a bind hook that places your GnuPG folder inside the tomb, but -makes it reachable from the standard $HOME/.gnupg location every time -the tomb will be opened: - -.EX - tomb open GPG.tomb -k GPG.tomb.key - echo ".gnupg .gnupg" > /media/GPG.tomb/bind-hooks - mv ~/.gnupg /media/GPG.tomb/.gnupg && mkdir ~/.gnupg - tomb close GPG && tomb open GPG.tomb -k GPG.tomb.key -.EE - -.IP \(bu -Script a tomb to launch the Firefox browser every time is opened, -keeping all its profile data inside it: - -.EX - tomb open FOX.tomb -k FOX.tomb.key - cat < /media/FOX.tomb/exec-hooks -#!/bin/sh -if [ "$1" = "open" ]; then - firefox -no-remote -profile "$2"/firefox-pro & -fi -EOF - chmod +x /media/FOX.tomb/exec-hooks - mkdir /media/FOX.tomb/firefox-pro -.EE - -.IP \(bu -Script a tomb to archive Pictures using Shotwell, launching it on open: - -.EX - tomb open Pictures.tomb -k Pictures.tomb.key - cat < /media/Pictures.tomb/bind-hooks -Pictures Pictures -EOF - cat < /media/Pictures.tomb/exec-hooks -#!/bin/sh -if [ "$1" = "open" ]; then - which shotwell > /dev/null - if [ "$?" = "0" ]; then - shotwell -d "$2"/Pictures/.shotwell & - fi -fi -EOF - chmod +x /media/Pictures.tomb/exec-hooks -.EE - -.SH BUGS -Please report bugs on the Github issue tracker at -.UR https://github.com/dyne/Tomb/issues -.UE - -One can also try to get in touch with developers via the #dyne chat -channel on \fIhttps://irc.dyne.org\fR. - -.SH COPYING - -This manual is Copyright (c) 2011-2021 by Denis Roio <\fIjaromil@dyne.org\fR> - -This manual includes contributions by Boyska and Hellekin O. Wolf. - -Permission is granted to copy, distribute and/or modify this manual -under the terms of the GNU Free Documentation License, Version 1.1 or -any later version published by the Free Software Foundation. -Permission is granted to make and distribute verbatim copies of this -manual page provided the above copyright notice and this permission -notice are preserved on all copies. - -.SH AVAILABILITY - -The most recent version of Tomb sourcecode and up to date -documentation is available for download from its website on -\fIhttps://tomb.dyne.org\fR. - -.SH SEE ALSO - -.B -.IP cryptsetup(8) -.B -.IP pinentry(1) -.B -.IP gpg-agent(1) - -GnuPG website: https://www.gnupg.org - -DM-Crypt website: https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt - -LUKS website: https://gitlab.com/cryptsetup/cryptsetup/wikis/home diff --git a/doc/tomb_manpage.pdf b/doc/tomb_manpage.pdf deleted file mode 100644 index 7707c265..00000000 Binary files a/doc/tomb_manpage.pdf and /dev/null differ diff --git a/extras/HACKING.txt b/extras/HACKING.txt deleted file mode 100644 index ca87184f..00000000 --- a/extras/HACKING.txt +++ /dev/null @@ -1,12 +0,0 @@ -### Code organization: -* tomblib: a library that wraps on tomb. Meant to be used by various scripts, and every UI -* qt / wx / whatever: directory for different gui implementations - -### QT project: - -status: only create wizard -the graphical part is done through create.ui, which can be edited by designer - -The UI should be (if possible) completely autocontained in this .ui file, and no code (or very few) should be added to make it work. -* ATM, some code has been added for the "password don't match" part. -* Some code need to be added to make the filedialog work diff --git a/extras/PYTHON.md b/extras/PYTHON.md deleted file mode 100644 index 6b54fb4b..00000000 --- a/extras/PYTHON.md +++ /dev/null @@ -1,73 +0,0 @@ -Tomber: a Python wrapper for Tomb -================================= - -Found in [extras/tomber](/extras/tomber) - -Description ------------ - -Tomber is a python wrapper for [Tomb](https://github.com/dyne/Tomb). -It relies on Python's subprocess module for Tomb command execution. - -Please note that for future compatibility with Tomb, using subprocess -execution of the tomb script is the recommended way to wrap its -functionalities in other languages. - -Tomber is still under development. Any contributions are greatly -welcomed here or on its original repository -https://github.com/reiven/tomber - - -Installation ----------- - -First of all Tomb must be installed. Refer to [INSTALL](/INSTALL.md) - -Then Tomber can be installed from -[PyPi](https://pypi.python.org/pypi) using -[pip](https://pypi.python.org/pypi/pip). - -Enter the following command in a terminal: - - pip install tomber - -Alternatively you can install it from this source repository - - -Example usage -------------- -```python -from tomber import * - -# dig a tomb of 20mb -tdig('test.tomb',20) - -# forge a key -tforge('test.key', 'this is the passphrase for the key') - -# lock the tomb -tlock('test.tomb', 'test.key', 'this is the passphrase for the key') - -# open the tomb -topen('test.tomb', 'test.key', 'this is the passphrase for the key', '/tmp/tomb') - -# close the tomb -tclose('test') -``` - -Running tests -------------- - -Keep in mind that the included *test.py* file execute the -`Tomb.slam()` command which will likely close any tombs, encrypted -volumes, you may have open. - - -License -------- - -Tomber is Copyright (c) 2014 by Federico Cardoso - -This package is distributed under BSD License. - -See [LICENSE](https://github.com/reiven/pynientos/blob/master/LICENSE) diff --git a/extras/android/README.txt b/extras/android/README.txt deleted file mode 100644 index f201eeb8..00000000 --- a/extras/android/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -This is an experimental port of Tomb to Android platform - -REQUIRES ROOT - see on-line docs on how to root Android. - -This includes a static binary of cryptsetup to interact with the -dm-crypt Linux API for filesystem cryptography (ELF for ARMv6) - -Tombs can be created and opened correctly - -Only aes-cbc-essiv:sha254 crypto algo is supported. - -At the moment tombs cannot be closed. -One has to reboot the device for that. - -Other functions have not been tested. - -More than ever, this is provided WITHOUT ANY WARRANTY - diff --git a/extras/android/tomb b/extras/android/tomb deleted file mode 100755 index 18c726c2..00000000 --- a/extras/android/tomb +++ /dev/null @@ -1,2760 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/zsh -# -# Tomb, the Crypto Undertaker -# -# A commandline tool to easily operate encryption of secret data -# - -# {{{ License - -# Copyright (C) 2007-2016 Dyne.org Foundation -# -# Tomb is designed, written and maintained by Denis Roio -# -# With contributions by Anathema, Boyska, Hellekin O. Wolf and GDrooid -# -# Gettext internationalization and Spanish translation is contributed by -# GDrooid, French translation by Hellekin, Russian translation by fsLeg, -# German translation by x3nu. -# -# Testing, reviews and documentation are contributed by Dreamer, Shining -# the Translucent, Mancausoft, Asbesto Molesto, Nignux, Vlax, The Grugq, -# Reiven, GDrooid, Alphazo, Brian May, TheJH, fsLeg, JoelMon and the -# Linux Action Show! -# -# Tomb's artwork is contributed by Jordi aka Mon Mort and Logan VanCuren. -# -# Cryptsetup was developed by Christophe Saout and Clemens Fruhwirth. - -# This source code is free software; you can redistribute it and/or -# modify it under the terms of the GNU Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This source code 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. Please refer -# to the GNU Public License for more details. -# -# You should have received a copy of the GNU Public License along with -# this source code; if not, write to: Free Software Foundation, Inc., -# 675 Mass Ave, Cambridge, MA 02139, USA. - -# }}} - License - -# {{{ Global variables - -typeset VERSION="2.2-android" -typeset DATE="Jan/2016" -typeset TOMBEXEC=$0 -typeset TMPPREFIX=${TMPPREFIX:-/tmp} -# TODO: configure which tmp dir to use from a cli flag - -# Tomb is using some global variables set by the shell: -# TMPPREFIX, UID, GID, PATH, TTY, USERNAME -# You can grep 'global variable' to see where they are used. - -# Keep a reference of the original command line arguments -typeset -a OLDARGS -for arg in "${(@)argv}"; do OLDARGS+=("$arg"); done - -# Special command requirements -typeset -a DD WIPE PINENTRY -DD=(dd) -WIPE=(rm -f) -PINENTRY=(pinentry) - -# load zsh regex module -#zmodload zsh/regex -#zmodload zsh/mapfile -#zmodload -F zsh/stat b:zstat - -# make sure variables aren't exported -unsetopt allexport - -# Flag optional commands if available (see _ensure_dependencies()) -typeset -i KDF=1 -typeset -i STEGHIDE=1 -typeset -i RESIZER=1 -typeset -i SWISH=1 -typeset -i QRENCODE=1 - -# Default mount options -typeset MOUNTOPTS="rw,noatime,nodev" - -# Makes glob matching case insensitive -unsetopt CASE_MATCH - -typeset -AH OPTS # Command line options (see main()) - -# Tomb context (see _plot()) -typeset -H TOMBPATH # Full path to the tomb -typeset -H TOMBDIR # Directory where the tomb is -typeset -H TOMBFILE # File name of the tomb -typeset -H TOMBNAME # Name of the tomb - -# Tomb secrets -typeset -H TOMBKEY # Encrypted key contents (see forge_key(), recover_key()) -typeset -H TOMBKEYFILE # Key file (ditto) -typeset -H TOMBSECRET # Raw deciphered key (see forge_key(), gpg_decrypt()) -typeset -H TOMBPASSWORD # Raw tomb passphrase (see gen_key(), ask_key_password()) -typeset -H TOMBTMP # Filename of secure temp just created (see _tmp_create()) - -typeset -aH TOMBTMPFILES # Keep track of temporary files -typeset -aH TOMBLOOPDEVS # Keep track of used loop devices - -# Make sure sbin is in PATH (man zshparam) -path+=( /sbin /usr/sbin ) - -# For gettext -export TEXTDOMAIN=tomb - -# }}} - -# {{{ Safety functions - -# Wrap sudo with a more visible message -_sudo() { su -c "${@}" } - -# Cleanup anything sensitive before exiting. -_endgame() { - - # Prepare some random material to overwrite vars - local rr="$RANDOM" - while [[ ${#rr} -lt 500 ]]; do - rr+="$RANDOM" - done - - # Ensure no information is left in unallocated memory - TOMBPATH="$rr"; unset TOMBPATH - TOMBDIR="$rr"; unset TOMBDIR - TOMBFILE="$rr"; unset TOMBFILE - TOMBNAME="$rr"; unset TOMBNAME - TOMBKEY="$rr"; unset TOMBKEY - TOMBKEYFILE="$rr"; unset TOMBKEYFILE - TOMBSECRET="$rr"; unset TOMBSECRET - TOMBPASSWORD="$rr"; unset TOMBPASSWORD - - # Clear temporary files - for f in $TOMBTMPFILES; do - ${=WIPE} "$f" - done - unset TOMBTMPFILES - - # Detach loop devices - for l in $TOMBLOOPDEVS; do - _sudo losetup -d "$l" - done - unset TOMBLOOPDEVS - -} - -# Trap functions for the _endgame event -TRAPINT() { _endgame INT } -TRAPEXIT() { _endgame EXIT } -TRAPHUP() { _endgame HUP } -TRAPQUIT() { _endgame QUIT } -TRAPABRT() { _endgame ABORT } -TRAPKILL() { _endgame KILL } -TRAPPIPE() { _endgame PIPE } -TRAPTERM() { _endgame TERM } -TRAPSTOP() { _endgame STOP } - -_cat() { cat } - -_is_found() { - # returns 0 if binary is found in path - [[ "$1" = "" ]] && return 1 - command -v "$1" 1>/dev/null 2>/dev/null - return $? -} - -# Define sepulture's plot (setup tomb-related arguments) -# Synopsis: _plot /path/to/the.tomb -# Set TOMB{PATH,DIR,FILE,NAME} -_plot() { - - # We set global variables - typeset -g TOMBPATH TOMBDIR TOMBFILE TOMBNAME - - TOMBPATH="$1" - - TOMBDIR=$(dirname $TOMBPATH) - - TOMBFILE=$(basename $TOMBPATH) - - # The tomb name is TOMBFILE without an extension. - # It can start with dots: ..foo.tomb -> ..foo - TOMBNAME="${TOMBFILE%\.[^\.]*}" - [[ -z $TOMBNAME ]] && { - _failure "Tomb won't work without a TOMBNAME." } - -} - -# Provide a random filename in shared memory -_tmp_create() { - [[ -d "$TMPPREFIX" ]] || { - # we create the tempdir with the sticky bit on - _sudo mkdir -m 1777 "$TMPPREFIX" - [[ $? == 0 ]] || _failure "Fatal error creating the temporary directory: ::1 temp dir::" "$TMPPREFIX" - } - - # We're going to add one more $RANDOM for each time someone complains - # about this being too weak of a random. - tfile="${TMPPREFIX}/$RANDOM$RANDOM$RANDOM$RANDOM" # Temporary file - umask 066 - [[ $? == 0 ]] || { - _failure "Fatal error setting the permission umask for temporary files" } - - [[ -r "$tfile" ]] && { - _failure "Someone is messing up with us trying to hijack temporary files." } - - touch "$tfile" - [[ $? == 0 ]] || { - _failure "Fatal error creating a temporary file: ::1 temp file::" "$tfile" } - - _verbose "Created tempfile: ::1 temp file::" "$tfile" - TOMBTMP="$tfile" - TOMBTMPFILES+=("$tfile") - - return 0 -} - -# Check if a *block* device is encrypted -# Synopsis: _is_encrypted_block /path/to/block/device -# Return 0 if it is an encrypted block device -_is_encrypted_block() { - local b=$1 # Path to a block device - local s="" # lsblk option -s (if available) - - # Issue #163 - # lsblk --inverse appeared in util-linux 2.22 - # but --version is not consistent... - lsblk --help | grep -Fq -- --inverse - [[ $? -eq 0 ]] && s="--inverse" - - sudo lsblk $s -o type -n $b 2>/dev/null \ - | egrep -q '^crypt$' - - return $? -} - -# Check if swap is activated -# Return 0 if NO swap is used, 1 if swap is used. -# Return 1 if any of the swaps is not encrypted. -# Return 2 if swap(s) is(are) used, but ALL encrypted. -# Use _check_swap in functions. It will call this function and -# exit if unsafe swap is present. -_ensure_safe_swap() { - - local -i r=1 # Return code: 0 no swap, 1 unsafe swap, 2 encrypted - local -a swaps # List of swap partitions - local bone is_crypt - - swaps="$(awk '/^\// { print $1 }' /proc/swaps 2>/dev/null)" - [[ -z "$swaps" ]] && return 0 # No swap partition is active - - _message "An active swap partition is detected..." - for s in $=swaps; do - { _is_encrypted_block $s } && { r=2 } || { - # We're dealing with unencrypted stuff. - # Maybe it lives on an encrypted filesystem anyway. - # @todo: verify it's actually on an encrypted FS (see #163 and !189) - # Well, no: bail out. - r=1; break - } - done - - if [[ $r -eq 2 ]]; then - _success "All your swaps are belong to crypt. Good." - else - _warning "This poses a security risk." - _warning "You can deactivate all swap partitions using the command:" - _warning " swapoff -a" - _warning "[#163] I may not detect plain swaps on an encrypted volume." - _warning "But if you want to proceed like this, use the -f (force) flag." - fi - return $r - -} - -# Wrapper to allow encrypted swap and remind the user about possible -# data leaks to disk if swap is on, which shouldn't be ignored. It could -# be run once in main(), but as swap evolves, it's better to run it -# whenever swap may be needed. -# Exit if unencrypted swap is active on the system. -_check_swap() { - if ! option_is_set -f && ! option_is_set --ignore-swap; then - _ensure_safe_swap - case $? in - 0|2) # No, or encrypted swap - return 0 - ;; - *) # Unencrypted swap - _failure "Operation aborted." - ;; - esac - fi -} - -# Ask user for a password -# Wraps around the pinentry command, from the GnuPG project, as it -# provides better security and conveniently use the right toolkit. -ask_password() { - - local description="$1" - local title="${2:-Enter tomb password.}" - local output - local password - local gtkrc - local theme - - # Distributions have broken wrappers for pinentry: they do - # implement fallback, but they disrupt the output somehow. We are - # better off relying on less intermediaries, so we implement our - # own fallback mechanisms. Pinentry supported: curses, gtk-2, qt4 - # and x11. - - # make sure LANG is set, default to C - LANG=${LANG:-C} - - _verbose "asking password with tty=$TTY lc-ctype=$LANG" - - if [[ "$DISPLAY" = "" ]]; then - - if _is_found "pinentry-curses"; then - _verbose "using pinentry-curses" - output=`cat <> $HOME/.tomb/mtab -} - -# Check if a filename is a valid tomb -is_valid_tomb() { - _verbose "is_valid_tomb ::1 tomb file::" $1 - - # First argument must be the path to a tomb - [[ -z "$1" ]] && { - _failure "Tomb file is missing from arguments." } - - _fail=0 - # Tomb file must be a readable, writable, non-empty regular file. - [[ ! -w "$1" ]] && { - _warning "Tomb file is not writable: ::1 tomb file::" $1 - _fail=1 - } - [[ ! -f "$1" ]] && { - _warning "Tomb file is not a regular file: ::1 tomb file::" $1 - _fail=1 - } - [[ ! -s "$1" ]] && { - _warning "Tomb file is empty (zero length): ::1 tomb file::" $1 - _fail=1 - } - - [[ $_fail = 1 ]] && { - _failure "Tomb command failed: ::1 command name::" $subcommand - } - - # TODO: split the rest of that function out. - # We already have a valid tomb, now we're checking - # whether we can alter it. - - # Tomb file may be a LUKS FS (or we are creating it) - file $1 | grep "luks encrypted file" || { - _warning "File is not yet a tomb: ::1 tomb file::" $1 } - - _plot $1 # Set TOMB{PATH,DIR,FILE,NAME} - - # Tomb already mounted (or we cannot alter it) - mount_list | grep "${TOMBFILE}.*\[$TOMBNAME\]$" && { - _failure "Tomb is currently in use: ::1 tomb name::" $TOMBNAME - } - - _message "Valid tomb file found: ::1 tomb path::" $TOMBPATH - - return 0 -} - -# $1 is the tomb file to be lomounted -lo_mount() { - tpath="$1" - - # TODO: Android always reports loop0 as next - # we need to implement our own loop table - - # check if we have support for loop mounting - _nstloop=`losetup -f` - [[ $? = 0 ]] || { - _warning "Loop mount of volumes is not possible on this machine, this error" - _warning "often occurs on VPS and kernels that don't provide the loop module." - _warning "It is impossible to use Tomb on this machine at this conditions." - _failure "Operation aborted." - } - - _sudo losetup -f "$tpath" # allocates the next loopback for our file - - TOMBLOOPDEVS+=("$_nstloop") # add to array of lodevs used - - return 0 -} - -# print out latest loopback mounted -lo_new() { print - "${TOMBLOOPDEVS[${#TOMBLOOPDEVS}]}" } - -# $1 is the path to the lodev to be preserved after quit -lo_preserve() { - _verbose "lo_preserve on ::1 path::" $1 - # remove the lodev from the tomb_lodevs array - TOMBLOOPDEVS=("${(@)TOMBLOOPDEVS:#$1}") -} - -# eventually used for debugging -dump_secrets() { - print "TOMBPATH: $TOMBPATH" - print "TOMBNAME: $TOMBNAME" - - print "TOMBKEY len: ${#TOMBKEY}" - print "TOMBKEYFILE: $TOMBKEYFILE" - print "TOMBSECRET len: ${#TOMBSECRET}" - print "TOMBPASSWORD: $TOMBPASSWORD" - - print "TOMBTMPFILES: ${(@)TOMBTMPFILES}" - print "TOMBLOOPDEVS: ${(@)TOMBLOOPDEVS}" -} - -# }}} - -# {{{ Commandline interaction - -usage() { - _print "Syntax: tomb [options] command [arguments]" - _print "\000" - _print "Commands:" - _print "\000" - _print " // Creation:" - _print " dig create a new empty TOMB file of size -s in MiB" - _print " forge create a new KEY file and set its password" - _print " lock installs a lock on a TOMB to use it with KEY" - _print "\000" - _print " // Operations on tombs:" - _print " open open an existing TOMB (-k KEY file or - for stdin)" - _print " index update the search indexes of tombs" - _print " search looks for filenames matching text patterns" - _print " list list of open TOMBs and information on them" - _print " close close a specific TOMB (or 'all')" - _print " slam slam a TOMB killing all programs using it" - [[ $RESIZER == 1 ]] && { - _print " resize resize a TOMB to a new size -s (can only grow)" - } - _print "\000" - _print " // Operations on keys:" - _print " passwd change the password of a KEY (needs old pass)" - _print " setkey change the KEY locking a TOMB (needs old key and pass)" - _print "\000" - [[ $QRENCODE == 1 ]] && { - _print " // Backup on paper:" - _print " engrave makes a QR code of a KEY to be saved on paper" - } - _print "\000" - [[ $STEGHIDE == 1 ]] && { - _print " // Steganography:" - _print " bury hide a KEY inside a JPEG image (for use with -k)" - _print " exhume extract a KEY from a JPEG image (prints to stdout)" - } - _print "\000" - _print "Options:" - _print "\000" - _print " -s size of the tomb file when creating/resizing one (in MiB)" - _print " -k path to the key to be used ('-k -' to read from stdin)" - _print " -n don't process the hooks found in tomb" - _print " -o options passed to commands: open, lock, forge (see man)" - _print " -f force operation (i.e. even if swap is active)" - [[ $KDF == 1 ]] && { - _print " --kdf forge keys armored against dictionary attacks" - } - - _print "\000" - _print " -h print this help" - _print " -v print version, license and list of available ciphers" - _print " -q run quietly without printing informations" - _print " -D print debugging information at runtime" - _print "\000" - _print "For more informations on Tomb read the manual: man tomb" - _print "Please report bugs on ." -} - - -# Check whether a commandline option is set. -# -# Synopsis: option_is_set -flag [out] -# -# First argument is the commandline flag (e.g., "-s"). -# If the second argument is present and set to 'out', print out the -# result: either 'set' or 'unset' (useful for if conditions). -# -# Return 0 if is set, 1 otherwise -option_is_set() { - local -i r # the return code (0 = set, 1 = unset) - - [[ -n ${(k)OPTS[$1]} ]]; - r=$? - - [[ $2 == "out" ]] && { - [[ $r == 0 ]] && { print 'set' } || { print 'unset' } - } - - return $r; -} - -# Print the option value matching the given flag -# Unique argument is the commandline flag (e.g., "-s"). -option_value() { - print -n - "${OPTS[$1]}" -} - -# Messaging function with pretty coloring -function _msg() { - local msg="$2" - command -v gettext 1>/dev/null 2>/dev/null && msg="$(gettext -s "$2")" - for i in $(seq 3 ${#}); - do - msg=${(S)msg//::$(($i - 2))*::/$*[$i]} - done - - local command="print -P" - local progname="$fg[magenta]${TOMBEXEC##*/}$reset_color" - local message="$fg_bold[normal]$fg_no_bold[normal]$msg$reset_color" - local -i returncode - - case "$1" in - inline) - command+=" -n"; pchars=" > "; pcolor="yellow" - ;; - message) - pchars=" . "; pcolor="white"; message="$fg_no_bold[$pcolor]$msg$reset_color" - ;; - verbose) - pchars="[D]"; pcolor="blue" - ;; - success) - pchars="(*)"; pcolor="green"; message="$fg_no_bold[$pcolor]$msg$reset_color" - ;; - warning) - pchars="[W]"; pcolor="yellow"; message="$fg_no_bold[$pcolor]$msg$reset_color" - ;; - failure) - pchars="[E]"; pcolor="red"; message="$fg_no_bold[$pcolor]$msg$reset_color" - returncode=1 - ;; - print) - progname="" - ;; - *) - pchars="[F]"; pcolor="red" - message="Developer oops! Usage: _msg MESSAGE_TYPE \"MESSAGE_CONTENT\"" - returncode=127 - ;; - esac - ${=command} "${progname} $fg_bold[$pcolor]$pchars$reset_color ${message}$color[reset_color]" >&2 - return $returncode -} - -function _message say() { - local notice="message" - [[ "$1" = "-n" ]] && shift && notice="inline" - option_is_set -q || _msg "$notice" $@ - return 0 -} - -function _verbose xxx() { - option_is_set -D && _msg verbose $@ - return 0 -} - -function _success yes() { - option_is_set -q || _msg success $@ - return 0 -} - -function _warning no() { - option_is_set -q || _msg warning $@ - return 1 -} - -function _failure die() { - typeset -i exitcode=${exitv:-1} - option_is_set -q || _msg failure $@ - # be sure we forget the secrets we were told - exit $exitcode -} - -function _print() { - option_is_set -q || _msg print $@ - return 0 -} - -_list_optional_tools() { - typeset -a _deps - _deps=(gettext dcfldd wipe steghide) - _deps+=(resize2fs tomb-kdb-pbkdf2 qrencode swish-e unoconv) - for d in $_deps; do - _print "`which $d`" - done - return 0 -} - - -# Check program dependencies -# -# Tomb depends on system utilities that must be present, and other -# functionality that can be provided by various programs according to -# what's available on the system. If some required commands are -# missing, bail out. -_ensure_dependencies() { - - # Check for required programs - for req in pinentry gpg mkfs.ext2 e2fsck; do - command -v $req 1>/dev/null 2>/dev/null || { - _failure "Missing required dependency ::1 command::. Please install it." $req } - done - - # Ensure system binaries are available in the PATH - path+=(/sbin /usr/sbin /system/xbin) # zsh magic - - # Which dd command to use - command -v dcfldd 1>/dev/null 2>/dev/null && DD=(dcfldd statusinterval=1) - - # Which wipe command to use - command -v wipe 1>/dev/null 2>/dev/null && WIPE=(wipe -f -s) - - # Check for steghide - command -v steghide 1>/dev/null 2>/dev/null || STEGHIDE=0 - # Check for resize - command -v resize2fs 1>/dev/null 2>/dev/null || RESIZER=0 - # Check for KDF auxiliary tools - command -v tomb-kdb-pbkdf2 1>/dev/null 2>/dev/null || KDF=0 - # Check for Swish-E file content indexer - command -v swish-e 1>/dev/null 2>/dev/null || SWISH=0 - # Check for QREncode for paper backups of keys - command -v qrencode 1>/dev/null 2>/dev/null || QRENCODE=0 -} - -# }}} - Commandline interaction - -# {{{ Key operations - -# $1 is the encrypted key contents we are checking -is_valid_key() { - local key="$1" # Unique argument is an encrypted key to test - - _verbose "is_valid_key" - - [[ -z $key ]] && key=$TOMBKEY - [[ "$key" = "cleartext" ]] && { - { option_is_set --unsafe } || { - _warning "cleartext key from stdin selected: this is unsafe." - exitv=127 _failure "please use --unsafe if you really want to do this." - } - _warning "received key in cleartext from stdin (unsafe mode)" - return 0 } - - [[ -z $key ]] && { - _warning "is_valid_key() called without an argument." - return 1 - } - - # If the key file is an image don't check file header - [[ -r $TOMBKEYFILE ]] \ - && file $TOMBKEYFILE | grep "JP.G" \ - && { - _message "Key is an image, it might be valid." - return 0 } - - print $key | grep "BEGIN PGP" && { - _message "Key is valid." - return 0 } - - return 1 -} - -# $1 is a string containing an encrypted key -_tomb_key_recover recover_key() { - local key="${1}" # Unique argument is an encrypted key - - _warning "Attempting key recovery." - - _head="${key[(f)1]}" # take the first line - - TOMBKEY="" # Reset global variable - - [[ $_head =~ "^_KDF_" ]] && TOMBKEY+="$_head\n" - - TOMBKEY+="-----BEGIN PGP MESSAGE-----\n" - TOMBKEY+="$key\n" - TOMBKEY+="-----END PGP MESSAGE-----\n" - - return 0 -} - -# Retrieve the tomb key from the file specified from the command line, -# or from stdin if -k - was selected. Run validity checks on the -# file. On success, return 0 and print out the full path of the key. -# Set global variables TOMBKEY and TOMBKEYFILE. -_load_key() { - local keyfile="$1" # Unique argument is an optional keyfile - - [[ -z $keyfile ]] && keyfile=$(option_value -k) - [[ -z $keyfile ]] && { - _failure "This operation requires a key file to be specified using the -k option." } - - if [[ $keyfile == "-" ]]; then - _verbose "load_key reading from stdin." - _message "Waiting for the key to be piped from stdin... " - TOMBKEYFILE=stdin - TOMBKEY=$(cat) - elif [[ $keyfile == "cleartext" ]]; then - _verbose "load_key reading SECRET from stdin" - _message "Waiting for the key to be piped from stdin... " - TOMBKEYFILE=cleartext - TOMBKEY=cleartext - TOMBSECRET=$(cat) - else - _verbose "load_key argument: ::1 key file::" $keyfile - [[ -r $keyfile ]] || _failure "Key not found, specify one using -k." - TOMBKEYFILE=$keyfile - TOMBKEY="`cat $TOMBKEYFILE`" - fi - - _verbose "load_key: ::1 key::" $TOMBKEYFILE - - [[ "$TOMBKEY" = "" ]] && { - # something went wrong, there is no key to load - # this occurs especially when piping from stdin and aborted - _failure "Key not found, specify one using -k." - } - - is_valid_key $TOMBKEY || { - _warning "The key seems invalid or its format is not known by this version of Tomb." - _tomb_key_recover $TOMBKEY - } - - # Declared TOMBKEYFILE (path) - # Declared TOMBKEY (contents) - - return 0 -} - -# takes two args just like get_lukskey -# prints out the decrypted content -# contains tweaks for different gpg versions -gpg_decrypt() { - # fix for gpg 1.4.11 where the --status-* options don't work ;^/ - local gpgver=$(gpg --version --no-permission-warning | awk '/^gpg/ {print $3}') - local gpgpass="$1\n$TOMBKEY" - local gpgstatus - - [[ $gpgver == "1.4.11" ]] && { - _verbose "GnuPG is version 1.4.11 - adopting status fix." - - TOMBSECRET=`print - "$gpgpass" | \ - gpg --batch --passphrase-fd 0 --no-tty --no-options` - ret=$? - unset gpgpass - - } || { # using status-file in gpg != 1.4.11 - - TOMBSECRET=`print - "$gpgpass" | \ - gpg --batch --passphrase-fd 0 --no-tty --no-options \ - --status-fd 2 --no-mdc-warning --no-permission-warning \ - --no-secmem-warning` |& grep GNUPG: \ - | read -r -d'\n' gpgstatus - - unset gpgpass - - ret=1 - - print - "${gpgstatus}" | grep "DECRYPTION_OKAY" && { ret=0 } - - - } - return $ret - -} - - -# Gets a key file and a password, prints out the decoded contents to -# be used directly by Luks as a cryptographic key -get_lukskey() { - # $1 is the password - _verbose "get_lukskey" - - _password="$1" - - - firstline="${TOMBKEY[(f)1]}" - - # key is KDF encoded - if print - "$firstline" | grep '^_KDF_'; then - kdf_hash="${firstline[(ws:_:)2]}" - _verbose "KDF: ::1 kdf::" "$kdf_hash" - case "$kdf_hash" in - "pbkdf2sha1") - kdf_salt="${firstline[(ws:_:)3]}" - kdf_ic="${firstline[(ws:_:)4]}" - kdf_len="${firstline[(ws:_:)5]}" - _message "Unlocking KDF key protection ($kdf_hash)" - _verbose "KDF salt: $kdf_salt" - _verbose "KDF ic: $kdf_ic" - _verbose "KDF len: $kdf_len" - _password=$(tomb-kdb-pbkdf2 $kdf_salt $kdf_ic $kdf_len 2>/dev/null <<<$_password) - ;; - *) - _failure "No suitable program for KDF ::1 program::." $pbkdf_hash - unset _password - return 1 - ;; - esac - - # key needs to be exhumed from an image - # TODO -# elif [[ -r $TOMBKEYFILE && print $(file $TOMBKEYFILE) |grep "JP.G" ]]; then - -# exhume_key $TOMBKEYFILE "$_password" - - fi - - gpg_decrypt "$_password" # Save decrypted contents into $TOMBSECRET - - ret="$?" - - _verbose "get_lukskey returns ::1::" $ret - return $ret -} - -# This function asks the user for the password to use the key it tests -# it against the return code of gpg on success returns 0 and saves -# the password in the global variable $TOMBPASSWORD -ask_key_password() { - [[ -z "$TOMBKEYFILE" ]] && { - _failure "Internal error: ask_key_password() called before _load_key()." } - - [[ "$TOMBKEYFILE" = "cleartext" ]] && { - _verbose "no password needed, using secret bytes from stdin" - return 0 } - - _message "A password is required to use key ::1 key::" $TOMBKEYFILE - passok=0 - tombpass="" - if [[ "$1" = "" ]]; then - - for c in 1 2 3; do - if [[ $c == 1 ]]; then - tombpass=$(ask_password "Insert password to: $TOMBKEYFILE") - else - tombpass=$(ask_password "Insert password to: $TOMBKEYFILE (attempt $c)") - fi - [[ $? = 0 ]] || { - _warning "User aborted password dialog." - return 1 - } - - get_lukskey "$tombpass" - - [[ $? = 0 ]] && { - passok=1; _message "Password OK." - break; - } - done - - else - # if a second argument is present then the password is already known - tombpass="$1" - _verbose "ask_key_password with tombpass: ::1 tomb pass::" $tombpass - - get_lukskey "$tombpass" - - [[ $? = 0 ]] && { - passok=1; _message "Password OK." - } - - fi - [[ $passok == 1 ]] || return 1 - - TOMBPASSWORD=$tombpass - return 0 -} - -# call cryptsetup with arguments using the currently known secret -# echo flags eliminate newline and disable escape (BSD_ECHO) -_cryptsetup() { - print -R -n - "$TOMBSECRET" | _sudo cryptsetup --key-file - ${=@} - return $? -} - -# change tomb key password -change_passwd() { - local tmpnewkey lukskey c tombpass tombpasstmp - - _check_swap # Ensure swap is secure, if any - _load_key # Try loading key from option -k and set TOMBKEYFILE - - _message "Commanded to change password for tomb key ::1 key::" $TOMBKEYFILE - - _tmp_create - tmpnewkey=$TOMBTMP - - if option_is_set --tomb-old-pwd; then - local tomboldpwd="`option_value --tomb-old-pwd`" - _verbose "tomb-old-pwd = ::1 old pass::" $tomboldpwd - ask_key_password "$tomboldpwd" - else - ask_key_password - fi - [[ $? == 0 ]] || _failure "No valid password supplied." - - _success "Changing password for ::1 key file::" $TOMBKEYFILE - - # Here $TOMBSECRET contains the key material in clear - - { option_is_set --tomb-pwd } && { - local tombpwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 new pass::" $tombpwd - gen_key "$tombpwd" >> "$tmpnewkey" - } || { - gen_key >> "$tmpnewkey" - } - - { is_valid_key "`cat $tmpnewkey`" } || { - _failure "Error: the newly generated keyfile does not seem valid." } - - # Copy the new key as the original keyfile name - cp -f "${tmpnewkey}" $TOMBKEYFILE - _success "Your passphrase was successfully updated." - - return 0 -} - - -# takes care to encrypt a key -# honored options: --kdf --tomb-pwd -o -gen_key() { - # $1 the password to use; if not set ask user - # -o is the --cipher-algo to use (string taken by GnuPG) - local algopt="`option_value -o`" - local algo="${algopt:-AES256}" - # here user is prompted for key password - tombpass="" - tombpasstmp="" - - if [ "$1" = "" ]; then - while true; do - # 3 tries to write two times a matching password - tombpass=`ask_password "Type the new password to secure your key"` - if [[ $? != 0 ]]; then - _failure "User aborted." - fi - if [ -z $tombpass ]; then - _failure "You set empty password, which is not possible." - fi - tombpasstmp=$tombpass - tombpass=`ask_password "Type the new password to secure your key (again)"` - if [[ $? != 0 ]]; then - _failure "User aborted." - fi - if [ "$tombpasstmp" = "$tombpass" ]; then - break; - fi - unset tombpasstmp - unset tombpass - done - else - tombpass="$1" - _verbose "gen_key takes tombpass from CLI argument: ::1 tomb pass::" $tombpass - fi - - header="" - [[ $KDF == 1 ]] && { - { option_is_set --kdf } && { - # KDF is a new key strenghtening technique against brute forcing - # see: https://github.com/dyne/Tomb/issues/82 - itertime="`option_value --kdf`" - # removing support of floating points because they can't be type checked well - if [[ "$itertime" != <-> ]]; then - unset tombpass - unset tombpasstmp - _error "Wrong argument for --kdf: must be an integer number (iteration seconds)." - _error "Depending on the speed of machines using this tomb, use 1 to 10, or more" - return 1 - fi - # --kdf takes one parameter: iter time (on present machine) in seconds - local -i microseconds - microseconds=$(( itertime * 1000000 )) - _success "Using KDF, iteration time: ::1 microseconds::" $microseconds - _message "generating salt" - pbkdf2_salt=`tomb-kdb-pbkdf2-gensalt` - _message "calculating iterations" - pbkdf2_iter=`tomb-kdb-pbkdf2-getiter $microseconds` - _message "encoding the password" - # We use a length of 64bytes = 512bits (more than needed!?) - tombpass=`tomb-kdb-pbkdf2 $pbkdf2_salt $pbkdf2_iter 64 <<<"${tombpass}"` - - header="_KDF_pbkdf2sha1_${pbkdf2_salt}_${pbkdf2_iter}_64\n" - } - } - - - print $header - - # TODO: check result of gpg operation - cat </dev/null || _failure "gpg (GnuPG) is not found, Tomb cannot function without it." - - ciphers=(`gpg --version | awk ' -BEGIN { ciphers=0 } -/^Cipher:/ { gsub(/,/,""); sub(/^Cipher:/,""); print; ciphers=1; next } -/^Hash:/ { ciphers=0 } -{ if(ciphers==0) { next } else { gsub(/,/,""); print; } } -'`) - print " ${ciphers}" - return 1 -} - -# Steganographic function to bury a key inside an image. -# Requires steghide(1) to be installed -bury_key() { - - _load_key # Try loading key from option -k and set TOMBKEY - - imagefile=$PARAM - - [[ "`file $imagefile`" =~ "JPEG" ]] || { - _warning "Encode failed: ::1 image file:: is not a jpeg image." $imagefile - return 1 - } - - _success "Encoding key ::1 tomb key:: inside image ::2 image file::" $TOMBKEY $imagefile - _message "Please confirm the key password for the encoding" - # We ask the password and test if it is the same encoding the - # base key, to insure that the same password is used for the - # encryption and the steganography. This is a standard enforced - # by Tomb, but it isn't strictly necessary (and having different - # password would enhance security). Nevertheless here we prefer - # usability. - - { option_is_set --tomb-pwd } && { - local tombpwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 tomb pass::" $tombpwd - ask_key_password "$tombpwd" - } || { - ask_key_password - } - [[ $? != 0 ]] && { - _warning "Wrong password supplied." - _failure "You shall not bury a key whose password is unknown to you." } - - # We omit armor strings since having them as constants can give - # ground to effective attacks on steganography - print - "$TOMBKEY" | awk ' -/^-----/ {next} -/^Version/ {next} -{print $0}' \ - | steghide embed --embedfile - --coverfile ${imagefile} \ - -p $TOMBPASSWORD -z 9 -e serpent cbc - if [ $? != 0 ]; then - _warning "Encoding error: steghide reports problems." - res=1 - else - _success "Tomb key encoded succesfully into image ::1 image file::" $imagefile - res=0 - fi - - return $res -} - -# mandatory 1st arg: the image file where key is supposed to be -# optional 2nd arg: the password to use (same as key, internal use) -# optional 3rd arg: the key where to save the result (- for stdout) -exhume_key() { - [[ "$1" = "" ]] && { - _failure "Exhume failed, no image specified" } - - local imagefile="$1" # The image file where to look for the key - local tombpass="$2" # (Optional) the password to use (internal use) - local destkey="$3" # (Optional) the key file where to save the - # result (- for stdout) - local r=1 # Return code (default: fail) - - # Ensure the image file is a readable JPEG - [[ ! -r $imagefile ]] && { - _failure "Exhume failed, image file not found: ::1 image file::" "${imagefile:-none}" } - [[ ! $(file "$imagefile") =~ "JP.G" ]] && { - _failure "Exhume failed: ::1 image file:: is not a jpeg image." $imagefile } - - # When a password is passed as argument then always print out - # the exhumed key on stdout without further checks (internal use) - [[ -n "$tombpass" ]] && { - TOMBKEY=$(steghide extract -sf $imagefile -p $tombpass -xf -) - [[ $? != 0 ]] && { - _failure "Wrong password or no steganographic key found" } - - recover_key $TOMBKEY - - return 0 - } - - # Ensure we have a valid destination for the key - [[ -z $destkey ]] && { option_is_set -k } && destkey=$(option_value -k) - [[ -z $destkey ]] && { - destkey="-" # No key was specified: fallback to stdout - _message "printing exhumed key on stdout" } - - # Bail out if destination exists, unless -f (force) was passed - [[ $destkey != "-" && -s $destkey ]] && { - _warning "File exists: ::1 tomb key::" $destkey - { option_is_set -f } && { - _warning "Use of --force selected: overwriting." - rm -f $destkey - } || { - _warning "Make explicit use of --force to overwrite." - _failure "Refusing to overwrite file. Operation aborted." } - } - - _message "Trying to exhume a key out of image ::1 image file::" $imagefile - { option_is_set --tomb-pwd } && { - tombpass=$(option_value --tomb-pwd) - _verbose "tomb-pwd = ::1 tomb pass::" $tombpass - } || { - [[ -n $TOMBPASSWORD ]] && tombpass=$TOMBPASSWORD - } || { - tombpass=$(ask_password "Insert password to exhume key from $imagefile") - [[ $? != 0 ]] && { - _warning "User aborted password dialog." - return 1 - } - } - - # Extract the key from the image - steghide extract -sf $imagefile -p ${tombpass} -xf $destkey - r=$? - - # Report to the user - [[ "$destkey" = "-" ]] && destkey="stdout" - [[ $r == 0 ]] && { - _success "Key succesfully exhumed to ::1 key::." $destkey - } || { - _warning "Nothing found in ::1 image file::" $imagefile - } - - return $r -} - -# Produces a printable image of the key contents so a backup on paper -# can be made and hidden in books etc. -engrave_key() { - - _load_key # Try loading key from option -k and set TOMBKEYFILE - - local keyname=$(basename $TOMBKEYFILE) - local pngname="$keyname.qr.png" - - _success "Rendering a printable QRCode for key: ::1 tomb key file::" $TOMBKEYFILE - # we omit armor strings to save space - awk '/^-----/ {next}; /^Version/ {next}; {print $0}' $TOMBKEYFILE \ - | qrencode --size 4 --level H --casesensitive -o $pngname - [[ $? != 0 ]] && { - _failure "QREncode reported an error." } - - _success "Operation successful:" - # TODO: only if verbose and/or not silent - ls -lh $pngname - file $pngname -} - -# }}} - Key handling - -# {{{ Create - -# Since version 1.5.3, tomb creation is a three-step process that replaces create_tomb(): -# -# * dig a .tomb (the large file) using /dev/urandom (takes some minutes at least) -# -# * forge a .key (the small file) using /dev/random (good entropy needed) -# -# * lock the .tomb file with the key, binding the key to the tomb (requires dm_crypt format) - -# Step one - Dig a tomb -# -# Synopsis: dig_tomb /path/to/tomb -s sizemebibytes -# -# It will create an empty file to be formatted as a loopback -# filesystem. Initially the file is filled with random data taken -# from /dev/urandom to improve overall tomb's security and prevent -# some attacks aiming at detecting how much data is in the tomb, or -# which blocks in the filesystem contain that data. - -dig_tomb() { - local tombpath="$1" # Path to tomb - # Require the specification of the size of the tomb (-s) in MiB - local -i tombsize=$(option_value -s) - - _message "Commanded to dig tomb ::1 tomb path::" $tombpath - - [[ -n "$tombpath" ]] || _failure "Missing path to tomb" - [[ -n "$tombsize" ]] || _failure "Size argument missing, use -s" - [[ $tombsize == <-> ]] || _failure "Size must be an integer (mebibytes)" - [[ $tombsize -ge 10 ]] || _failure "Tombs can't be smaller than 10 mebibytes" - - _plot $tombpath # Set TOMB{PATH,DIR,FILE,NAME} - - [[ -e $TOMBPATH ]] && { - _warning "A tomb exists already. I'm not digging here:" - ls -lh $TOMBPATH - return 1 - } - - _success "Creating a new tomb in ::1 tomb path::" $TOMBPATH - - _message "Generating ::1 tomb file:: of ::2 size::MiB" $TOMBFILE $tombsize - - # Ensure that file permissions are safe even if interrupted - touch $TOMBPATH - [[ $? = 0 ]] || { - _warning "Error creating the tomb ::1 tomb path::" $TOMBPATH - _failure "Operation aborted." - } - chmod 0600 $TOMBPATH - - _verbose "Data dump using ::1:: from /dev/urandom" ${DD[1]} - ${=DD} if=/dev/urandom bs=1048576 count=$tombsize of=$TOMBPATH - - [[ $? == 0 && -e $TOMBPATH ]] && { - ls -lh $TOMBPATH - } || { - _warning "Error creating the tomb ::1 tomb path::" $TOMBPATH - _failure "Operation aborted." - } - - _success "Done digging ::1 tomb name::" $TOMBNAME - _message "Your tomb is not yet ready, you need to forge a key and lock it:" - _message "tomb forge ::1 tomb path::.key" $TOMBPATH - _message "tomb lock ::1 tomb path:: -k ::1 tomb path::.key" $TOMBPATH - - return 0 -} - -# Step two -- Create a detached key to lock a tomb with -# -# Synopsis: forge_key [destkey|-k destkey] [-o cipher] -# -# Arguments: -# -k path to destination keyfile -# -o Use an alternate algorithm -# -forge_key() { - # can be specified both as simple argument or using -k - local destkey="$1" - { option_is_set -k } && { destkey=$(option_value -k) } - - local algo="AES256" # Default encryption algorithm - - [[ -z "$destkey" ]] && { - _failure "A filename needs to be specified using -k to forge a new key." } - -# _message "Commanded to forge key ::1 key::" $destkey - - _check_swap # Ensure the available memory is safe to use - - # Ensure GnuPG won't exit with an error before first run - [[ -r $HOME/.gnupg/pubring.gpg ]] || { - mkdir -m 0700 $HOME/.gnupg - touch $HOME/.gnupg/pubring.gpg } - - # Do not overwrite any files accidentally - [[ -r "$destkey" ]] && { - ls -lh $destkey - _failure "Forging this key would overwrite an existing file. Operation aborted." } - - touch $destkey - [[ $? == 0 ]] || { - _warning "Cannot generate encryption key." - _failure "Operation aborted." } - chmod 0600 $destkey - - # Update algorithm if it was passed on the command line with -o - { option_is_set -o } && algopt="$(option_value -o)" - [[ -n "$algopt" ]] && algo=$algopt - - _message "Commanded to forge key ::1 key:: with cipher algorithm ::2 algorithm::" \ - $destkey $algo - - [[ $KDF == 1 ]] && { - _message "Using KDF to protect the key password (`option_value --kdf` rounds)" - } - - TOMBKEYFILE="$destkey" # Set global variable - - _warning "This operation takes time, keep using this computer on other tasks," - _warning "once done you will be asked to choose a password for your tomb." - _warning "To make it faster you can move the mouse around." - _warning "If you are on a server, you can use an Entropy Generation Daemon." - - # Use /dev/random as the entropy source, unless --use-random is specified - local random_source=/dev/urandom - { option_is_set --use-random } && random_source=/dev/random - - _verbose "Data dump using ::1:: from ::2 source::" ${DD[1]} $random_source - TOMBSECRET=$(${=DD} bs=1 count=256 if=$random_source) - [[ $? == 0 ]] || { - _warning "Cannot generate encryption key." - _failure "Operation aborted." } - - # Here the global variable TOMBSECRET contains the naked secret - - _success "Choose the password of your key: ::1 tomb key::" $TOMBKEYFILE - _message "(You can also change it later using 'tomb passwd'.)" - # _user_file $TOMBKEYFILE - - tombname="$TOMBKEYFILE" # XXX ??? - # the gen_key() function takes care of the new key's encryption - { option_is_set --tomb-pwd } && { - local tombpwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 new pass::" $tombpwd - gen_key "$tombpwd" >> $TOMBKEYFILE - } || { - gen_key >> $TOMBKEYFILE - } - - # load the key contents (set global variable) - TOMBKEY="`cat $TOMBKEYFILE`" - - # this does a check on the file header - is_valid_key $TOMBKEY || { - _warning "The key does not seem to be valid." - _warning "Dumping contents to screen:" - print "`cat $TOMBKEY`" - _warning "--" - _sudo umount ${keytmp} - rm -r $keytmp - _failure "Operation aborted." - } - - _message "Done forging ::1 key file::" $TOMBKEYFILE - _success "Your key is ready:" - ls -lh $TOMBKEYFILE -} - -# Step three -- Lock tomb -# -# Synopsis: tomb_lock file.tomb file.tomb.key [-o cipher] -# -# Lock the given tomb with the given key file, in fact formatting the -# loopback volume as a LUKS device. -# Default cipher 'aes-xts-plain64:sha256'can be overridden with -o -lock_tomb_with_key() { - # old default was aes-cbc-essiv:sha256 - # Override with -o - # for more alternatives refer to cryptsetup(8) - local cipher="aes-cbc-essiv:sha256" - - local tombpath="$1" # First argument is the path to the tomb - - [[ -n $tombpath ]] || { - _warning "No tomb specified for locking." - _warning "Usage: tomb lock file.tomb file.tomb.key" - return 1 - } - - _plot $tombpath - - _message "Commanded to lock tomb ::1 tomb file::" $TOMBFILE - - [[ -f $TOMBPATH ]] || { - _failure "There is no tomb here. You have to dig it first." } - - _verbose "Tomb found: ::1 tomb path::" $TOMBPATH - - lo_mount $TOMBPATH - nstloop=`lo_new` - - _verbose "Loop mounted on ::1 mount point::" $nstloop - - _message "Checking if the tomb is empty (we never step on somebody else's bones)." - su -c cryptsetup isLuks ${nstloop} - if [[ $? = 0 ]]; then - # is it a LUKS encrypted nest? then bail out and avoid reformatting it - _warning "The tomb was already locked with another key." - _failure "Operation aborted. I cannot lock an already locked tomb. Go dig a new one." - else - _message "Fine, this tomb seems empty." - fi - - _load_key # Try loading key from option -k and set TOMBKEYFILE - - # the encryption cipher for a tomb can be set when locking using -c - { option_is_set -o } && algopt="$(option_value -o)" - [[ -n "$algopt" ]] && cipher=$algopt - _message "Locking using cipher: ::1 cipher::" $cipher - - # get the pass from the user and check it - if option_is_set --tomb-pwd; then - tomb_pwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 tomb pass::" $tomb_pwd - ask_key_password "$tomb_pwd" - else - ask_key_password - fi - [[ $? == 0 ]] || _failure "No valid password supplied." - - _success "Locking ::1 tomb file:: with ::2 tomb key file::" $TOMBFILE $TOMBKEYFILE - - _message "Formatting Luks mapped device." - _cryptsetup --batch-mode \ - --cipher ${cipher} --key-size 256 --key-slot 0 \ - luksFormat ${nstloop} - [[ $? == 0 ]] || { - _warning "cryptsetup luksFormat returned an error." - _failure "Operation aborted." } - - _cryptsetup --cipher ${cipher} luksOpen ${nstloop} tomb.tmp - [[ $? == 0 ]] || { - _warning "cryptsetup luksOpen returned an error." - _failure "Operation aborted." } - - _message "Formatting your Tomb with Ext3/Ext2 filesystem." - _sudo mkfs.ext2 -q -F -j -L $TOMBNAME /dev/mapper/tomb.tmp - - [[ $? == 0 ]] || { - _warning "Tomb format returned an error." - _warning "Your tomb ::1 tomb file:: may be corrupted." $TOMBFILE } - - # Sync - _sudo cryptsetup luksClose tomb.tmp - - _message "Done locking ::1 tomb name:: using Luks dm-crypt ::2 cipher::" $TOMBNAME $cipher - _success "Your tomb is ready in ::1 tomb path:: and secured with key ::2 tomb key::" \ - $TOMBPATH $TOMBKEYFILE - -} - -# This function changes the key that locks a tomb -change_tomb_key() { - local tombkey="$1" # Path to the tomb's key file - local tombpath="$2" # Path to the tomb - - _message "Commanded to reset key for tomb ::1 tomb path::" $tombpath - - [[ -z "$tombpath" ]] && { - _warning "Command 'setkey' needs two arguments: the old key file and the tomb." - _warning "I.e: tomb -k new.tomb.key old.tomb.key secret.tomb" - _failure "Execution aborted." - } - - _check_swap - - # this also calls _plot() - is_valid_tomb $tombpath - - lo_mount $TOMBPATH - nstloop=`lo_new` - _sudo cryptsetup isLuks ${nstloop} - # is it a LUKS encrypted nest? we check one more time - [[ $? == 0 ]] || { - _failure "Not a valid LUKS encrypted volume: ::1 volume::" $TOMBPATH } - - _load_key $tombkey # Try loading given key and set TOMBKEY and - # TOMBKEYFILE - local oldkey=$TOMBKEY - local oldkeyfile=$TOMBKEYFILE - - # we have everything, prepare to mount - _success "Changing lock on tomb ::1 tomb name::" $TOMBNAME - _message "Old key: ::1 old key::" $oldkeyfile - - # render the mapper - mapdate=`date +%s` - # save date of mount in minutes since 1970 - mapper="tomb.$TOMBNAME.$mapdate.$(basename $nstloop)" - - # load the old key - if option_is_set --tomb-old-pwd; then - tomb_old_pwd="`option_value --tomb-old-pwd`" - _verbose "tomb-old-pwd = ::1 old pass::" $tomb_old_pwd - ask_key_password "$tomb_old_pwd" - else - ask_key_password - fi - [[ $? == 0 ]] || { - _failure "No valid password supplied for the old key." } - old_secret=$TOMBSECRET - - # luksOpen the tomb (not really mounting, just on the loopback) - print -R -n - "$old_secret" | _sudo cryptsetup --key-file - \ - luksOpen ${nstloop} ${mapper} - [[ $? == 0 ]] || _failure "Unexpected error in luksOpen." - - _load_key # Try loading new key from option -k and set TOMBKEYFILE - - _message "New key: ::1 key file::" $TOMBKEYFILE - - if option_is_set --tomb-pwd; then - tomb_new_pwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 tomb pass::" $tomb_new_pwd - ask_key_password "$tomb_new_pwd" - else - ask_key_password - fi - [[ $? == 0 ]] || { - _failure "No valid password supplied for the new key." } - - _tmp_create - tmpnewkey=$TOMBTMP - print -R -n - "$TOMBSECRET" >> $tmpnewkey - - print -R -n - "$old_secret" | _sudo cryptsetup --key-file - \ - luksChangeKey "$nstloop" "$tmpnewkey" - - [[ $? == 0 ]] || _failure "Unexpected error in luksChangeKey." - - _sudo cryptsetup luksClose "${mapper}" || _failure "Unexpected error in luksClose." - - _success "Successfully changed key for tomb: ::1 tomb file::" $TOMBFILE - _message "The new key is: ::1 new key::" $TOMBKEYFILE - - return 0 -} - -# }}} - Creation - -# {{{ Open - -# $1 = tombfile $2(optional) = mountpoint -mount_tomb() { - local tombpath="$1" # First argument is the path to the tomb - [[ -n "$tombpath" ]] || _failure "No tomb name specified for opening." - - _message "Commanded to open tomb ::1 tomb name::" $tombpath - - _check_swap - - # this also calls _plot() - is_valid_tomb $tombpath - - _load_key # Try loading new key from option -k and set TOMBKEYFILE - - tombmount="$2" - [[ "$tombmount" = "" ]] && { - # Android default in app's home/media - tombmount="$HOME/media/$TOMBNAME" - mkdir -p $tombmount - _message "Mountpoint not specified, using default: ::1 mount point::" $tombmount - } - - _success "Opening ::1 tomb file:: on ::2 mount point::" $TOMBNAME $tombmount - - lo_mount $TOMBPATH - nstloop=`lo_new` - - _sudo cryptsetup isLuks ${nstloop} || { - # is it a LUKS encrypted nest? see cryptsetup(1) - _failure "::1 tomb file:: is not a valid Luks encrypted storage file." $TOMBFILE } - - _message "This tomb is a valid LUKS encrypted device." - - luksdump="`_sudo cryptsetup luksDump ${nstloop}`" - tombdump=(`print $luksdump | awk ' - /^Cipher name/ {print $3} - /^Cipher mode/ {print $3} - /^Hash spec/ {print $3}'`) - _message "Cipher is \"::1 cipher::\" mode \"::2 mode::\" hash \"::3 hash::\"" $tombdump[1] $tombdump[2] $tombdump[3] - - slotwarn=`print $luksdump | awk ' - BEGIN { zero=0 } - /^Key slot 0/ { zero=1 } - /^Key slot.*ENABLED/ { if(zero==1) print "WARN" }'` - [[ "$slotwarn" == "WARN" ]] && { - _warning "Multiple key slots are enabled on this tomb. Beware: there can be a backdoor." } - - # save date of mount in minutes since 1970 - mapdate=`date +%s` - - mapper="tomb.$TOMBNAME.$mapdate.$(basename $nstloop)" - - _verbose "dev mapper device: ::1 mapper::" $mapper - _verbose "Tomb key: ::1 key file::" $TOMBKEYFILE - - # take the name only, strip extensions - _verbose "Tomb name: ::1 tomb name:: (to be engraved)" $TOMBNAME - - { option_is_set --tomb-pwd } && { - tomb_pwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 tomb pass::" $tomb_pwd - ask_key_password "$tomb_pwd" - } || { - ask_key_password - } - [[ $? == 0 ]] || _failure "No valid password supplied." - - _cryptsetup luksOpen ${nstloop} ${mapper} - [[ $? = 0 ]] || { - _failure "Failure mounting the encrypted file." } - - # preserve the loopdev after exit - lo_preserve "$nstloop" - - # array: [ cipher, keysize, loopdevice ] - tombstat=(`_sudo cryptsetup status ${mapper} | awk ' - /cipher:/ {print $2} - /keysize:/ {print $2} - /device:/ {print $2}'`) - _success "Success unlocking tomb ::1 tomb name::" $TOMBNAME - _verbose "Key size is ::1 size:: for cipher ::2 cipher::" $tombstat[2] $tombstat[1] - - _message "Checking filesystem via ::1::" $tombstat[3] - _sudo e2fsck -p -C0 /dev/mapper/${mapper} - _verbose "Tomb engraved as ::1 tomb name::" $TOMBNAME - _sudo tune2fs -L $TOMBNAME /dev/mapper/${mapper} > /dev/null - - # we need root from here on - _sudo mkdir -p $tombmount - - # Default mount options are overridden with the -o switch - { option_is_set -o } && { - local oldmountopts=$MOUNTOPTS - MOUNTOPTS="$(option_value -o)" } - - # TODO: safety check MOUNTOPTS - # safe_mount_options && \ - _sudo mount -t ext2 -o $MOUNTOPTS /dev/mapper/${mapper} ${tombmount} - # Clean up if the mount failed - [[ $? == 0 ]] || { - _warning "Error mounting ::1 mapper:: on ::2 tombmount::" $mapper $tombmount - [[ $oldmountopts != $MOUNTOPTS ]] && \ - _warning "Are mount options '::1 mount options::' valid?" $MOUNTOPTS - # TODO: move cleanup to _endgame() - [[ -d $tombmount ]] && _sudo rmdir $tombmount - [[ -e /dev/mapper/$mapper ]] && _sudo cryptsetup luksClose $mapper - # The loop is taken care of in _endgame() - _failure "Cannot mount ::1 tomb name::" $TOMBNAME - } - - # Add to Android's own mtab - mount_add_tomb_mtab /dev/mapper/$mapper $tombmount - - _sudo chown $UID:$GID ${tombmount} - _sudo chmod 0711 ${tombmount} - - _success "Success opening ::1 tomb file:: on ::2 mount point::" $TOMBFILE $tombmount - - local tombtty tombhost tombuid tombuser - - # print out when it was opened the last time, by whom and where -# [[ -r ${tombmount}/.last ]] && { -# tombsince=$(_cat ${tombmount}/.last) -# tombsince=$(date --date=@$tombsince +%c) -# tombtty=$(_cat ${tombmount}/.tty) -# tombhost=$(_cat ${tombmount}/.host) -# tomblast=$(_cat ${tombmount}/.last) -# tombuid=$(_cat ${tombmount}/.uid | tr -d ' ') - -# tombuser=$(getent passwd $tombuid) -# tombuser=${tombuser[(ws@:@)1]} - -# _message "Last visit by ::1 user::(::2 tomb build::) from ::3 tty:: on ::4 host::" $tombuser $tombuid $tombtty $tombhost -# _message "on date ::1 date::" $tombsince -# } - # write down the UID and TTY that opened the tomb -# rm -f ${tombmount}/.uid -# print $_UID > ${tombmount}/.uid -# rm -f ${tombmount}/.tty -# print $_TTY > ${tombmount}/.tty - # also the hostname - # rm -f ${tombmount}/.host - # hostname > ${tombmount}/.host - # and the "last time opened" information - # in minutes since 1970, this is printed at next open - rm -f ${tombmount}/.last - date +%s > ${tombmount}/.last - # human readable: date --date=@"`cat .last`" +%c - - - # process bind-hooks (mount -o bind of directories) - # and post-hooks (execute on open) - { option_is_set -n } || { - exec_safe_bind_hooks ${tombmount} - exec_safe_post_hooks ${tombmount} open } - - return 0 -} - -## HOOKS EXECUTION -# -# Execution of code inside a tomb may present a security risk, e.g., -# if the tomb is shared or compromised, an attacker could embed -# malicious code. When in doubt, open the tomb with the -n switch in -# order to skip this feature and verify the files mount-hooks and -# bind-hooks inside the tomb yourself before letting them run. - -# Mount files and directories from the tomb to the current user's HOME. -# -# Synopsis: exec_safe_bind_hooks /path/to/mounted/tomb -# -# This can be a security risk if you share tombs with untrusted people. -# In that case, use the -n switch to turn off this feature. -exec_safe_bind_hooks() { - local mnt="$1" # First argument is the mount point of the tomb - - # Default mount options are overridden with the -o switch - [[ -n ${(k)OPTS[-o]} ]] && MOUNTOPTS=${OPTS[-o]} - - # No HOME set? Note: this should never happen again. - [[ -z $HOME ]] && { - _warning "How pitiful! A tomb, and no HOME." - return 1 } - - [[ -z $mnt || ! -d $mnt ]] && { - _warning "Cannot exec bind hooks without a mounted tomb." - return 1 } - - [[ -r "$mnt/bind-hooks" ]] || { - _verbose "bind-hooks not found in ::1 mount point::" $mnt - return 1 } - - typeset -Al maps # Maps of files and directories to mount - typeset -al mounted # Track already mounted files and directories - - # better parsing for bind hooks checks for two separated words on - # each line, using zsh word separator array subscript - _bindhooks="${mapfile[${mnt}/bind-hooks]}" - for h in ${(f)_bindhooks}; do - s="${h[(w)1]}" - d="${h[(w)2]}" - [[ "$s" = "" ]] && { _warning "bind-hooks file is broken"; return 1 } - [[ "$d" = "" ]] && { _warning "bind-hooks file is broken"; return 1 } - maps+=($s $d) - _verbose "bind-hook found: $s -> $d" - done - unset _bindhooks - - for dir in ${(k)maps}; do - [[ "${dir[1]}" == "/" || "${dir[1,2]}" == ".." ]] && { - _warning "bind-hooks map format: local/to/tomb local/to/\$HOME" - continue } - - [[ "${${maps[$dir]}[1]}" == "/" || "${${maps[$dir]}[1,2]}" == ".." ]] && { - _warning "bind-hooks map format: local/to/tomb local/to/\$HOME. Rolling back" - for dir in ${mounted}; do _sudo umount $dir; done - return 1 } - - if [[ ! -r "$HOME/${maps[$dir]}" ]]; then - _warning "bind-hook target not existent, skipping ::1 home::/::2 subdir::" $HOME ${maps[$dir]} - elif [[ ! -r "$mnt/$dir" ]]; then - _warning "bind-hook source not found in tomb, skipping ::1 mount point::/::2 subdir::" $mnt $dir - else - _sudo mount -o bind,$MOUNTOPTS $mnt/$dir $HOME/${maps[$dir]} \ - && mounted+=("$HOME/${maps[$dir]}") - fi - done -} - -# Execute automated actions configured in the tomb. -# -# Synopsis: exec_safe_post_hooks /path/to/mounted/tomb [open|close] -# -# If an executable file named 'post-hooks' is found inside the tomb, -# run it as a user. This might need a dialog for security on what is -# being run, however we expect you know well what is inside your tomb. -# If you're mounting an untrusted tomb, be safe and use the -n switch -# to verify what it would run if you let it. This feature opens the -# possibility to make encrypted executables. -exec_safe_post_hooks() { - local mnt=$1 # First argument is where the tomb is mounted - local act=$2 # Either 'open' or 'close' - - # Only run if post-hooks has the executable bit set - [[ -x $mnt/post-hooks ]] || return - - # If the file starts with a shebang, run it. - cat $mnt/post-hooks | head -n1 | grep '^#!\s*/' &> /dev/null - [[ $? == 0 ]] && { - _success "Post hooks found, executing as user ::1 user name::." $USERNAME - $mnt/post-hooks $act $mnt - } -} - -# }}} - Tomb open - -# {{{ List - -# list all tombs mounted in a readable format -# $1 is optional, to specify a tomb -list_tombs() { - - local tombname tombmount tombfs tombfsopts tombloop - local ts tombtot tombused tombavail tombpercent tombp tombsince - local tombtty tombhost tombuid tombuser - # list all open tombs - mounted_tombs=(`list_tomb_mounts $1`) - [[ ${#mounted_tombs} == 0 ]] && { - _failure "I can't see any ::1 status:: tomb, may they all rest in peace." ${1:-open} } - - for t in ${mounted_tombs}; do - mapper=`basename ${t[(ws:;:)1]}` - tombname=${t[(ws:;:)5]} - tombmount=${t[(ws:;:)2]} - tombfs=${t[(ws:;:)3]} - tombfsopts=${t[(ws:;:)4]} - tombloop=${mapper[(ws:.:)4]} - - # calculate tomb size (TODO Android) -# ts=`df /dev/mapper/$mapper | -#awk "/mapper/"' { print $2 ";" $3 ";" $4 ";" $5 }'` -# tombtot=${ts[(ws:;:)1]} -# tombused=${ts[(ws:;:)2]} -# tombavail=${ts[(ws:;:)3]} -# tombpercent=${ts[(ws:;:)4]} -# tombp=${tombpercent%%%} - - # obsolete way to get the last open date from /dev/mapper - # which doesn't work when tomb filename contain dots - # tombsince=`date --date=@${mapper[(ws:.:)3]} +%c` - - # find out who opens it from where - [[ -r ${tombmount}/.tty ]] && { -# tombsince=$(_cat ${tombmount}/.last) -# tombsince=$(date --date=@$tombsince +%c) -# tombtty=$(_cat ${tombmount}/.tty) -# tombhost=$(_cat ${tombmount}/.host) -# tombuid=$(_cat ${tombmount}/.uid | tr -d ' ') - -# tombuser=$(getent passwd $tombuid) - tombuser=${tombuser[(ws@:@)1]} - } - - { option_is_set --get-mountpoint } && { print $tombmount; continue } - - _message "::1 tombname:: open on ::2 tombmount:: using ::3 tombfsopts::" \ - $tombname $tombmount $tombfsopts - - _verbose "::1 tombname:: /dev/::2 tombloop:: device mounted (detach with losetup -d)" $tombname $tombloop - -# _message "::1 tombname:: open since ::2 tombsince::" $tombname $tombsince - -# [[ -z "$tombtty" ]] || { -# _message "::1 tombname:: open by ::2 tombuser:: from ::3 tombtty:: on ::4 tombhost::" \ -# $tombname $tombuser $tombtty $tombhost -# } - -# _message "::1 tombname:: size ::2 tombtot:: of which ::3 tombused:: (::5 tombpercent::%) is used: ::4 tombavail:: free " \ -# $tombname $tombtot $tombused $tombavail $tombpercent - -# [[ ${tombp} -ge 90 ]] && { -# _warning "::1 tombname:: warning: your tomb is almost full!" $tombname -# } - - # Now check hooks (TODO Android) -# mounted_hooks=(`list_tomb_binds $tombname $tombmount`) -# for h in ${mounted_hooks}; do -# _message "::1 tombname:: hooks ::2 hookname:: on ::3 hookdest::" \ -# $tombname "`basename ${h[(ws:;:)1]}`" ${h[(ws:;:)2]} -# done - done -} - - -# Print out an array of mounted tombs (internal use) -# Format is semi-colon separated list of attributes -# if 1st arg is supplied, then list only that tomb -# -# String positions in the semicolon separated array: -# -# 1. full mapper path -# -# 2. mountpoint -# -# 3. filesystem type -# -# 4. mount options -# -# 5. tomb name -list_tomb_mounts() { - # list all open tombs - if [[ "$1" = "" ]]; then mount_list; - # list a specific tomb - else mount_list | grep "${1}$"; fi -} - -# list_tomb_binds -# print out an array of mounted bind hooks (internal use) -# format is semi-colon separated list of attributes -# needs two arguments: name of tomb whose hooks belong -# mount tomb -list_tomb_binds() { - [[ -z "$2" ]] && { - _failure "Internal error: list_tomb_binds called without argument." } - - # OK well, prepare for some insanity: parsing the mount table on GNU/Linux - # is like combing a Wookie while he is riding a speedbike down a valley. - - typeset -A tombs - typeset -a binds - for t in "${(f)$(mount_list | grep '/dev/mapper/tomb.*]$')}"; do - len="${(w)#t}" - [[ "${t[(w)$len]}" = "$1" ]] || continue - tombs+=( ${t[(w)1]} ${t[(w)$len]} ) - - done - - for m in ${(k)tombs}; do - for p in "${(f)$(cat /proc/mounts):s/\\040(deleted)/}"; do - # Debian's kernel appends a '\040(deleted)' to the mountpoint in /proc/mounts - # so if we parse the string as-is then this will break the parsing. How nice of them! - # Some bugs related to this are more than 10yrs old. Such Debian! Much stable! Very parsing! - # Bug #711183 umount parser for /proc/mounts broken on stale nfs mount (gets renamed to "/mnt/point (deleted)") - # Bug #711184 mount should not stat mountpoints on mount - # Bug #711187 linux-image-3.2.0-4-amd64: kernel should not rename mountpoint if nfs server is dead/unreachable - [[ "${p[(w)1]}" = "$m" ]] && { - [[ "${(q)p[(w)2]}" != "${(q)2}" ]] && { - # Our output format: - # mapper;mountpoint;fs;flags;name - binds+=("$m;${(q)p[(w)2]};${p[(w)3]};${p[(w)4]};${tombs[$m]}") } - } - done - done - - # print the results out line by line - for b in $binds; do print - "$b"; done -} - -# }}} - Tomb list - -# {{{ Index and search - -# index files in all tombs for search -# $1 is optional, to specify a tomb -index_tombs() { - { command -v updatedb 1>/dev/null 2>/dev/null } || { - _failure "Cannot index tombs on this system: updatedb (mlocate) not installed." } - - updatedbver=`updatedb --version | grep '^updatedb'` - [[ "$updatedbver" =~ "GNU findutils" ]] && { - _warning "Cannot use GNU findutils for index/search commands." } - [[ "$updatedbver" =~ "mlocate" ]] || { - _failure "Index command needs 'mlocate' to be installed." } - - _verbose "$updatedbver" - - mounted_tombs=(`list_tomb_mounts $1`) - [[ ${#mounted_tombs} == 0 ]] && { - # Considering one tomb - [[ -n "$1" ]] && { - _failure "There seems to be no open tomb engraved as [::1::]" $1 } - # Or more - _failure "I can't see any open tomb, may they all rest in peace." } - - _success "Creating and updating search indexes." - - # start the LibreOffice document converter if installed - { command -v unoconv 1>/dev/null 2>/dev/null } && { - unoconv -l 2>/dev/null & - _verbose "unoconv listener launched." - sleep 1 } - - for t in ${mounted_tombs}; do - mapper=`basename ${t[(ws:;:)1]}` - tombname=${t[(ws:;:)5]} - tombmount=${t[(ws:;:)2]} - [[ -r ${tombmount}/.noindex ]] && { - _message "Skipping ::1 tomb name:: (.noindex found)." $tombname - continue } - _message "Indexing ::1 tomb name:: filenames..." $tombname - updatedb -l 0 -o ${tombmount}/.updatedb -U ${tombmount} - - # here we use swish to index file contents - [[ $SWISH == 1 ]] && { - _message "Indexing ::1 tomb name:: contents..." $tombname - rm -f ${tombmount}/.swishrc - _message "Generating a new swish-e configuration file: ::1 swish conf::" ${tombmount}/.swishrc - cat < ${tombmount}/.swishrc -# index directives -DefaultContents TXT* -IndexDir $tombmount -IndexFile $tombmount/.swish -# exclude images -FileRules filename regex /\.jp.?g/i -FileRules filename regex /\.png/i -FileRules filename regex /\.gif/i -FileRules filename regex /\.tiff/i -FileRules filename regex /\.svg/i -FileRules filename regex /\.xcf/i -FileRules filename regex /\.eps/i -FileRules filename regex /\.ttf/i -# exclude audio -FileRules filename regex /\.mp3/i -FileRules filename regex /\.ogg/i -FileRules filename regex /\.wav/i -FileRules filename regex /\.mod/i -FileRules filename regex /\.xm/i -# exclude video -FileRules filename regex /\.mp4/i -FileRules filename regex /\.avi/i -FileRules filename regex /\.ogv/i -FileRules filename regex /\.ogm/i -FileRules filename regex /\.mkv/i -FileRules filename regex /\.mov/i -FileRules filename regex /\.flv/i -FileRules filename regex /\.webm/i -# exclude system -FileRules filename is ok -FileRules filename is lock -FileRules filename is control -FileRules filename is status -FileRules filename is proc -FileRules filename is sys -FileRules filename is supervise -FileRules filename regex /\.asc$/i -FileRules filename regex /\.gpg$/i -# pdf and postscript -FileFilter .pdf pdftotext "'%p' -" -FileFilter .ps ps2txt "'%p' -" -# compressed files -FileFilterMatch lesspipe "%p" /\.tgz$/i -FileFilterMatch lesspipe "%p" /\.zip$/i -FileFilterMatch lesspipe "%p" /\.gz$/i -FileFilterMatch lesspipe "%p" /\.bz2$/i -FileFilterMatch lesspipe "%p" /\.Z$/ -# spreadsheets -FileFilterMatch unoconv "-d spreadsheet -f csv --stdout %P" /\.xls.*/i -FileFilterMatch unoconv "-d spreadsheet -f csv --stdout %P" /\.xlt.*/i -FileFilter .ods unoconv "-d spreadsheet -f csv --stdout %P" -FileFilter .ots unoconv "-d spreadsheet -f csv --stdout %P" -FileFilter .dbf unoconv "-d spreadsheet -f csv --stdout %P" -FileFilter .dif unoconv "-d spreadsheet -f csv --stdout %P" -FileFilter .uos unoconv "-d spreadsheet -f csv --stdout %P" -FileFilter .sxc unoconv "-d spreadsheet -f csv --stdout %P" -# word documents -FileFilterMatch unoconv "-d document -f txt --stdout %P" /\.doc.*/i -FileFilterMatch unoconv "-d document -f txt --stdout %P" /\.odt.*/i -FileFilterMatch unoconv "-d document -f txt --stdout %P" /\.rtf.*/i -FileFilterMatch unoconv "-d document -f txt --stdout %P" /\.tex$/i -# native html support -IndexContents HTML* .htm .html .shtml -IndexContents XML* .xml -EOF - - swish-e -c ${tombmount}/.swishrc -S fs -v3 - } - _message "Search index updated." - done -} - -search_tombs() { - { command -v locate 1>/dev/null 2>/dev/null } || { - _failure "Cannot index tombs on this system: updatedb (mlocate) not installed." } - - updatedbver=`updatedb --version | grep '^updatedb'` - [[ "$updatedbver" =~ "GNU findutils" ]] && { - _warning "Cannot use GNU findutils for index/search commands." } - [[ "$updatedbver" =~ "mlocate" ]] || { - _failure "Index command needs 'mlocate' to be installed." } - - _verbose "$updatedbver" - - # list all open tombs - mounted_tombs=(`list_tomb_mounts`) - [[ ${#mounted_tombs} == 0 ]] && { - _failure "I can't see any open tomb, may they all rest in peace." } - - _success "Searching for: ::1::" ${(f)@} - for t in ${mounted_tombs}; do - _verbose "Checking for index: ::1::" ${t} - mapper=`basename ${t[(ws:;:)1]}` - tombname=${t[(ws:;:)5]} - tombmount=${t[(ws:;:)2]} - [[ -r ${tombmount}/.updatedb ]] && { - # Use mlocate to search hits on filenames - _message "Searching filenames in tomb ::1 tomb name::" $tombname - locate -d ${tombmount}/.updatedb -e -i "${(f)@}" - _message "Matches found: ::1 matches::" \ - $(locate -d ${tombmount}/.updatedb -e -i -c ${(f)@}) - - # Use swish-e to search over contents - [[ $SWISH == 1 && -r $tombmount/.swish ]] && { - _message "Searching contents in tomb ::1 tomb name::" $tombname - swish-e -w ${=@} -f $tombmount/.swish -H0 } - } || { - _warning "Skipping tomb ::1 tomb name::: not indexed." $tombname - _warning "Run 'tomb index' to create indexes." } - done - _message "Search completed." -} - -# }}} - Index and search - -# {{{ Resize - -# resize tomb file size -resize_tomb() { - local tombpath="$1" # First argument is the path to the tomb - - _message "Commanded to resize tomb ::1 tomb name:: to ::2 size:: mebibytes." $1 $OPTS[-s] - - [[ -z "$tombpath" ]] && _failure "No tomb name specified for resizing." - [[ ! -r $tombpath ]] && _failure "Cannot find ::1::" $tombpath - - newtombsize="`option_value -s`" - [[ -z "$newtombsize" ]] && { - _failure "Aborting operations: new size was not specified, use -s" } - - # this also calls _plot() - is_valid_tomb $tombpath - - _load_key # Try loading new key from option -k and set TOMBKEYFILE - - local oldtombsize=$(( `stat -c %s "$TOMBPATH" 2>/dev/null` / 1048576 )) - local mounted_tomb=`mount_list | - awk -vtomb="[$TOMBNAME]" '/^\/dev\/mapper\/tomb/ { if($7==tomb) print $1 }'` - - # Tomb must not be open - [[ -z "$mounted_tomb" ]] || { - _failure "Please close the tomb ::1 tomb name:: before trying to resize it." $TOMBNAME } - # New tomb size must be specified - [[ -n "$newtombsize" ]] || { - _failure "You must specify the new size of ::1 tomb name::" $TOMBNAME } - # New tomb size must be an integer - [[ $newtombsize == <-> ]] || _failure "Size is not an integer." - - # Tombs can only grow in size - if [[ "$newtombsize" -gt "$oldtombsize" ]]; then - - delta="$(( $newtombsize - $oldtombsize ))" - - _message "Generating ::1 tomb file:: of ::2 size::MiB" $TOMBFILE $newtombsize - - _verbose "Data dump using ::1:: from /dev/urandom" ${DD[1]} - ${=DD} if=/dev/urandom bs=1048576 count=${delta} >> $TOMBPATH - [[ $? == 0 ]] || { - _failure "Error creating the extra resize ::1 size::, operation aborted." \ - $tmp_resize } - - # If same size this allows to re-launch resize if pinentry expires - # so that it will continue resizing without appending more space. - # Resizing the partition to the file size cannot harm data anyway. - elif [[ "$newtombsize" = "$oldtombsize" ]]; then - _message "Tomb seems resized already, operating filesystem stretch" - else - _failure "The new size must be greater then old tomb size." - fi - - { option_is_set --tomb-pwd } && { - tomb_pwd="`option_value --tomb-pwd`" - _verbose "tomb-pwd = ::1 tomb pass::" $tomb_pwd - ask_key_password "$tomb_pwd" - } || { - ask_key_password - } - [[ $? == 0 ]] || _failure "No valid password supplied." - - lo_mount "$TOMBPATH" - nstloop=`lo_new` - - mapdate=`date +%s` - mapper="tomb.$TOMBNAME.$mapdate.$(basename $nstloop)" - - _message "opening tomb" - _cryptsetup luksOpen ${nstloop} ${mapper} || { - _failure "Failure mounting the encrypted file." } - - _sudo cryptsetup resize "${mapper}" || { - _failure "cryptsetup failed to resize ::1 mapper::" $mapper } - - _sudo e2fsck -p -f /dev/mapper/${mapper} || { - _failure "e2fsck failed to check ::1 mapper::" $mapper } - - _sudo resize2fs /dev/mapper/${mapper} || { - _failure "resize2fs failed to resize ::1 mapper::" $mapper } - - # close and free the loop device - _sudo cryptsetup luksClose "${mapper}" - - return 0 -} - -# }}} - -# {{{ Close - -umount_tomb() { - local tombs how_many_tombs - local pathmap mapper tombname tombmount loopdev - local ans pidk pname - - if [ "$1" = "all" ]; then - mounted_tombs=(`list_tomb_mounts`) - else - mounted_tombs=(`list_tomb_mounts $1`) - fi - - [[ ${#mounted_tombs} == 0 ]] && { - _failure "There is no open tomb to be closed." } - - [[ ${#mounted_tombs} -gt 1 && -z "$1" ]] && { - _warning "Too many tombs mounted, please specify one (see tomb list)" - _warning "or issue the command 'tomb close all' to close them all." - _failure "Operation aborted." } - - for t in ${mounted_tombs}; do - mapper=`basename ${t[(ws:;:)1]}` - - # strip square parens from tombname - tombname=${t[(ws:;:)5]} - tombmount=${t[(ws:;:)2]} - tombfs=${t[(ws:;:)3]} - tombfsopts=${t[(ws:;:)4]} - tombloop=${mapper[(ws:.:)4]} - - _verbose "Name: ::1 tomb name::" $tombname - _verbose "Mount: ::1 mount point::" $tombmount - _verbose "Mapper: ::1 mapper::" $mapper - - [[ -e "$mapper" ]] && { - _warning "Tomb not found: ::1 tomb file::" $1 - _warning "Please specify an existing tomb." - return 0 } - - [[ -n $SLAM ]] && { - _success "Slamming tomb ::1 tomb name:: mounted on ::2 mount point::" \ - $tombname $tombmount - _message "Kill all processes busy inside the tomb." - { slam_tomb "$tombmount" } || { - _failure "Cannot slam the tomb ::1 tomb name::" $tombname } - } || { - _message "Closing tomb ::1 tomb name:: mounted on ::2 mount point::" \ - $tombname $tombmount } - - # check if there are binded dirs and close them - bind_tombs=(`list_tomb_binds $tombname $tombmount`) - for b in ${bind_tombs}; do - bind_mapper="${b[(ws:;:)1]}" - bind_mount="${b[(ws:;:)2]}" - _message "Closing tomb bind hook: ::1 hook::" $bind_mount - _sudo umount "`print - ${bind_mount}`" || { - [[ -n $SLAM ]] && { - _success "Slamming tomb: killing all processes using this hook." - slam_tomb "`print - ${bind_mount}`" || _failure "Cannot slam the bind hook ::1 hook::" $bind_mount - umount "`print - ${bind_mount}`" || _failure "Cannot slam the bind hook ::1 hook::" $bind_mount - } || { - _failure "Tomb bind hook ::1 hook:: is busy, cannot close tomb." $bind_mount - } - } - done - - # Execute post-hooks for eventual cleanup - { option_is_set -n } || { - exec_safe_post_hooks ${tombmount%%/} close } - - _verbose "Performing umount of ::1 mount point::" $tombmount - _sudo umount ${tombmount} - [[ $? = 0 ]] || { _failure "Tomb is busy, cannot umount!" } - - # If we used a default mountpoint and is now empty, delete it - tombname_regex=${tombname//\[/} - tombname_regex=${tombname_regex//\]/} - - rmdir $tombmount - - _sudo cryptsetup luksClose $mapper - [[ $? == 0 ]] || { - _failure "Error occurred in cryptsetup luksClose ::1 mapper::" $mapper } - - # Normally the loopback device is detached when unused - [[ -e "/dev/$tombloop" ]] && _sudo losetup -d "/dev/$tombloop" - [[ $? = 0 ]] || { - _verbose "/dev/$tombloop was already closed." } - - _success "Tomb ::1 tomb name:: closed: your bones will rest in peace." $tombname - - done # loop across mounted tombs - - return 0 -} - -# Kill all processes using the tomb -slam_tomb() { - # $1 = tomb mount point - if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then - return 0 - fi - #Note: shells are NOT killed by INT or TERM, but they are killed by HUP - for s in TERM HUP KILL; do - _verbose "Sending ::1:: to processes inside the tomb:" $s - if option_is_set -D; then - ps -fp `fuser -m /media/a.tomb 2>/dev/null`| - while read line; do - _verbose $line - done - fi - fuser -s -m "$1" -k -M -$s - if [[ -z `fuser -m "$1" 2>/dev/null` ]]; then - return 0 - fi - if ! option_is_set -f; then - sleep 3 - fi - done - return 1 -} - -# }}} - Tomb close - -# {{{ Main routine - -main() { - - _ensure_dependencies # Check dependencies are present or bail out - - local -A subcommands_opts - ### Options configuration - # - # Hi, dear developer! Are you trying to add a new subcommand, or - # to add some options? Well, keep in mind that option names are - # global: they cannot bear a different meaning or behaviour across - # subcommands. The only exception is "-o" which means: "options - # passed to the local subcommand", and thus can bear a different - # meaning for different subcommands. - # - # For example, "-s" means "size" and accepts one argument. If you - # are tempted to add an alternate option "-s" (e.g., to mean - # "silent", and that doesn't accept any argument) DON'T DO IT! - # - # There are two reasons for that: - # I. Usability; users expect that "-s" is "size" - # II. Option parsing WILL EXPLODE if you do this kind of bad - # things (it will complain: "option defined more than once") - # - # If you want to use the same option in multiple commands then you - # can only use the non-abbreviated long-option version like: - # -force and NOT -f - # - main_opts=(q -quiet=q D -debug=D h -help=h v -version=v f -force=f -tmp: U: G: T: -no-color -unsafe) - subcommands_opts[__default]="" - # -o in open and mount is used to pass alternate mount options - subcommands_opts[open]="n -nohook=n k: -kdf: o: -ignore-swap -tomb-pwd: " - subcommands_opts[mount]=${subcommands_opts[open]} - - subcommands_opts[create]="" # deprecated, will issue warning - - # -o in forge and lock is used to pass an alternate cipher. - subcommands_opts[forge]="-ignore-swap k: -kdf: o: -tomb-pwd: -use-random " - subcommands_opts[dig]="-ignore-swap s: -size=s " - subcommands_opts[lock]="-ignore-swap k: -kdf: o: -tomb-pwd: " - subcommands_opts[setkey]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: " - subcommands_opts[engrave]="k: " - - subcommands_opts[passwd]="k: -ignore-swap -kdf: -tomb-old-pwd: -tomb-pwd: " - subcommands_opts[close]="" - subcommands_opts[help]="" - subcommands_opts[slam]="" - subcommands_opts[list]="-get-mountpoint " - - subcommands_opts[index]="" - subcommands_opts[search]="" - - subcommands_opts[help]="" - subcommands_opts[bury]="k: -tomb-pwd: " - subcommands_opts[exhume]="k: -tomb-pwd: " - # subcommands_opts[decompose]="" - # subcommands_opts[recompose]="" - # subcommands_opts[install]="" - subcommands_opts[askpass]="" - subcommands_opts[source]="" - subcommands_opts[resize]="-ignore-swap s: -size=s k: -tomb-pwd: " - subcommands_opts[check]="-ignore-swap " - # subcommands_opts[translate]="" - - ### Detect subcommand - local -aU every_opts #every_opts behave like a set; that is, an array with unique elements - for optspec in $subcommands_opts$main_opts; do - for opt in ${=optspec}; do - every_opts+=${opt} - done - done - local -a oldstar - oldstar=("${(@)argv}") - #### detect early: useful for --option-parsing - zparseopts -M -D -Adiscardme ${every_opts} - if [[ -n ${(k)discardme[--option-parsing]} ]]; then - print $1 - if [[ -n "$1" ]]; then - return 1 - fi - return 0 - fi - unset discardme - if ! zparseopts -M -E -D -Adiscardme ${every_opts}; then - _failure "Error parsing." - return 127 - fi - unset discardme - subcommand=$1 - if [[ -z $subcommand ]]; then - subcommand="__default" - fi - - if [[ -z ${(k)subcommands_opts[$subcommand]} ]]; then - _warning "There's no such command \"::1 subcommand::\"." $subcommand - exitv=127 _failure "Please try -h for help." - fi - argv=("${(@)oldstar}") - unset oldstar - - ### Parsing global + command-specific options - # zsh magic: ${=string} will split to multiple arguments when spaces occur - set -A cmd_opts ${main_opts} ${=subcommands_opts[$subcommand]} - # if there is no option, we don't need parsing - if [[ -n $cmd_opts ]]; then - zparseopts -M -E -D -AOPTS ${cmd_opts} - if [[ $? != 0 ]]; then - _warning "Some error occurred during option processing." - exitv=127 _failure "See \"tomb help\" for more info." - fi - fi - #build PARAM (array of arguments) and check if there are unrecognized options - ok=0 - PARAM=() - for arg in $*; do - if [[ $arg == '--' || $arg == '-' ]]; then - ok=1 - continue #it shouldn't be appended to PARAM - elif [[ $arg[1] == '-' ]]; then - if [[ $ok == 0 ]]; then - exitv=127 _failure "Unrecognized option ::1 arg:: for subcommand ::2 subcommand::" $arg $subcommand - fi - fi - PARAM+=$arg - done - # First parameter actually is the subcommand: delete it and shift - [[ $subcommand != '__default' ]] && { PARAM[1]=(); shift } - - ### End parsing command-specific options - - # Use colors unless told not to - { ! option_is_set --no-color } && { autoload -Uz colors && colors } - # Some options are only available during insecure mode - { ! option_is_set --unsafe } && { - for opt in --tomb-pwd --use-random --tomb-old-pwd; do - { option_is_set $opt } && { - exitv=127 _failure "You specified option ::1 option::, which is DANGEROUS and should only be used for testing\nIf you really want so, add --unsafe" $opt } - done - } - # read -t or --tmp flags to set a custom temporary directory - option_is_set --tmp && TMPPREFIX=$(option_value --tmp) - - - # When we run as root, we remember the original uid:gid to set - # permissions for the calling user and drop privileges - - [[ "$PARAM" == "" ]] && { - _verbose "Tomb command: ::1 subcommand::" $subcommand - } || { - _verbose "Tomb command: ::1 subcommand:: ::2 param::" $subcommand $PARAM - } - - [[ -z $_UID ]] || { - _verbose "Caller: uid[::1 uid::], gid[::2 gid::], tty[::3 tty::]." \ - $_UID $_GID $_TTY - } - - _verbose "Temporary directory: $TMPPREFIX" - - # Process subcommand - case "$subcommand" in - - # USAGE - help) - usage - ;; - - # DEPRECATION notice (leave here as 'create' is still present in old docs) - create) - _warning "The create command is deprecated, please use dig, forge and lock instead." - _warning "For more informations see Tomb's manual page (man tomb)." - _failure "Operation aborted." - ;; - - # CREATE Step 1: dig -s NN file.tomb - dig) - dig_tomb ${=PARAM} - ;; - - # CREATE Step 2: forge file.tomb.key - forge) - forge_key ${=PARAM} - ;; - - # CREATE Step 2: lock -k file.tomb.key file.tomb - lock) - lock_tomb_with_key ${=PARAM} - ;; - - # Open the tomb - mount|open) - mount_tomb ${=PARAM} - ;; - - # Close the tomb - # `slam` is used to force closing. - umount|close|slam) - [[ "$subcommand" == "slam" ]] && SLAM=1 - umount_tomb $PARAM[1] - ;; - - # Grow tomb's size - resize) - [[ $RESIZER == 0 ]] && { - _failure "Resize2fs not installed: cannot resize tombs." } - resize_tomb $PARAM[1] - ;; - - ## Contents manipulation - - # Index tomb contents - index) - index_tombs $PARAM[1] - ;; - - # List tombs - list) - list_tombs $PARAM[1] - ;; - - # Search tomb contents - search) - search_tombs ${=PARAM} - ;; - - ## Locking operations - - # Export key to QR Code - engrave) - [[ $QRENCODE == 0 ]] && { - _failure "QREncode not installed: cannot engrave keys on paper." } - engrave_key ${=PARAM} - ;; - - # Change password on existing key - passwd) - change_passwd $PARAM[1] - ;; - - # Change tomb key - setkey) - change_tomb_key ${=PARAM} - ;; - - # STEGANOGRAPHY: hide key inside an image - bury) - [[ $STEGHIDE == 0 ]] && { - _failure "Steghide not installed: cannot bury keys into images." } - bury_key $PARAM[1] - ;; - - # STEGANOGRAPHY: read key hidden in an image - exhume) - [[ $STEGHIDE == 0 ]] && { - _failure "Steghide not installed: cannot exhume keys from images." } - exhume_key $PARAM[1] - ;; - - ## Internal commands useful to developers - - # Make tomb functions available to the calling shell or script - 'source') return 0 ;; - - # Ask user for a password interactively - askpass) ask_password $PARAM[1] $PARAM[2] ;; - - # Default operation: presentation, or version information with -v - __default) - _print "Tomb ::1 version:: - a strong and gentle undertaker for your secrets" $VERSION - _print "\000" - _print " Copyright (C) 2007-2015 Dyne.org Foundation, License GNU GPL v3+" - _print " This is free software: you are free to change and redistribute it" - _print " For the latest sourcecode go to " - _print "\000" - option_is_set -v && { - local langwas=$LANG - LANG=en - _print " This source code is distributed in the hope that it will be useful," - _print " but WITHOUT ANY WARRANTY; without even the implied warranty of" - _print " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - LANG=$langwas - _print " When in need please refer to ." - _print "\000" - _print "System utils:" - _print "\000" - cat < - - - Tomb crypto volume - - - - Tomb crypto key - - - diff --git a/extras/desktop/gtkrc-2.0 b/extras/desktop/gtkrc-2.0 deleted file mode 100644 index 3d484812..00000000 --- a/extras/desktop/gtkrc-2.0 +++ /dev/null @@ -1,3 +0,0 @@ -pixmap_path "%prefix%/pixmaps" -style "normal" { stock["gtk-dialog-authentication"] = {{"monmort.xpm"}} } -widget "*" style "normal" diff --git a/extras/desktop/gtkrc.in b/extras/desktop/gtkrc.in deleted file mode 100644 index 3d484812..00000000 --- a/extras/desktop/gtkrc.in +++ /dev/null @@ -1,3 +0,0 @@ -pixmap_path "%prefix%/pixmaps" -style "normal" { stock["gtk-dialog-authentication"] = {{"monmort.xpm"}} } -widget "*" style "normal" diff --git a/extras/desktop/install.zsh b/extras/desktop/install.zsh deleted file mode 100644 index 3bdef3f3..00000000 --- a/extras/desktop/install.zsh +++ /dev/null @@ -1,90 +0,0 @@ -# {{{ - Install -# install mime-types, bells and whistles for the desktop -# see http://developers.sun.com/solaris/articles/integrating_gnome.html -# and freedesktop specs -install_tomb() { - -# TODO: distro package deps (for binary) -# debian: zsh, cryptsetup, sudo - _message "updating mimetypes..." - cat < /tmp/dyne-tomb.xml - - - - Tomb crypto volume - - - - Tomb crypto key - - - -EOF - xdg-mime install /tmp/dyne-tomb.xml - xdg-icon-resource install --context mimetypes --size 32 monmort.xpm monmort - xdg-icon-resource install --size 32 monmort.xpm dyne-monmort - - rm /tmp/dyne-tomb.xml - - _message "updating desktop..." - cat < /usr/share/applications/tomb.desktop -[Desktop Entry] -Version=1.0 -Type=Application -Name=Tomb crypto undertaker -GenericName=Crypto undertaker -Comment=Keep your bones safe -Exec="${TOMBOPENEXEC}" %U -TryExec=tomb-open -Icon=monmort.xpm -Terminal=true -Categories=Utility;Security;Archiving;Filesystem; -MimeType=application/x-tomb-volume; -X-AppInstall-Package=tomb -EOF - update-desktop-database - - _message "updating menus..." - cat < /etc/menu/tomb -?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="text" \ - section="Applications/Accessories" title="Tomb" hints="Crypto" \ - hotkey="Tomb" -EOF - update-menus - - _message "updating mime info..." - cat < /usr/share/mime-info/tomb.keys -# actions for encrypted tomb storage -application/x-tomb-volume: - open="${TOMBOPENEXEC}" %f - view=tomb-open %f - icon-filename=monmort.xpm - short_list_application_ids_for_novice_user_level=tomb -EOF - cat < /usr/share/mime-info/tomb.mime -# mime type for encrypted tomb storage -application/x-tomb-volume - ext: tomb - -application/x-tomb-key - ext: tomb.key -EOF - cat < /usr/lib/mime/packages/tomb -application/x-tomb-volume; tomb-open '%s'; priority=8 -EOF - update-mime - - _message "updating application entry..." - - cat < /usr/share/application-registry/tomb.applications -tomb - command=tomb-open - name=Tomb - Crypto Undertaker - can_open_multiple_files=false - expects_uris=false - requires_terminal=true - mime-types=application/x-tomb-volume,application/x-tomb-key -EOF - _message "Tomb is now installed." -} -# }}} diff --git a/extras/desktop/tomb b/extras/desktop/tomb deleted file mode 100644 index 2a1d5564..00000000 --- a/extras/desktop/tomb +++ /dev/null @@ -1,4 +0,0 @@ -?package(tomb):command="tomb" icon="/usr/share/pixmaps/monmort.xpm" needs="text" \ - section="Applications/Accessories" title="Tomb" hints="Crypto" \ - hotkey="Tomb" - diff --git a/extras/desktop/tomb-ascii-art.txt b/extras/desktop/tomb-ascii-art.txt deleted file mode 100644 index 6c583455..00000000 --- a/extras/desktop/tomb-ascii-art.txt +++ /dev/null @@ -1,18 +0,0 @@ - - ,-------------------------------------------------. - ,--. / Your tomb is open on loop3. Beware of zombies... ) -( x o) (___________________________________________________/ - \||| / hellekin's Tomb v0.2.1 2011-01-20 03:00:26 AM - - - ,-------------------------------------------------. - ,--. / Mr Carpenter needs to size ya for the coffin: ) -( o O) ( How big do you want it? (in Mb) / - \||| /\_________________________________________________/ - - - ` ' ,--------------------------------------------------. - ,-'. / Ye ain't gonna find any tomb without a name... ) -( x x) (____________________________________________________/ - \|:| / hellekin's Tomb v0.2.1 2011-01-20 03:00:26 AM - diff --git a/extras/desktop/tomb.applications b/extras/desktop/tomb.applications deleted file mode 100644 index 34f5014c..00000000 --- a/extras/desktop/tomb.applications +++ /dev/null @@ -1,7 +0,0 @@ -tomb - command=tomb-open - name=Tomb - Crypto Undertaker - can_open_multiple_files=false - expects_uris=false - requires_terminal=false - mime-types=application/x-tomb-volume,application/x-tomb-key diff --git a/extras/desktop/tomb.desktop b/extras/desktop/tomb.desktop deleted file mode 100644 index 29bb8509..00000000 --- a/extras/desktop/tomb.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=Tomb crypto undertaker -GenericName=Crypto undertaker -Comment=Keep your bones safe -Exec=xterm -e tomb-open wizard %U -TryExec=tomb-open %U -Icon=monmort -Terminal=false -Categories=Utility;Security;Archiving;Filesystem; -MimeType=application/x-tomb-volume; -X-AppInstall-Package=tomb diff --git a/extras/desktop/tomb.keys b/extras/desktop/tomb.keys deleted file mode 100644 index 780a77ba..00000000 --- a/extras/desktop/tomb.keys +++ /dev/null @@ -1,12 +0,0 @@ -# actions for encrypted tomb storage -application/x-tomb-volume: - open=tomb-open %f - view=tomb-open %f - icon-filename=monmort.xpm - short_list_application_ids_for_novice_user_level=tomb - -application/x-tomb-key: - open=tomb-open %f - view=tomb-open %f - icon-filename=monmort.xpm - short_list_application_ids_for_novice_user_level=tomb diff --git a/extras/desktop/tomb.mime b/extras/desktop/tomb.mime deleted file mode 100644 index 41b1b46c..00000000 --- a/extras/desktop/tomb.mime +++ /dev/null @@ -1,6 +0,0 @@ -# mime type for encrypted tomb storage -application/x-tomb-volume - ext: tomb - -application/x-tomb-key - ext: tomb.key diff --git a/extras/desktop/tomb.mimepkg b/extras/desktop/tomb.mimepkg deleted file mode 100644 index 68ccb86b..00000000 --- a/extras/desktop/tomb.mimepkg +++ /dev/null @@ -1 +0,0 @@ -application/x-tomb-volume; tomb-open '%s'; priority=8 \ No newline at end of file diff --git a/extras/dismissed/INSTALL.python b/extras/dismissed/INSTALL.python deleted file mode 100644 index 42c38993..00000000 --- a/extras/dismissed/INSTALL.python +++ /dev/null @@ -1,30 +0,0 @@ -About -***** - -This document is about the installing of both pytomb and the tomb gui. - -Pytomb is a python library that is needed to run the tomb gui - -Dependencies -============ - -The pytomb library has NO dependencies. Hooray! - -The gui depends on having PyQt4 installed in your operative system. This is -package python-qt4 in debian or ubuntu, python2-pyqt in archlinux. If you are -unsure about this, try to install and check if it works ;) - -Basic Installation -================== - -First, install pytomb. It has no dependencies - -1. `cd' to the directory containing pytomb (src/pytomb) -2. do `sudo python2 setup.py install' - -Then, you have to install the gui. - -1. `cd' to the directory containing the gui (src/qt) -2. do `python2 setup.py build_ui' -3. do `sudo python2 setup.py install' - diff --git a/extras/dismissed/debian/changelog b/extras/dismissed/debian/changelog deleted file mode 100644 index bcf08786..00000000 --- a/extras/dismissed/debian/changelog +++ /dev/null @@ -1,32 +0,0 @@ -tomb (1.2-1) unstable; urgency=low - - * New upstream release - - -- Denis Roio Mon, 07 Nov 2011 21:03:34 +0100 - -tomb (1.0-1) unstable; urgency=low - - * New upstream release - * Fixes to dependencies - * Split in 2 packages: tomb and tomb-gtk - - -- Denis Roio Mon, 21 Feb 2011 00:59:55 +0100 - -tomb (0.9.2-1) unstable; urgency=low - - * New upstream release - * Mentored fixes to debian packaging - - -- Denis Roio Thu, 10 Feb 2011 15:22:58 +0100 - -tomb (0.9.1-1) unstable; urgency=low - - * New upstream release - - -- Denis Roio Thu, 03 Feb 2011 22:32:23 +0100 - -tomb (0.9-1) unstable; urgency=low - - * Initial release. (Closes: #611660) - - -- Denis Roio Mon, 31 Jan 2011 19:39:06 +0100 diff --git a/extras/dismissed/debian/compat b/extras/dismissed/debian/compat deleted file mode 100644 index 45a4fb75..00000000 --- a/extras/dismissed/debian/compat +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/extras/dismissed/debian/control b/extras/dismissed/debian/control deleted file mode 100644 index 944da209..00000000 --- a/extras/dismissed/debian/control +++ /dev/null @@ -1,36 +0,0 @@ -Source: tomb -Section: misc -Priority: extra -Maintainer: Denis Roio -Build-Depends: debhelper (>= 7), autotools-dev, cdbs, libgtk2.0-dev, libnotify-dev, pkg-config -Standards-Version: 3.9.1 -Homepage: http://tomb.dyne.org - -Package: tomb -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, zsh, cryptsetup, pinentry-curses, gnupg, sudo -Suggests: tomb-gtk, wipe, dcfldd, steghide -Description: the crypto undertaker - Derived from the dyne:bolic nesting mechanism, Tomb is a free and - easy to operate desktop application for fairly strong encryption of - personal files. A tomb is like a locked folder that can be - transported and hidden in filesystems; its keys are password - protected and can be kept separate, for instance keeping a tomb file - in your computer's harddisk and its key file on a USB stick. - Tomb relies on dm-crypt (and cryptsetup) as an encryption backend - using the aes-cbc-essiv:sha256 cypher. - -Package: tomb-gtk -Architecture: any -Depends: tomb, libnotify-bin, pinentry-gtk2, ${shlibs:Depends}, ${misc:Depends} -Description: the crypto undertaker - desktop integration - Derived from the dyne:bolic nesting mechanism, Tomb is a free and - easy to operate desktop application for fairly strong encryption of - personal files. A tomb is like a locked folder that can be - transported and hidden in filesystems; its keys are password - protected and can be kept separate, for instance keeping a tomb file - in your computer's harddisk and its key file on a USB stick. - Tomb relies on dm-crypt (and cryptsetup) as an encryption backend - using the aes-cbc-essiv:sha256 cypher. - . - This package contains a graphical interface to use Tomb on the desktop. diff --git a/extras/dismissed/debian/copyright b/extras/dismissed/debian/copyright deleted file mode 100644 index b17146be..00000000 --- a/extras/dismissed/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -This package was debianized by Denis Roio -on Thu Jan 13 23:21:12 CET 2011 - -It was downloaded from the code.dyne.org source repository - -Upstream Author(s): Denis Roio - -Copyright: - - -License: - This software is available under the GNU General Public License. - http://www.opensource.org/licenses/gpl-license.php - -Packaging: - Copyright (C) 2011 by Denis Roio - released under the terms of GNU GPL version 3, - see `/usr/share/common-licenses/GPL-3'. diff --git a/extras/dismissed/debian/dirs b/extras/dismissed/debian/dirs deleted file mode 100644 index e7724817..00000000 --- a/extras/dismissed/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -usr/bin diff --git a/extras/dismissed/debian/docs b/extras/dismissed/debian/docs deleted file mode 100644 index e845566c..00000000 --- a/extras/dismissed/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/extras/dismissed/debian/menu b/extras/dismissed/debian/menu deleted file mode 100644 index db68deb6..00000000 --- a/extras/dismissed/debian/menu +++ /dev/null @@ -1,3 +0,0 @@ -?package(tomb):command="tomb-open" icon="/usr/share/pixmaps/monmort.xpm" needs="text" \ - section="Applications/System/Security" title="Tomb" hints="Crypto" \ - hotkey="Tomb" diff --git a/extras/dismissed/debian/postinst b/extras/dismissed/debian/postinst deleted file mode 100755 index e4f8b6e0..00000000 --- a/extras/dismissed/debian/postinst +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -if [ -x /usr/sbin/update-mime ]; then - update-mime -fi - diff --git a/extras/dismissed/debian/rules b/extras/dismissed/debian/rules deleted file mode 100755 index 5f4ce40f..00000000 --- a/extras/dismissed/debian/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f -include /usr/share/cdbs/1/rules/autoreconf.mk -include /usr/share/cdbs/1/rules/buildcore.mk -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/autotools.mk -# include /usr/share/cdbs/1/class/gnome.mk - diff --git a/extras/dismissed/debian/source/format b/extras/dismissed/debian/source/format deleted file mode 100644 index 163aaf8d..00000000 --- a/extras/dismissed/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/extras/dismissed/debian/tomb-gtk.install b/extras/dismissed/debian/tomb-gtk.install deleted file mode 100644 index cdc16b55..00000000 --- a/extras/dismissed/debian/tomb-gtk.install +++ /dev/null @@ -1,14 +0,0 @@ -usr/bin/tomb-status -usr/share/man/man1/tomb-status.1 -usr/share/pixmaps/monmort.png -usr/share/pixmaps/monmort.xpm -usr/share/app-install/icons/monmort.png -usr/share/application-registry/tomb.applications -usr/share/applications/tomb.desktop -usr/share/mime-info/tomb.keys -usr/share/mime-info/tomb.mime -usr/share/mime/packages/dyne-tomb.xml -usr/share/themes/tomb/gtk-2.0-key/gtkrc -usr/share/icons/hicolor/32x32/mimetypes/application-x-tomb-volume.png -usr/share/icons/hicolor/32x32/mimetypes/application-x-tomb-key.png -usr/share/app-install/desktop/tomb.desktop diff --git a/extras/dismissed/debian/tomb.install b/extras/dismissed/debian/tomb.install deleted file mode 100644 index 4a392efd..00000000 --- a/extras/dismissed/debian/tomb.install +++ /dev/null @@ -1,4 +0,0 @@ -usr/bin/tomb -usr/bin/tomb-open -usr/share/man/man1/tomb.1 -usr/share/man/man1/tomb-open.1 diff --git a/extras/dismissed/debian/tomb.mime b/extras/dismissed/debian/tomb.mime deleted file mode 100644 index ff3c4b97..00000000 --- a/extras/dismissed/debian/tomb.mime +++ /dev/null @@ -1 +0,0 @@ -application/x-tomb-volume; tomb-open '%s'; priority=8 diff --git a/extras/dismissed/debian/tomb.sharedmimeinfo b/extras/dismissed/debian/tomb.sharedmimeinfo deleted file mode 100644 index c545eaea..00000000 --- a/extras/dismissed/debian/tomb.sharedmimeinfo +++ /dev/null @@ -1,11 +0,0 @@ - - - - Tomb crypto volume - - - - Tomb crypto key - - - diff --git a/extras/dismissed/debian/watch b/extras/dismissed/debian/watch deleted file mode 100644 index 24d1c317..00000000 --- a/extras/dismissed/debian/watch +++ /dev/null @@ -1,5 +0,0 @@ -version = 3 - -# Package mantained by upstream developer -# wishing there would be a way to watch git repos? -# however our ftp is on ftp://ftp.dyne.org/tomb/releases diff --git a/extras/dismissed/pytomb/.gitignore b/extras/dismissed/pytomb/.gitignore deleted file mode 100644 index 31a3caf2..00000000 --- a/extras/dismissed/pytomb/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.*.swp -*.pyc -*.egg-info -build -dist diff --git a/extras/dismissed/pytomb/setup.py b/extras/dismissed/pytomb/setup.py deleted file mode 100644 index 62c72c6c..00000000 --- a/extras/dismissed/pytomb/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -from setuptools import setup - -setup( - name = 'TombLib', - url = 'http://tomb.dyne.org/', - author = 'boyska', - author_email = 'piuttosto@logorroici.org', - version = '1.1', - packages = ['tomblib'], - - test_suite = 'nose.collector', - classifiers = [ - 'Topic :: Security :: Cryptography', - 'Intended Audience :: Developers', - 'Operating System :: POSIX :: Linux', - 'License :: OSI Approved :: GNU General Public License (GPL)', - 'Development Status :: 3 - Alpha' - ] -) - - diff --git a/extras/dismissed/pytomb/tomblib/__init__.py b/extras/dismissed/pytomb/tomblib/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/extras/dismissed/pytomb/tomblib/parser.py b/extras/dismissed/pytomb/tomblib/parser.py deleted file mode 100644 index e9eb7f95..00000000 --- a/extras/dismissed/pytomb/tomblib/parser.py +++ /dev/null @@ -1,34 +0,0 @@ -''' -Utilities to analyze tomb output -''' -import re - -#found: [m] followed by some ID (usually "found") inside square brackets, then -#something else, then a space, then the content -_found_regex = re.compile(r'^\[m\]\[([^]]+)\] +(([^:]+)://(.+))$') -#generic: programname, then some identifiers in square (or round) brackets, -#then maybe something else, then a space, then the context -_generic_regex = re.compile(r'^[a-z-]+ [[(]([^]]+)[\])] +(.+)$') -types = {'E':'error', 'W':'warning', 'D':'debug', '*':'success'} -def parse_line(line): - '''Analyze a single line. - Return None if no standard format is detected, a dict otherwise. - The fields 'type' and 'content' are always in the dict; 'content' may be - empty - 'type' can be 'error', 'progress' - ''' - - - match = _found_regex.match(line) - if match: - return { 'type': types.get(match.group(1)) or match.group(1), - 'content': match.group(2), 'scheme': match.group(3), - 'path': match.group(4) } - match = _generic_regex.search(line) - if match: - return { 'type': types.get(match.group(1)) or match.group(1), - 'content': match.group(2) } - - return None - - diff --git a/extras/dismissed/pytomb/tomblib/test_parser.py b/extras/dismissed/pytomb/tomblib/test_parser.py deleted file mode 100644 index 4ea2334a..00000000 --- a/extras/dismissed/pytomb/tomblib/test_parser.py +++ /dev/null @@ -1,52 +0,0 @@ -from tomblib.parser import * - -class TestWrong: - def test_short(self): - '''short format is not supported anymore''' - assert parse_line('[!] foo') is None - def test_colors(self): - '''parsing while using colors should fail''' - parse = parse_line('\033[32mundertaker [W] url protocol not recognized: nonscheme') - assert parse is None - def test_no_spaces_in_programname(self): - parse = parse_line('tomb open [W] url protocol not recognized: nonscheme') - assert parse is None - -class TestFound: - def test_simple(self): - parse = parse_line('[m][found] scheme:///and/path') - assert parse is not None - assert parse['type'] == 'found' - assert parse['content'] == 'scheme:///and/path' - assert 'scheme' in parse - assert parse['scheme'] == 'scheme' - assert 'path' in parse - assert parse['path'] == '/and/path' - -class TestGeneric: - def test_simple(self): - parse = parse_line('undertaker [W] url protocol not recognized: nonscheme') - assert parse is not None - assert parse['type'] == 'warning' - assert parse['content'] == 'url protocol not recognized: nonscheme' - - def test_debug(self): - parse = parse_line('undertaker [D] url protocol not recognized: nonscheme') - assert parse is not None - assert parse['type'] == 'debug' - assert parse['content'] == 'url protocol not recognized: nonscheme' - - def test_success(self): - parse = parse_line('undertaker (*) url protocol not recognized: nonscheme') - assert parse is not None - assert parse['type'] == 'success' - assert parse['content'] == 'url protocol not recognized: nonscheme' - - def test_dash(self): - parse = parse_line('tomb-open [W] url protocol not recognized: nonscheme') - assert parse is not None - assert parse['type'] == 'warning' - assert parse['content'] == 'url protocol not recognized: nonscheme' - - - diff --git a/extras/dismissed/pytomb/tomblib/tomb.py b/extras/dismissed/pytomb/tomblib/tomb.py deleted file mode 100644 index 8e701485..00000000 --- a/extras/dismissed/pytomb/tomblib/tomb.py +++ /dev/null @@ -1,91 +0,0 @@ -''' -Module structure: - -this contain a class, which is indeed just a collection of functions -(the methods are all static). -It's meant to behave in a way which is similar to the command line, for - -Notes: consider moving to a more typical usage (instantiate, then use method) -to make it more configurable (ie set the tomb executable path). -''' - -import subprocess - -class Tomb(object): - ''' - This is just a collection of static methods, so you should NOT instantiate - - The methods are meant to resemble the command line interface as much as - possible - - There is no support to things like threading, multiprocessing, whatever. - If you want to interact asynchronously with tomb, just do it in a separate - layer. - ''' - tombexec = 'tomb' - def _check_exec_path(self): - '''Checks, using which, if tomb is available. - Returns None on error, the path on success. - ''' - try: - path = subprocess.check_output(['which', 'tomb']) - except subprocess.CalledProcessError: - return None - return path - - @classmethod - def check(cls, command, stdout=None, stderr=None, no_color=True, ignore_swap=False): - args = [command] - if no_color: - args += ['--no-color'] - if ignore_swap: - args += ['--ignore-swap'] - try: - subprocess.check_call([cls.tombexec, 'check'] + args, stdout=stdout, stderr=stderr) - except subprocess.CalledProcessError: - return False - return True - - @classmethod - def create(cls, tombpath, tombsize,keypath, stdout=None, stderr=None, - no_color=True, ignore_swap=False): - '''If keypath is None, it will be created adjacent to the tomb. - This is unsafe, and you should NOT do it. - - Note that this will invoke pinentry - - no_color is supported as an option for short-lived retrocompatibility: - it will be removed as soon as no-color will be integrated - ''' - args = [tombpath, '-s', tombsize] - if keypath is not None: - args += ['-k', keypath] - if no_color: - args += ['--no-color'] - if ignore_swap: - args += ['--ignore-swap'] - try: - subprocess.check_call([cls.tombexec, 'create'] + args, stdout=stdout, stderr=stderr) - except subprocess.CalledProcessError: - return False - return True - - @classmethod - def open(cls, tombpath,keypath=None, no_color=True, ignore_swap=False): - args = [tombpath] - if keypath is not None: - args += ['-k', keypath] - if no_color: - args += ['--no-color'] - if ignore_swap: - args += ['--ignore-swap'] - try: - subprocess.check_call([cls.tombexec, 'open'] + args) - except subprocess.CalledProcessError: - return False - return True - - -if __name__ == '__main__': - #Debug stuff. Also useful for an example - print Tomb.create('/tmp/a.tomb', '10', '/tmp/akey') diff --git a/extras/dismissed/pytomb/tomblib/undertaker.py b/extras/dismissed/pytomb/tomblib/undertaker.py deleted file mode 100644 index 0b22b916..00000000 --- a/extras/dismissed/pytomb/tomblib/undertaker.py +++ /dev/null @@ -1,79 +0,0 @@ -import subprocess -from tempfile import NamedTemporaryFile - -import parser - -class Undertaker(object): - ''' - This is similar to Tomb class, and provides a wrapper on undertaker. - - TODO: - * methods for automagical scan - * output parsing, giving meaningful output - - Due to the non-interactive nature of undertaker, it's simpler than Tomb - ''' - undertakerexec = 'undertaker' - @classmethod - def check(cls, paths): - '''Will check if there are keys available there, as in --path - - paths can be a string (one address), or a list of - ''' - #TODO: more solid check: something like - if type(paths) is not str: - out = [] - for p in paths: - try: - res = cls.check(p) - except: - continue - else: - if res: - out.extend(res) - return out - - buf = NamedTemporaryFile() - try: - subprocess.check_call([cls.undertakerexec, paths, '--batch', - '--path'], stderr=buf) - except subprocess.CalledProcessError as exc: - return False - - out = [] - buf.seek(0) - for line in buf: - ret = parser.parse_line(line) - if ret and ret['type'] == 'found': - out.append(ret['content']) - return out - - - @classmethod - def get(cls, paths): - ''' - Similar to check, but truly get the key content. - If paths is iterable, stop at the first successful path - ''' - if type(paths) is not str: - for p in paths: - try: - res = cls.get(p) - except: - continue - else: - if res: - return res - buf = NamedTemporaryFile() - try: - subprocess.check_call([cls.undertakerexec, paths, '--batch'], - stdout=buf) - except subprocess.CalledProcessError: - return False - buf.seek(0) - return buf.read() - - -if __name__ == '__main__': - Undertaker.undertakerexec = '/home/davide/coding/projects/tomb/src/undertaker' - print Undertaker.get('near:///home/davide/Desktop/testing.tomb') diff --git a/extras/dismissed/qt/.gitignore b/extras/dismissed/qt/.gitignore deleted file mode 100644 index cf9dc94d..00000000 --- a/extras/dismissed/qt/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.*.swp -*.pyc -TombQt.egg-info -build -dist -disk diff --git a/extras/dismissed/qt/Makefile b/extras/dismissed/qt/Makefile deleted file mode 100644 index aeb1a389..00000000 --- a/extras/dismissed/qt/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TARGETS_OPEN=tombqt/ui_open_tombfile.py tombqt/ui_open_keymethod.py tombqt/ui_open_success.py -TARGETS=tombqt/ui_create.py $(TARGETS_OPEN) - -all: $(TARGETS) -test_create: tombqt/ui_create.py - python2 -3 tombqt/create.py -test_open: $(TARGETS_OPEN) - python2 -3 tombqt/open.py - - -tombqt/ui_create.py: tombqt/create.ui - pyuic4 create.ui -o tombqt/ui_create.py -tombqt/ui_open_tombfile.py: tombqt/open_tombfile.ui - pyuic4 tombqt/open_tombfile.ui -o tombqt/ui_open_tombfile.py -tombqt/ui_open_keymethod.py: tombqt/open_keymethod.ui - pyuic4 tombqt/open_keymethod.ui -o tombqt/ui_open_keymethod.py -tombqt/ui_open_success.py: tombqt/open_success.ui - pyuic4 tombqt/open_success.ui -o tombqt/ui_open_success.py - -clean: - rm $(TARGETS) - -.PHONY: test clean diff --git a/extras/dismissed/qt/notes.txt b/extras/dismissed/qt/notes.txt deleted file mode 100644 index 05525f52..00000000 --- a/extras/dismissed/qt/notes.txt +++ /dev/null @@ -1,9 +0,0 @@ -Some conventions: -.ui files are designers files -Sometimes it's necessary to create custom widget to extend the functionality -given by designer in a clean way. These files should be called ui_whatever.py - -.ui files must be "compiled" using pyuic4. This should be done with make, but -won't be right now. So, for the moment, I'll keep compiled files directly in -the sources, for easiness. - diff --git a/extras/dismissed/qt/setup.py b/extras/dismissed/qt/setup.py deleted file mode 100644 index 6e029e9b..00000000 --- a/extras/dismissed/qt/setup.py +++ /dev/null @@ -1,63 +0,0 @@ -import os -import glob -from setuptools import setup -from StringIO import StringIO - -from distutils import log -from distutils.core import Command -from distutils.dep_util import newer - -class build_ui(Command): -# Stolen from picard - description = "build Qt UI files" - user_options = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - from PyQt4 import uic - for uifile in glob.glob("tombqt/*.ui"): - pyfile = "ui_%s.py" % os.path.splitext(os.path.basename(uifile))[0] - pyfile = os.path.join('tombqt', pyfile) - if newer(uifile, pyfile): - log.info("compiling %s -> %s", uifile, pyfile) - tmp = StringIO() - uic.compileUi(uifile, tmp) - source = tmp.getvalue() - f = open(pyfile, "w") - f.write(source) - f.close() - -setup( - name = 'TombQt', - url = 'http://tomb.dyne.org/', - author = 'boyska', - author_email = 'piuttosto@logorroici.org', - version = '0.1', - packages = ['tombqt'], - cmdclass = { - 'build_ui': build_ui - }, - entry_points = { - 'gui_scripts': [ - 'tomb-qt-create = tombqt.create:run_create_wizard', - 'tomb-qt-open = tombqt.open:run_open_wizard' - ] - }, - classifiers = [ - 'Topic :: Security :: Cryptography', - 'Intended Audience :: End Users/Desktop', - 'Operating System :: POSIX :: Linux', - 'Environment :: X11 Applications :: Qt', - 'License :: OSI Approved :: GNU General Public License (GPL)', - 'Development Status :: 3 - Alpha' - ] -) - - - - diff --git a/extras/dismissed/qt/tombqt/__init__.py b/extras/dismissed/qt/tombqt/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/extras/dismissed/qt/tombqt/create.py b/extras/dismissed/qt/tombqt/create.py deleted file mode 100755 index d39697c1..00000000 --- a/extras/dismissed/qt/tombqt/create.py +++ /dev/null @@ -1,134 +0,0 @@ -import sys, os - -from PyQt4.QtGui import QApplication, QWizard -from PyQt4 import QtCore -from PyQt4 import QtGui -from ui_create import Ui_Wizard - -if __name__ == '__main__': - parentdir = sys.path[0].split(os.sep)[:-1] - sys.path.append(os.sep.join(parentdir)) -from tomblib.tomb import Tomb -from worker import TombCreateThread - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class TombCreateWizard(QWizard): - def __init__(self, *args, **kwargs): - QWizard.__init__(self, *args, **kwargs) - self.ui = ui = Ui_Wizard() - ui.setupUi(self) - #instance attributes: - self.ignore_swap = False - self._tomb_check = False #ugly; it's used by check_progress_complete - - ui.wizardPage_tomb_location.registerField('tombpath*', - ui.lineEdit_tombpath) #required field, note the * - ui.wizardPage_key_location.setCommitPage(True) - - QtCore.QObject.connect(ui.button_tombpath, - QtCore.SIGNAL(_fromUtf8('clicked()')), - self.on_tomb_location_clicked) - QtCore.QObject.connect(self, - QtCore.SIGNAL(_fromUtf8('currentIdChanged(int)')), - self.on_change_page) - QtCore.QObject.connect(ui.radioButton_swapoff, - QtCore.SIGNAL(_fromUtf8('toggled(bool)')), - ui.wizardPage_check.completeChanged) - QtCore.QObject.connect(ui.radioButton_ignore, - QtCore.SIGNAL(_fromUtf8('toggled(bool)')), - ui.wizardPage_check.completeChanged) - def check_progress_complete(*args, **kwargs): - if self.ui.progressBar.value() == 100: - return True - return False - def check_is_solved(): - if self._tomb_check: - return True - if self.ui.radioButton_swapoff.isChecked() or \ - self.ui.radioButton_ignore.isChecked(): - return True - return False - self.ui.wizardPage_progress.isComplete = check_progress_complete - self.ui.wizardPage_check.isComplete = check_is_solved - self.ui.groupBox_swap.setVisible(False) - self.finished.connect(self.on_finish) - - def _keyloc(self): - keyloc = None - if self.ui.radioButton_usb.isChecked(): - print 'Warning: it is not supported' - raise NotImplementedError - elif self.ui.radioButton_near.isChecked(): - print 'going near' - keyloc = None - else: - keyloc = self.ui.lineEdit_custom.text() - if not keyloc: - raise ValueError - return keyloc - - def on_tomb_location_clicked(self, *args, **kwargs): - filename = QtGui.QFileDialog.getSaveFileName(self, 'Create Tomb', - filter="Tomb(*.tomb)") - self.ui.lineEdit_tombpath.setText(filename) - def on_change_page(self, pagenumber): - if self.currentPage() == self.ui.wizardPage_progress: - self.create_tomb() - if self.currentPage() == self.ui.wizardPage_check: - self.check_requisite() - - def on_finish(self, finishedint): - if self.currentPage() != self.ui.wizardPage_end: - #there has been an error - return - - if self.ui.checkBox_open.isChecked(): - Tomb.open(self.ui.lineEdit_tombpath.text(), self._keyloc()) - def on_thread_creation_finished(self): - if self.thread.get_success(): - self.ui.progressBar.setValue(100) - else: - self.ui.progressBar.setEnabled(False) - self.ui.label_progress.setText('Error while creating the tomb!') - self.ui.wizardPage_progress.setFinalPage(True) - self.ui.wizardPage_progress.completeChanged.emit() - def create_tomb(self): - self.thread = TombCreateThread(self.ui.lineEdit_tombpath.text(), - str(self.ui.spinBox_size.value()), self._keyloc(), - no_color=False, ignore_swap=self.ui.radioButton_ignore.isChecked()) - self.thread.finished.connect(self.on_thread_creation_finished) - self.thread.terminated.connect(self.on_thread_creation_finished) - self.thread.line_received.connect(self.ui.textBrowser_log.append) - def err_append_to_log(text): - self.ui.textBrowser_log.append('Error: ' + text + - '') - self.thread.error_received.connect(err_append_to_log) - self.thread.start() - def check_requisite(self): - self._tomb_check = check = Tomb.check('create', no_color=False) - self.ui.wizardPage_check.completeChanged.emit() - if check: - self.ui.label_check.setText('Everything seems fine!') - return - self.ui.label_check.setText('Some error occurred') - if Tomb.check('create', no_color=False, ignore_swap=True): # swap is the only error - self.ui.groupBox_swap.setVisible(True) - #TODO: support swapoff - #TODO: calculate the amount of ram available vs swap used - self.ui.radioButton_swapoff.setEnabled(False) - self.ui.label_swapoff.setEnabled(False) - - -def run_create_wizard(): - app = QApplication(sys.argv) - window = TombCreateWizard() - window.show() - sys.exit(app.exec_()) - -if __name__ == '__main__': - run_create_wizard() - diff --git a/extras/dismissed/qt/tombqt/create.ui b/extras/dismissed/qt/tombqt/create.ui deleted file mode 100755 index 2c509550..00000000 --- a/extras/dismissed/qt/tombqt/create.ui +++ /dev/null @@ -1,553 +0,0 @@ - - - Wizard - - - - 0 - 0 - 710 - 368 - - - - Wizard - - - QWizard::HaveHelpButton|QWizard::IndependentPages - - - - Tomb - - - tomb creation - - - - - - This wizard will guide you to the creation of a tomb.<br> It will be fun! - - - Qt::RichText - - - true - - - - - - - - Requirements check - - - - - - Checking... - - - - - - - true - - - Swap error - - - - - - It seems that you have swap activated. It is very dangerous, since you could leave LOT of traces on your computer UNencrypted. You have some options: - - - true - - - - - - - - - Swapoff - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 20 - 20 - - - - - - - - Note: swapoff could take a long time, and, in case the memory is not enough, could even make your system crash. Your system seems to have %freeram%MB free - - - true - - - - - - - - - - - - - Ignore - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 20 - 20 - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Note:</span> You should use this only if you are sure that your swap is encrypted, or that you are using compcache.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If this is not the case, DON'T select this, as it is <span style=" font-weight:600;">VERY DANGEROUS </span>to use encryption with swap activated</p></body></html> - - - true - - - - - - - - - - - - - - - - - - Please enter tomb size. Digging the tomb will require some time: usually, one minute per GB, but your mileage may vary. <br>Keep in mind that resizing it in the future is still NOT implemented - - - true - - - - - - - - - Enter tomb size, in MB. 1GB=1000MB) - - - spinBox_size - - - - - - - 10 - - - 100000 - - - 100 - - - - - - - - - - - - - Where do you want your tomb to be digged? - - - true - - - lineEdit_tombpath - - - - - - - - - true - - - /path/to/file.tomb - - - - - - - Open file - - - - - - - - - - Key creation - - - Choose the location for your key - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Now, you have to decide where to put the <span style=" font-weight:600;">key</span> for your tomb<br />You should not leave your key at the door, as this will lower security A LOT</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Also, the keyfile is very small (less than a KB), so disk space is not an issue</p></body></html> - - - Qt::RichText - - - true - - - - - - - - - - - false - - - On a USB pen (best security) - - - true - - - false - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 40 - 20 - - - - - - - - false - - - If you choose to do so, do not insert it NOW. Do it when you are asked to do so - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It will be created as a regular file in the same directory of your tomb.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">It is much easier to use, but also much more <span style=" font-style:italic;">insecure</span>: all your security will be guaranteed by your <span style=" font-weight:600;">password</span>. If you really want to do this, choose a strong password (lot of random/non-dictionary words, spaces, numbers, odd characters)</p></body></html> - - - Near to the tomb itself (this is BAD) - - - true - - - - - - - Specify location - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 40 - 20 - - - - - - - - false - - - - - - - false - - - Choose location - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Help: </span>the key file is very small, so disk usage is not an issue</p></body></html> - - - true - - - - - - - - Creating - - - Please wait - - - - - - - - 0 - - - true - - - false - - - - - - - - - Creating tomb, please wait... - - - - - - - - - - - Log - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><title>Log</title><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600;">Log</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt; font-weight:600;"></p></body></html> - - - - - - - - - - - You successfully created the tomb! - - - - - - - false - - - Open the just-created tomb NOW! - - - false - - - false - - - - - - - - - - radioButton_custom - toggled(bool) - lineEdit_custom - setEnabled(bool) - - - 91 - 56 - - - 53 - 56 - - - - - radioButton_custom - toggled(bool) - pushButton_custom - setEnabled(bool) - - - 98 - 56 - - - 98 - 56 - - - - - Wizard - currentIdChanged(int) - label_11 - hide() - - - 181 - 335 - - - 99 - 60 - - - - - Wizard - helpRequested() - label_11 - show() - - - 135 - 356 - - - 99 - 60 - - - - - - check_passwords_equal() - - diff --git a/extras/dismissed/qt/tombqt/open.py b/extras/dismissed/qt/tombqt/open.py deleted file mode 100644 index e2171bd0..00000000 --- a/extras/dismissed/qt/tombqt/open.py +++ /dev/null @@ -1,109 +0,0 @@ -import sys - -from PyQt4 import QtCore, QtGui - -from ui_open_tombfile import Ui_tombfile -from ui_open_keymethod import Ui_keymethod -from ui_open_success import Ui_success - -from tomblib.tomb import Tomb -from tomblib.undertaker import Undertaker - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class TombfilePage(QtGui.QWizardPage): - def __init__(self, *args, **kwargs): - QtGui.QWizardPage.__init__(self, *args) - self.ui = Ui_tombfile() - self.ui.setupUi(self) - if 'tombfile' in kwargs and kwargs['tombfile'] is not None: - self.ui.tomb_line.setText(kwargs['tombfile']) - self.ui.tomb_browse.clicked.connect(self.on_tomb_location_clicked) - def on_tomb_location_clicked(self, *args, **kwargs): - filename = QtGui.QFileDialog.getOpenFileName(self, 'Select Tomb', - filter="Tomb (*.tomb)") - self.ui.tomb_line.setText(filename) - -class MethodPage(QtGui.QWizardPage): - def __init__(self, *args, **kwargs): - QtGui.QWizardPage.__init__(self, *args, **kwargs) - self.ui = Ui_keymethod() - self.ui.setupUi(self) - self.group = group = QtGui.QButtonGroup() - for radio in self.children(): - if type(radio) == QtGui.QRadioButton: - group.addButton(radio) - - def initializePage(self): - self.found = Undertaker.check( str('near://' + self.wizard().get_tombfile()) ) or [] - box = self.ui.radio_layout - - for key in self.found: - radio = QtGui.QRadioButton('Automatically found: ' + key, parent=self) - radio.setChecked(True) - radio.setProperty('path', key) - box.insertWidget(0, radio) - self.group.addButton(radio) - - - def nextId(self): - '''Virtual method reimplemented to decide next page''' - if self.ui.fs.isChecked(): - keyfile = QtGui.QFileDialog.getOpenFileName(self.wizard(), 'Key file', - filter="Tomb keys (*.tomb.key);;Buried keys (*.jpeg)") - if keyfile: - #TODO: check if this really is a success :) - if Tomb.open(self.wizard().get_tombfile(), keyfile): #bugs when wrong password - return TombOpenWizard.SUCCESS_PAGE - #else: #TODO: should alert the user that we failed - return TombOpenWizard.METHOD_PAGE - if self.ui.usb.isChecked(): - return TombOpenWizard.USB_PAGE - print self.group.checkedButton().property('path').toPyObject() - return TombOpenWizard.SUCCESS_PAGE - -class SuccessPage(QtGui.QWizardPage): - def __init__(self, *args, **kwargs): - QtGui.QWizardPage.__init__(self, *args, **kwargs) - self.ui = Ui_success() - self.ui.setupUi(self) - -class TombOpenWizard(QtGui.QWizard): - TOMBFILE_PAGE=1 - METHOD_PAGE=2 - SUCCESS_PAGE=99 - USB_PAGE=20 - def __init__(self, *args, **kwargs): - QtGui.QWizard.__init__(self, *args) - self.setPage(TombOpenWizard.TOMBFILE_PAGE, - TombfilePage(self, tombfile = kwargs['tombfile'] - if 'tombfile' in kwargs else None)) - self.setPage(TombOpenWizard.METHOD_PAGE, MethodPage(self)) - self.setPage(TombOpenWizard.SUCCESS_PAGE, SuccessPage(self)) - if 'tombfile' in kwargs and kwargs['tombfile'] is not None: - self.setStartId(TombOpenWizard.METHOD_PAGE) - - def get_tombfile(self): - page = self.page(TombOpenWizard.TOMBFILE_PAGE) - return page.ui.tomb_line.text() - - - -def run_open_wizard(): - app = QtGui.QApplication(sys.argv) - window = TombOpenWizard(tombfile=sys.argv[1] if len(sys.argv) > 1 else None) - window.show() - sys.exit(app.exec_()) - -if __name__ == '__main__': - Undertaker.undertakerexec = '/home/davide/coding/projects/tomb/src/undertaker' - run_open_wizard() - - - - - - diff --git a/extras/dismissed/qt/tombqt/open.ui b/extras/dismissed/qt/tombqt/open.ui deleted file mode 100644 index aeb67935..00000000 --- a/extras/dismissed/qt/tombqt/open.ui +++ /dev/null @@ -1,239 +0,0 @@ - - - Dialog - - - Tomb open - - - Open a tomb file; this will require a passphrase - - - false - - - true - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Opening %tombname%</span></p></body></html> - - - Qt::RichText - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Maximum - - - - 40 - 20 - - - - - - - - Size: %tombsize% - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 25 - - - - - - - - Opening key - - - false - - - false - - - - - - Key found in %autokeypath% - - - - - - - Select a key to open the tomb - - - Choose another key - - - true - - - false - - - false - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 40 - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">HELP</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To open a tomb, you need both:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 1. a key, which is a file with secret information.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> 2. a passphrase</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This dialog will help you choose the keyfile. We try hard to find the key, but if we can't found the right one, choose it yourself using the button</p></body></html> - - - true - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Open - - - false - - - - - - - - - buttonBox - rejected() - Dialog - reject() - - - 578 - 751 - - - 529 - 381 - - - - - buttonBox - accepted() - Dialog - accept() - - - 447 - 735 - - - 279 - 326 - - - - - Dialog - created() - label_4 - hide() - - - 141 - 756 - - - 136 - 692 - - - - - buttonBox - helpRequested() - label_4 - hide() - - - 39 - 738 - - - 71 - 676 - - - - - - created() - - diff --git a/extras/dismissed/qt/tombqt/open_choosekey.ui b/extras/dismissed/qt/tombqt/open_choosekey.ui deleted file mode 100644 index e45b8f3d..00000000 --- a/extras/dismissed/qt/tombqt/open_choosekey.ui +++ /dev/null @@ -1,147 +0,0 @@ - - - Dialog - - - - 0 - 0 - - - - Dialog - - - true - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Auto-search</span></p></body></html> - - - Qt::RichText - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - - - - Custom location - - - - - - - - - false - - - /path/to/keyfile - - - - - - - Choose file - - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 247 - 604 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 315 - 604 - - - 286 - 274 - - - - - diff --git a/extras/dismissed/qt/tombqt/open_keymethod.ui b/extras/dismissed/qt/tombqt/open_keymethod.ui deleted file mode 100644 index 22999369..00000000 --- a/extras/dismissed/qt/tombqt/open_keymethod.ui +++ /dev/null @@ -1,84 +0,0 @@ - - - keymethod - - - - 0 - 0 - 480 - 640 - - - - WizardPage - - - Choose key - - - - - - Qt::Vertical - - - - 20 - 265 - - - - - - - - - - Filesystem - - - true - - - - - - - false - - - USB drive - - - - - - - false - - - Retrieve via bluetooth (advanced) - - - - - - - - - Qt::Vertical - - - - 20 - 265 - - - - - - - - - diff --git a/extras/dismissed/qt/tombqt/open_success.ui b/extras/dismissed/qt/tombqt/open_success.ui deleted file mode 100644 index 200e4fd5..00000000 --- a/extras/dismissed/qt/tombqt/open_success.ui +++ /dev/null @@ -1,34 +0,0 @@ - - - success - - - - 0 - 0 - 480 - 640 - - - - WizardPage - - - Tomb opened - - - success - - - - - - You successfully opened the tomb - - - - - - - - diff --git a/extras/dismissed/qt/tombqt/open_tombfile.ui b/extras/dismissed/qt/tombqt/open_tombfile.ui deleted file mode 100644 index 3b73ab22..00000000 --- a/extras/dismissed/qt/tombqt/open_tombfile.ui +++ /dev/null @@ -1,79 +0,0 @@ - - - tombfile - - - - 0 - 0 - 480 - 640 - - - - WizardPage - - - Choose tomb - - - - - - Qt::Vertical - - - - 20 - 276 - - - - - - - - - - Choose a tomb file on your filesystem - - - - - - - - - /path/to/your.tomb - - - - - - - Browse - - - - - - - - - - - Qt::Vertical - - - - 20 - 276 - - - - - - - - - diff --git a/extras/dismissed/qt/tombqt/ui_create.py b/extras/dismissed/qt/tombqt/ui_create.py deleted file mode 100644 index 0f259930..00000000 --- a/extras/dismissed/qt/tombqt/ui_create.py +++ /dev/null @@ -1,282 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'create.ui' -# -# Created: Thu Nov 3 00:16:51 2011 -# by: PyQt4 UI code generator 4.8.6 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class Ui_Wizard(object): - def setupUi(self, Wizard): - Wizard.setObjectName(_fromUtf8("Wizard")) - Wizard.resize(710, 368) - Wizard.setWindowTitle(QtGui.QApplication.translate("Wizard", "Wizard", None, QtGui.QApplication.UnicodeUTF8)) - Wizard.setOptions(QtGui.QWizard.HaveHelpButton|QtGui.QWizard.IndependentPages) - self.wizardPage_intro = QtGui.QWizardPage() - self.wizardPage_intro.setTitle(QtGui.QApplication.translate("Wizard", "Tomb", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_intro.setSubTitle(QtGui.QApplication.translate("Wizard", "tomb creation", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_intro.setObjectName(_fromUtf8("wizardPage_intro")) - self.verticalLayout = QtGui.QVBoxLayout(self.wizardPage_intro) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.label = QtGui.QLabel(self.wizardPage_intro) - self.label.setText(QtGui.QApplication.translate("Wizard", "This wizard will guide you to the creation of a tomb.
It will be fun!", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setTextFormat(QtCore.Qt.RichText) - self.label.setWordWrap(True) - self.label.setObjectName(_fromUtf8("label")) - self.verticalLayout.addWidget(self.label) - Wizard.addPage(self.wizardPage_intro) - self.wizardPage_check = QtGui.QWizardPage() - self.wizardPage_check.setTitle(QtGui.QApplication.translate("Wizard", "Requirements check", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_check.setObjectName(_fromUtf8("wizardPage_check")) - self.verticalLayout_12 = QtGui.QVBoxLayout(self.wizardPage_check) - self.verticalLayout_12.setObjectName(_fromUtf8("verticalLayout_12")) - self.label_check = QtGui.QLabel(self.wizardPage_check) - self.label_check.setText(QtGui.QApplication.translate("Wizard", "Checking...", None, QtGui.QApplication.UnicodeUTF8)) - self.label_check.setObjectName(_fromUtf8("label_check")) - self.verticalLayout_12.addWidget(self.label_check) - self.groupBox_swap = QtGui.QGroupBox(self.wizardPage_check) - self.groupBox_swap.setEnabled(True) - self.groupBox_swap.setTitle(QtGui.QApplication.translate("Wizard", "Swap error", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_swap.setObjectName(_fromUtf8("groupBox_swap")) - self.verticalLayout_13 = QtGui.QVBoxLayout(self.groupBox_swap) - self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13")) - self.label_7 = QtGui.QLabel(self.groupBox_swap) - self.label_7.setText(QtGui.QApplication.translate("Wizard", "It seems that you have swap activated. It is very dangerous, since you could leave LOT of traces on your computer UNencrypted. You have some options:", None, QtGui.QApplication.UnicodeUTF8)) - self.label_7.setWordWrap(True) - self.label_7.setObjectName(_fromUtf8("label_7")) - self.verticalLayout_13.addWidget(self.label_7) - self.verticalLayout_swapoff = QtGui.QVBoxLayout() - self.verticalLayout_swapoff.setObjectName(_fromUtf8("verticalLayout_swapoff")) - self.radioButton_swapoff = QtGui.QRadioButton(self.groupBox_swap) - self.radioButton_swapoff.setText(QtGui.QApplication.translate("Wizard", "Swapoff", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_swapoff.setObjectName(_fromUtf8("radioButton_swapoff")) - self.verticalLayout_swapoff.addWidget(self.radioButton_swapoff) - self.horizontalLayout_6 = QtGui.QHBoxLayout() - self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6")) - spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_6.addItem(spacerItem) - self.label_swapoff = QtGui.QLabel(self.groupBox_swap) - self.label_swapoff.setText(QtGui.QApplication.translate("Wizard", "Note: swapoff could take a long time, and, in case the memory is not enough, could even make your system crash. Your system seems to have %freeram%MB free", None, QtGui.QApplication.UnicodeUTF8)) - self.label_swapoff.setWordWrap(True) - self.label_swapoff.setObjectName(_fromUtf8("label_swapoff")) - self.horizontalLayout_6.addWidget(self.label_swapoff) - self.verticalLayout_swapoff.addLayout(self.horizontalLayout_6) - self.verticalLayout_13.addLayout(self.verticalLayout_swapoff) - self.verticalLayout_11 = QtGui.QVBoxLayout() - self.verticalLayout_11.setObjectName(_fromUtf8("verticalLayout_11")) - self.radioButton_ignore = QtGui.QRadioButton(self.groupBox_swap) - self.radioButton_ignore.setText(QtGui.QApplication.translate("Wizard", "Ignore", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_ignore.setObjectName(_fromUtf8("radioButton_ignore")) - self.verticalLayout_11.addWidget(self.radioButton_ignore) - self.horizontalLayout_7 = QtGui.QHBoxLayout() - self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7")) - spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_7.addItem(spacerItem1) - self.label_9 = QtGui.QLabel(self.groupBox_swap) - self.label_9.setText(QtGui.QApplication.translate("Wizard", "\n" -"\n" -"

Note: You should use this only if you are sure that your swap is encrypted, or that you are using compcache.

\n" -"

If this is not the case, DON\'T select this, as it is VERY DANGEROUS to use encryption with swap activated

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_9.setWordWrap(True) - self.label_9.setObjectName(_fromUtf8("label_9")) - self.horizontalLayout_7.addWidget(self.label_9) - self.verticalLayout_11.addLayout(self.horizontalLayout_7) - self.verticalLayout_13.addLayout(self.verticalLayout_11) - self.verticalLayout_12.addWidget(self.groupBox_swap) - Wizard.addPage(self.wizardPage_check) - self.wizardPage_tomb_size = QtGui.QWizardPage() - self.wizardPage_tomb_size.setObjectName(_fromUtf8("wizardPage_tomb_size")) - self.verticalLayout_2 = QtGui.QVBoxLayout(self.wizardPage_tomb_size) - self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) - self.label_2 = QtGui.QLabel(self.wizardPage_tomb_size) - self.label_2.setText(QtGui.QApplication.translate("Wizard", "Please enter tomb size. Digging the tomb will require some time: usually, one minute per GB, but your mileage may vary.
Keep in mind that resizing it in the future is still NOT implemented", None, QtGui.QApplication.UnicodeUTF8)) - self.label_2.setWordWrap(True) - self.label_2.setObjectName(_fromUtf8("label_2")) - self.verticalLayout_2.addWidget(self.label_2) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.label_3 = QtGui.QLabel(self.wizardPage_tomb_size) - self.label_3.setText(QtGui.QApplication.translate("Wizard", "Enter tomb size, in MB. 1GB=1000MB)", None, QtGui.QApplication.UnicodeUTF8)) - self.label_3.setObjectName(_fromUtf8("label_3")) - self.horizontalLayout.addWidget(self.label_3) - self.spinBox_size = QtGui.QSpinBox(self.wizardPage_tomb_size) - self.spinBox_size.setMinimum(10) - self.spinBox_size.setMaximum(100000) - self.spinBox_size.setProperty("value", 100) - self.spinBox_size.setObjectName(_fromUtf8("spinBox_size")) - self.horizontalLayout.addWidget(self.spinBox_size) - self.verticalLayout_2.addLayout(self.horizontalLayout) - Wizard.addPage(self.wizardPage_tomb_size) - self.wizardPage_tomb_location = QtGui.QWizardPage() - self.wizardPage_tomb_location.setObjectName(_fromUtf8("wizardPage_tomb_location")) - self.verticalLayout_3 = QtGui.QVBoxLayout(self.wizardPage_tomb_location) - self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) - self.label_4 = QtGui.QLabel(self.wizardPage_tomb_location) - self.label_4.setText(QtGui.QApplication.translate("Wizard", "Where do you want your tomb to be digged?", None, QtGui.QApplication.UnicodeUTF8)) - self.label_4.setWordWrap(True) - self.label_4.setObjectName(_fromUtf8("label_4")) - self.verticalLayout_3.addWidget(self.label_4) - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) - self.lineEdit_tombpath = QtGui.QLineEdit(self.wizardPage_tomb_location) - self.lineEdit_tombpath.setFrame(True) - self.lineEdit_tombpath.setPlaceholderText(QtGui.QApplication.translate("Wizard", "/path/to/file.tomb", None, QtGui.QApplication.UnicodeUTF8)) - self.lineEdit_tombpath.setObjectName(_fromUtf8("lineEdit_tombpath")) - self.horizontalLayout_2.addWidget(self.lineEdit_tombpath) - self.button_tombpath = QtGui.QPushButton(self.wizardPage_tomb_location) - self.button_tombpath.setText(QtGui.QApplication.translate("Wizard", "Open file", None, QtGui.QApplication.UnicodeUTF8)) - self.button_tombpath.setObjectName(_fromUtf8("button_tombpath")) - self.horizontalLayout_2.addWidget(self.button_tombpath) - self.verticalLayout_3.addLayout(self.horizontalLayout_2) - Wizard.addPage(self.wizardPage_tomb_location) - self.wizardPage_key_location = QtGui.QWizardPage() - self.wizardPage_key_location.setTitle(QtGui.QApplication.translate("Wizard", "Key creation", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_key_location.setSubTitle(QtGui.QApplication.translate("Wizard", "Choose the location for your key", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_key_location.setObjectName(_fromUtf8("wizardPage_key_location")) - self.verticalLayout_6 = QtGui.QVBoxLayout(self.wizardPage_key_location) - self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) - self.label_5 = QtGui.QLabel(self.wizardPage_key_location) - self.label_5.setText(QtGui.QApplication.translate("Wizard", "\n" -"\n" -"

Now, you have to decide where to put the key for your tomb
You should not leave your key at the door, as this will lower security A LOT

\n" -"

Also, the keyfile is very small (less than a KB), so disk space is not an issue

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_5.setTextFormat(QtCore.Qt.RichText) - self.label_5.setWordWrap(True) - self.label_5.setObjectName(_fromUtf8("label_5")) - self.verticalLayout_6.addWidget(self.label_5) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5")) - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) - self.radioButton_usb = QtGui.QRadioButton(self.wizardPage_key_location) - self.radioButton_usb.setEnabled(False) - self.radioButton_usb.setText(QtGui.QApplication.translate("Wizard", "On a USB pen (best security)", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_usb.setCheckable(True) - self.radioButton_usb.setChecked(False) - self.radioButton_usb.setObjectName(_fromUtf8("radioButton_usb")) - self.verticalLayout_4.addWidget(self.radioButton_usb) - self.horizontalLayout_4 = QtGui.QHBoxLayout() - self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4")) - spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_4.addItem(spacerItem2) - self.label_6 = QtGui.QLabel(self.wizardPage_key_location) - self.label_6.setEnabled(False) - self.label_6.setText(QtGui.QApplication.translate("Wizard", "If you choose to do so, do not insert it NOW. Do it when you are asked to do so", None, QtGui.QApplication.UnicodeUTF8)) - self.label_6.setObjectName(_fromUtf8("label_6")) - self.horizontalLayout_4.addWidget(self.label_6) - self.verticalLayout_4.addLayout(self.horizontalLayout_4) - self.verticalLayout_5.addLayout(self.verticalLayout_4) - self.radioButton_near = QtGui.QRadioButton(self.wizardPage_key_location) - self.radioButton_near.setToolTip(QtGui.QApplication.translate("Wizard", "\n" -"\n" -"

It will be created as a regular file in the same directory of your tomb.

\n" -"

It is much easier to use, but also much more insecure: all your security will be guaranteed by your password. If you really want to do this, choose a strong password (lot of random/non-dictionary words, spaces, numbers, odd characters)

", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_near.setText(QtGui.QApplication.translate("Wizard", "Near to the tomb itself (this is BAD)", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_near.setChecked(True) - self.radioButton_near.setObjectName(_fromUtf8("radioButton_near")) - self.verticalLayout_5.addWidget(self.radioButton_near) - self.radioButton_custom = QtGui.QRadioButton(self.wizardPage_key_location) - self.radioButton_custom.setText(QtGui.QApplication.translate("Wizard", "Specify location", None, QtGui.QApplication.UnicodeUTF8)) - self.radioButton_custom.setObjectName(_fromUtf8("radioButton_custom")) - self.verticalLayout_5.addWidget(self.radioButton_custom) - self.verticalLayout_6.addLayout(self.verticalLayout_5) - self.horizontalLayout_3 = QtGui.QHBoxLayout() - self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3")) - spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Maximum, QtGui.QSizePolicy.Minimum) - self.horizontalLayout_3.addItem(spacerItem3) - self.lineEdit_custom = QtGui.QLineEdit(self.wizardPage_key_location) - self.lineEdit_custom.setEnabled(False) - self.lineEdit_custom.setObjectName(_fromUtf8("lineEdit_custom")) - self.horizontalLayout_3.addWidget(self.lineEdit_custom) - self.pushButton_custom = QtGui.QPushButton(self.wizardPage_key_location) - self.pushButton_custom.setEnabled(False) - self.pushButton_custom.setText(QtGui.QApplication.translate("Wizard", "Choose location", None, QtGui.QApplication.UnicodeUTF8)) - self.pushButton_custom.setObjectName(_fromUtf8("pushButton_custom")) - self.horizontalLayout_3.addWidget(self.pushButton_custom) - self.verticalLayout_6.addLayout(self.horizontalLayout_3) - self.label_11 = QtGui.QLabel(self.wizardPage_key_location) - self.label_11.setText(QtGui.QApplication.translate("Wizard", "\n" -"\n" -"

Help: the key file is very small, so disk usage is not an issue

", None, QtGui.QApplication.UnicodeUTF8)) - self.label_11.setWordWrap(True) - self.label_11.setObjectName(_fromUtf8("label_11")) - self.verticalLayout_6.addWidget(self.label_11) - Wizard.addPage(self.wizardPage_key_location) - self.wizardPage_progress = QtGui.QWizardPage() - self.wizardPage_progress.setTitle(QtGui.QApplication.translate("Wizard", "Creating", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_progress.setSubTitle(QtGui.QApplication.translate("Wizard", "Please wait", None, QtGui.QApplication.UnicodeUTF8)) - self.wizardPage_progress.setObjectName(_fromUtf8("wizardPage_progress")) - self.verticalLayout_9 = QtGui.QVBoxLayout(self.wizardPage_progress) - self.verticalLayout_9.setObjectName(_fromUtf8("verticalLayout_9")) - self.verticalLayout_7 = QtGui.QVBoxLayout() - self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7")) - self.progressBar = QtGui.QProgressBar(self.wizardPage_progress) - self.progressBar.setProperty("value", 0) - self.progressBar.setTextVisible(True) - self.progressBar.setInvertedAppearance(False) - self.progressBar.setObjectName(_fromUtf8("progressBar")) - self.verticalLayout_7.addWidget(self.progressBar) - self.horizontalLayout_5 = QtGui.QHBoxLayout() - self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5")) - self.label_progress = QtGui.QLabel(self.wizardPage_progress) - self.label_progress.setText(QtGui.QApplication.translate("Wizard", "Creating tomb, please wait...", None, QtGui.QApplication.UnicodeUTF8)) - self.label_progress.setObjectName(_fromUtf8("label_progress")) - self.horizontalLayout_5.addWidget(self.label_progress) - self.verticalLayout_7.addLayout(self.horizontalLayout_5) - self.verticalLayout_9.addLayout(self.verticalLayout_7) - self.textBrowser_log = QtGui.QTextBrowser(self.wizardPage_progress) - self.textBrowser_log.setDocumentTitle(QtGui.QApplication.translate("Wizard", "Log", None, QtGui.QApplication.UnicodeUTF8)) - self.textBrowser_log.setHtml(QtGui.QApplication.translate("Wizard", "\n" -"Log\n" -"

Log

\n" -"

", None, QtGui.QApplication.UnicodeUTF8)) - self.textBrowser_log.setObjectName(_fromUtf8("textBrowser_log")) - self.verticalLayout_9.addWidget(self.textBrowser_log) - Wizard.addPage(self.wizardPage_progress) - self.wizardPage_end = QtGui.QWizardPage() - self.wizardPage_end.setObjectName(_fromUtf8("wizardPage_end")) - self.verticalLayout_8 = QtGui.QVBoxLayout(self.wizardPage_end) - self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8")) - self.label_10 = QtGui.QLabel(self.wizardPage_end) - self.label_10.setText(QtGui.QApplication.translate("Wizard", "You successfully created the tomb!", None, QtGui.QApplication.UnicodeUTF8)) - self.label_10.setObjectName(_fromUtf8("label_10")) - self.verticalLayout_8.addWidget(self.label_10) - self.checkBox_open = QtGui.QCheckBox(self.wizardPage_end) - self.checkBox_open.setEnabled(False) - self.checkBox_open.setText(QtGui.QApplication.translate("Wizard", "Open the just-created tomb NOW!", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox_open.setChecked(False) - self.checkBox_open.setTristate(False) - self.checkBox_open.setObjectName(_fromUtf8("checkBox_open")) - self.verticalLayout_8.addWidget(self.checkBox_open) - Wizard.addPage(self.wizardPage_end) - self.label_3.setBuddy(self.spinBox_size) - self.label_4.setBuddy(self.lineEdit_tombpath) - - self.retranslateUi(Wizard) - QtCore.QObject.connect(self.radioButton_custom, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.lineEdit_custom.setEnabled) - QtCore.QObject.connect(self.radioButton_custom, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.pushButton_custom.setEnabled) - QtCore.QObject.connect(Wizard, QtCore.SIGNAL(_fromUtf8("currentIdChanged(int)")), self.label_11.hide) - QtCore.QObject.connect(Wizard, QtCore.SIGNAL(_fromUtf8("helpRequested()")), self.label_11.show) - QtCore.QMetaObject.connectSlotsByName(Wizard) - - def retranslateUi(self, Wizard): - pass - diff --git a/extras/dismissed/qt/tombqt/ui_open_keymethod.py b/extras/dismissed/qt/tombqt/ui_open_keymethod.py deleted file mode 100644 index 21b99515..00000000 --- a/extras/dismissed/qt/tombqt/ui_open_keymethod.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'tombqt/open_keymethod.ui' -# -# Created: Sat Jan 28 03:36:11 2012 -# by: PyQt4 UI code generator 4.9 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class Ui_keymethod(object): - def setupUi(self, keymethod): - keymethod.setObjectName(_fromUtf8("keymethod")) - keymethod.resize(480, 640) - self.verticalLayout = QtGui.QVBoxLayout(keymethod) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - spacerItem = QtGui.QSpacerItem(20, 265, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) - self.radio_layout = QtGui.QVBoxLayout() - self.radio_layout.setObjectName(_fromUtf8("radio_layout")) - self.fs = QtGui.QRadioButton(keymethod) - self.fs.setObjectName(_fromUtf8("fs")) - self.radio_layout.addWidget(self.fs) - self.usb = QtGui.QRadioButton(keymethod) - self.usb.setEnabled(False) - self.usb.setObjectName(_fromUtf8("usb")) - self.radio_layout.addWidget(self.usb) - self.bluetooth = QtGui.QRadioButton(keymethod) - self.bluetooth.setEnabled(False) - self.bluetooth.setObjectName(_fromUtf8("bluetooth")) - self.radio_layout.addWidget(self.bluetooth) - self.verticalLayout.addLayout(self.radio_layout) - spacerItem1 = QtGui.QSpacerItem(20, 265, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem1) - - self.retranslateUi(keymethod) - QtCore.QMetaObject.connectSlotsByName(keymethod) - - def retranslateUi(self, keymethod): - keymethod.setWindowTitle(QtGui.QApplication.translate("keymethod", "WizardPage", None, QtGui.QApplication.UnicodeUTF8)) - keymethod.setTitle(QtGui.QApplication.translate("keymethod", "Choose key", None, QtGui.QApplication.UnicodeUTF8)) - self.fs.setText(QtGui.QApplication.translate("keymethod", "Filesystem", None, QtGui.QApplication.UnicodeUTF8)) - self.usb.setText(QtGui.QApplication.translate("keymethod", "USB drive", None, QtGui.QApplication.UnicodeUTF8)) - self.bluetooth.setText(QtGui.QApplication.translate("keymethod", "Retrieve via bluetooth (advanced)", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/extras/dismissed/qt/tombqt/ui_open_success.py b/extras/dismissed/qt/tombqt/ui_open_success.py deleted file mode 100644 index 700081ff..00000000 --- a/extras/dismissed/qt/tombqt/ui_open_success.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'tombqt/open_success.ui' -# -# Created: Mon Jan 23 23:06:38 2012 -# by: PyQt4 UI code generator 4.9 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class Ui_success(object): - def setupUi(self, success): - success.setObjectName(_fromUtf8("success")) - success.resize(480, 640) - self.verticalLayout = QtGui.QVBoxLayout(success) - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.label = QtGui.QLabel(success) - self.label.setObjectName(_fromUtf8("label")) - self.verticalLayout.addWidget(self.label) - - self.retranslateUi(success) - QtCore.QMetaObject.connectSlotsByName(success) - - def retranslateUi(self, success): - success.setWindowTitle(QtGui.QApplication.translate("success", "WizardPage", None, QtGui.QApplication.UnicodeUTF8)) - success.setTitle(QtGui.QApplication.translate("success", "Tomb opened", None, QtGui.QApplication.UnicodeUTF8)) - success.setSubTitle(QtGui.QApplication.translate("success", "success", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("success", "You successfully opened the tomb", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/extras/dismissed/qt/tombqt/ui_open_tombfile.py b/extras/dismissed/qt/tombqt/ui_open_tombfile.py deleted file mode 100644 index d9f1eb6b..00000000 --- a/extras/dismissed/qt/tombqt/ui_open_tombfile.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'tombqt/open_tombfile.ui' -# -# Created: Tue Jan 24 00:49:10 2012 -# by: PyQt4 UI code generator 4.9 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -try: - _fromUtf8 = QtCore.QString.fromUtf8 -except AttributeError: - _fromUtf8 = lambda s: s - -class Ui_tombfile(object): - def setupUi(self, tombfile): - tombfile.setObjectName(_fromUtf8("tombfile")) - tombfile.resize(480, 640) - self.verticalLayout_2 = QtGui.QVBoxLayout(tombfile) - self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) - spacerItem = QtGui.QSpacerItem(20, 276, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.label = QtGui.QLabel(tombfile) - self.label.setObjectName(_fromUtf8("label")) - self.verticalLayout.addWidget(self.label) - self.horizontalLayout = QtGui.QHBoxLayout() - self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) - self.tomb_line = QtGui.QLineEdit(tombfile) - self.tomb_line.setObjectName(_fromUtf8("tomb_line")) - self.horizontalLayout.addWidget(self.tomb_line) - self.tomb_browse = QtGui.QPushButton(tombfile) - self.tomb_browse.setObjectName(_fromUtf8("tomb_browse")) - self.horizontalLayout.addWidget(self.tomb_browse) - self.verticalLayout.addLayout(self.horizontalLayout) - self.verticalLayout_2.addLayout(self.verticalLayout) - spacerItem1 = QtGui.QSpacerItem(20, 276, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.verticalLayout_2.addItem(spacerItem1) - - self.retranslateUi(tombfile) - QtCore.QMetaObject.connectSlotsByName(tombfile) - - def retranslateUi(self, tombfile): - tombfile.setWindowTitle(QtGui.QApplication.translate("tombfile", "WizardPage", None, QtGui.QApplication.UnicodeUTF8)) - tombfile.setTitle(QtGui.QApplication.translate("tombfile", "Choose tomb", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("tombfile", "Choose a tomb file on your filesystem", None, QtGui.QApplication.UnicodeUTF8)) - self.tomb_line.setPlaceholderText(QtGui.QApplication.translate("tombfile", "/path/to/your.tomb", None, QtGui.QApplication.UnicodeUTF8)) - self.tomb_browse.setText(QtGui.QApplication.translate("tombfile", "Browse", None, QtGui.QApplication.UnicodeUTF8)) - diff --git a/extras/dismissed/qt/tombqt/worker.py b/extras/dismissed/qt/tombqt/worker.py deleted file mode 100644 index 3064bac8..00000000 --- a/extras/dismissed/qt/tombqt/worker.py +++ /dev/null @@ -1,62 +0,0 @@ -import sys,os -import time -from tempfile import NamedTemporaryFile - -from PyQt4 import QtCore - -parentdir = sys.path[0].split(os.sep)[:-1] -sys.path.append(os.sep.join(parentdir)) -from tomblib.tomb import Tomb -from tomblib.parser import parse_line - -class TombCreateThread(QtCore.QThread): - line_received = QtCore.pyqtSignal(QtCore.QString) - error_received = QtCore.pyqtSignal(QtCore.QString) - def __init__(self, tombpath, size, keypath, **opts): - QtCore.QThread.__init__(self) - self.tombpath = tombpath - self.size = size - self.keypath = keypath - self.opts = opts - - self.err_thread = TombOutputThread() - self.err_thread.line_received.connect(self.line_received) - self.err_thread.error_received.connect(self.error_received) - - def run(self): - self.err_thread.start() - self.status = Tomb.create(str(self.tombpath), str(self.size), - self.keypath, stderr=self.err_thread.buffer, **self.opts) -# self.err_thread.terminate() - - def get_success(self): - return self.status - -class TombOutputThread(QtCore.QThread): - line_received = QtCore.pyqtSignal(QtCore.QString) - error_received = QtCore.pyqtSignal(QtCore.QString) - progressed = QtCore.pyqtSignal(int) #value in percent - - def __init__(self): - QtCore.QThread.__init__(self) - self.buffer = NamedTemporaryFile() - - def run(self): - while True: - where = self.buffer.tell() - line = self.buffer.readline() - if not line: - time.sleep(1) - self.buffer.seek(where) - else: - #ansi color escapes messes this up, but it'ok anyway - self.line_received.emit(line) - self.parse_line(line) - - def parse_line(self, line): - #This could be simplified, and s/search/match, if --no-color supported - #see #59 - #TODO: this should be moved to tomblib.parse - parsed = parse_line(line) - if parsed and parsed['type'] == 'error': - self.error_received.emit(parsed.content) diff --git a/extras/dismissed/tomb-open b/extras/dismissed/tomb-open deleted file mode 100755 index 70c947a6..00000000 --- a/extras/dismissed/tomb-open +++ /dev/null @@ -1,386 +0,0 @@ -#!/bin/zsh -# -# Tomb, the Crypto Undertaker -# -# a tool to easily operate file encryption of private and secret data -# -# Copyleft (C) 2007-2011 Denis Roio -# -# This source code is free software; you can redistribute it and/or -# modify it under the terms of the GNU Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This source code 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. -# Please refer to the GNU Public License for more details. -# -# You should have received a copy of the GNU Public License along with -# this source code; if not, write to: -# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# startup wrapper to open tombs - -TOMBEXEC="tomb" - -if [ "$0" = "./tomb-open" ]; then - TOMBEXEC="$PWD/tomb" -fi - -# includes all shell functions in tomb -source $TOMBEXEC source - -try() { - which ${1} > /dev/null - if [ $? = 0 ]; then - return 0 - else - return -1 - fi -} - -# popup notification -tomb-notify() { - - which notify-send > /dev/null - if [ $? != 0 ]; then return 1; fi - - # look for our icon in common prefixes - if [ -r /usr/share/pixmaps/monmort.xpm ]; then icon=/usr/share/pixmaps/monmort.xpm - elif [ -r /usr/share/icons/monmort.xpm ]; then icon=/usr/share/icons/monmort.xpm - elif [ -r /usr/local/share/pixmaps/monmort.xpm ]; then icon=/usr/local/share/pixmaps/monmort.xpm - elif [ -r /usr/local/share/icons/monmort.xpm ]; then icon=/usr/local/share/icons/monmort.xpm - elif [ -r /opt/share/pixmaps/monmort.xpm ]; then icon=/opt/share/pixmaps/monmort.xpm - elif [ -r /sw/share/pixmaps/monmort.xpm ]; then icon=/sw/share/pixmaps/monmort.xpm - fi - - if [ -z $1 ]; then - notify-send -i $icon \ - -u low -h string:App:Tomb \ - "Tomb version $VERSION" \ - "Hi, I'm the Undertaker. -Let's start setting your Crypt?" - else - notify-send -i $icon ${@} - fi -} - - -# USB plug auto detect using dmesg -# tested on ubuntu 10.04 and debian 6.0 -# please test and patch on other systems if you can. -# TODO: use udev rules, see how archlinux folks document it: -# https://wiki.archlinux.org/index.php/System_Encryption_with_LUKS_for_dm-crypt -# here we could modularize the choice of methods using function pointers, -# so that they are configurable when calling tomb. -ask_usbkey() { - unset usbkey_mount - say "Waiting 1 minute for a usb key to connect" - act -n "please insert your usb key " - - tomb-notify "Insert your USB KEY" \ - "Tomb is waiting 30 seconds for you to insert an external key." - - plugged=false - c=0 - while [ "$plugged" != "true" ]; do - dmesg | tail -n 12 | grep -q 'new.*USB device' - if [ $? = 0 ]; then plugged=true; fi - echo -n "." - sleep .5 - c=`expr $c + 1` - if [ $c -gt 60 ]; then - echo - die "timeout" - fi - done - - echo - act -n "usb key inserted, attaching " - - c=0 - attached=false - while [ "$attached" != "true" ]; do - dmesg | tail -n 12| grep -q 'Attached.*removable disk' - if [ $? = 0 ]; then attached=true; fi - echo -n "." - sleep .5 - c=`expr $c + 1` - if [ $c -gt 30 ]; then - echo - export usbkey_mount=none - die "timeout" - fi - done - - echo - act -n "usb attached, opening " - - # get the first partition -# usbpart=`dmesg |tail -n 12 | grep ' sd.:' |cut -d: -f2 |tr -d ' '` - for i in $(seq 1 10); do - usbpart=$(dmesg | tail -n 12 | sed '/ sd.:/!d;s/^.*: \(sd.[0-9]*\)/\1/') - if [ -n "$usbpart" ]; then - break - elif [ $i -eq 10 ]; then - die "timeout" 1 - else - echo -n . - sleep 1 - fi - done - - mtmp=`$TOMBEXEC mktemp tomb` - sudo mount /dev/$usbpart $mtmp - if [ $? = 0 ]; then - usbmount=$mtmp - else - die "cannot mount usbkey partition $usbmount" - fi - - echo - act "usb key mounted on $usbmount" - usbkey_mount=$usbmount - return 0 -} - -launch_status() { - # calculates the correct arguments to launch tomb-status tray - # applet; it takes the tomb name as an argument and should be - # launched after a successful tomb mount. - if ! [ $1 ]; then - die "cannot launch status tray applet: we don't even know the name of our tomb." - fi - - if [ $DISPLAY ]; then - tombname=${1} - tombbase=`basename $tombname` - tombmap=`mount -l | awk "/\[${tombbase}\]\$/"' { print $1 } '` - tombmount=`mount -l | awk "/\[${tombbase}\]\$/"' { print $3 } '` - if [ -x ./tomb-status ]; then # launch from build dir - ./tomb-status $tombmap $tombname $tombmount &! - else - which tomb-status > /dev/null - if [ $? = 0 ]; then - tomb-status $tombmap $tombname $tombmount &! - fi - fi - fi -} - -# got an argument -if [ $1 ]; then # is it a file? - - tombdir=`dirname $1` - tombfile=`basename $1` - tombname=${tombfile%%\.*} - - if [ -f ${tombdir}/${tombfile} ]; then - - # is it a luks partition - file ${tombdir}/${tombfile} | grep -i LUKS > /dev/null - if [ $? = 0 ]; then # tomb is a valid LUKS file - if [ -r ${tombdir}/${tombname}.tomb.key ]; then - tombkey=${tombdir}/${tombname}.tomb.key - else - ask_usbkey - if ! [ $usbkey_mount ]; then # no usb key was mounted - die "key not provided for tomb $tombname: operation aborted" 1 - else # usb mounted, check key presence - if [ -r ${usbkey_mount}/.tomb/${tombname}.tomb.key ]; then - tombkey=${usbkey_mount}/.tomb/${tombname}.tomb.key - elif [ -r ${usbkey_mount}/.tomb ]; then - die "we can't find the right key, have a look yourself:\n$(ls -lha ${usbkey_mount}/.tomb)" 1 - else - die "there are no keys stored in your usb" 1 - fi - fi - fi - if ! [ ${tombkey} ]; then # just to be sure - die "key not found, operation aborted." 1 - else - - "${TOMBEXEC}" mount -k ${tombkey} ${tombdir}/${tombfile} - success=$? - fi - - if [ $usbkey_mount ]; then - sudo umount ${usbkey_mount} - rmdir ${usbkey_mount} - unset usbkey_mount - fi - - if [ $success = 0 ]; then # mount was succesfull (with password and all) - launch_status ${tombname} - exit 0 - else - tomb-notify "Tomb cannot open." "Are you knocking the wrong door?" - exit 1 - fi - else - tomb-notify "Not a real Tomb." "We found no real bones in there, or the tomb file permissions won't allow us in." - exit 1 - fi - - - elif [ -d $1 ]; then # its a directory - -# FIXME: somehow xdg-open loses mailcap mimes when executed by tomb-status -# try xdg-open; if [ $? = 0 ]; then xdg-open ${1}; exit 0; fi - try gnome-open; if [ $? = 0 ]; then gnome-open ${1}; exit 0; fi - try thunar; if [ $? = 0 ]; then thunar ${1}; exit 0; fi - try pcmanfm; if [ $? = 0 ]; then pcmanfm ${1}; exit 0; fi - try rox; if [ $? = 0 ]; then rox ${1}; exit 0; fi - try fsviewer; if [ $? = 0 ]; then fsviewer ${1}; exit 0; fi -# try xnc; if [ $? = 0 ]; then xnc ${1}; exit 0; fi - tomb-notify "File manager not found." "Tomb cannot guess which filemanager you are using" - exit 1 - fi -fi - - -# no argument but on graphical display: creation dialog -if [ "$1" != "wizard" ]; then - if [ -z $DISPLAY ]; then - no "tomb-open is a wrapper for the command 'tomb'" - no "type 'tomb-open wizard' if you want to be guided" - "${TOMBEXEC}" help - exit 1 - fi -fi - -# no arguments: start guided tomb creation -tomb-notify -# we do it on the desktop by default -if [ -r $HOME/Desktop ]; then - cd $HOME/Desktop; -# or inside HOME -else cd $HOME; fi -say "Tomb - simple commandline tool for encrypted storage" -say "version $VERSION ($DATE) by Jaromil @ dyne.org" -say "Guided creation of a new Tomb" -cat < " -read -q -if [ "$?" != 0 ]; then - die "Operation aborted" 1 -fi - # let's proceed -say "Please type in the name for your new tomb file:" -echo -n "> " -read -u 1 tombname -say "How big you want the Tomb to be?" -act "Type a size number in Megabytes:" -echo -n "> " -read -u 1 tombsize -if [[ "$tombsize" != <-> ]]; then - die "Only digit allowed! Operation aborted" -fi -clear -say "You have commanded the creation of this Tomb:" -act "$tombname ( $tombsize MBytes )"; -echo -cat < " -read -q -if [ $? != 0 ]; then - die "Operation aborted." 1 - -fi -cat < " -read -q -if [ $? = 0 ]; then - ask_usbkey - if [ ${usbkey_mount} ]; then - - sudo mkdir -m 0700 -p ${usbkey_mount}/.tomb - sudo cp -v ${tombfile}.key ${usbkey_mount}/.tomb/ - sudo chmod -R go-rwx ${usbkey_mount}/.tomb - - yes "${tombname}.key succesfully saved on your USB" - act "now we'll proceed opening your brand new tomb" - - "${TOMBEXEC}" open -k ${tombfile}.key ${tombfile} - if [ $? = 0 ]; then - launch_status ${tombname} - fi - - rm -f ${tombfile}.key - - sudo umount ${usbkey_mount} - rmdir ${usbkey_mount} - unset usbkey_mount - - exit 0 - fi -fi - -cat <