Commit graph

2619 commits

Author SHA1 Message Date
Steve Beattie
ec7676bdec utils/aa-*: adjust python shebang lines to ease rewriting to an
alternate python if installed via the python-tools-setup.py script.
2014-02-14 14:42:19 -08:00
Steve Beattie
a482139616 utils/aa-autodep: make --force be a boolean argument, not require an additional value 2014-02-14 12:25:13 -08:00
Steve Beattie
3cbbeac60d utils/apparmor/tools.py: fix misimport of UI stuff as well as a paren
depth error in use_autodep()
2014-02-14 12:19:55 -08:00
Steve Beattie
edb874a2de utils/apparmor/aa.py: fix confusion over name vs data structure 2014-02-14 11:54:02 -08:00
Steve Beattie
4d2b9b5c5d utils/apparmor/aa.py: fix dict/list confusion in create_new_profile() 2014-02-14 11:20:20 -08:00
Steve Beattie
841c0e767c deprecated/utils/: add back Makefile to simplify install of deprecated
Immunix perl modules
2014-02-13 14:32:28 -08:00
Steve Beattie
e61d8bda60 utils: have make clean purge python3 __pycache__ dir in apparmor/ 2014-02-13 11:54:42 -08:00
Steve Beattie
f54a574ee4 utils/: fix last make check failure, though the new utils tests need to
be added in (but they have failures themselves currently)
2014-02-13 11:32:36 -08:00
Steve Beattie
56b01b6eaa utils/apparmor/yasti.py: work around ycp not being available everywhere 2014-02-13 11:14:34 -08:00
Steve Beattie
3b726b996d utils: no need to run pyflakes on aa-status twice 2014-02-13 11:01:29 -08:00
Steve Beattie
2db3a226dc Regenerate apparmor-utils pot (translations template) file 2014-02-13 10:59:16 -08:00
Steve Beattie
be2296edf1 utils/apparmor/: work around last of pyflakes issues here 2014-02-13 10:52:00 -08:00
Steve Beattie
81b3db3dbf Fix more pyflakes issues that cause make check to fail 2014-02-13 10:01:03 -08:00
Steve Beattie
f652178a02 aa-mergeprof: fixup some of the whitespace issues 2014-02-13 08:31:59 -08:00
Steve Beattie
d318ff6100 Fix up last pyflakes issues with tools 2014-02-13 08:24:02 -08:00
Steve Beattie
15a95e3b36 Fix up some more pyflakes issues with the tools 2014-02-13 08:20:59 -08:00
Steve Beattie
bf655b530f Fix make install to handle new python binaries, as well as informing
setuptools to install the entire apparmor python package.
2014-02-13 00:04:39 -08:00
Steve Beattie
e9db24ac23 Add support for better integration of external apparmor modules (e.g.
appamror-click), see http://www.python.org/dev/peps/pep-0402/ for details.
2014-02-12 23:32:25 -08:00
Steve Beattie
32e0931588 Fix up execute permissions that were lost in the merger for some reason. 2014-02-12 16:59:27 -08:00
Steve Beattie
f989dd0132 Merge in Kshitij Gupta <kgupta8592@gmail.com>'s rewrite of the
logprof/genprof and related utilities in python. Because the branch that
was worked on was not based on the apparmor tree, not all of the history
can be maintained for files that are not newly created or entirely
rewritten in the branch.

(This merge also includes a subsequent commit to the branch
I was merging from which includes my missed bzr add of
utils/apparmor/translations.py)
2014-02-12 15:54:00 -08:00
Steve Beattie
b3b4fd448e Reorganize layout to ease merger into upstream apparmor-utils tree. 2014-02-12 13:27:30 -08:00
Steve Beattie
c1c0eab113 Merge trunk change. 2014-02-12 13:05:03 -08:00
Jamie Strandboge
46f5f51909 add support for python3.2 and python3.4 to the python abstraction
Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-12 14:42:39 -06:00
Steve Beattie
975e389f1d Move over the perl apparmor modules (Immunix) as well as some other
perl utilities to the deprecated to directory; a couple of perl
utilities remain, but they are still useful and do not depend on the
Immunix module (just the LibAppArmor perl module).
2014-02-12 10:27:44 -08:00
Steve Beattie
c43d4eaa93 Move perl applications that were reimplemented in python by Kshitij
Gupta to the deprecated directory.
2014-02-12 09:59:23 -08:00
Steve Beattie
d27752350a Simplify the work tools and modules need to do to get the shared
translations. External utilities can still use their own textdomains
if they have strings that are not part of the apparmor-utils catalog.
2014-02-11 16:23:21 -08:00
Steve Beattie
4987e5b158 Clean up a bunch of pep8 warnings, as found by running:
pep8 --ignore=E501,E302

