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

chore(signing): Copy policy.json to /etc/containers/ on Universal Blue based images #319

Open
fiftydinar opened this issue Aug 11, 2024 · 0 comments · Fixed by #375
Open
Labels
state: blocked Something is blocking action.

Comments

@fiftydinar
Copy link
Collaborator

fiftydinar commented Aug 11, 2024

Waiting for Universal Blue to copy policy.json to /etc/containers/ for this to work

@fiftydinar fiftydinar added the state: blocked Something is blocking action. label Aug 11, 2024
fiftydinar added a commit that referenced this issue Dec 7, 2024
Fixes: #319

I only tested this in non-Universal Blue image. With & without rechunk.

Before:
```
[11:39:42 g.i/h/rechunk:v1.0.1] => WARNING: FOUND /usr/etc. MERGING TO ETC FOR COMPATIBILITY
[11:39:42 g.i/h/rechunk:v1.0.1] => EXPECT PERMISSIONS ISSUES ON THE MERGED PATHS
[11:39:42 g.i/h/rechunk:v1.0.1] => The following files from /usr/etc will be merged to /etc:
[11:39:42 g.i/h/rechunk:v1.0.1] => ./usr/etc
[11:39:42 g.i/h/rechunk:v1.0.1] => |-- containers
[11:39:42 g.i/h/rechunk:v1.0.1] => |   |-- policy.json
[11:39:42 g.i/h/rechunk:v1.0.1] => |   `-- registries.d
[11:39:42 g.i/h/rechunk:v1.0.1] => |       `-- gidro-os.yaml
[11:39:42 g.i/h/rechunk:v1.0.1] => `-- pki
[11:39:42 g.i/h/rechunk:v1.0.1] =>     `-- containers
[11:39:42 g.i/h/rechunk:v1.0.1] =>         `-- gidro-os.pub
[11:39:42 g.i/h/rechunk:v1.0.1] => 
[11:39:42 g.i/h/rechunk:v1.0.1] => 5 directories, 3 files
```

After:
```
[18:26:31 g.i/h/rechunk:v1.0.1] => WARNING: FOUND /usr/etc. MERGING TO ETC FOR COMPATIBILITY
[18:26:31 g.i/h/rechunk:v1.0.1] => EXPECT PERMISSIONS ISSUES ON THE MERGED PATHS
[18:26:31 g.i/h/rechunk:v1.0.1] => The following files from /usr/etc will be merged to /etc:
[18:26:31 g.i/h/rechunk:v1.0.1] => ./usr/etc
[18:26:31 g.i/h/rechunk:v1.0.1] => `-- pki
[18:26:31 g.i/h/rechunk:v1.0.1] =>     `-- containers
[18:26:31 g.i/h/rechunk:v1.0.1] =>         `-- gidro-os.pub
[18:26:31 g.i/h/rechunk:v1.0.1] => 
[18:26:31 g.i/h/rechunk:v1.0.1] => 3 directories, 1 file
```

Only thing remaining is to see if copying .pub keys to `/etc/` only will work, as it caused issues before. That would get rid of all files in `/usr/etc/`.

https://github.com/blue-build/cli/blob/a8cac2adc90fa842e4565bc1825e588df4f5bcbd/template/templates/Containerfile.j2#L26
fiftydinar added a commit that referenced this issue Dec 8, 2024
* chore(signing): Switch fully from `/usr/etc/` to `/etc/`

Fixes: #319

I only tested this in non-Universal Blue image. With & without rechunk.

Before:
```
[11:39:42 g.i/h/rechunk:v1.0.1] => WARNING: FOUND /usr/etc. MERGING TO ETC FOR COMPATIBILITY
[11:39:42 g.i/h/rechunk:v1.0.1] => EXPECT PERMISSIONS ISSUES ON THE MERGED PATHS
[11:39:42 g.i/h/rechunk:v1.0.1] => The following files from /usr/etc will be merged to /etc:
[11:39:42 g.i/h/rechunk:v1.0.1] => ./usr/etc
[11:39:42 g.i/h/rechunk:v1.0.1] => |-- containers
[11:39:42 g.i/h/rechunk:v1.0.1] => |   |-- policy.json
[11:39:42 g.i/h/rechunk:v1.0.1] => |   `-- registries.d
[11:39:42 g.i/h/rechunk:v1.0.1] => |       `-- gidro-os.yaml
[11:39:42 g.i/h/rechunk:v1.0.1] => `-- pki
[11:39:42 g.i/h/rechunk:v1.0.1] =>     `-- containers
[11:39:42 g.i/h/rechunk:v1.0.1] =>         `-- gidro-os.pub
[11:39:42 g.i/h/rechunk:v1.0.1] => 
[11:39:42 g.i/h/rechunk:v1.0.1] => 5 directories, 3 files
```

After:
```
[18:26:31 g.i/h/rechunk:v1.0.1] => WARNING: FOUND /usr/etc. MERGING TO ETC FOR COMPATIBILITY
[18:26:31 g.i/h/rechunk:v1.0.1] => EXPECT PERMISSIONS ISSUES ON THE MERGED PATHS
[18:26:31 g.i/h/rechunk:v1.0.1] => The following files from /usr/etc will be merged to /etc:
[18:26:31 g.i/h/rechunk:v1.0.1] => ./usr/etc
[18:26:31 g.i/h/rechunk:v1.0.1] => `-- pki
[18:26:31 g.i/h/rechunk:v1.0.1] =>     `-- containers
[18:26:31 g.i/h/rechunk:v1.0.1] =>         `-- gidro-os.pub
[18:26:31 g.i/h/rechunk:v1.0.1] => 
[18:26:31 g.i/h/rechunk:v1.0.1] => 3 directories, 1 file
```

Only thing remaining is to see if copying .pub keys to `/etc/` only will work, as it caused issues before. That would get rid of all files in `/usr/etc/`.

https://github.com/blue-build/cli/blob/a8cac2adc90fa842e4565bc1825e588df4f5bcbd/template/templates/Containerfile.j2#L26

* fix(signing): Error-out on missing image cosign key

* chore(signing): More descriptive log about missing image key

* chore(signing): Copy `policy.json` to `/usr/etc/` in Universal Blue images
@fiftydinar fiftydinar changed the title chore(signing): Migrate from /usr/etc/ to /etc/ chore(signing): Copy policy.json to /etc/containers/ on Universal Blue based images Dec 8, 2024
@fiftydinar fiftydinar reopened this Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: blocked Something is blocking action.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant