From Perl Stork, 3 Years ago, written in Plain Text.
Embed Show code
  1. #!/bin/bash
  2. # Adapted from Void's AppArmor script
  3.  
  4. . /usr/lib/rc/functions
  5. . /etc/rc/apparmor.conf
  6.  
  7. case "$1" in
  8.     start)
  9.         stat_busy "Loading AppArmor profiles"
  10.         if [ ! -d /sys/kernel/security/apparmor ]; then
  11.             printhl "AppArmor module disabled - aborting"
  12.             stat_die apparmor
  13.         fi
  14.  
  15.  
  16.         if [[ "$APPARMOR" ]]; then
  17.             if [[ "$APPARMOR" != "complain" && "$APPARMOR" != "enforce" ]]; then
  18.                 printhl "Unknown AppArmor mode - ignoring profiles"
  19.                 stat_done apparmor
  20.             fi
  21.  
  22.             [ "$APPARMOR" = "complain" ] && AACOMPLAIN="-C"
  23.  
  24.             if [[ -d /etc/apparmor.d && -x /usr/bin/apparmor_parser ]]; then
  25.                 for profile in /etc/apparmor.d/*; do
  26.                     if [[ -f "$profile" ]]; then
  27.                         printf '* Load profile %s: %s\n' "$(APPARMOR)" "$profile"
  28.                         apparmor_parser -a "$AACOMPLAIN" "$profile"
  29.                     fi
  30.                 done
  31.             else
  32.                 printhl "AppArmor is not installed, aborting"
  33.                 stat_die apparmor
  34.             fi
  35.         fi
  36.  
  37.         rc=$?
  38.         (( rc || $? )) && stat_die
  39.         add_daemon apparmor
  40.         stat_done
  41.         ;;
  42.     *)
  43.         echo "usage: $0 {start}"
  44.         exit 1
  45.         ;;
  46. esac
  47.  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
#!/bin/bash
# Adapted from Void's AppArmor script
 
. /usr/lib/rc/functions
. /etc/rc/apparmor.conf
 
case "$1" in
    start)
        stat_busy "Loading AppArmor profiles"
        if [ ! -d /sys/kernel/security/apparmor ]; then
            printhl "AppArmor module disabled - aborting"
            stat_die apparmor
        fi
 
 
        if [[ "$APPARMOR" ]]; then
            if [[ "$APPARMOR" != "complain" && "$APPARMOR" != "enforce" ]]; then
                printhl "Unknown AppArmor mode - ignoring profiles"
                stat_done apparmor
            fi
 
            [ "$APPARMOR" = "complain" ] && AACOMPLAIN="-C"
 
            if [[ -d /etc/apparmor.d && -x /usr/bin/apparmor_parser ]]; then
                for profile in /etc/apparmor.d/*; do
                    if [[ -f "$profile" ]]; then
                        printf '* Load profile %s: %s\n' "$(APPARMOR)" "$profile"
                        apparmor_parser -a "$AACOMPLAIN" "$profile"
                    fi
                done
            else
                printhl "AppArmor is not installed, aborting"
                stat_die apparmor
            fi
        fi
 
        rc=$?
        (( rc || $? )) && stat_die
        add_daemon apparmor
        stat_done
        ;;
    *)
        echo "usage: $0 {start}"
        exit 1
        ;;
esac
 
captcha