on individual files. This uncovered a bug where the type of an object
was being compared to a type of a list. However, a python string is a
list of characters, and so would cause the test to be true.
2014-02-10 22:20:36 -08:00
Steve Beattie
0525932561 Get rid of the globbing imports, which allows pyflakes to do a better
job. Clean up a bunch of pyflakes complaints. Doing so uncovered
references to apparmor/yasti.py functions in aa.py that hadn't been
imported.
2014-02-10 22:17:21 -08:00
Steve Beattie
35e1936202 Convert to using python's modular translations interface. This allows
the utility python modules to be used inside another tool with another
textdomain binding and still have the translations for that tool and the
stuff internal to the apparmor module convert properly.
2014-02-10 22:15:05 -08:00
Steve Beattie
395c429cb1 Delete empty file 2014-02-10 22:14:54 -08:00
Jamie Strandboge
4b01cb2544 Move os.chdir(old_cwd) to before the aa-exec call it remove the side-effect of
the chdir to $HOME when using Xpra.

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-06 15:15:48 -05:00
Jamie Strandboge
0c5d6f4660 add ubuntu-unity7-* abstractions for Ubuntu desktop users 2014-02-05 23:44:04 -05:00
Tyler Hicks
4b950117f9 parser: Quiet search dir valgrind warning and remove suppression
When passing an include directory on the command line to
apparmor_parser, valgrind emits a warning:

 Invalid read of size 4
    at 0x404DA6: add_search_dir(char const*) (parser_include.c:152)
    by 0x40BB37: process_arg(int, char*) (parser_main.c:457)
    by 0x403D43: main (parser_main.c:590)
  Address 0x572207c is 28 bytes inside a block of size 29 alloc'd
    at 0x4C2A420: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x53E31C9: strdup (strdup.c:42)
    by 0x404D94: add_search_dir(char const*) (parser_include.c:145)
    by 0x40BB37: process_arg(int, char*) (parser_main.c:457)
    by 0x403D43: main (parser_main.c:590)

This patch quiets the warning by removing strlen() calls on the t char
array. Instead, it only calls strlen() on the dir char array. t is a
dupe of dir and strlen(dir) does not trigger the valgrind warning.

Additionally, this patch adds a bit of defensive programming to the
while loop to ensure that index into the t array is never negative.

Finally, the valgrind suppression is removed from valgrind_simple.py.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-05 15:17:32 -05:00
Steve Beattie
0d613279ba parser: remove one valgrind suppression from test script
With commit 2364 addressing one of valgrind's false positives, we can
remove the related valgrind suppression entry from the test script.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
2014-02-05 10:58:03 -08:00
Tyler Hicks
2001fb6f81 parser: Quiet valgrind false positive
strlen() assumes that it can read an entire word but when a char array
does not end on a word boundary, it reads past the end of the array.
This results in the following valgrind warning:

 Invalid read of size 4
    at 0x40A162: yylex() (parser_lex.l:277)
    by 0x40FA14: yyparse() (parser_yacc.c:1487)
    by 0x40C5B9: process_profile(int, char const*) (parser_main.c:1003)
    by 0x404074: main (parser_main.c:1340)
  Address 0x578d870 is 16 bytes inside a block of size 18 alloc'd
    at 0x4C2A420: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x53E31C9: strdup (strdup.c:42)
    by 0x40A145: yylex() (parser_lex.l:276)
    by 0x40FA14: yyparse() (parser_yacc.c:1487)
    by 0x40C5B9: process_profile(int, char const*) (parser_main.c:1003)
    by 0x404074: main (parser_main.c:1340)

This patch quiets the warning by not using strlen(). This can be done
because yyleng already contains the length of string.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-05 13:39:24 -05:00
John Johansen
5df1ac3610 Move short_options next to long_options to make them easier to keep in sync
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-05 09:10:53 -05:00
Steve Beattie
0a8e97098d parser: fix --cache-loc short arg option (-L)
When the --cache-loc option was added in trunk commit 1916, it was
intended that -L would be the short form of the option (based on
documentation and usage changes). However, the commit mistakenly
did not include the short option in the list include in the call
to getopt_long(3). This patch adds it along with the indicator
that it requires an argument (the different cache location) to the
getopt_long() call.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2014-02-04 14:28:21 -08:00
John Johansen
572fe066da The preprocessing output is broken, in a couple of places
includes come out like

  #include 

  ##included <tunables/home>

