Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding support for custom CAs (issue #11). #12

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

Open
dcarlet wants to merge 1 commit into coder:main
base: main
Choose a base branch
Loading
from dcarlet:issue-11

Conversation

Copy link

@dcarlet dcarlet commented Mar 16, 2023
edited by code-asher
Loading

Updated Dockerfile to install ca-certificates
Updated the deployment.yaml and added:
A poststart lifecycle hook to run update-ca-certificates
volume definition certs that maps to .Values.certificates.secretName
volumeMounts that mount the secret to /usr/local/share/ca-certificates/
Both of these generate if persistence is enabled or not (to ensure that if neither persistence or artifactory are specified, but certificates is, that the yaml is still correct.
Updated the values.yaml to add
certificates:
secretName: ""
Along with some corresponding updates to the README.md files in root and helm chart.

TESTING:
Testing was accomplished by creating a separate Dockerfile which was just FROM the existing v1.2.1 image and adding ca-certificates. A values file was created that:

  1. Used this image
  2. set certificates.secretName
  3. Set ingress information
  4. Set artifactory.enabled to true and configured it against my private artifactory.

Testing was positive:

/opt # ./code-marketplace -v add ms-python.python-2023年5月10日672245.vsix --artifactory https://artifactory.local.domain/artifactory --repo vscode-extensions
2023年03月16日 20:03:56.653 [INFO]<artifactory.go:88>Seeding manifest cache...
2023年03月16日 20:03:56.717 [DEBUG]<artifactory.go:135>artifactory request{"path": "api/storage/vscode-extensions?list\u0026deep=1\u0026depth=3\u0026listFolders=1", "method": "GET", "took": "63.398861ms"}
2023年03月16日 20:03:56.717 [DEBUG]<artifactory.go:178>parse list response{"took": "305.9μs"}
2023年03月16日 20:03:56.718 [INFO]<artifactory.go:120>Seeded manifest cache{"count": 0, "took": "64.410262ms"}
2023年03月16日 20:03:57.022 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension.vsixmanifest", "method": "PUT", "took": "290.632781ms"}
2023年03月16日 20:03:57.165 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/CHANGELOG.md", "method": "PUT", "took": "142.379237ms"}
2023年03月16日 20:03:57.295 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/dist/extension.browser.js", "method": "PUT", "took": "129.862626ms"}
2023年03月16日 20:03:57.345 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/dist/extension.browser.js.LICENSE.txt", "method": "PUT", "took": "49.677148ms"}
2023年03月16日 20:03:57.400 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/icon.png", "method": "PUT", "took": "55.143953ms"}
2023年03月16日 20:03:57.454 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/LICENSE.txt", "method": "PUT", "took": "53.012451ms"}
2023年03月16日 20:03:57.509 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/package.json", "method": "PUT", "took": "54.904753ms"}
2023年03月16日 20:03:57.561 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/README.md", "method": "PUT", "took": "45.820144ms"}
2023年03月16日 20:03:58.209 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/ms-python.python-2023年5月10日672245.vsix", "method": "PUT", "took": "647.480824ms"}
Unpacked ms-python.python-2023年5月10日672245 to https://artifactory.local.domain/artifactory/ms-python/python/2023.5.10672245
 - ms-python.python-2023年5月10日672245 has 0 dependencies
 - ms-python.python-2023年5月10日672245 is in a pack with 2 other extensions
 - ms-toolsai.jupyter
 - ms-python.vscode-pylance

Closes #11

Updated Dockerfile to install ca-certificates
Updated the deployment.yaml and added:
 A poststart lifecycle hook to run `update-ca-certificates`
 volume definition certs that maps to .Values.certificates.secretName
 volumeMounts that mount the secret to /usr/local/share/ca-certificates/
 Both of these generate if persistence is enabled or not (to ensure that if neither persistence or artifactory are specified, but certificates is, that the yaml is still correct.
Updated the values.yaml to add
 certificates:
 secretName: ""
Along with some corresponding updates to the README.md files in root and helm chart.
TESTING:
Testing was accomplished by creating a separate Dockerfile which was just FROM the existing v1.2.1 image and adding ca-certificates.
A values file was created that:
1. Used this image
2. set certificates.secretName
3. Set ingress information
4. Set artifactory.enabled to true and configured it against my private artifactory.
Testing was positive:
```
/opt # ./code-marketplace -v add ms-python.python-2023年5月10日672245.vsix --artifactory https://artifactory.local.domain/artifactory --repo vscode-extensions
2023年03月16日 20:03:56.653 [INFO]<artifactory.go:88>Seeding manifest cache...
2023年03月16日 20:03:56.717 [DEBUG]<artifactory.go:135>artifactory request{"path": "api/storage/vscode-extensions?list\u0026deep=1\u0026depth=3\u0026listFolders=1", "method": "GET", "took": "63.398861ms"}
2023年03月16日 20:03:56.717 [DEBUG]<artifactory.go:178>parse list response{"took": "305.9μs"}
2023年03月16日 20:03:56.718 [INFO]<artifactory.go:120>Seeded manifest cache{"count": 0, "took": "64.410262ms"}
2023年03月16日 20:03:57.022 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension.vsixmanifest", "method": "PUT", "took": "290.632781ms"}
2023年03月16日 20:03:57.165 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/CHANGELOG.md", "method": "PUT", "took": "142.379237ms"}
2023年03月16日 20:03:57.295 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/dist/extension.browser.js", "method": "PUT", "took": "129.862626ms"}
2023年03月16日 20:03:57.345 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/dist/extension.browser.js.LICENSE.txt", "method": "PUT", "took": "49.677148ms"}
2023年03月16日 20:03:57.400 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/icon.png", "method": "PUT", "took": "55.143953ms"}
2023年03月16日 20:03:57.454 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/LICENSE.txt", "method": "PUT", "took": "53.012451ms"}
2023年03月16日 20:03:57.509 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/package.json", "method": "PUT", "took": "54.904753ms"}
2023年03月16日 20:03:57.561 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/extension/README.md", "method": "PUT", "took": "45.820144ms"}
2023年03月16日 20:03:58.209 [DEBUG]<artifactory.go:135>artifactory request{"path": "vscode-extensions/ms-python/python/2023.5.10672245/ms-python.python-2023年5月10日672245.vsix", "method": "PUT", "took": "647.480824ms"}
Unpacked ms-python.python-2023年5月10日672245 to https://artifactory.local.domain/artifactory/ms-python/python/2023.5.10672245
 - ms-python.python-2023年5月10日672245 has 0 dependencies
 - ms-python.python-2023年5月10日672245 is in a pack with 2 other extensions
 - ms-toolsai.jupyter
 - ms-python.vscode-pylance
```
Copy link

github-actions bot commented Mar 16, 2023
edited
Loading

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Copy link
Member

@code-asher code-asher left a comment
edited
Loading

Choose a reason for hiding this comment

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

Just left some suggestions that are mostly wrapping. This is great! Thank you so much. Not being able to specify your own certs was a big oversight as running air-gapped was one of the main goals.

Comment on lines +70 to +72
## Custom Certificate Authorities for Container Deployment

If your artifactory server or extension download location is on a domain not signed by a default CA, then you will need to add those files either by volume mount or `docker cp` and then run `update-ca-certificates`.
Copy link
Member

@code-asher code-asher Mar 16, 2023

Choose a reason for hiding this comment

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

Minor formatting suggestion (just some capitalization to match the other headings, wrapping, and one more heading level).

Suggested change
## Custom Certificate Authorities for Container Deployment
If your artifactory server or extension download location is on a domain not signed by a default CA, then you will need to add those files either by volume mount or `docker cp` and then run `update-ca-certificates`.
### Custom certificate authorities for container deployment
If your Artifactory server or extension download location is on a domain not
signed by a default CA, then you will need to add those files either by volume
mount or `docker cp` and then run `update-ca-certificates`.

@@ -54,6 +54,21 @@ $ kubectl exec -it "$POD_NAME" -- /opt/code-marketplace add https://github.com/V
In the future it will be possible to use Artifactory for storing and retrieving
extensions instead of a persistent volume.

## Adding custom certificate authorities

If the location for retrieving extensions (or if using Artifactory storage) is not signed by a common CA, then create a secret in the deployed namespace:
Copy link
Member

@code-asher code-asher Mar 16, 2023

Choose a reason for hiding this comment

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

Just a bit of wrapping to match the rest:

Suggested change
If the location for retrieving extensions (or if using Artifactory storage) is not signed by a common CA, then create a secret in the deployed namespace:
If the location for retrieving extensions (or if using Artifactory storage) is
not signed by a common CA, then create a secret in the deployed namespace:


If the location for retrieving extensions (or if using Artifactory storage) is not signed by a common CA, then create a secret in the deployed namespace:
```
kubectl create secret -n $namespace generic all-cas --from-file="certificate1.pem"=/path/to/certificate1.pem \
Copy link
Member

@code-asher code-asher Mar 16, 2023

Choose a reason for hiding this comment

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

Thinking it might look nice if all the --from-file are on their own line.

Suggested change
kubectl create secret -n $namespace generic all-cas --from-file="certificate1.pem"=/path/to/certificate1.pem \
kubectl create secret -n $namespace generic all-cas \
--from-file="certificate1.pem"=/path/to/certificate1.pem \

@@ -93,3 +93,10 @@ persistence:
repo: extensions
# Size is ignored when using Artifactory.
size: 100Gi

# Create a secret with all additional certificate authorities, ex:
# kubectl create secret -n $namespace generic all-cas --from-file="certificate1.pem"=/path/to/certificate1.pem \
Copy link
Member

@code-asher code-asher Mar 16, 2023

Choose a reason for hiding this comment

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

Suggested change
# kubectl create secret -n $namespace generic all-cas --from-file="certificate1.pem"=/path/to/certificate1.pem \
# kubectl create secret -n $namespace generic all-cas \
# --from-file="certificate1.pem"=/path/to/certificate1.pem \

Copy link
Author

dcarlet commented Mar 16, 2023

I have read the CLA Document and I hereby sign the CLA

Copy link
Author

dcarlet commented Mar 16, 2023

recheck

Copy link
Contributor

bdsoha commented May 29, 2023

@code-asher This is a very much needed enhancement, any chance to get this merged and deployed?

Copy link
Member

My memory is a bit fuzzy and I might have misunderstood but last I remember when talking to @dcarlet there was still some tweaking that needed to be done to make this fully functional. Have you tried out the changes? If they work for you I will go ahead and get it merged up.

Copy link
Contributor

bdsoha commented Aug 1, 2023

@dcarlet Great PR, any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@code-asher code-asher code-asher approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Support for custom CAs

AltStyle によって変換されたページ (->オリジナル) /