Commit graph

2223 commits

Author SHA1 Message Date
Steve Beattie
ed2b8b3111 mod_apparmor: revert apache 2.4 api fix from commit 2131
This patch reverts commit 2131 which added support for the newer apache
2.4 ap_hook_check_access_ex() api, based on a report from Christian that
it broke apache's simple authentication.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-10-09 12:49:38 -07:00
Christian Boltz
5efe6e2cec ntpd on openSUSE Factory needs another location for the pid file.
References: https://bugzilla.novell.com/show_bug.cgi?id=899746
  

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-10-06 19:58:49 +02:00
Seth Arnold
766485972a Merge changes from trunk -- almost entirely additions to abstractions, a
perl multiarch change to logprof.conf and new perl severity entries.

  intrigeri@boum.org 2014-09-10 Cherry-pick r2671 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2387 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2610 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2506 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2592 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2353 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2294 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2593 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2590 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2522 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2369 from master.
    intrigeri@boum.org 2014-09-10 Cherry-pick r2246 from master.
2014-09-12 16:13:45 -07:00
Seth Arnold
029875ef72 Remove <sys/sysctl.h> from parser_main.c to fix FTBFS on x32 platform.
As originally applied to trunk in 2667:

  The AppArmor parser failed to build on the x32 architecture due to a
  missing <sys/sysctl.h> header. This header is included by accident, a
  vestige of earlier days, and wasn't removed when the sysctls were
  removed. (Think Linux 2.0 or Linux 2.2 days.)

  See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=760378

  Thanks to Thorsten Glaser for the discovery and initial fix.
2014-09-10 18:36:10 -07:00
intrigeri
770746a320 Cherry-pick r2671 from master. 2014-09-10 17:41:44 -07:00
intrigeri
90bcee0f23 Cherry-pick r2387 from master. 2014-09-10 17:40:14 -07:00
intrigeri
2ace7d9dfa Cherry-pick r2610 from master. 2014-09-10 17:37:53 -07:00
intrigeri
95368e8fd0 Cherry-pick r2506 from master. 2014-09-10 17:37:27 -07:00
intrigeri
53fce179d9 Cherry-pick r2592 from master. 2014-09-10 17:37:02 -07:00
intrigeri
7566f992dd Cherry-pick r2353 from master. 2014-09-10 17:34:21 -07:00
intrigeri
3b1b013fc8 Cherry-pick r2294 from master. 2014-09-10 17:33:36 -07:00
intrigeri
e579d939ce Cherry-pick r2593 from master. 2014-09-10 17:32:57 -07:00
intrigeri
a591cf73b1 Cherry-pick r2590 from master. 2014-09-10 17:32:03 -07:00
intrigeri
97f6d4f52e Cherry-pick r2522 from master. 2014-09-10 17:24:07 -07:00
intrigeri
793013c3ce Cherry-pick r2369 from master. 2014-09-10 17:21:54 -07:00
intrigeri
fc03b984bd Cherry-pick r2246 from master. 2014-09-10 17:21:31 -07:00
Christian Boltz
e1092cfc72 add missing --display to aa-notify.pod
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-08 20:41:07 +02:00
Christian Boltz
90fe8b8d09 Fix for commit 2.8 branch r2140:
> Allow dnsmasq read access to IPv6 config