which is wrong because #include by itself is broken, and since -p is
supposed to be removing includes, it should not be directly echoed

any keyword in the keyword table is double echoed

  ownerowner /{run,dev}/shm/pulse-shm* rwk


Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
2014-02-02 19:23:10 -10:00
Christian Boltz
19038d063b /usr/lib/dovecot/auth reads the mysql config files, which is not covered by
abstractions/mysql.

This binary/profile seems to be the only one that needs to do this, so 
add it to this profile (instead of abstractions/mysql) to avoid superfluous
permissions for other programs with abstractions/mysql

Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-02 15:16:25 +01:00
Christian Boltz
a38ce71813 update usr.bin.dovecot profile
after testing the dovecot profiles on a new server, I noticed 
/usr/sbin/dovecot needs some more permissions:
- mysql access
- execution permissions for /usr/lib/dovecot/dict and lmtp
- write access to some postfix sockets, used to
  - provide SMTP Auth via dovecot
  - deliver mails to dovecot via LMTP 
- and read access to /proc/filesystems

Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-02 15:13:51 +01:00
Christian Boltz
8b802b3fe6 update logprof.conf for UsrMove
logprof.conf contains a list of binaries in the [qualifiers] section 
that should for example never have their own profile.

Since some distributions moved lots of files from /bin/ to /usr/bin/ 
("UsrMove"), this list is outdated.

The patch adds copies of all /bin/ (and /sbin/) lines with /usr 
prepended.

Acked-by: John Johansen <john.johansen@canonical.com>
2014-02-02 15:12:32 +01:00
Kshitij Gupta
1126e1f8d7 Fixed the sample --trace feature. Opinions on using it? and should it be implemented in every tool separately? 2014-02-01 07:04:08 +05:30
Kshitij Gupta
21d1c4572d 2014-02-01 06:32:20 +05:30
Kshitij Gupta
c82fda86b6 Some bugfixes for UIYesNo to deny invalid keys, fix autodep when creating new profiles 2014-02-01 06:14:05 +05:30
Christian Boltz
bdaf2592e8 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:16:36 +01:00
Christian Boltz
0fa4676d30 [3/3] dovecot profiles: update usr.sbin.dovecot profile for dovecot 2.x
The usr.sbin.dovecot profile needs several updates for dovecot 2.x, 
including
- capability dac_override and kill
- Px for various binaries in /usr/lib/dovecot/

The patch also adds a nice copyright header (I hope I got the bzr log 
right ;-)


Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-26 22:48:02 +01:00
Christian Boltz
df94a355fc [2/3] dovecot profiles: add profiles for new dovecot 2.x binaries
dovecot 2.x comes with several new binaries in /usr/lib/dovecot. 
This patch adds profiles for

/usr/lib/dovecot/anvil 
/usr/lib/dovecot/auth 
/usr/lib/dovecot/config 
/usr/lib/dovecot/dict 
/usr/lib/dovecot/dovecot-lda 
/usr/lib/dovecot/lmtp 
/usr/lib/dovecot/log 
/usr/lib/dovecot/managesieve 
/usr/lib/dovecot/ssl-params

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


Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-26 22:46:51 +01:00
Christian Boltz
86ed060f25 [1/3] dovecot profiles: introduce tunables/dovecot
Introduces tunables/dovecot (with @{DOVECOT_MAILSTORE}) and replace 
the mail storage location in various dovecot-related profiles with 
this variable.

Also add nice copyright headers (I hope I got the bzr log right ;-)


Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-26 22:43:42 +01:00
Felix Geyer
6733da5fcd nameservice abstraction: read permission to avahi socket
From: Felix Geyer <debfx@ubuntu.com>

AppArmor requires read and write permission to connect to
unix domain sockets but the nameservice abstraction only
grants write access to the avahi socket.
As a result mdns name resolution fails.

Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-26 12:16:54 -08:00
Steve Beattie
cb679f3206 add keyword 'other' vim syntax support, plus language parsing tests
Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
2014-01-24 11:17:23 -08:00