-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
- Loading branch information
1 parent
9a3b632
commit 31d987e
Showing
18 changed files
with
435 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2020 Red Hat, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package types | ||
|
||
import ( | ||
"github.com/coreos/ignition/v2/config/util" | ||
|
||
"github.com/coreos/vcontext/path" | ||
"github.com/coreos/vcontext/report" | ||
) | ||
|
||
func (cm Cex) IsPresent() bool { | ||
return util.IsTrue(cm.Enabled) | ||
} | ||
|
||
func (cx Cex) Validate(c path.ContextPath) (r report.Report) { | ||
if !util.IsTrue(cx.Enabled) { | ||
return | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2021 Red Hat, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package types | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/coreos/ignition/v2/config/util" | ||
|
||
"github.com/coreos/vcontext/path" | ||
"github.com/coreos/vcontext/report" | ||
) | ||
|
||
func TestCexValidate(t *testing.T) { | ||
tests := []struct { | ||
in Cex | ||
at path.ContextPath | ||
out error | ||
}{ | ||
{ | ||
in: Cex{}, | ||
out: nil, | ||
}, | ||
{ | ||
in: Cex{ | ||
Enabled: util.BoolToPtr(true), | ||
}, | ||
out: nil, | ||
}, | ||
} | ||
|
||
for i, test := range tests { | ||
r := test.in.Validate(path.ContextPath{}) | ||
expected := report.Report{} | ||
expected.AddOnError(test.at, test.out) | ||
if !reflect.DeepEqual(expected, r) { | ||
t.Errorf("#%d: bad report: want %v, got %v", i, expected, r) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Intention of this file. | ||
1. This is a dummy "keyfile" specific to IBM Crypto Card based LUKs encryption. | ||
2. A key used to encrypt and decrypt the user data on a volume formatted in luks2 format. | ||
3. A key slot in luks2 header stores a wrapped copy of this volume key,where the wrapping | ||
key is derived from the users passphrase or "keyfile". | ||
4. In the infrastructure for protected volume encryption, the luks2 volume key is secure key. | ||
5. The effective volume is twofold protected: it is encrypted by an AES master key | ||
from a CCA or EP11 coProcessor and by a wrapping key or KEK derived from a passphrase or "keyfile". | ||
6. Therefore to unlock a luks2 volume a passphrase - provided interactively or from this "keyfile" | ||
is required to decrypt the outer wrapping. | ||
7. The security provided by the passphrase or "keyfile" is typically much lower than that provided by the wrapping AES master key. | ||
8. Therefore the password or "keyfile" may be exposed without any loss of security. | ||
9. When a secure key for the PAES cipher is provide to dm-crypt inorder to open a volume, | ||
it automatically transforms this secure key into a protected key that can be interpreted by the CPACF. | ||
10. The actual effective key of the luks2 volume key is never exposed to the operating system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.