File tree Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Expand file tree Collapse file tree 2 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,17 @@ package apparmor
2
2
3
3
import "errors"
4
4
5
- var (
6
- // IsEnabled returns true if apparmor is enabled for the host.
7
- IsEnabled = isEnabled
5
+ // IsEnabled returns true if apparmor is enabled for the host.
6
+ func IsEnabled () bool {
7
+ return isEnabled ()
8
+ }
8
9
9
- // ApplyProfile will apply the profile with the specified name to the process after
10
- // the next exec. It is only supported on Linux and produces an ErrApparmorNotEnabled
11
- // on other platforms.
12
- ApplyProfile = applyProfile
10
+ // ApplyProfile will apply the profile with the specified name to the process
11
+ // after the next exec. It is only supported on Linux and produces an
12
+ // [ErrApparmorNotEnabled] on other platforms.
13
+ func ApplyProfile (name string ) error {
14
+ return applyProfile (name )
15
+ }
13
16
14
- // ErrApparmorNotEnabled indicates that AppArmor is not enabled or not supported.
15
- ErrApparmorNotEnabled = errors .New ("apparmor: config provided but apparmor not supported" )
16
- )
17
+ // ErrApparmorNotEnabled indicates that AppArmor is not enabled or not supported.
18
+ var ErrApparmorNotEnabled = errors .New ("apparmor: config provided but apparmor not supported" )
Original file line number Diff line number Diff line change @@ -53,17 +53,16 @@ func setProcAttr(attr, value string) error {
53
53
return err
54
54
}
55
55
56
- // changeOnExec reimplements aa_change_onexec from libapparmor in Go
56
+ // changeOnExec reimplements aa_change_onexec from libapparmor in Go.
57
57
func changeOnExec (name string ) error {
58
58
if err := setProcAttr ("exec" , "exec " + name ); err != nil {
59
59
return fmt .Errorf ("apparmor failed to apply profile: %w" , err )
60
60
}
61
61
return nil
62
62
}
63
63
64
- // applyProfile will apply the profile with the specified name to the process after
65
- // the next exec. It is only supported on Linux and produces an error on other
66
- // platforms.
64
+ // applyProfile will apply the profile with the specified name to the process
65
+ // after the next exec.
67
66
func applyProfile (name string ) error {
68
67
if name == "" {
69
68
return nil
You can’t perform that action at this time.
0 commit comments