diff --git a/changehat/libapparmor/AUTHORS b/changehat/libapparmor/AUTHORS new file mode 100644 index 000000000..7e97ff99a --- /dev/null +++ b/changehat/libapparmor/AUTHORS @@ -0,0 +1,2 @@ +Steve Beattie +Matt Barringer diff --git a/changehat/libapparmor/COPYING.LGPL b/changehat/libapparmor/COPYING.LGPL new file mode 100644 index 000000000..8add30ad5 --- /dev/null +++ b/changehat/libapparmor/COPYING.LGPL @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey 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 library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/changehat/libapparmor/ChangeLog b/changehat/libapparmor/ChangeLog new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/changehat/libapparmor/ChangeLog @@ -0,0 +1 @@ + diff --git a/changehat/libapparmor/INSTALL b/changehat/libapparmor/INSTALL new file mode 100644 index 000000000..23e5f25d0 --- /dev/null +++ b/changehat/libapparmor/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/changehat/libapparmor/Makefile.am b/changehat/libapparmor/Makefile.am new file mode 100644 index 000000000..f82a36b84 --- /dev/null +++ b/changehat/libapparmor/Makefile.am @@ -0,0 +1,25 @@ +AUTOMAKE_OPTIONS = foreign 1.4 +NAME = libapparmor +SRCDIR = src + +SUBDIRS = doc src swig testsuite + +REPO_VERSION=$(shell if [ -x /usr/bin/svn ] ; then \ + /usr/bin/svn info . 2> /dev/null | grep "^Last Changed Rev:" | sed "s/^Last Changed Rev: //" ; \ + fi) + +REPO_URL=$(shell if [ -x /usr/bin/svn ] ; then \ + /usr/bin/svn info . 2> /dev/null | grep "^URL:" | sed "s/^URL: //" ; \ + fi) +RELEASE_DIR = $(NAME)-$(VERSION)-${REPO_VERSION} + +SVNTARBALL = $(NAME)-$(VERSION)-${REPO_VERSION}.tar.gz +SVNTAR = /bin/tar czvp -h --exclude .svn --exclude CVS --exclude .cvsignore --exclude ${SVNTARBALL} --exclude ${RELEASE_DIR}/${RELEASE_DIR} $(shell test -f ${NAME}.exclude && echo "-X ${NAME}.exclude") + +distball: clean + rm -rf $(RELEASE_DIR) + svn export -r $(REPO_VERSION) $(REPO_URL) $(RELEASE_DIR) + $(SVNTAR) -f $(SVNTARBALL) $(RELEASE_DIR) + rm -rf $(RELEASE_DIR) + +EXTRA_DIST = AUTHORS ChangeLog COPYING.LGPL INSTALL NEWS README diff --git a/changehat/libapparmor/NEWS b/changehat/libapparmor/NEWS new file mode 100644 index 000000000..4097fdf43 --- /dev/null +++ b/changehat/libapparmor/NEWS @@ -0,0 +1 @@ +- 2007-06-24 - Initial release, version 0.6 diff --git a/changehat/libapparmor/README b/changehat/libapparmor/README new file mode 100644 index 000000000..2262eaa61 --- /dev/null +++ b/changehat/libapparmor/README @@ -0,0 +1 @@ +What little documentation exists is in src/aalogparse.h. Please file bugs using http://bugzilla.novell.com under the AppArmor product. diff --git a/changehat/libapparmor/autogen.sh b/changehat/libapparmor/autogen.sh new file mode 100755 index 000000000..773ab7f02 --- /dev/null +++ b/changehat/libapparmor/autogen.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $package." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to compile $package." + echo "Download the appropriate package for your system," + echo "or get the source from one of the GNU ftp sites" + echo "listed in http://www.gnu.org/order/ftp.html" + DIE=1 +} + +(libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed to compile $package." + echo "Download the appropriate package for your system," + echo "or get the source from one of the GNU ftp sites" + echo "listed in http://www.gnu.org/order/ftp.html" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +echo "Running aclocal" +aclocal +echo "Running autoconf" +autoconf --force +echo "Running libtoolize" +libtoolize --automake +echo "Running automake -ac" +automake -ac diff --git a/changehat/libapparmor/config.h.in b/changehat/libapparmor/config.h.in new file mode 100644 index 000000000..cde24fcc0 --- /dev/null +++ b/changehat/libapparmor/config.h.in @@ -0,0 +1,62 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const diff --git a/changehat/libapparmor/configure.in b/changehat/libapparmor/configure.in new file mode 100644 index 000000000..a16bb9548 --- /dev/null +++ b/changehat/libapparmor/configure.in @@ -0,0 +1,71 @@ +AC_INIT(configure.in) + +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(libapparmor, 2.1) + +AM_PROG_LEX +AC_PROG_YACC + +AC_PATH_PROG([SWIG], [swig]) + + +PROG_POD2MAN + +AC_MSG_CHECKING(Checking for Python) +AC_ARG_WITH(python, +[ --with-python enable the python wrapper [[default=no]]], +[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)]) +if test "$with_python" = "yes"; then + sinclude(m4/ac_python_devel.m4) + AC_PYTHON_DEVEL + AM_PATH_PYTHON +fi + +AC_MSG_CHECKING(Checking for perl) +AC_ARG_WITH(perl, +[ --with-perl enable the perl wrapper [[default=no]]], +[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)]) +if test "$with_perl" = "yes"; then + AC_PATH_PROG(PERL, perl, no) + if test x$PERL = xno; then + enable_perl=no + else + perl_includedir="`$PERL -e 'use Config; print $Config{archlib}'`/CORE" + AC_CHECK_FILE($perl_includedir/perl.h, enable_perl=yes, enable_perl=no) + fi +fi + + +AC_MSG_CHECKING(Checking for ruby) +AC_ARG_WITH(ruby, +[ --with-ruby enable the ruby wrapper [[default=no]]], +[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)]) +if test "$with_ruby" = "yes"; then + AC_PATH_PROG([RUBY], [ruby]) +fi + + +AM_CONDITIONAL(HAVE_PYTHON, test x$with_python = xyes) +AM_CONDITIONAL(HAVE_PERL, test x$with_perl = xyes) +AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes) +AM_CONDITIONAL(BUILD_ROOTLIB, test x$enable_rootlib = xyes) + +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h stdint.h) + +AC_C_CONST +AM_PROG_LIBTOOL + +AC_OUTPUT( +Makefile +doc/Makefile +src/Makefile +swig/Makefile +swig/perl/Makefile +swig/python/Makefile +swig/ruby/Makefile +testsuite/Makefile +testsuite/config/Makefile +testsuite/libaalogparse.test/Makefile +testsuite/lib/Makefile +) diff --git a/changehat/libapparmor/doc/Makefile.am b/changehat/libapparmor/doc/Makefile.am new file mode 100644 index 000000000..7243ef1d8 --- /dev/null +++ b/changehat/libapparmor/doc/Makefile.am @@ -0,0 +1,19 @@ +POD2MAN = pod2man + +man_MANS = change_hat.2 + +PODS = $(subst .2,.pod,$(man_MANS)) + +EXTRA_DIST = $(man_MANS) $(PODS) + +## delete man pages at maintainer-clean +BUILT_SOURCES = $(man_MANS) + +%.2: %.pod + $(POD2MAN) \ + --section=1 \ + --release="NOVELL/SUSE" \ + --center="AppArmor" \ + --date="2007-07-27" \ + $< > $@ +$ diff --git a/changehat/libapparmor/doc/change_hat.pod b/changehat/libapparmor/doc/change_hat.pod new file mode 100644 index 000000000..0cb104b7a --- /dev/null +++ b/changehat/libapparmor/doc/change_hat.pod @@ -0,0 +1,233 @@ +# $Id: change_hat.pod 534 2007-04-03 20:08:50Z steve-beattie $ +# This publication is intellectual property of Novell Inc. Its contents +# can be duplicated, either in part or in whole, provided that a copyright +# label is visibly located on each copy. +# +# All information found in this book has been compiled with utmost +# attention to detail. However, this does not guarantee complete accuracy. +# Neither SUSE LINUX GmbH, the authors, nor the translators shall be held +# liable for possible errors or the consequences thereof. +# +# Many of the software and hardware descriptions cited in this book +# are registered trademarks. All trade names are subject to copyright +# restrictions and may be registered trade marks. SUSE LINUX GmbH +# essentially adheres to the manufacturer's spelling. +# +# Names of products and trademarks appearing in this book (with or without +# specific notation) are likewise subject to trademark and trade protection +# laws and may thus fall under copyright restrictions. +# +# Please direct suggestions and comments to apparmor-general@forge.novell.com. + + +=pod + +=head1 NAME + +change_hat - change to or from a "hat" within a AppArmor profile + +=head1 SYNOPSIS + +B<#include Esys/apparmor.hE> + +B + +Link with B<-lapparmor> when compiling. + +=head1 DESCRIPTION + +An AppArmor profile applies to an executable program; if a portion of +the program needs different access permissions than other portions, +the program can "change hats" to a different role, also known as a +subprofile. To change into a new hat, it calls the change_hat() function +to do so. It passes in a pointer to the I which it wants to +change into, and a 32bit I. The I is used to +return out of the subprofile at a later time. + +If a program wants to return out of the current subprofile to the +original profile, it calls change_hat() with a pointer to NULL as +the I, and the original I value. If the +I does not match the original I passed into the +kernel when the program entered the subprofile, the change back to the +original profile will not happen, and the current task will be killed. +If the I matches the original token, then the process will +change back to the original profile. + +If the program wants to change to a subprofile that it can never +change back out of, the application should call change_hat() with a +I of I<0>. + +As both read(2) and write(2) are mediated, a file must be listed in a +subprofile definition if the file is to be accessed while the process +is in a "hat". + +=head1 RETURN VALUE + +On success zero is returned. On error, -1 is returned, and +errno(3) is set appropriately. + +=head1 ERRORS + +=over 4 + +=item B + +The apparmor kernel module is not loaded or the communication via the +F file did not conform to protocol. + +=item B + +Insufficient kernel memory was available. + +=item B + +The calling application is not confined by apparmor. + +=item B + +The application's profile has no hats defined for it. + +=item B + +The specified I does not exist in this profile or the +process tried to change another process's domain. + +=back + +=head1 EXAMPLE + +The following code examples shows simple, if contrived, uses of +change_hat(); a typical use of change_hat() will separate privileged +portions of a process from unprivileged portions of a process, such as +keeping unauthenticated network traffic handling separate from +authenticated network traffic handling in OpenSSH or executing +user-supplied CGI scripts in apache. + +The use of random(3) is simply illustrative. Use of F is +recommended. + +First, a simple high-level overview of change_hat() use: + + void foo (void) { + int magic_token; + + /* get a random magic token value + from our huge entropy pool */ + magic_token = random_function(); + + /* change into the subprofile while + * we do stuff we don't trust */ + change_hat ("stuff_we_dont_trust", magic_token); + + /* Go do stuff we don't trust -- this is all + * done in *this* process space, no separate + * fork()/exec()'s are done. */ + interpret_perl_stuff(stuff_from_user); + + /* now change back to our original profile */ + change_hat (NULL, magic_token); + } + +Second, an example to show that files not listed in a subprofile +("hat") aren't accessible after a change_hat() call: + + #include + #include + #include + #include + #include + #include + #include + #include + + + int main(int argc, char *argv[]) { + int fd; + int tok; + char buf[10]; + + /* random() is a poor choice */ + tok = random(); + + /* open /etc/passwd outside of any hat */ + if ((fd=open("/etc/passwd", O_RDONLY)) < 0) + perror("Failure opening /etc/passwd"); + + /* confirm for ourselves that we can really read /etc/passwd */ + memset(&buf, 0, 10); + if (read(fd, &buf, 10) == -1) { + perror("Failure reading /etc/passwd pre-hat"); + _exit(1); + } + buf[9] = '\0'; + printf("/etc/passwd: %s\n", buf); + + /* change hat to the "hat" subprofile, which should not have + * read access to /etc/passwd -- even though we have a valid + * file descriptor at the time of the change_hat() call. */ + if (change_hat("hat", tok)) { + perror("Failure changing hat -- aborting"); + _exit(1); + } + + /* confirm that we cannot read /etc/passwd */ + lseek(fd,0,SEEK_SET); + memset(&buf, 0, 10); + if (read(fd, &buf, 10) == -1) + perror("Failure reading /etc/passwd post-hat"); + buf[9] = '\0'; + printf("/etc/passwd: %s\n", buf); + + return 0; + } + + +This code example requires the following profile to be loaded with +apparmor_parser(8): + + /tmp/ch { + /etc/ld.so.cache mr, + /etc/locale/** r, + /etc/localtime r, + /usr/share/locale/** r, + /usr/share/zoneinfo/** r, + /usr/lib/locale/** mr, + /usr/lib/gconv/*.so mr, + /usr/lib/gconv/gconv-modules* mr, + + /lib/ld-*.so* mrix, + /lib/libc*.so* mr, + /lib/libapparmor*.so* mr, + /dev/pts/* rw, + /tmp/ch mr, + + /etc/passwd r, + + ^hat { + /dev/pts/* rw, + } + } + + +The output when run: + + $ /tmp/ch + /etc/passwd: root:x:0: + Failure reading /etc/passwd post-hat: Permission denied + /etc/passwd: + $ + + +=head1 BUGS + +None known. If you find any, please report them to bugzilla at +L. Note that change_hat(2) provides no +memory barriers between different areas of a program; if address space +separation is required, then separate processes should be used. + +=head1 SEE ALSO + +apparmor(7), apparmor.d(5), apparmor_parser(8), and +L. + +=cut diff --git a/changehat/libapparmor/libapparmor1.spec b/changehat/libapparmor/libapparmor1.spec new file mode 100644 index 000000000..e668081f9 --- /dev/null +++ b/changehat/libapparmor/libapparmor1.spec @@ -0,0 +1,104 @@ +# +# spec file for package libapparmor +# +# norootforbuild +%define _unpackaged_files_terminate_build 0 + +Name: libapparmor1 +Version: 2.1 +Release: 1 +License: LGPL +Group: Development/Libraries/C and C++ +BuildRoot: %{_tmppath}/%{name}-${version}-build +Source0: %{name}-%{version}.tar.bz2 +BuildRequires: swig gcc perl +Provides: libapparmor +Provides: libimmunix +Obsoletes: libapparmor +Obsoletes: libimmunix +Summary: A utility library for AppArmor + +%description +- + +%package -n libapparmor-devel +Requires: %{name} = %{version} +Group: Development/Libraries/C and C++ +Summary: - + +%description -n libapparmor-devel +- + +%post -n libapparmor-devel +/sbin/ldconfig + +%postun -n libapparmor-devel +/sbin/ldconfig + +%package -n perl-libapparmor +Requires: %{name} = %{version} +Requires: perl = %{perl_version} +Group: Development/Libraries/Perl +Summary: - + +%description -n perl-libapparmor +- + +%prep +%setup -q + +%build +./configure --prefix=%{_prefix} --libdir=%{_libdir} --with-perl +make + +%install +make install DESTDIR="$RPM_BUILD_ROOT" +mkdir ${RPM_BUILD_ROOT}/%{_lib} +# this is really hacky +rm ${RPM_BUILD_ROOT}/%{_libdir}/libapparmor.so +rm ${RPM_BUILD_ROOT}/%{_libdir}/libimmunix.so +cp ${RPM_BUILD_ROOT}/%{_libdir}/libapparmor.so.1.0.0 ${RPM_BUILD_ROOT}/%{_lib} +cp ${RPM_BUILD_ROOT}/%{_libdir}/libimmunix.so.1.0.0 ${RPM_BUILD_ROOT}/%{_lib} +ln -s /%{_lib}/libapparmor.so.1.0.0 ${RPM_BUILD_ROOT}/%{_libdir}/libapparmor.so +ln -s /%{_lib}/libimmunix.so.1.0.0 ${RPM_BUILD_ROOT}/%{_libdir}/libimmunix.so + +find $RPM_BUILD_ROOT -name .packlist -exec rm -f {} \; +find $RPM_BUILD_ROOT -name perllocal.pod -exec rm -f {} \; + +%clean +rm -rf "$RPM_BUILD_ROOT" + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-,root,root) +/%{_lib}/libapparmor.so.1.0.0 +/%{_lib}/libimmunix.so.1.0.0 + +%files -n libapparmor-devel +%defattr(-,root,root) +%{_libdir}/libapparmor.so +%{_libdir}/libimmunix.so +%{_libdir}/libapparmor.la +%{_libdir}/libapparmor.a +%{_libdir}/libimmunix.la +%{_libdir}/libimmunix.a +%{_mandir}/man*/* +%dir %{_includedir}/aalogparse +%{_includedir}/sys/apparmor.h +%{_includedir}/aalogparse/* + +%files -n perl-libapparmor +%defattr(-,root,root) +%dir %{perl_vendorarch}/auto/LibAppArmor +%{perl_vendorarch}/auto/LibAppArmor/* +%{perl_vendorarch}/LibAppArmor.pm + +%changelog +- + + diff --git a/changehat/libapparmor/m4/ac_pod2man.m4 b/changehat/libapparmor/m4/ac_pod2man.m4 new file mode 100644 index 000000000..7610645e8 --- /dev/null +++ b/changehat/libapparmor/m4/ac_pod2man.m4 @@ -0,0 +1,16 @@ +AC_DEFUN(PROG_POD2MAN,[ + AC_CHECK_PROG(POD2MAN,pod2man,pod2man,no) + if test "$POD2MAN" = "no"; then + AC_MSG_ERROR([ +The pod2man program was not found in the default path. pod2man is part of +Perl, which can be retrieved from: + + http://www.perl.com/ + +The latest version at this time is 5.6.1; it is available packaged as the +following archive: + + http://www.perl.com/CPAN/src/stable.tar.gz +]) + fi +]) diff --git a/changehat/libapparmor/m4/ac_python_devel.m4 b/changehat/libapparmor/m4/ac_python_devel.m4 new file mode 100644 index 000000000..260d715b8 --- /dev/null +++ b/changehat/libapparmor/m4/ac_python_devel.m4 @@ -0,0 +1,193 @@ +AC_DEFUN([AC_PYTHON_DEVEL],[ + # + # Allow the use of a (user set) custom python version + # + AC_ARG_VAR([PYTHON_VERSION],[The installed Python + version to use, for example '2.3'. This string + will be appended to the Python interpreter + canonical name.]) + + AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) + if test -z "$PYTHON"; then + AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) + PYTHON_VERSION="" + fi + + # + # Check for a version of Python >= 2.1.0 + # + AC_MSG_CHECKING([for a version of Python >= '2.1.0']) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver >= '2.1.0'"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([ +This version of the AC@&t@_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. +]) + else + AC_MSG_RESULT([skip at user request]) + fi + else + AC_MSG_RESULT([yes]) + fi + + # + # if the macro parameter ``version'' is set, honour it + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver $1"` + if test "$ac_supports_python_ver" = "True"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See ``configure --help'' for reference. +]) + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + AC_MSG_CHECKING([for the distutils Python package]) + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` + if test -z "$ac_distutils_result"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([cannot import Python module "distutils". +Please check your Python installation. The error was: +$ac_distutils_result]) + PYTHON_VERSION="" + fi + + # + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_inc();"` + if test -n "${python_path}"; then + python_path="-I$python_path" + fi + PYTHON_CPPFLAGS=$python_path + fi + AC_MSG_RESULT([$PYTHON_CPPFLAGS]) + AC_SUBST([PYTHON_CPPFLAGS]) + + # + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + py_version=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print join(get_config_vars('VERSION'))"` + if test "$py_version" == "[None]"; then + if test -n "$PYTHON_VERSION"; then + py_version=$PYTHON_VERSION + else + py_version=`$PYTHON -c "import sys; \ + print sys.version[[:3]]"` + fi + fi + + PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print '-L' + get_python_lib(0,1), \ + '-lpython';"`$py_version + fi + AC_MSG_RESULT([$PYTHON_LDFLAGS]) + AC_SUBST([PYTHON_LDFLAGS]) + + # + # Check for site packages + # + AC_MSG_CHECKING([for Python site-packages path]) + if test -z "$PYTHON_SITE_PKG"; then + PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_lib(0,0);"` + fi + AC_MSG_RESULT([$PYTHON_SITE_PKG]) + AC_SUBST([PYTHON_SITE_PKG]) + + # + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LOCALMODLIBS'), conf('LIBS')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) + + # + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LINKFORSHARED')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) + AC_SUBST(PYTHON_EXTRA_LDFLAGS) + + # + # final check to see if everything compiles alright + # + AC_MSG_CHECKING([consistency of all components of python development environment]) + AC_LANG_PUSH([C]) + # save current global flags + LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_LINK([ + #include + ],[ + Py_Initialize(); + ],[pythonexists=yes],[pythonexists=no]) + + AC_MSG_RESULT([$pythonexists]) + + if test ! "$pythonexists" = "yes"; then + AC_MSG_ERROR([ + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LDFLAGS environment variable. + Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + ]) + PYTHON_VERSION="" + fi + AC_LANG_POP + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + + # + # all done! + # +]) diff --git a/changehat/libapparmor/src/Makefile.am b/changehat/libapparmor/src/Makefile.am new file mode 100644 index 000000000..74edea61a --- /dev/null +++ b/changehat/libapparmor/src/Makefile.am @@ -0,0 +1,25 @@ +INCLUDES = $(all_includes) + +BUILT_SOURCES = grammar.h scanner.h +AM_YFLAGS = -d -p aalogparse_ + +scanner.h: + $(LEX) scanner.l + +changehatdir = $(includedir)/sys +changehat_HEADERS = apparmor.h + +aalogparsedir = $(includedir)/aalogparse +aalogparse_HEADERS = aalogparse.h + +lib_LTLIBRARIES = libapparmor.la libimmunix.la +noinst_HEADERS = grammar.h parser.h scanner.h + +libapparmor_la_SOURCES = grammar.y libaalogparse.c change_hat.c scanner.c +libapparmor_la_LDFLAGS = -module -version-info 1:0:0 -XCClinker -dynamic \ + -Wl,--version-script=libapparmor.map -Wl,-soname=libapparmor.so.1 + +libimmunix_la_SOURCES = change_hat.c libimmunix_warning.c +libimmunix_la_LDFLAGS = -module -version-info 1:0:0 -Wl,--version-script=libapparmor.map -Wl,-soname=libimmunix.so.1 + +EXTRA_DIST = grammar.y scanner.l libapparmor.map diff --git a/changehat/libapparmor/src/aalogparse.h b/changehat/libapparmor/src/aalogparse.h new file mode 100644 index 000000000..ad4b692d8 --- /dev/null +++ b/changehat/libapparmor/src/aalogparse.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * NOVELL (All rights reserved) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License published by the Free Software Foundation. + * + * 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, contact Novell, Inc. + */ + + +#ifndef __LIBAALOGPARSE_H_ +#define __LIBAALOGPARSE_H_ + +#define AA_RECORD_EXEC_MMAP 1 +#define AA_RECORD_READ 2 +#define AA_RECORD_WRITE 4 +#define AA_RECORD_EXEC 8 +#define AA_RECORD_LINK 16 + +/** + * This is just for convenience now that we have two + * wildly different grammars. + */ + +typedef enum +{ + AA_RECORD_SYNTAX_V1, + AA_RECORD_SYNTAX_V2, + AA_RECORD_SYNTAX_UNKNOWN +} aa_record_syntax_version; + +typedef enum +{ + AA_RECORD_INVALID, /* Default event type */ + AA_RECORD_ERROR, /* Internal AA error */ + AA_RECORD_AUDIT, /* Audited event */ + AA_RECORD_ALLOWED, /* Complain mode event */ + AA_RECORD_DENIED, /* Denied access event */ + AA_RECORD_HINT, /* Process tracking info */ + AA_RECORD_STATUS /* Configuration change */ +} aa_record_event_type; + +/** + * With the sole exception of active_hat, this is a 1:1 + * mapping from the keys that the new syntax uses. + * + * Some examples of the old syntax and how they're mapped with the aa_log_record struct: + * + * "PERMITTING r access to /path (program_name(12345) profile /profile active hat)" + * - operation: access + * - requested_mask: r + * - pid: 12345 + * - profile: /profile + * - name: /path + * - info: program_name + * - active_hat: hat + * + * "REJECTING mkdir on /path/to/something (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out" + * - operation: mkdir + * - name: /path/to/something + * - info: bash + * - pid: 23415 + * - profile: /bin/freak-aa-out + * - active_hat: /bin/freak-aa-out + * + * "REJECTING xattr set on /path/to/something (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out)" + * - operation: xattr + * - attribute: set + * - name: /path/to/something + * - info: bash + * - pid: 23415 + * - profile: /bin/freak-aa-out + * - active_hat: /bin/freak-aa-out + * + * "PERMITTING attribute (something) change to /else (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out)" + * - operation: setattr + * - attribute: something + * - name: /else + * - info: bash + * - pid: 23415 + * - profile: /bin/freak-aa-out + * - active_hat: /bin/freak-aa-out + * + * "PERMITTING access to capability 'cap' (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out)" + * - operation: capability + * - name: cap + * - info: bash + * - pid: 23415 + * - profile: /bin/freak-aa-out + * - active_hat: /bin/freak-aa-out + * + * "LOGPROF-HINT unknown_hat TESTHAT pid=27764 profile=/change_hat_test/test_hat active=/change_hat_test/test_hat" + * - operation: change_hat + * - name: TESTHAT + * - info: unknown_hat + * - pid: 27764 + * - profile: /change_hat_test/test_hat + * - active_hat: /change_hat_test/test_hat + * + * "LOGPROF-HINT fork pid=27764 child=38229" + * - operation: clone + * - task: 38229 + * - pid: 27764 + **/ + +typedef struct +{ + aa_record_syntax_version version; + aa_record_event_type event; /* Event type */ + long pid; /* PID of the program logging the message */ + long task; + + int bitmask; /* Bitmask containing "r" "w" "x" etc */ + char *audit_id; + char *operation; /* "Exec" "Ptrace", etc. */ + char *denied_mask; /* "r", "w", etc. */ + char *requested_mask; + char *profile; /* The name of the profile */ + char *name; + char *name2; + char *attribute; + char *parent; + char *magic_token; + char *info; + char *active_hat; +} aa_log_record; + +/** + * Parses a single log record string and returns a pointer to the parsed + * data. It is the calling program's responsibility to free that struct + * with free_record(); + * @param[in] Record to parse. + * @return Parsed data. + */ +aa_log_record * +parse_record(char *str); + +/** + * Frees all struct data. + * @param[in] Data to free. + */ +void +free_record(aa_log_record *record); + +#endif + diff --git a/changehat/libapparmor/src/apparmor.h b/changehat/libapparmor/src/apparmor.h new file mode 100644 index 000000000..c6c1cd9d2 --- /dev/null +++ b/changehat/libapparmor/src/apparmor.h @@ -0,0 +1,23 @@ +/* $Id: apparmor.h 132 2006-09-28 07:45:55Z steve-beattie $ + + Copyright (c) 2003, 2004, 2005, 2006 Novell, Inc. (All rights reserved) + + The libapparmor library is licensed under the terms of the GNU + Lesser General Public License, version 2.1. Please see the file + COPYING.LGPL. +*/ + +#ifndef _SYS_APPARMOR_H_ +#define _SYS_APPARMOR_H 1 + +__BEGIN_DECLS + +/* Prototype for change_hat as defined by the AppArmor project + + Please see the change_hat(2) manpage for information. */ + +extern int change_hat (const char *subprofile, unsigned int magic_token); + +__END_DECLS + +#endif /* sys/apparmor.h */ diff --git a/changehat/libapparmor/src/change_hat.c b/changehat/libapparmor/src/change_hat.c new file mode 100644 index 000000000..f814730de --- /dev/null +++ b/changehat/libapparmor/src/change_hat.c @@ -0,0 +1,85 @@ +/* $Id: change_hat.c 13 2006-04-12 21:43:34Z steve-beattie $ + + Copyright (c) 2003, 2004, 2005, 2006 Novell, Inc. (All rights reserved) + + The libapparmor library is licensed under the terms of the GNU + Lesser General Public License, version 2.1. Please see the file + COPYING.LGPL. + +*/ + +#define _GNU_SOURCE /* for asprintf */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int change_hat(char *subprofile, unsigned int token) +{ + int rc = -1; + int fd, ret, len = 0, ctlerr = 0; + char *buf = NULL; + const char *cmd = "changehat"; + char *ctl = NULL; + pid_t tid = syscall(SYS_gettid); + + /* both may not be null */ + if (!(token || subprofile)) { + errno = EINVAL; + goto out; + } + + if (subprofile && strnlen(subprofile, PATH_MAX + 1) > PATH_MAX) { + errno = EPROTO; + goto out; + } + + len = asprintf(&buf, "%s %08x^%s", cmd, token, + subprofile ? subprofile : ""); + if (len < 0) { + goto out; + } + + ctlerr = asprintf(&ctl, "/proc/%d/attr/current", tid); + if (ctlerr < 0) { + goto out; + } + + fd = open(ctl, O_WRONLY); + if (fd == -1) { + goto out; + } + + ret = write(fd, buf, len); + if (ret != len) { + int saved; + if (ret != -1) { + errno = EPROTO; + } + saved = errno; + (void)close(fd); + errno = saved; + goto out; + } + + rc = 0; + (void)close(fd); + +out: + if (buf) { + /* clear local copy of magic token before freeing */ + memset(buf, '\0', len); + free(buf); + } + if (ctl) { + free(ctl); + } + return rc; +} diff --git a/changehat/libapparmor/src/grammar.y b/changehat/libapparmor/src/grammar.y new file mode 100644 index 000000000..821be427e --- /dev/null +++ b/changehat/libapparmor/src/grammar.y @@ -0,0 +1,381 @@ +/* + * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * NOVELL (All rights reserved) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License published by the Free Software Foundation. + * + * 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, contact Novell, Inc. + */ + + +%{ + +#define YYDEBUG 0 +#include +#include "aalogparse.h" +#include "parser.h" +#include "grammar.h" +#include "scanner.h" + +aa_log_record *ret_record; +void aalogparse_error(void *scanner, char const *s) +{ + printf("Error: %s\n", s); +} +%} + +%defines +%pure_parser +%lex-param{void *scanner} +%parse-param{void *scanner} + +%union +{ + char *t_str; + long t_long; +} + +%type old_profile; +%token TOK_DIGITS +%token TOK_QUOTED_STRING TOK_PATH TOK_ID TOK_NULL_COMPLAIN TOK_MODE TOK_SINGLE_QUOTED_STRING TOK_AUDIT_DIGITS + +%token TOK_EQUALS +%token TOK_COLON +%token TOK_OPEN_PAREN +%token TOK_CLOSE_PAREN +%token TOK_PERIOD + +%token TOK_TYPE_REJECT +%token TOK_TYPE_AUDIT +%token TOK_TYPE_COMPLAIN +%token TOK_TYPE_HINT +%token TOK_TYPE_STATUS +%token TOK_TYPE_ERROR +%token TOK_OLD_TYPE_APPARMOR +%token TOK_OLD_APPARMOR_REJECT +%token TOK_OLD_APPARMOR_PERMIT +%token TOK_OLD_APPARMOR_LOGPROF_HINT +%token TOK_OLD_UNKNOWN_HAT +%token TOK_OLD_ACTIVE +%token TOK_OLD_UNKNOWN_PROFILE +%token TOK_OLD_MISSING_PROFILE +%token TOK_OLD_ACCESS +%token TOK_OLD_TO +%token TOK_OLD_PIPE +%token TOK_OLD_EXTENDED +%token TOK_OLD_ATTRIBUTE +%token TOK_OLD_ON +%token TOK_OLD_MKDIR +%token TOK_OLD_RMDIR +%token TOK_OLD_XATTR +%token TOK_OLD_CHANGE +%token TOK_OLD_CAPABILITY +%token TOK_OLD_FORK +%token TOK_OLD_CHILD + +%token TOK_KEY_TYPE +%token TOK_KEY_MSG +%token TOK_KEY_OPERATION +%token TOK_KEY_NAME +%token TOK_KEY_NAME2 +%token TOK_KEY_DENIED_MASK +%token TOK_KEY_REQUESTED_MASK +%token TOK_KEY_ATTRIBUTE +%token TOK_KEY_TASK +%token TOK_KEY_PARENT +%token TOK_KEY_MAGIC_TOKEN +%token TOK_KEY_INFO +%token TOK_KEY_PID +%token TOK_KEY_PROFILE +%token TOK_AUDIT +%token TOK_KEY_IMAGE + +%% + +type: TOK_KEY_TYPE TOK_EQUALS type_syntax ; + +type_syntax: old_syntax { ret_record->version = AA_RECORD_SYNTAX_V1; } + | new_syntax { ret_record->version = AA_RECORD_SYNTAX_V2; } + ; + +old_syntax: TOK_OLD_TYPE_APPARMOR audit_msg old_msg ; + +new_syntax: + TOK_TYPE_REJECT audit_msg key { ret_record->event = AA_RECORD_DENIED; } + | TOK_TYPE_AUDIT audit_msg key { ret_record->event = AA_RECORD_AUDIT; } + | TOK_TYPE_COMPLAIN audit_msg key { ret_record->event = AA_RECORD_ALLOWED; } + | TOK_TYPE_HINT audit_msg key { ret_record->event = AA_RECORD_HINT; } + | TOK_TYPE_STATUS audit_msg key { ret_record->event = AA_RECORD_STATUS; } + | TOK_TYPE_ERROR audit_msg key { ret_record->event = AA_RECORD_ERROR; } + ; + +old_msg: + old_permit_reject_syntax old_permit_reject_syntax2 + | TOK_OLD_APPARMOR_LOGPROF_HINT old_logprof_syntax { ret_record->event = AA_RECORD_HINT; } + ; + +old_permit_reject_syntax: + TOK_OLD_APPARMOR_REJECT { ret_record->event = AA_RECORD_DENIED; } + | TOK_OLD_APPARMOR_PERMIT { ret_record->event = AA_RECORD_ALLOWED; } + ; + +old_permit_reject_syntax2: + TOK_MODE TOK_OLD_ACCESS old_permit_reject_path_pipe_extended + TOK_OPEN_PAREN TOK_ID TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_KEY_PROFILE old_profile TOK_OLD_ACTIVE old_profile TOK_CLOSE_PAREN + { + ret_record->requested_mask = strdup($1); + free($1); + ret_record->info = strdup($5); + free($5); + ret_record->pid = atol($7); + free($7); + ret_record->profile = strdup($10); + free($10); + ret_record->active_hat = strdup($12); + free($12); + ret_record->operation = strdup("access"); + } + | mkdir_or_rmdir TOK_OLD_ON TOK_PATH + TOK_OPEN_PAREN TOK_ID TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_KEY_PROFILE old_profile TOK_OLD_ACTIVE old_profile TOK_CLOSE_PAREN + { + ret_record->name = strdup($3); + free($3); + ret_record->info = strdup($5); + free($5); + ret_record->pid = atol($7); + free($7); + ret_record->profile = strdup($10); + free($10); + ret_record->active_hat = strdup($12); + free($12); + } + | TOK_OLD_XATTR TOK_ID TOK_OLD_ON TOK_PATH + TOK_OPEN_PAREN TOK_ID TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_KEY_PROFILE old_profile TOK_OLD_ACTIVE old_profile TOK_CLOSE_PAREN + { + ret_record->operation = strdup("xattr"); + ret_record->attribute = strdup($2); + free($2); + ret_record->name = strdup($4); + free($4); + ret_record->info = strdup($6); + free($6); + ret_record->pid = atol($8); + free($8); + ret_record->profile = strdup($11); + free($11); + ret_record->active_hat = strdup($13); + free($13); + } + | TOK_KEY_ATTRIBUTE TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_OLD_CHANGE TOK_OLD_TO TOK_PATH + TOK_OPEN_PAREN TOK_ID TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_KEY_PROFILE old_profile TOK_OLD_ACTIVE old_profile TOK_CLOSE_PAREN + { + ret_record->operation = strdup("setattr"); + ret_record->attribute = strdup($3); + free($3); + ret_record->name = strdup($7); + free($7); + ret_record->info = strdup($9); + free($9); + ret_record->pid = atol($11); + free($11); + ret_record->profile = strdup($14); + free($14); + ret_record->active_hat = strdup($16); + free($16); + } + | TOK_OLD_ACCESS TOK_OLD_TO TOK_OLD_CAPABILITY TOK_SINGLE_QUOTED_STRING + TOK_OPEN_PAREN TOK_ID TOK_OPEN_PAREN TOK_ID TOK_CLOSE_PAREN + TOK_KEY_PROFILE old_profile TOK_OLD_ACTIVE old_profile TOK_CLOSE_PAREN + { + ret_record->operation = strdup("capability"); + ret_record->name = strdup($4); + free($4); + ret_record->info = strdup($6); + free($6); + ret_record->pid = atol($8); + free($8); + ret_record->profile = strdup($11); + free($11); + ret_record->active_hat = strdup($13); + free($13); + } + ; + +mkdir_or_rmdir: + TOK_OLD_MKDIR { ret_record->operation = strdup("mkdir"); } + | TOK_OLD_RMDIR { ret_record->operation = strdup("rmdir"); } + ; + +old_permit_reject_path_pipe_extended: + TOK_OLD_TO TOK_PATH + { + ret_record->name = strdup($2); + free($2); + } + | TOK_OLD_TO TOK_OLD_PIPE /* Frankly, I don't think this is used */ + { + ret_record->info = strdup("pipe"); + } + | TOK_OLD_EXTENDED TOK_KEY_ATTRIBUTE /* Nor this */ + { + ret_record->info = strdup("extended attribute"); + } + ; +old_logprof_syntax: + old_logprof_syntax2 TOK_KEY_PID TOK_EQUALS TOK_DIGITS + TOK_KEY_PROFILE TOK_EQUALS old_profile TOK_OLD_ACTIVE TOK_EQUALS old_profile + { + ret_record->pid = $4; + ret_record->profile = strdup($7); + free($7); + ret_record->active_hat = strdup($10); + free($10); + } + | old_logprof_fork_syntax + ; + +old_logprof_syntax2: + TOK_OLD_UNKNOWN_PROFILE TOK_KEY_IMAGE TOK_EQUALS TOK_ID + { + ret_record->operation = strdup("profile_set"); + ret_record->info = strdup("unknown profile"); + ret_record->name = strdup($4); + free($4); + } + | TOK_OLD_MISSING_PROFILE TOK_KEY_IMAGE TOK_EQUALS TOK_ID + { + ret_record->operation = strdup("exec"); + ret_record->info = strdup("mandatory profile missing"); + ret_record->name = strdup($4); + free($4); + } + | TOK_OLD_UNKNOWN_HAT TOK_ID + { + ret_record->operation = strdup("change_hat"); + ret_record->name = strdup($2); + free($2); + ret_record->info = strdup("unknown_hat"); + } + ; + +/* TODO: Clean this up */ +old_logprof_fork_syntax: + TOK_OLD_FORK TOK_KEY_PID TOK_EQUALS TOK_DIGITS + TOK_OLD_CHILD TOK_EQUALS TOK_DIGITS old_logprof_fork_addition + { + ret_record->operation = strdup("clone"); + ret_record->task = $7; + ret_record->pid = $4; + } + ; + +old_logprof_fork_addition: + /* Nothin */ + | TOK_KEY_PROFILE TOK_EQUALS old_profile TOK_OLD_ACTIVE TOK_EQUALS old_profile + { + ret_record->profile = strdup($3); + free($3); + ret_record->active_hat = strdup($6); + free($6); + } + ; + +old_profile: + TOK_PATH + { + $$ = strdup($1); + free($1); + } + | TOK_NULL_COMPLAIN + { + $$ = strdup("null-complain-profile"); + } + ; + +audit_msg: TOK_KEY_MSG TOK_EQUALS TOK_AUDIT TOK_OPEN_PAREN TOK_AUDIT_DIGITS TOK_PERIOD TOK_AUDIT_DIGITS TOK_COLON TOK_AUDIT_DIGITS TOK_CLOSE_PAREN TOK_COLON + { + /* TOK_AUDIT_DIGITS is actually a character string, and this could be done in a better way. */ + int len1 = strlen($5); + int len2 = strlen($7); + int len3 = strlen($9); + int len = len1 + len2 + len3; + ret_record->audit_id = (char *) malloc(len + 3); + strncat(ret_record->audit_id, $5, len1); + strncat(ret_record->audit_id, ".", 1); + strncat(ret_record->audit_id, $7, len2); + strncat(ret_record->audit_id, ":", 1); + strncat(ret_record->audit_id, $9, len3); + free($5); + free($7); + free($9); + } ; + +key: + key_list + | key key_list + ; + +key_list: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING + { ret_record->operation = strdup($3); free($3); } + | TOK_KEY_NAME TOK_EQUALS TOK_QUOTED_STRING + { ret_record->name = strdup($3); free($3); } + | TOK_KEY_NAME2 TOK_EQUALS TOK_QUOTED_STRING + { ret_record->name2 = strdup($3); free($3); } + | TOK_KEY_DENIED_MASK TOK_EQUALS TOK_QUOTED_STRING + { ret_record->denied_mask = strdup($3); free($3);} + | TOK_KEY_REQUESTED_MASK TOK_EQUALS TOK_QUOTED_STRING + { ret_record->requested_mask = strdup($3); free($3);} + | TOK_KEY_ATTRIBUTE TOK_EQUALS TOK_QUOTED_STRING + { ret_record->attribute = strdup($3); free($3);} + | TOK_KEY_TASK TOK_EQUALS TOK_QUOTED_STRING + { ret_record->task = atol($3); free($3);} + | TOK_KEY_PARENT TOK_EQUALS TOK_QUOTED_STRING + { ret_record->parent = strdup($3); free($3);} + | TOK_KEY_MAGIC_TOKEN TOK_EQUALS TOK_QUOTED_STRING + { ret_record->magic_token = strdup($3); free($3);} + | TOK_KEY_INFO TOK_EQUALS TOK_QUOTED_STRING + { ret_record->info = strdup($3); free($3);} + | TOK_KEY_PID TOK_EQUALS TOK_QUOTED_STRING + { ret_record->pid = atol($3); free($3);} + | TOK_KEY_PROFILE TOK_EQUALS TOK_QUOTED_STRING + { ret_record->profile = strdup($3); free($3);} + ; + +%% + +aa_log_record * +_parse_yacc(char *str) +{ + /* yydebug = 1; */ + YY_BUFFER_STATE lex_buf; + yyscan_t scanner; + int parser_return; + + ret_record = NULL; + ret_record = (aa_log_record *) malloc(sizeof(aa_log_record)); + + _init_log_record(ret_record); + + if (ret_record == NULL) + return NULL; + + aalogparse_lex_init(&scanner); + lex_buf = aalogparse__scan_string(str, scanner); + parser_return = aalogparse_parse(scanner); + aalogparse__delete_buffer(lex_buf, scanner); + aalogparse_lex_destroy(scanner); + return ret_record; +} diff --git a/changehat/libapparmor/src/libaalogparse.c b/changehat/libapparmor/src/libaalogparse.c new file mode 100644 index 000000000..b5ad76d7e --- /dev/null +++ b/changehat/libapparmor/src/libaalogparse.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * NOVELL (All rights reserved) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License published by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + */ + +/* + * @author Matt Barringer + */ + +/* + * TODO: + * + * - Convert the text permission mask into a bitmask + * - Clean up parser grammar + */ + + +#include +#include "aalogparse.h" +#include "parser.h" + +/* This is mostly just a wrapper around the code in grammar.y */ +aa_log_record * +parse_record(char *str) +{ + if (str == NULL) + return NULL; + + return _parse_yacc(str); +} + +void +free_record(aa_log_record *record) +{ + if (record != NULL) + { + if (record->operation != NULL) + free(record->operation); + if (record->requested_mask != NULL) + free(record->requested_mask); + if (record->denied_mask != NULL) + free(record->denied_mask); + if (record->profile != NULL) + free(record->profile); + if (record->name != NULL) + free(record->name); + if (record->name2 != NULL) + free(record->name2); + if (record->attribute != NULL) + free(record->attribute); + if (record->parent != NULL) + free(record->parent); + if (record->magic_token != NULL) + free(record->magic_token); + if (record->info != NULL) + free(record->info); + if (record->active_hat != NULL) + free(record->active_hat); + if (record->audit_id != NULL) + free(record->audit_id); + free(record); + } + return; +} + +/* Set all of the fields to appropriate values */ +void +_init_log_record(aa_log_record *record) +{ + if (record == NULL) + return; + + record->version = AA_RECORD_SYNTAX_UNKNOWN; + record->event = AA_RECORD_INVALID; + record->pid = 0; + record->bitmask = 0; + record->task = 0; + + record->audit_id = NULL; + record->operation = NULL; + record->denied_mask = NULL; + record->requested_mask = NULL; + record->profile = NULL; + record->name = NULL; + record->name2 = NULL; + record->attribute = NULL; + record->parent = NULL; + record->magic_token = NULL; + record->info = NULL; + record->active_hat = NULL; + return; +} diff --git a/changehat/libapparmor/src/libapparmor.map b/changehat/libapparmor/src/libapparmor.map new file mode 100644 index 000000000..93aed6e92 --- /dev/null +++ b/changehat/libapparmor/src/libapparmor.map @@ -0,0 +1,15 @@ +IMMUNIX_1.0 { + global: + change_hat; + local: + *; +}; + +APPARMOR_1.0 { + global: + change_hat; + parse_record; + free_record; + local: + *; +}; diff --git a/changehat/libapparmor/src/libimmunix_warning.c b/changehat/libapparmor/src/libimmunix_warning.c new file mode 100644 index 000000000..0e86bdd30 --- /dev/null +++ b/changehat/libapparmor/src/libimmunix_warning.c @@ -0,0 +1,23 @@ +/* $Id: libimmunix_warning.c 13 2006-04-12 21:43:34Z steve-beattie $ + + Copyright (c) 2006 Novell, Inc. (All rights reserved) + The libimmunix library is licensed under the terms of the GNU + Lesser General Public License, version 2.1. Please see the file + COPYING.LGPL. + +*/ + +#include + +void __libimmunix_warning(void) __attribute__ ((constructor)); +void __libimmunix_warning(void) +{ + extern const char *__progname; /* global from linux crt0 */ + openlog (__progname, LOG_PID|LOG_PERROR, LOG_USER); + syslog(LOG_NOTICE, + "%s links against libimmunix.so, which is deprecated. " + "Please link against libapparmor instead\n", + __progname); + closelog(); + +} diff --git a/changehat/libapparmor/src/parser.h b/changehat/libapparmor/src/parser.h new file mode 100644 index 000000000..ae01f956f --- /dev/null +++ b/changehat/libapparmor/src/parser.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * NOVELL (All rights reserved) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License published by the Free Software Foundation. + * + * 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, contact Novell, Inc. + */ + + +#ifndef __AA_LOG_PARSER_H__ +#define __AA_LOG_PARSER_H__ + +extern void _init_log_record(aa_log_record *record); +extern aa_log_record *_parse_yacc(char *str); + +#endif + diff --git a/changehat/libapparmor/src/scanner.l b/changehat/libapparmor/src/scanner.l new file mode 100644 index 000000000..c20ece5ef --- /dev/null +++ b/changehat/libapparmor/src/scanner.l @@ -0,0 +1,228 @@ +/* + * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + * NOVELL (All rights reserved) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License published by the Free Software Foundation. + * + * 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, contact Novell, Inc. + */ + + +%option noyywrap +%option reentrant +%option prefix="aalogparse_" +%option bison-bridge +%option header-file="scanner.h" +%option outfile="lex.yy.c" +%{ + +#include "grammar.h" +%} + +ws [ \t\r\n] + +equals "=" +digits [0-9]+ +colon ":" +open_paren "(" +close_paren ")" +ID [^ \t\n\(\)="'!] +path "/"{ID}* +period "\." +modes [RrWwXxIiLlUuPpMm] +/* New message types */ + +reject_type "APPARMOR_DENIED" +audit_type "APPARMOR_AUDIT" +complain_type "APPARMOR_ALLOWED" +hint_type "APPARMOR_HINT" +status_type "APPARMOR_STATUS" +error_type "APPARMOR_ERROR" + +/* Old message tokens */ + +old_apparmor_type "APPARMOR" +old_apparmor_reject "REJECTING" +old_apparmor_permit "PERMITTING" +old_apparmor_logprof "LOGPROF-HINT" +old_unknown_hat "unknown_hat" +old_unknown_profile "unknown_profile" +old_missing_profile "missing_mandatory_profile" +old_active "active" +old_access "access" +old_to "to" +old_pipe "pipe" +old_extended "extended" +old_rmdir "rmdir" +old_mkdir "mkdir" +old_on "on" +old_xattr "xattr" +old_change "change" +old_capability "capability" +old_fork "fork" +old_child "child" + +null_complain "null-complain-profile" + +/* Key tokens */ + +key_type "type" +key_msg "msg" +key_operation "operation" +key_name "name" +key_name2 "name2" +key_denied_mask "denied_mask" +key_requested_mask "requested_mask" +key_attribute "attribute" +key_task "task" +key_parent "parent" +key_magic_token "magic_token" +key_info "info" +key_pid "pid" +key_profile "profile" +key_image "image" +audit "audit" + +%x quoted_string +%x sub_id +%x audit_id +%x single_quoted_string + +%% +%{ +char string_buf[512]; +char *string_buf_ptr; + +/* yy_flex_debug = 1; */ +%} + +{ws}+ { /* Skip whitespace */ } + +{ + {digits} { yylval->t_str = strdup(yytext); return(TOK_AUDIT_DIGITS);} + {colon} { return(TOK_COLON); } + {period} { return(TOK_PERIOD); } + {open_paren} { return(TOK_OPEN_PAREN); } + {close_paren} { BEGIN(INITIAL); return(TOK_CLOSE_PAREN); } +} + +{ + {open_paren} { return(TOK_OPEN_PAREN); } + {close_paren} { BEGIN(INITIAL); return(TOK_CLOSE_PAREN); } + "'" { string_buf_ptr = string_buf; BEGIN(single_quoted_string); } + {ws} { } + \" { string_buf_ptr = string_buf; BEGIN(quoted_string); } + {ID}+ { + yylval->t_str = strdup(yytext); + BEGIN(INITIAL); + return(TOK_ID); + } + {equals} { return(TOK_EQUALS); } + } + + + +"'" { string_buf_ptr = string_buf; BEGIN(single_quoted_string); } +"'" { /* End of the quoted string */ + BEGIN(INITIAL); + *string_buf_ptr = '\0'; + yylval->t_str = strdup(string_buf); + return(TOK_SINGLE_QUOTED_STRING); + } + + +\\(.|\n) { *string_buf_ptr++ = yytext[1]; } + +[^\\\n\'\"]+ { + char *yptr = yytext; + while (*yptr) + { + *string_buf_ptr++ = *yptr++; + } + + } + +\" { string_buf_ptr = string_buf; BEGIN(quoted_string); } +\" { /* End of the quoted string */ + BEGIN(INITIAL); + *string_buf_ptr = '\0'; + yylval->t_str = strdup(string_buf); + return(TOK_QUOTED_STRING); + } + + +\\(.|\n) { *string_buf_ptr++ = yytext[1]; } + +[^\\\n\"]+ { + char *yptr = yytext; + while (*yptr) + { + *string_buf_ptr++ = *yptr++; + } + } +{equals} { return(TOK_EQUALS); } +{digits} { yylval->t_long = atol(yytext); return(TOK_DIGITS); } +{colon} { return(TOK_COLON); } +{open_paren} { + BEGIN(sub_id); + return(TOK_OPEN_PAREN); + } +{close_paren} { return(TOK_CLOSE_PAREN); } +{path} { yylval->t_str = strdup(yytext); return(TOK_PATH); } +{reject_type} { return(TOK_TYPE_REJECT); } +{audit_type} { return(TOK_TYPE_AUDIT); } +{complain_type} { return(TOK_TYPE_COMPLAIN); } +{hint_type} { return(TOK_TYPE_HINT); } +{status_type} { return(TOK_TYPE_STATUS); } +{error_type} { return(TOK_TYPE_ERROR); } +{period} { return(TOK_PERIOD); } + +{old_apparmor_type} { return(TOK_OLD_TYPE_APPARMOR); } +{old_apparmor_reject} { return(TOK_OLD_APPARMOR_REJECT); } +{old_apparmor_permit} { return(TOK_OLD_APPARMOR_PERMIT); } +{old_apparmor_logprof} { return(TOK_OLD_APPARMOR_LOGPROF_HINT); } +{old_unknown_hat} { BEGIN(sub_id); return(TOK_OLD_UNKNOWN_HAT); } +{old_unknown_profile} { return(TOK_OLD_UNKNOWN_PROFILE); } +{old_missing_profile} { return(TOK_OLD_MISSING_PROFILE); } +{old_active} { return(TOK_OLD_ACTIVE); } +{old_access} { return(TOK_OLD_ACCESS); } +{old_to} { return(TOK_OLD_TO); } +{old_pipe} { return(TOK_OLD_PIPE); } +{old_extended} { return(TOK_OLD_EXTENDED); } +{old_mkdir} { return(TOK_OLD_MKDIR); } +{old_rmdir} { return(TOK_OLD_RMDIR); } +{old_on} { return(TOK_OLD_ON); } +{old_xattr} { BEGIN(sub_id); return(TOK_OLD_XATTR); } +{old_change} { return(TOK_OLD_CHANGE); } +{old_capability} { BEGIN(sub_id); return(TOK_OLD_CAPABILITY); } +{old_fork} { return(TOK_OLD_FORK); } +{old_child} { return(TOK_OLD_CHILD); } +{modes}+ { yylval->t_str = strdup(yytext); return(TOK_MODE); } + +{key_type} { return(TOK_KEY_TYPE); } +{key_msg} { return(TOK_KEY_MSG); } +{key_operation} { return(TOK_KEY_OPERATION); } +{key_name} { return(TOK_KEY_NAME); } +{key_name2} { return(TOK_KEY_NAME2); } +{key_denied_mask} { return(TOK_KEY_DENIED_MASK); } +{key_requested_mask} { return(TOK_KEY_REQUESTED_MASK); } +{key_attribute} { BEGIN(sub_id); return(TOK_KEY_ATTRIBUTE); } +{key_task} { return(TOK_KEY_TASK); } +{key_parent} { return(TOK_KEY_PARENT); } +{key_magic_token} { return(TOK_KEY_MAGIC_TOKEN); } +{key_info} { return(TOK_KEY_INFO); } +{key_pid} { return(TOK_KEY_PID); } +{key_profile} { return(TOK_KEY_PROFILE); } +{audit} { BEGIN(audit_id); return(TOK_AUDIT); } +{null_complain} { return(TOK_NULL_COMPLAIN); } +{key_image} { BEGIN(sub_id); return(TOK_KEY_IMAGE); } + +%% diff --git a/changehat/libapparmor/swig/Makefile.am b/changehat/libapparmor/swig/Makefile.am new file mode 100644 index 000000000..592d1a8a8 --- /dev/null +++ b/changehat/libapparmor/swig/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = perl python ruby + +EXTRA_DIST = SWIG/*.i java/Makefile.am diff --git a/changehat/libapparmor/swig/SWIG/libapparmor.i b/changehat/libapparmor/swig/SWIG/libapparmor.i new file mode 100644 index 000000000..5c670d905 --- /dev/null +++ b/changehat/libapparmor/swig/SWIG/libapparmor.i @@ -0,0 +1,12 @@ +%module LibAppArmor + +%{ +#include "aalogparse.h" +extern int change_hat (const char *subprofile, unsigned int magic_token); + +%} + +%include "typemaps.i" +%include "aalogparse.h" +extern int change_hat (const char *subprofile, unsigned int magic_token); + diff --git a/changehat/libapparmor/swig/java/Makefile.am b/changehat/libapparmor/swig/java/Makefile.am new file mode 100644 index 000000000..6958b4c51 --- /dev/null +++ b/changehat/libapparmor/swig/java/Makefile.am @@ -0,0 +1,21 @@ +WRAPPERFILES = apparmorlogparse_wrap.c + +BUILT_SOURCES = apparmorlogparse_wrap.c + +all-local: apparmorlogparse_wrap.o + $(CC) -module apparmorlogparse_wrap.o -o libaalogparse.so + +apparmorlogparse_wrap.o: apparmorlogparse_wrap.c + $(CC) -c apparmorlogparse_wrap.c $(CFLAGS) -I../../src -I/usr/include/classpath -fno-strict-aliasing -o apparmorlogparse_wrap.o + +clean-local: + rm -rf org + +apparmorlogparse_wrap.c: org/aalogparse ../SWIG/*.i + $(SWIG) -java -I../SWIG -I../../src -outdir org/aalogparse \ + -package org.aalogparse -o apparmorlogparse_wrap.c libaalogparse.i + +org/aalogparse: + mkdir -p org/aalogparse + +EXTRA_DIST = $(BUILT_SOURCES) diff --git a/changehat/libapparmor/swig/perl/Makefile.PL b/changehat/libapparmor/swig/perl/Makefile.PL new file mode 100644 index 000000000..89523e0e0 --- /dev/null +++ b/changehat/libapparmor/swig/perl/Makefile.PL @@ -0,0 +1,9 @@ +use ExtUtils::MakeMaker; + +use vars qw($CCFLAGS $OBJECT $VERSION $OPTIMIZE); + +WriteMakefile( + 'NAME' => 'LibAppArmor', + 'MAKEFILE' => 'Makefile.perl', + 'FIRST_MAKEFILE' => 'Makefile.perl', + ); diff --git a/changehat/libapparmor/swig/perl/Makefile.am b/changehat/libapparmor/swig/perl/Makefile.am new file mode 100644 index 000000000..a17b36402 --- /dev/null +++ b/changehat/libapparmor/swig/perl/Makefile.am @@ -0,0 +1,34 @@ +if HAVE_PERL + +PERL_MAKEFILE = Makefile.perl + +WRAPPER_SOURCES = libapparmor_wrap.c LibAppArmor.pm + +all-local: .build-stamp + +.build-stamp: $(WRAPPER_SOURCES) $(PERL_MAKEFILE) + make -f $(PERL_MAKEFILE) + touch .build-stamp + +check-local: .build-stamp + make -f $(PERL_MAKEFILE) test + +install-exec-local: .build-stamp + make -f $(PERL_MAKEFILE) install_vendor + +clean-local: $(PERL_MAKEFILE) + make -f $(PERL_MAKEFILE) clean + rm -f $(PERL_MAKEFILE).old + rm -rf build + +$(PERL_MAKEFILE): Makefile.PL + $(PERL) Makefile.PL VERSION="0.1" OBJECT="../../src/.libs/libapparmor.so libapparmor_wrap.o" CCFLAGS="-I../../src -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -pipe -Wdeclaration-after-statement" OPTIMIZE="$(CFLAGS) -shared -I$(includedir) -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -pipe -Wdeclaration-after-statement" + + +$(WRAPPER_SOURCES): ../SWIG/*.i + $(SWIG) -perl -I../../src -I../SWIG -o libapparmor_wrap.c libapparmor.i + +endif + +EXTRA_DIST = Makefile.PL $(WRAPPER_SOURCES) examples/*.pl + diff --git a/changehat/libapparmor/swig/perl/examples/example.pl b/changehat/libapparmor/swig/perl/examples/example.pl new file mode 100644 index 000000000..2a7b4997d --- /dev/null +++ b/changehat/libapparmor/swig/perl/examples/example.pl @@ -0,0 +1,15 @@ +require LibAppArmor; + +$msg = "type=APPARMOR msg=audit(1168662182.495:58): PERMITTING r access to /home/matt/projects/change_hat_test/test (test_hat(27871) profile /home/matt/projects/change_hat_test/test_hat active null-complain-profile)"; + +my($test) = AppArmorLogRecordParser::parse_record($msg); + +if (AppArmorLogRecordParser::aa_log_record::swig_event_get($test) == $AppArmorLogRecordParser::AA_RECORD_ALLOWED ) +{ + print "AA_RECORD_ALLOWED\n"; +} + +print "Audit ID: " . AppArmorLogRecordParser::aa_log_record::swig_audit_id_get($test) . "\n"; +print "PID: " . AppArmorLogRecordParser::aa_log_record::swig_pid_get($test) . "\n"; + +AppArmorLogRecordParser::free_record($test); diff --git a/changehat/libapparmor/swig/python/Makefile.am b/changehat/libapparmor/swig/python/Makefile.am new file mode 100644 index 000000000..cab3c4992 --- /dev/null +++ b/changehat/libapparmor/swig/python/Makefile.am @@ -0,0 +1,17 @@ +if HAVE_PYTHON + +BUILT_SOURCES = libapparmor_wrap.c + +SWIG_SOURCES = ../SWIG/libapparmor.i + +pkgpython_PYTHON = LibAppArmor.py +pkgpyexec_LTLIBRARIES = _libapparmor.la +_libapparmor_la_SOURCES = libapparmor_wrap.c $(SWIG_SOURCES) +_libapparmor_la_CPPFLAGS = $(SWIG_PYTHON_CFLAGS) -I$(top_srcdir)/src -I/usr/include/python +_libapparmor_la_LDFLAGS = -module +_libapparmor_la_LIBADD = ../../src/.libs/libapparmor.so + +libapparmor_wrap.c: $(SWIG_SOURCES) + $(SWIG) -python -I$(top_srcdir)/src -o $@ $< + +endif diff --git a/changehat/libapparmor/swig/ruby/Makefile.am b/changehat/libapparmor/swig/ruby/Makefile.am new file mode 100644 index 000000000..c9a42719b --- /dev/null +++ b/changehat/libapparmor/swig/ruby/Makefile.am @@ -0,0 +1,24 @@ +if HAVE_RUBY + +RUBY_MAKEFILE = Makefile.ruby + +WRAPPER_FILES = LibAppArmor_wrap.* LibAppArmor.so extension.mak .build-stamp + +BUILT_SOURCES = LibAppArmor_wrap.c + +all-local: .build-stamp + +.build-stamp: LibAppArmor_wrap.c + CFLAGS="$(CFLAGS) -I../../src" $(RUBY) extconf.rb build + touch .build-stamp + +install-exec-local: .build-stamp + make -f $(RUBY_MAKEFILE) install + +LibAppArmor_wrap.c: ../SWIG/*.i + $(SWIG) -ruby -I../SWIG -I../../src -o ./LibAppArmor_wrap.c libapparmor.i + +endif + +EXTRA_DIST = extconf.rb $(BUILT_SOURCES) examples/*.rb + diff --git a/changehat/libapparmor/swig/ruby/examples/example.rb b/changehat/libapparmor/swig/ruby/examples/example.rb new file mode 100644 index 000000000..70d651aff --- /dev/null +++ b/changehat/libapparmor/swig/ruby/examples/example.rb @@ -0,0 +1,2 @@ +require 'AppArmorLogRecordParser' + diff --git a/changehat/libapparmor/swig/ruby/extconf.rb b/changehat/libapparmor/swig/ruby/extconf.rb new file mode 100644 index 000000000..fdd60dd22 --- /dev/null +++ b/changehat/libapparmor/swig/ruby/extconf.rb @@ -0,0 +1,76 @@ +require 'mkmf' +require 'ftools' + +$CFLAGS += " " + (ENV['CFLAGS'] || "") + (ENV['CXXFLAGS'] || "") +$LDFLAGS = "../../src/.libs/libaalogparse.so" + +def usage + puts < Build, + "install" => Install +} + +availableCommands[cmd].execute diff --git a/changehat/libapparmor/testsuite/Makefile.am b/changehat/libapparmor/testsuite/Makefile.am new file mode 100644 index 000000000..d06c94277 --- /dev/null +++ b/changehat/libapparmor/testsuite/Makefile.am @@ -0,0 +1,18 @@ +SUBDIRS = lib config libaalogparse.test +PACKAGE = libaalogparse +AUTOMAKE_OPTIONS = dejagnu + +INCLUDES = -I. -I$(top_srcdir)/src + +AM_CPPFLAGS = $(DEBUG_FLAGS) -DLOCALEDIR=\"${localedir}\" + +noinst_PROGRAMS = test_multi.multi + +test_multi_multi_SOURCES = test_multi.c +test_multi_multi_CFLAGS = $(CFLAGS) +test_multi_multi_LDFLAGS = $(LDFLAGS) ../src/.libs/libapparmor.a + +clean-local: + rm -f tmp.err.* tmp.out.* site.exp site.bak + +EXTRA_DIST = test_multi/*.in test_multi/*.out test_multi/*.err diff --git a/changehat/libapparmor/testsuite/config/Makefile.am b/changehat/libapparmor/testsuite/config/Makefile.am new file mode 100644 index 000000000..ca54bb154 --- /dev/null +++ b/changehat/libapparmor/testsuite/config/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = default.exp unix.exp unknown.exp diff --git a/changehat/libapparmor/testsuite/config/default.exp b/changehat/libapparmor/testsuite/config/default.exp new file mode 100644 index 000000000..28b0d5bae --- /dev/null +++ b/changehat/libapparmor/testsuite/config/default.exp @@ -0,0 +1,3 @@ +# empty + + diff --git a/changehat/libapparmor/testsuite/config/unix.exp b/changehat/libapparmor/testsuite/config/unix.exp new file mode 100644 index 000000000..64ce0d61f --- /dev/null +++ b/changehat/libapparmor/testsuite/config/unix.exp @@ -0,0 +1,2 @@ +load_lib "libaalogparse_init.exp" + diff --git a/changehat/libapparmor/testsuite/config/unknown.exp b/changehat/libapparmor/testsuite/config/unknown.exp new file mode 100644 index 000000000..57d6c7caa --- /dev/null +++ b/changehat/libapparmor/testsuite/config/unknown.exp @@ -0,0 +1,2 @@ +perror "No setup for current configuration." +exit 1 diff --git a/changehat/libapparmor/testsuite/lib/Makefile.am b/changehat/libapparmor/testsuite/lib/Makefile.am new file mode 100644 index 000000000..738345bb2 --- /dev/null +++ b/changehat/libapparmor/testsuite/lib/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = libaalogparse_init.exp diff --git a/changehat/libapparmor/testsuite/lib/libaalogparse_init.exp b/changehat/libapparmor/testsuite/lib/libaalogparse_init.exp new file mode 100644 index 000000000..8963afe73 --- /dev/null +++ b/changehat/libapparmor/testsuite/lib/libaalogparse_init.exp @@ -0,0 +1,186 @@ +proc single-run { src } { + + set path [split $src "/"] + set filename [lindex $path [expr [llength $path]-1]] + + # extract basename and check extension + + set fname [split $filename "."] + + if {[llength $fname] < 2} { + fail "Bad filename syntax '$src'" + return -1 + } + if {[lindex $fname [expr [llength $fname]-1]] != "single"} { + fail "Not .single extension '$src'" + return -1 + } + + # setup filenames + + # $src is the name of the original testfile with absolute path + # tests/$filename is the name of the original testfile with relative path, + # relative to the testsuite directory + set test_prg "$filename" + + set base_name [lindex $fname 0] + + puts "Running $base_name..." + + #generate output directory + + exec mkdir -p ./single.out/out + set outfile ./single.out/out/$base_name.out + set refoutfile ./single.out/$base_name.out + set errfile ./single.out/out/$base_name.err + set referrfile ./single.out/$base_name.err + + # run the test + + set command "LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:../src/.libs\" $src >$outfile 2>$errfile" + set result "" + set oops [catch { set result [exec sh -c $command] } catched] + + if {$oops != 0} { + fail "test case failed for $base_name: $catched" + return -1 + } + + # check return code from runprg + + if {$result != ""} { + warning "Run of $base_name results in '$result'" + return -1 + } + + if { [ file exists $refoutfile ] == 0 } { + perror "Missing file $refoutfile" 0 + } else { + if { [ diff $refoutfile $outfile ] != 1 } { + puts "Output doesn't match expected data:" + puts [ exec sh -c "diff -u $refoutfile $outfile || true" ] + fail $base_name + return -1 + } + } + + if { [ file exists $referrfile ] == 0 } { + perror "Missing file $referrfile" 0 + } else { + if { [ diff $referrfile $errfile ] != 1 } { + puts "Output doesn't match expected data:" + puts [ exec sh -c "diff -u $referrfile $errfile || true" ] + fail $base_name + return -1 + } + } + + # ok, all is fine + pass $base_name + + return 0 +} + + + +proc multi-run { src } { + set errorOccured 0 + set path [split $src "/"] + set filename [lindex $path [expr [llength $path]-1]] + + # extract basename and check extension + + set fname [split $filename "."] + + if {[llength $fname] < 2} { + fail "Bad filename syntax '$src'" + return -1 + } + if {[lindex $fname [expr [llength $fname]-1]] != "multi"} { + fail "Not .multi extension '$src'" + return -1 + } + # setup filenames + + # $src is the name of the original testfile with absolute path + # tests/$filename is the name of the original testfile with relative path, + # relative to the testsuite directory + set test_prg "$filename" + + set base_name [lindex $fname 0] + + puts "Running $base_name..." + + set testcases [glob $base_name/*.in ] + + foreach testcase $testcases { + set testPath [split $testcase "/"] + set testFilename [lindex $testPath [expr [llength $testPath]-1]] + set testFname [split $testFilename "."] + set testBase_name [lindex $testFname 0] + puts " ... $testBase_name" + + #generate output directory + + exec mkdir -p ./$base_name/out + set errfile ./$base_name/out/$testBase_name.err + set referrfile ./$base_name/$testBase_name.err + set outfile ./$base_name/out/$testBase_name.out + set refoutfile ./$base_name/$testBase_name.out + + # run the test + + set command "LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:../src/.libs\" $src $testcase >$outfile 2>$errfile" + set result "" + set oops [catch { set result [exec sh -c $command] } catched] + + if {$oops != 0} { + fail "test case failed for $testBase_name: $catched" + set errorOccured 0 + continue + } + + # check return code from runprg + + if {$result != ""} { + warning "Run of $testBase_name results in '$result'" + set errorOccured 0 + continue + } + + if { [ file exists $refoutfile ] == 0 } { + perror "Missing file $refoutfile" 0 + } else { + if { [ diff $refoutfile $outfile ] != 1 } { + puts "Output doesn't match expected data:" + puts [ exec sh -c "diff -u $refoutfile $outfile || true" ] + fail $testBase_name + set errorOccured 0 + continue + } + } + + if { [ file exists $referrfile ] == 0 } { + perror "Missing file $referrfile" 0 + } else { + if { [ diff $referrfile $errfile ] != 1 } { + puts "Output doesn't match expected data:" + puts [ exec sh -c "diff -u $referrfile $errfile || true" ] + fail $testBase_name + set errorOccured 0 + continue + } + } + + # ok, all is fine + pass $testBase_name + } + + if { $errorOccured == 0 } { + return 0 + } else { + return -1 + } + +} + diff --git a/changehat/libapparmor/testsuite/libaalogparse.test/Makefile.am b/changehat/libapparmor/testsuite/libaalogparse.test/Makefile.am new file mode 100644 index 000000000..cc6b17d2c --- /dev/null +++ b/changehat/libapparmor/testsuite/libaalogparse.test/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = multi_test.exp diff --git a/changehat/libapparmor/testsuite/libaalogparse.test/multi_test.exp b/changehat/libapparmor/testsuite/libaalogparse.test/multi_test.exp new file mode 100644 index 000000000..8dc626b87 --- /dev/null +++ b/changehat/libapparmor/testsuite/libaalogparse.test/multi_test.exp @@ -0,0 +1,24 @@ +# Runs all tests with the extention "multi" for several times. +# Each testprogram .multi has an own subdirectory +# in which several testcases are defined for this program +# Each testcase has 3 files: +# +# .in +# .out +# .err +# +# The program ".multi" will be called with the argument +# ".in". The standard output will be compared with the +# files ".out" and ".err". +# The testcase is successful if the program returns 0 AND the outputs +# are identically equal to the files ".out" and +# ".err". + +if { [catch { set filenames [glob $srcdir/*.multi] } ] } { + puts "No .multi files found" +} else { + # foreach file, call multi-run (from testsuite/lib) + + foreach file $filenames { multi-run $file } +} + diff --git a/changehat/libapparmor/testsuite/test_multi.c b/changehat/libapparmor/testsuite/test_multi.c new file mode 100644 index 000000000..6b517014f --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi.c @@ -0,0 +1,157 @@ +#include +#include +#include +#include + +#include "aalogparse.h" + +int print_results(aa_log_record *record); + +int main(int argc, char **argv) +{ + FILE *testcase; + char log_line[1024]; + aa_log_record *test = NULL; + int ret = -1; + + if (argc != 2) + { + fprintf(stderr, "Usage: test_multi.multi \n"); + return(1); + } + + printf("START\n"); + printf("File: %s\n", argv[1]); + + testcase = fopen(argv[1], "r"); + if (testcase == NULL) + { + perror("Could not open testcase: "); + return(1); + } + + if (fgets(log_line, 1023, testcase) == NULL) + { + fprintf(stderr, "Could not read testcase.\n"); + fclose(testcase); + return(1); + } + + fclose(testcase); + + test = parse_record(log_line); + + if (test == NULL) + { + fprintf(stderr,"Parsing failed.\n"); + return(1); + } + ret = print_results(test); + free_record(test); + return ret; +} + +int print_results(aa_log_record *record) +{ + printf("Event type: "); + switch(record->event) + { + case AA_RECORD_ERROR: + { + printf("AA_RECORD_ERROR\n"); + break; + } + case AA_RECORD_INVALID: + { + printf("AA_RECORD_INVALID\n"); + break; + } + case AA_RECORD_AUDIT: + { + printf("AA_RECORD_AUDIT\n"); + break; + } + case AA_RECORD_ALLOWED: + { + printf("AA_RECORD_ALLOWED\n"); + break; + } + case AA_RECORD_DENIED: + { + printf("AA_RECORD_DENIED\n"); + break; + } + case AA_RECORD_HINT: + { + printf("AA_RECORD_HINT\n"); + break; + } + case AA_RECORD_STATUS: + { + printf("AA_RECORD_STATUS\n"); + break; + } + default: + { + printf("UNKNOWN EVENT TYPE\n"); + break; + } + } + if (record->audit_id != NULL) + { + printf("Audit ID: %s\n", record->audit_id); + } + if (record->operation != NULL) + { + printf("Operation: %s\n", record->operation); + } + if (record->requested_mask != NULL) + { + printf("Mask: %s\n", record->requested_mask); + } + if (record->denied_mask != NULL) + { + printf("Denied Mask: %s\n", record->denied_mask); + } + if (record->profile != NULL) + { + printf("Profile: %s\n", record->profile); + } + if (record->name != NULL) + { + printf("Name: %s\n", record->name); + } + if (record->name2 != NULL) + { + printf("Name2: %s\n", record->name2); + } + if (record->attribute != NULL) + { + printf("Attribute: %s\n", record->attribute); + } + if (record->task != 0) + { + printf("Task: %i\n", record->task); + } + if (record->parent != NULL) + { + printf("Parent: %s\n", record->parent); + } + if (record->magic_token != NULL) + { + printf("Token: %s\n", record->magic_token); + } + if (record->info != NULL) + { + printf("Info: %s\n", record->info); + } + if (record->pid != 0) + { + printf("PID: %i\n", record->pid); + } + if (record->active_hat != NULL) + { + printf("Active hat: %s\n", record->active_hat); + } + return(0); +} diff --git a/changehat/libapparmor/testsuite/test_multi/testcase1.err b/changehat/libapparmor/testsuite/test_multi/testcase1.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase1.in b/changehat/libapparmor/testsuite/test_multi/testcase1.in new file mode 100644 index 000000000..054990397 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase1.in @@ -0,0 +1 @@ +type=APPARMOR_DENIED msg=audit(1181057184.959:7): operation="exec" denied_mask="x" name="/bin/ping" pid="31938" profile="/bin/ping" name2="ping2" requested_mask="rwx" attribute="attr" task="something" parent="something" magic_token="29493103210" info="Information" diff --git a/changehat/libapparmor/testsuite/test_multi/testcase1.out b/changehat/libapparmor/testsuite/test_multi/testcase1.out new file mode 100644 index 000000000..a29d8d8a4 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase1.out @@ -0,0 +1,15 @@ +START +File: test_multi/testcase1.in +Event type: AA_RECORD_DENIED +Audit ID: 1181057184.959:7 +Operation: exec +Mask: rwx +Denied Mask: x +Profile: /bin/ping +Name: /bin/ping +Name2: ping2 +Attribute: attr +Parent: something +Token: 29493103210 +Info: Information +PID: 31938 diff --git a/changehat/libapparmor/testsuite/test_multi/testcase10.err b/changehat/libapparmor/testsuite/test_multi/testcase10.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase10.in b/changehat/libapparmor/testsuite/test_multi/testcase10.in new file mode 100644 index 000000000..0d6b9745b --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase10.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1168661976.062:55): LOGPROF-HINT fork pid=27764 child=38229 profile=/home/matt/projects/change_hat_test/test_hat active=/home/matt/projects/change_hat_test/test_hat diff --git a/changehat/libapparmor/testsuite/test_multi/testcase10.out b/changehat/libapparmor/testsuite/test_multi/testcase10.out new file mode 100644 index 000000000..4299b50fe --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase10.out @@ -0,0 +1,9 @@ +START +File: test_multi/testcase10.in +Event type: AA_RECORD_HINT +Audit ID: 1168661976.062:55 +Operation: clone +Profile: /home/matt/projects/change_hat_test/test_hat +Task: 38229 +PID: 27764 +Active hat: /home/matt/projects/change_hat_test/test_hat diff --git a/changehat/libapparmor/testsuite/test_multi/testcase11.err b/changehat/libapparmor/testsuite/test_multi/testcase11.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase11.in b/changehat/libapparmor/testsuite/test_multi/testcase11.in new file mode 100644 index 000000000..edc0cbed0 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase11.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1168661976.062:55): LOGPROF-HINT fork pid=27764 child=38229 diff --git a/changehat/libapparmor/testsuite/test_multi/testcase11.out b/changehat/libapparmor/testsuite/test_multi/testcase11.out new file mode 100644 index 000000000..c01f33721 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase11.out @@ -0,0 +1,7 @@ +START +File: test_multi/testcase11.in +Event type: AA_RECORD_HINT +Audit ID: 1168661976.062:55 +Operation: clone +Task: 38229 +PID: 27764 diff --git a/changehat/libapparmor/testsuite/test_multi/testcase2.err b/changehat/libapparmor/testsuite/test_multi/testcase2.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase2.in b/changehat/libapparmor/testsuite/test_multi/testcase2.in new file mode 100644 index 000000000..653e6def8 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase2.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1168662182.495:58): PERMITTING r access to /home/matt/projects/change_hat_test/test (test_hat(27871) profile /home/matt/projects/change_hat_test/test_hat active null-complain-profile) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase2.out b/changehat/libapparmor/testsuite/test_multi/testcase2.out new file mode 100644 index 000000000..792127d0c --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase2.out @@ -0,0 +1,11 @@ +START +File: test_multi/testcase2.in +Event type: AA_RECORD_ALLOWED +Audit ID: 1168662182.495:58 +Operation: access +Mask: r +Profile: /home/matt/projects/change_hat_test/test_hat +Name: /home/matt/projects/change_hat_test/test +Info: test_hat +PID: 27871 +Active hat: null-complain-profile diff --git a/changehat/libapparmor/testsuite/test_multi/testcase3.err b/changehat/libapparmor/testsuite/test_multi/testcase3.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase3.in b/changehat/libapparmor/testsuite/test_multi/testcase3.in new file mode 100644 index 000000000..3e0d4e152 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase3.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1168661976.062:55): LOGPROF-HINT unknown_hat TESTHAT pid=27764 profile=/home/matt/projects/change_hat_test/test_hat active=/home/matt/projects/change_hat_test/test_hat diff --git a/changehat/libapparmor/testsuite/test_multi/testcase3.out b/changehat/libapparmor/testsuite/test_multi/testcase3.out new file mode 100644 index 000000000..a208b4a6d --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase3.out @@ -0,0 +1,10 @@ +START +File: test_multi/testcase3.in +Event type: AA_RECORD_HINT +Audit ID: 1168661976.062:55 +Operation: change_hat +Profile: /home/matt/projects/change_hat_test/test_hat +Name: TESTHAT +Info: unknown_hat +PID: 27764 +Active hat: /home/matt/projects/change_hat_test/test_hat diff --git a/changehat/libapparmor/testsuite/test_multi/testcase4.err b/changehat/libapparmor/testsuite/test_multi/testcase4.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase4.in b/changehat/libapparmor/testsuite/test_multi/testcase4.in new file mode 100644 index 000000000..b5ec4df56 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase4.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): REJECTING r access to /bin/freak-aa-out (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase4.out b/changehat/libapparmor/testsuite/test_multi/testcase4.out new file mode 100644 index 000000000..e1a36ac7f --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase4.out @@ -0,0 +1,11 @@ +START +File: test_multi/testcase4.in +Event type: AA_RECORD_DENIED +Audit ID: 1167188680.127:54 +Operation: access +Mask: r +Profile: /bin/freak-aa-out +Name: /bin/freak-aa-out +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out diff --git a/changehat/libapparmor/testsuite/test_multi/testcase5.err b/changehat/libapparmor/testsuite/test_multi/testcase5.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase5.in b/changehat/libapparmor/testsuite/test_multi/testcase5.in new file mode 100644 index 000000000..2a2070e99 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase5.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): REJECTING mkdir on /path/to/something (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase5.out b/changehat/libapparmor/testsuite/test_multi/testcase5.out new file mode 100644 index 000000000..dfe5aedc2 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase5.out @@ -0,0 +1,10 @@ +START +File: test_multi/testcase5.in +Event type: AA_RECORD_DENIED +Audit ID: 1167188680.127:54 +Operation: mkdir +Profile: /bin/freak-aa-out +Name: /path/to/something +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out diff --git a/changehat/libapparmor/testsuite/test_multi/testcase6.err b/changehat/libapparmor/testsuite/test_multi/testcase6.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase6.in b/changehat/libapparmor/testsuite/test_multi/testcase6.in new file mode 100644 index 000000000..dda013814 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase6.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): PERMITTING rmdir on /path/to/something (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase6.out b/changehat/libapparmor/testsuite/test_multi/testcase6.out new file mode 100644 index 000000000..0ae08021d --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase6.out @@ -0,0 +1,10 @@ +START +File: test_multi/testcase6.in +Event type: AA_RECORD_ALLOWED +Audit ID: 1167188680.127:54 +Operation: rmdir +Profile: /bin/freak-aa-out +Name: /path/to/something +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out diff --git a/changehat/libapparmor/testsuite/test_multi/testcase7.err b/changehat/libapparmor/testsuite/test_multi/testcase7.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase7.in b/changehat/libapparmor/testsuite/test_multi/testcase7.in new file mode 100644 index 000000000..cb621e221 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase7.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): REJECTING xattr set on /path/to/something (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase7.out b/changehat/libapparmor/testsuite/test_multi/testcase7.out new file mode 100644 index 000000000..9c57b64e8 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase7.out @@ -0,0 +1,11 @@ +START +File: test_multi/testcase7.in +Event type: AA_RECORD_DENIED +Audit ID: 1167188680.127:54 +Operation: xattr +Profile: /bin/freak-aa-out +Name: /path/to/something +Attribute: set +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out diff --git a/changehat/libapparmor/testsuite/test_multi/testcase8.err b/changehat/libapparmor/testsuite/test_multi/testcase8.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase8.in b/changehat/libapparmor/testsuite/test_multi/testcase8.in new file mode 100644 index 000000000..bb08aafab --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase8.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): PERMITTING attribute (something) change to /else (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase8.out b/changehat/libapparmor/testsuite/test_multi/testcase8.out new file mode 100644 index 000000000..18e446369 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase8.out @@ -0,0 +1,11 @@ +START +File: test_multi/testcase8.in +Event type: AA_RECORD_ALLOWED +Audit ID: 1167188680.127:54 +Operation: setattr +Profile: /bin/freak-aa-out +Name: /else +Attribute: something +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out diff --git a/changehat/libapparmor/testsuite/test_multi/testcase9.err b/changehat/libapparmor/testsuite/test_multi/testcase9.err new file mode 100644 index 000000000..e69de29bb diff --git a/changehat/libapparmor/testsuite/test_multi/testcase9.in b/changehat/libapparmor/testsuite/test_multi/testcase9.in new file mode 100644 index 000000000..42111ea04 --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase9.in @@ -0,0 +1 @@ +type=APPARMOR msg=audit(1167188680.127:54): PERMITTING access to capability 'cap' (bash(23415) profile /bin/freak-aa-out active /bin/freak-aa-out) diff --git a/changehat/libapparmor/testsuite/test_multi/testcase9.out b/changehat/libapparmor/testsuite/test_multi/testcase9.out new file mode 100644 index 000000000..c17906dac --- /dev/null +++ b/changehat/libapparmor/testsuite/test_multi/testcase9.out @@ -0,0 +1,10 @@ +START +File: test_multi/testcase9.in +Event type: AA_RECORD_ALLOWED +Audit ID: 1167188680.127:54 +Operation: capability +Profile: /bin/freak-aa-out +Name: cap +Info: bash +PID: 23415 +Active hat: /bin/freak-aa-out