The commit did not match this part of the commit message  
> slightly modified (../conf/**/mtu -> ../conf/*/mtu)
which I'm fixing now.
2014-09-08 20:39:12 +02:00
Christian Boltz
6f6bce01a1 Allow dnsmasq read access to IPv6 config
The IPv6 Neighbor Discovery protocol (RFC 2461) suggests
implementations provide MTU in Router Advertisement (RA)
messages.  From section 4.2

MTU    SHOULD be sent on links that have a variable MTU
       (as specified in the document that describes how to
       run IP over the particular link type).  MAY be sent
       on other links.

dnsmasq supports this option and should have read access
to an interface's MTU.

Patch by James Fehlig <jfehlig@suse.com>


slightly modified (../conf/**/mtu -> ../conf/*/mtu)


Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-09-06 23:09:18 +02:00
Arthur Marble
c72c406357 parser: fix FTBFS when building with clang
Fix undefined reference error in parser/parser_interface.c.
http://clang.llvm.org/compatibility.html#inline has more details.

Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756807

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-29 12:26:59 -07:00
Christian Boltz
038c37c551 smbd: changed cachedir in openSUSE
openSUSE now compiles samba --with-cachedir=/var/lib/samba (instead of 
the default /var/cache/samba). This patch updates the smbd profile to 
match this change.

References: https://bugzilla.novell.com/show_bug.cgi?id=869787


Acked by: Seth Arnold <seth.arnold@canonical.com>
2014-08-11 23:24:23 +02:00
Christian Boltz
dedfb6d17a From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Properly handle bare 'file' keyword
References: bnc#889652

The bare file keyword is a shortcut for /{**,}. There are also implied
permissions that go with it.

This patch accepts the file keyword as well as allowing for missing mode
specifiers.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:49:15 +02:00
Christian Boltz
08fcbcc8ec From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Handle bare 'capability' keyword
References: bnc#889651

Specifying 'capability' implies all capabilities, but the perl code didn't
recognize it.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:48:30 +02:00
Christian Boltz
ff267dc1fc From: Jeff Mahoney <jeffm@suse.com>
Subject: perl-apparmor: Fix bare 'network' keyword handling
References: bnc#889650

The 'network' bare keyword was being printed as "audit network all" due to
two different bugs:

1) {audit}{all} was always being set to 1, regardless of whether the audit
   keyword was used
2) {rule} eq 'all' is the wrong test - it should be {rule}{all}

With these fixed, 'network' is properly handled.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Acked-by: Steve Beattie <steve@nxnw.org>
2014-08-02 12:47:39 +02:00
Steve Beattie
47df23aca5 parser: remove leaked in C++ish bool
In commit rev 2127, backported from trunk, a bit of C++ish style code
leaked in, the use of a bool variable. This is problematic for pure C
code. This commit converts the bool to an int and adjusts the true and
false keywords to their corresponding macros as defined in parser.h.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-07-30 03:49:49 -07:00
Steve Beattie
090c912431 utils: add CAP_AUDIT_READ to severity.db
Merge from trunk rev 2564.

This patch adds the new capability CAP_AUDIT_READ, added in the 3.16
kernel, to the utils severity.db. I set the severity level at 7,
since it seemed to offer less exposure than CAP_AUDIT_CONTROL and
CAP_AUDIT_WRITE, which are both considered severity 8.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-21 22:56:11 -07:00
Steve Beattie
59ed7057b3 libapparmor: fix log parsing memory leaks
This patch fixes some memory leaks in the libapparmor log parsing
functions, specifically around handling records obtained from syslog
and records containing network addresses.

Bug: https://bugs.launchpad.net/bugs/1340927
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-12 07:48:12 -07:00
Steve Beattie
b01c8f2a7a mod_apparmor: for apache 2.4, use new access control hook
Use ap_hook_check_access_ex() instead of
ap_hook_access_checker() for apache 2.4; see
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html#http_request

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-07-10 10:09:48 -07:00
Steve Beattie
afe682c65c mod_apparmor: try uri hat after AADefaultHatName, not before
Bug: https://bugs.launchpad.net/bugs/1322778

Between the apparmor 2.8.2 and 2.8.3, a bug was fixed in mod_apparmor
(in 2.8 revno 2120) that corrected the storage location for
AADefaultHatName.  The incorrect storage caused the hat specified by
the AADefaultHatName keyword to be the default value for AAHatName,
and meant that if both an AAHatName and an AADefaultHatName entry
were given in a vhost, mod_apparmor would not fall back to trying
AADefaultHatName if the hat specified in AAHatName did not exist in
the apache apparmor profile.

However, because the value specified in AADefaultHatName was the
default, if no AAHatName was specified, it would be attempted first,
before a hat based on the passed URI, rather than after as the
documentation stated and the code intended. By fixing the storage bug,
the attempted hat ordering now matched the documentation. But a number
of users came to rely on AADefaultHatName being attempted before the
URI. Additionally, because the 2.8 mod_apparmor attempts each hat
individually (rather than use the aa_change_hatv like trunk's
mod_apparmor), each attempt with the URI-based hatname is logged by the
kernel portion of apparmor, making system logs particularly noisy those
same users.

This patch re-adjusts the ordering so that the URI-based hat is
attempted after the hat specified by AADefaultHatName is attempted,
thus maintaining the actual behavior before the bug addressed in
revno 2120 was fixed.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>

Bug: https://launchpad.net/bugs/1322778
2014-07-10 10:08:24 -07:00
Christian Boltz
979b1d9f22 abstractions/nameservice should allow /run/nscd/passwd etc. in addition
to /var/run/nscd/passwd.

References: https://bugzilla.novell.com/show_bug.cgi?id=886225


Acked-by: Seth Arnold <seth.arnold@canonical.com> for both trunk and 2.8.
2014-07-09 10:18:54 +02:00
Jamie Strandboge
2c21b2d732 Description: update nvidia abstraction for additional /proc and ~/.nv/GLCache
access
Bug-Ubuntu: https://launchpad.net/bugs/1325050

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-06-06 13:52:24 -05:00
John Johansen
409e8703cf Fix profile loads from cache files that contain multiple profiles
backport of dev commit 2510

v3: fix freeing of filename when undefined
v2: address tyhicks feedback
    refactor to have a common write routine
    fix issue with set profile load being done even if !kernel_load

Profile loads from cache files that contain multiple profiles can
result in multiple reloads of the same profile or error messages about
failure to load profiles if the --add option is used. eg.

  apparmor="STATUS" operation="profile_load"
  name="/usr/lib/apache2/mpm-prefork/apache2" pid=8631
  comm="apparmor_parser"
  <sth0R> [82932.058388] type=1400 audit(1395415826.937:616):
  apparmor="STATUS" operation="profile_load" name="DEFAULT_URI" pid=8631
  comm="apparmor_parser"
  <sth0R> [82932.058391] type=1400 audit(1395415826.937:617):
  apparmor="STATUS" operation="profile_load"
  name="HANDLING_UNTRUSTED_INPUT" pid=8631 comm="apparmor_parser"
  <sth0R> [82932.058394] type=1400 audit(1395415826.937:618):
  apparmor="STATUS" operation="profile_load" name="phpsysinfo" pid=8631
  comm="apparmor_parser"
  <sth0R> [82932.059058] type=1400 audit(1395415826.937:619):
  apparmor="STATUS" operation="profile_replace" info="profile can not be
  replaced" error=-17
  name="/usr/lib/apache2/mpm-prefork/apache2//DEFAULT_URI" pid=8631
  comm="apparmor_parser"
  <sth0R> [82932.059574] type=1400 audit(1395415826.937:620):
  apparmor="STATUS" operation="profile_replace" info="profile can not be
  replaced" error=-17
  name="/usr/lib/apache2/mpm-prefork/apache2//HANDLING_UNTRUSTED_INPUT"
  pid=8631 comm="apparmor_parser"


The reason this happens is that the cache file is a container that
can contain multiple profiles in sequential order
  profile1
  profile2
  profile3

The parser loads the entire cache file to memory and the writes the
whole file to the kernel interface. It then skips foward in the file
to the next profile and reloads the file from that profile into
the kernel.
  eg. First load
    profile1
    profile2
    profile3

  advance to profile2, do second load
    profile2
    profile3

  advance to profile3, do third load
    profile3


With older kernels the interface would stop after the first profile and
return that it had processed the whole file, thus while wasting compute
resources copying extra data no errors occurred. However newer kernels
now support atomic loading of multipe profiles, so that all the profiles
passed in to the interface get processed.

This means on newer kernels the current parser load behavior results
in multiple loads/replacements when a cache file contains more than
one profile (note: loads from a compile do not have this problem).

To fix this, detect if the kernel supports atomic set loads, and load
the cache file once. If it doesn't only load one profile section
from a cache file at a time.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-05-08 09:37:01 -07:00
Steve Beattie
933658d8a6 Add dconf abstraction for querying dconf settings
Merge from trunk revno: 2209

An abstraction to grant the ability to query dconf settings. It does
not grant the ability to update or add settings, due to our current
inability to restrict where within the dconf hierarchy updates
can occur.

Nominated for 2.8 by intrigeri <intrigeri@boum.org>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-03-10 10:25:55 -07:00
Seth Arnold
3df7f56154 Cherrypick revision 2412 from trunk, store magic token in unsigned int
Original log:
Store the aa_change_hat magic token in an unsigned long in the test suite

The magic token used in the test suite is incorrectly stored
as an int rather than unsigned long leading to failure like this:

running changehat_misc
/tmp/testlibCTcwOe/source/trusty/apparmor-2.8.95~2411/tests/regression/apparmor/prologue.inc: line 176: 20184
Killed                  $testexec "$@" > $outfile 2>&1
Error: changehat_twice failed. Test 'CHANGEHAT (subprofile->subprofile)' was expected to 'pass'. Reason for
failure 'killed by signal 9'

Signed-off-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-03-04 10:57:23 -08:00
Jamie Strandboge
155bdd07af Add /var/www/html to abstractions/web-data, which is the path used on Debian
and its derivatives
Bug-Ubuntu: https://launchpad.net/bugs/1285653

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-27 14:51:31 -06:00
Christian Boltz
96c2ee3e08 dnsmasq profile - NetworkManager integration
This is an updated version of the previous dnsmasq profile patch, again 
from develop7 [at] develop7.info


Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-17 22:57:14 +01:00
Seth Arnold
1d07373407 bump versions in preparation for release 2014-02-16 21:01:10 -08:00
Steve Beattie
255954f240 mod_apparmor: include errno in log messages for failures
Merged from trunk revno: 2340

This patch includes the errno in the log messages generated by two
different failed aa_change_hat() calls and the failure to open
/dev/urandom to get the random token, to further ease failure
diagnosis.

2.8 Note: did not apply cleanly, required manual adjustment.

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:51:11 -08:00
Steve Beattie
1c03c6249f mod_apparmor: fix AADefaultHatName storage
Merge from trunk revno: 2335

When defining an AADefaultHatName entry, it was being stored in the
passed mconfig location, which is not the module specific server
config, but instead the top level (i.e. no path defined) default
directory/location config. This would be superceded by a more specific
directory config if it applied to the request. Thus, if an AAHatName was
defined that applied, but the named hat was not defined in the apparmor
policy, mod_apparmor would not attempt to fall back to the defined
AADefaultHatName, but instead jump directly to trying the DEFAULT_URI
hat.

This patch fixes it by storing the defined AADefaultHatName correctly in
the module specific storage in the related server data structure. It
also adds a bit of developer debugging statements.

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:43:37 -08:00
Steve Beattie
b0e00b01f2 mod_apparmor: improve initial and exit aa_change_hat call log message
Merge from trunk revno: 2334

This patch adds the name of the hat to the log message about the
initial aa_change_hat call, just to be explicit about what's happening
when debugging and changes the formatting slightly of the exiting
change_hat log message.

Patch history:
  v1: initial version
  v2: tweak output of exit trace message

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:42:12 -08:00
Steve Beattie
a20f467bf0 mod_apparmor: convert change_hat to aa_change_hat()
Merge from trunk revno: 2333

mod_apparmor never got converted to use the renamed aa_change_hat()
call (there's a compatibility macro in sys/apparmor.h); this patch does
that as well as converting the type of the magic_token to long from int.

(This patch is somewhat mooted by a later patch in the series to
convert to using aa_change_hatv(), but would be a safer candidate
for e.g. the 2.8 branch.)

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:40:57 -08:00
Steve Beattie
ba1e5a5b7c mod_apparmor: convert debug_dump_uri to use trace loglevel
Merge from trunk revno: 2332

This patch converts the debug_dump_uri() function to use the trace
loglevels and enable it all the time, rather than just when DEBUG is
defined at compile time.

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:39:21 -08:00
Steve Beattie
11288e5b8d mod_apparmor: use trace1 loglevel for developer-oriented debug messages
Merged from trunk revno: 2331

Apache 2.4 added addition logging levels. This patch converts some of
the log messages that are more intended for mod_apparmor development
and debugging than for sysadmins configuring mod_apparmor to use trace1
(APLOG_TRACE1) level instead. Since apache 2.2. does not contain this
level (or define), we define it back to APLOG_DEBUG.

Patch history:
  v1: initial version
  v2: mark a couple of additional log messages as trace1 level

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2014-02-14 16:38:04 -08:00
Steve Beattie
bea5043bb8 mod_apparmor: fix logging
Merge from trunk revno: 2330

The apache2 mod_apparmor module was failing to log debugging messages
when the apache loglevel was set to debug or lower (i.e. traceN). This
patch fixes it by using ap_log_rerror() (for request specific messages,
with the request passed for context) and ap_log_error() (more general
messages outside of a request context).

Also, the APLOG_USE_MODULE macro is called, to mark the log messages
as belonging to the apparmor module, so that the apache 2.4 feature
of enabling debug logging for just the apparmor module will work,
with an apache configuration entry like:

  LogLevel apparmor:debug

See

  http://ci.apache.org/projects/httpd/trunk/doxygen/group__APACHE__CORE__LOG.html

for specific about the ap_log_*error() and APLOG_USE_MODULE functions
and macros, and

  http://httpd.apache.org/docs/2.4/mod/core.html.en#loglevel

for the bits about module specific logging.

Patch history:
  v1: initial version
  v2: - revert to using ap_log_error with (the 2.4 specific)
        ap_server_conf outside of a request specific context, as the
        pool specific ap_log_perror messages weren't being reported.
      - add compatibility workaround for apache 2.2
  v3: keep commented out merge function's log call consistent with the
      others

For 2.8:
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Christian Boltz <apparmor@cboltz.de> (on IRC)
2014-02-14 16:35:21 -08:00
Seth Arnold
692e1b29e6 Fix --create-cache-dire typo in apparmor_parser --help output.
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2014-02-14 15:28:46 -08:00
Christian Boltz
3c7f5f5feb update abstractions/winbind
- some *.dat files live in a different directory nowadays (at least in 
  openSUSE)
- the openSUSE smb.conf includes the (autogenerated) dhcp.conf, so this
  file also needs to be readable.

References: https://bugzilla.novell.com/show_bug.cgi?id=863226

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-14 23:38:10 +01:00
Christian Boltz
b7e854695b apparmor.vim says "attach_disconnect" is correct, but the parser only
likes "attach_disconnected".

Acked-By: Jamie Strandboge <jamie@canonical.com>
2014-01-29 23:18:52 +01:00
Steve Beattie
2b51489cef Subject: libapparmor: fix aa_change_hat token format string
Merge from trunk commit rev 2329.

This patch fixes the format string for the magic token in aa_change_hat
to match the type of the magic token (long). Without this, on 64
bit platforms, only the bottom 32 bits of the token would be used.
aa_change_hatv() has the correct format string, so an aa_change_hatv()
call followed by an exiting aa_change_hat() call would result in the
latter having a different token, which would cause the process to be
killed by apparmor.

(Hat tip to John Johansen for spotting the actual bug.)

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-23 13:18:25 -08:00
Christian Boltz
78cbf37db0 allow dnsmasq read config created by recent NetworkManager
(see  http://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=d82669d3fdaa7ec70ef1b64941c101ac810c394b 
for details)

Patch by develop7 [at] develop7.info

Acked-by: Jamie Strandboge <jamie@canonical.com>
2014-01-17 20:59:22 +01:00
Steve Beattie
9040d46cc4 parser: fix compilation failure on 32 bit systems
Merge from trunk revision 2308.

std::max in C++ requires that both arguments be the same type. The
previous fix added std::max comparisons between unsigned long numeric
constants and size_t, this fix casts the numeric constants to size_t.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-10 11:08:38 -08:00