-
Notifications
You must be signed in to change notification settings - Fork 79
Add public key verification for aws cli download #715
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
base: main
Are you sure you want to change the base?
Conversation
template/v2/Dockerfile
Outdated
RUN curl -O "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \ | ||
curl -O "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig" | ||
RUN gpg --import aws-cli-public-key.asc | ||
RUN gpg --fingerprint FB5DB77FD5C118B80511ADA8A6310ACC4672475C | ||
RUN gpg --verify awscli-exe-linux-x86_64.zip.sig awscli-exe-linux-x86_64.zip && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid additional "RUN" commands in the Dockerfile because each "RUN" command will generate a new image layer and may cause increase in image size. One way is to move the "COPY" command to the beginning and connect these commands with "&"
template/v2/Dockerfile
Outdated
sudo ./aws/install && \ | ||
rm -rf aws awscliv2.zip && \ | ||
|
||
COPY aws-cli-public-key.asc . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's copy the file to "/tmp/" folder so it will be automatically cleaned up. Example: https://github.com/aws/sagemaker-distribution/blob/main/template/v2/Dockerfile#L85
template/v2/Dockerfile
Outdated
RUN curl -O "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && \ | ||
curl -O "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip.sig" | ||
RUN gpg --import aws-cli-public-key.asc | ||
RUN gpg --fingerprint FB5DB77FD5C118B80511ADA8A6310ACC4672475C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this fingerprint generated? Will it change in the future or is it fixed? Let's avoid to have such hard-coded value here. If this is indeed needed, try to add some comment to explain what this is
Description
Add a file that stores the public key the AWS CLI is using (public resource can be find in their documents).
Add logic in the Dockerfile to read the public key and validate the downloaded file.
Type of Change
Release Information
Does this change need to be included in patch version releases? By default, any pull requests will only be added to the next SMD image minor version release once they are merged in template folder. Only critical bug fix or security update should be applied to new patch versions of existed image minor versions.
If yes, please explain why:
Appsec requirement, not urgent
How Has This Been Tested?
Tested in a test Dockerfile
Checklist:
Test Screenshots (if applicable):
test generate SMD docker image succeed:
Related Issues
N/A
Additional Notes
N/A