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
22
33import "errors"
44
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+ }
89
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+ }
1316
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 {
5353 return err
5454}
5555
56- // changeOnExec reimplements aa_change_onexec from libapparmor in Go
56+ // changeOnExec reimplements aa_change_onexec from libapparmor in Go.
5757func changeOnExec (name string ) error {
5858 if err := setProcAttr ("exec" , "exec " + name ); err != nil {
5959 return fmt .Errorf ("apparmor failed to apply profile: %w" , err )
6060 }
6161 return nil
6262}
6363
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.
6766func applyProfile (name string ) error {
6867 if name == "" {
6968 return nil
You can’t perform that action at this time.
0 commit comments