~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init/network-interface-security.conf

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# network-interface-security - configure network device security
2
 
#
3
 
# This is a one-time start-up script to load AppArmor profiles needed
4
 
# before the network comes up.
5
 
 
6
 
description     "configure network device security"
7
 
 
8
 
# In order to avoid upstart bug LP: #447654, we cannot have an AND
9
 
# statement here (with the ORs).  An "and virtual-filesystems" is desired
10
 
# here to make sure that the securityfs is mounted, but since each of the
11
 
# ORed services already require virtual-filesystems be mounted, this is safe:
12
 
start on (starting network-interface
13
 
          or starting network-manager
14
 
          or starting networking)
15
 
stop on (stopped network-interface JOB=$JOB INTERFACE=$INTERFACE
16
 
          or stopped network-manager JOB=$JOB
17
 
          or stopped networking JOB=$JOB)
18
 
 
19
 
# In order to handle the lack of upstart feature LP: #568860, we need to
20
 
# run multiple times, for each of the above "starting" service instances, or
21
 
# else another one might run while we're running, and not wait for us to
22
 
# finish.
23
 
instance $JOB${INTERFACE:+/}${INTERFACE:-}
24
 
 
25
 
# Since we need these profiles to be loaded before any of the above services
26
 
# begin running, this service must be a pre-start so that its pre-start
27
 
# script finishes before the above services' start scripts begin.
28
 
pre-start script
29
 
    [ -f /run/network-interface-security ] && exit 0 # already ran
30
 
    [ -d /rofs/etc/apparmor.d ]  && exit 0 # do not load on liveCD
31
 
    [ -d /sys/module/apparmor ]  || exit 0 # do not load without AppArmor
32
 
    [ -x /sbin/apparmor_parser ] || exit 0 # do not load without parser
33
 
    for link in /etc/apparmor/init/network-interface-security/* ; do
34
 
        [ -L $link ] && /sbin/apparmor_parser -r -W $link || true
35
 
    done
36
 
    > /run/network-interface-security
37
 
end script