File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 93
93
94
94
// Kernel arguments
95
95
ErrGeneralKernelArgumentSupport = errors .New ("kernel argument customization is not supported in this spec version" )
96
+
97
+ // SElinux
98
+ ErrSelinuxInvalidModeValue = errors .New ("Invalid Selinux mode value, it must be true(enforcing) or false(permissive)" )
99
+ ErrSelinuxInvalidStateValue = errors .New ("Invalid Selinux state value, it must be true(enabled) or false(disabled)" )
100
+ ErrSelinuxModeRequiredWithStateTrue = errors .New ("Invalid configuration. If Selinux is enabled, a mode should be defined." )
96
101
)
97
102
98
103
type ErrUnmarshal struct {
Original file line number Diff line number Diff line change @@ -77,3 +77,17 @@ func (user GrubUser) Validate(c path.ContextPath) (r report.Report) {
77
77
}
78
78
return
79
79
}
80
+
81
+ func (s * Selinux ) ValidateSelinux (c path.ContextPath ) (r report.Report ) {
82
+ if s .State != nil {
83
+ if ! (* s .State == true || * s .State == false ) {
84
+ r .AddOnError (c .Append ("state" ), common .ErrSelinuxInvalidStateValue )
85
+ } else if * s .State == true && s .Mode == nil {
86
+ r .AddOnError (c .Append ("mode" ), common .ErrSelinuxModeRequiredWithStateTrue )
87
+ }
88
+ }
89
+ if s .Mode != nil && ! (* s .Mode == true || * s .Mode == false ) {
90
+ r .AddOnError (c .Append ("mode" ), common .ErrSelinuxInvalidModeValue )
91
+ }
92
+ return
93
+ }
You can’t perform that action at this time.
0 commit comments