Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize test images customization #403

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

ansasaki
Copy link
Contributor

Minimize test images customization to make possible to easily test other images.

@Koncpa
Copy link
Collaborator

Koncpa commented Jun 30, 2023

@ansasaki Just FYI for running in CI, probably need to use Dockerfile.upstream.c9s.

@ansasaki ansasaki force-pushed the generic_container branch 8 times, most recently from 8c68425 to e4bc67b Compare July 6, 2023 16:40
Copy link
Collaborator

@kkaarreell kkaarreell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are few details that we should probably discuss.

Library/test-helpers/Dockerfile.upstream.c9s Outdated Show resolved Hide resolved
Library/test-helpers/lib.sh Show resolved Hide resolved
Library/test-helpers/lib.sh Outdated Show resolved Hide resolved
Library/test-helpers/lib.sh Outdated Show resolved Hide resolved
container/functional/keylime_ipv6_multihost/test.sh Outdated Show resolved Hide resolved
@ansasaki ansasaki force-pushed the generic_container branch 7 times, most recently from 45cd75c to 6ae3f5b Compare July 10, 2023 14:40
@ansasaki ansasaki force-pushed the generic_container branch 4 times, most recently from 9bf261c to 90a4a58 Compare July 18, 2023 14:43
@ansasaki ansasaki changed the title WIP: Minimize test images customization Minimize test images customization Jul 18, 2023
@ansasaki
Copy link
Contributor Author

@kkaarreell @Koncpa I think this is ready for review. I removed most of the customization done to the images. The only remaining workaround left was for the issue with the permissions: the agent container is executed by root, and will drop privileges to the internal keylime user. The problem is that the internal user needs access to the CA certificates. The workaround I added is a podman run that chown the files in the volume mounted in /var/lib/keylime/cv_ca.

This workaround is applied to the built image, not on the Dockerfile. Theoretically, we could test the upstream Dockerfiles instead of the ones we created.

I'll start working on the other part, where we fetch built images from a registry instead of building from the Dockerfile.

@Koncpa
Copy link
Collaborator

Koncpa commented Jul 20, 2023

@ansasaki I'm not sure, if won't be needed provide additional changes in keylime server role test repo and also rework your PR. There is used ssh access to container for conecting ansible for preparing keylime roles. It seems that in your PR try to remove all container customization related to ssh. Please correct me if I'm wrong.
FYI: @kkaarreell

@@ -2006,12 +2005,7 @@ limeconPrepareImage() {
ARGS="--volume /var/tmp/keylime_sources:/mnt/keylime_sources:z"
fi

#set up for ssh access
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably that should be keep it there regarding to containers for keylime ansible roles testing or rework it.

@ansasaki
Copy link
Contributor Author

@ansasaki I'm not sure, if won't be needed provide additional changes in keylime server role test repo and also rework your PR. There is used ssh access to container for conecting ansible for preparing keylime roles. It seems that in your PR try to remove all container customization related to ssh. Please correct me if I'm wrong. FYI: @kkaarreell

Yes, I'm trying to remove all customization, including the SSH setup from the test image, because the keylime images won't have that. This way we can use the same tests for the images we build as part of the test (from the dockerfiles) as well as for the images we obtain directly from the registry.

If we rely on special setup (e.g. to add SSH access), then it would be difficult to reuse the tests for the images obtained from the registry.

If the SSH access is strictly necessary, then we could create an image by adding the SSH setup on a layer on top of the tested image (used as a base image) for the test cases that need SSH. It is not ideal, but at least we could use the keylime images obtained from the registry as well as the test images built as part of the tests.

@Koncpa
Copy link
Collaborator

Koncpa commented Jul 20, 2023

Understand..Hm for rest of the test images is not necessary to have ssh access, just for systemd image which is use for keylime ansible role tests.

Systemd image should have all necessary ssh setup in docker file, but we need somewhere else generate ssh keys which are essential for access and for now it's directly generate in func limeconPrepareImage.

There are two options: create new function in lib for generating ssh keys or in every ansible role test generate ssh keys. Probably it would be better to have function for generating ssh keys...WDYT?? @kkaarreell

@kkaarreell
Copy link
Collaborator

I think this is fine. As you said, ordinary images do not need ssh access and for the systemd container (that we use for system roles testing) the ssh setup remains in place. So I believe nothing should be missing. We could possibly run system roles tests against Anderson's branch to double check.

@kkaarreell
Copy link
Collaborator

kkaarreell commented Jul 20, 2023

We could possibly run system roles tests against Anderson's branch to double check.

I just realized it won't be possible until we rebase keylime in RHEL since here we are targeting upstream while keylime_server role is for RHEL, i.e. the test code is currently not compatible.

@Koncpa
Copy link
Collaborator

Koncpa commented Jul 20, 2023

I think this is fine. As you said, ordinary images do not need ssh access and for the systemd container (that we use for system roles testing) the ssh setup remains in place. So I believe nothing should be missing. We could possibly run system roles tests against Anderson's branch to double check.

@kkaarreell But part of the ssh setup on host is removed in this PR, so we neeed to update it.

@ansasaki
Copy link
Contributor Author

I think this is fine. As you said, ordinary images do not need ssh access and for the systemd container (that we use for system roles testing) the ssh setup remains in place. So I believe nothing should be missing. We could possibly run system roles tests against Anderson's branch to double check.

@kkaarreell But part of the ssh setup on host is removed in this PR, so we neeed to update it.

I can put back the key generation part, but I think it would be better if either it is conditional, controlled by some environment variable, or in a separate helper function. Otherwise new keys would be generated for each built image, even though they are not used in most of them.

@kkaarreell
Copy link
Collaborator

I think that piece can be put into the respective test.

Koncpa added a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Jul 24, 2023
Koncpa added a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Jul 24, 2023
Koncpa added a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Jul 24, 2023
@Koncpa
Copy link
Collaborator

Koncpa commented Jul 24, 2023

Minimize test images customization to make possible to easily test other
images.

Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
@kkaarreell
Copy link
Collaborator

Hi @ansasaki , do you plan further updates or can we merge it?

@kkaarreell kkaarreell self-requested a review August 3, 2023 08:20
@ansasaki
Copy link
Contributor Author

ansasaki commented Aug 4, 2023

Hi @ansasaki , do you plan further updates or can we merge it?

I think we can merge this. I'll open a separate PR for next changes

@kkaarreell kkaarreell merged commit b63aa68 into RedHat-SP-Security:main Aug 4, 2023
5 checks passed
@ansasaki ansasaki deleted the generic_container branch August 4, 2023 08:19
Koncpa added a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Aug 25, 2023
kkaarreell pushed a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Aug 30, 2023
kkaarreell pushed a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Aug 30, 2023
kkaarreell pushed a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Sep 5, 2023
kkaarreell pushed a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Sep 5, 2023
kkaarreell pushed a commit to RedHat-SP-Security/keylime_server-role-tests that referenced this pull request Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants