Server IP : 127.0.0.2 / Your IP : 3.16.1.194 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/snapd/ |
Upload File : |
#!/bin/sh # This script is provided for integration with systemd on distributions where # apparmor profiles generated and managed by snapd are not loaded by the # system-wide apparmor systemd integration on early boot-up. # # Only the start operation is provided as all other activity is managed by # snapd as a part of the life-cycle of particular snaps. # # In addition the script assumes that the system-wide apparmor service has # already executed, initializing apparmor file-systems as necessary. # NOTE: This script doesn't set -e as it contains code copied from apparmor # init script that also does not set it. In addition the intent is to simply # load application profiles, as many as we can, even if for whatever reason # some of those fail. # The following portion is copied from /lib/apparmor/functions as shipped by Ubuntu # <copied-code> SECURITYFS="/sys/kernel/security" export AA_SFS="$SECURITYFS/apparmor" # Checks to see if the current container is capable of having internal AppArmor # profiles that should be loaded. Callers of this function should have already # verified that they're running inside of a container environment with # something like `systemd-detect-virt --container`. # # The only known container environments capable of supporting internal policy # are LXD and LXC environment. # # Returns 0 if the container environment is capable of having its own internal # policy and non-zero otherwise. # # IMPORTANT: This function will return 0 in the case of a non-LXD/non-LXC # system container technology being nested inside of a LXD/LXC container that # utilized an AppArmor namespace and profile stacking. The reason 0 will be # returned is because .ns_stacked will be "yes" and .ns_name will still match # "lx[dc]-*" since the nested system container technology will not have set up # a new AppArmor profile namespace. This will result in the nested system # container's boot process to experience failed policy loads but the boot # process should continue without any loss of functionality. This is an # unsupported configuration that cannot be properly handled by this function. is_container_with_internal_policy() { ns_stacked_path="${AA_SFS}/.ns_stacked" ns_name_path="${AA_SFS}/.ns_name" ns_stacked ns_name if ! [ -f "$ns_stacked_path" ] || ! [ -f "$ns_name_path" ]; then return 1 fi read -r ns_stacked < "$ns_stacked_path" if [ "$ns_stacked" != "yes" ]; then return 1 fi # LXD and LXC set up AppArmor namespaces starting with "lxd-" and # "lxc-", respectively. Return non-zero for all other namespace # identifiers. read -r ns_name < "$ns_name_path" if [ "${ns_name#lxd-*}" = "$ns_name" ] && \ [ "${ns_name#lxc-*}" = "$ns_name" ]; then return 1 fi return 0 } # This terminates code copied from /lib/apparmor/functions on Ubuntu # </copied-code> case "$1" in start) # <copied-code> if [ -x /usr/bin/systemd-detect-virt ] && \ systemd-detect-virt --quiet --container && \ ! is_container_with_internal_policy; then exit 0 fi # </copied-code> if [ "$(find /var/lib/snapd/apparmor/profiles/ -type f | wc -l)" -eq 0 ]; then exit 0 fi for profile in /var/lib/snapd/apparmor/profiles/*; do # Filter out profiles with names ending with ~, those are temporary files created by snapd. test "${profile%\~}" != "${profile}" && continue echo "$profile" done | xargs \ -P"$(getconf _NPROCESSORS_ONLN)" \ apparmor_parser \ --replace \ --write-cache \ --cache-loc=/var/cache/apparmor \ -O no-expr-simplify \ --quiet ;; esac