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

feat(snap)!: Remove secrets-config proxy snap options #4511

Merged

Conversation

farshidtz
Copy link
Member

This feature allowed using snap options to:

  1. add an admin user with its public key
  2. replace the default API Gateway certificate

The ability to add users by public key has been removed in secrets-config v3. The remaining parts which are to replace default TLS certificate, is possible via other, more secure means. As a result, this feature along with all its complexity is being removed.

For more details, refer to canonical/edgex-snap-hooks#81 (comment)

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

New Dependency Instructions (If applicable)

BREAKING CHANGE: Removing the support for the apps.secrets-config.proxy.* snap options

Signed-off-by: Farshid Tavakolizadeh <farshid.tavakolizadeh@canonical.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
2.4% 2.4% Duplication

@farshidtz farshidtz marked this pull request as ready for review April 12, 2023 17:36
Copy link
Contributor

@MonicaisHer MonicaisHer left a comment

Choose a reason for hiding this comment

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

I have tested setting up TLS with snap built from this PR:

$ snap install ./edgexfoundry_3.0.0-dev.128_amd64.snap --dangerous
edgexfoundry 3.0.0-dev.128 installed
$ sudo ./script.sh 
+ SERVER_CERT_FILE=server.crt
+ SERVER_KEY_FILE=server.key
+ SERVER_CSR_FILE=server.csr
+ CA_CERT_FILE=ca.crt
+ CA_KEY_FILE=ca.key
+ TEMP_DIR=/var/snap/edgexfoundry/common
+ openssl ecparam -name prime256v1 -genkey -noout -out ca.key
+ openssl req -new -x509 -sha256 -key ca.key -out ca.crt -subj /CN=local-ca
+ openssl ecparam -name prime256v1 -genkey -noout -out server.key
+ openssl req -new -sha256 -key server.key -out server.csr -subj /CN=localhost
+ openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 1000 -sha256
Certificate request self-signature ok
subject=CN = localhost
+ sudo cp server.crt server.key /var/snap/edgexfoundry/common/
+ sudo edgexfoundry.secrets-config proxy tls --inCert /var/snap/edgexfoundry/common/server.crt --inKey /var/snap/edgexfoundry/common/server.key --targetFolder /var/snap/edgexfoundry/current/nginx
+ sudo rm server.crt server.key
+ sudo snap restart --reload edgexfoundry.nginx
Restarted.
+ sleep 1
+ curl --cacert ca.crt -v https://localhost:8443/core-data/api/v2/ping
*   Trying 127.0.0.1:8443...
* Connected to localhost (127.0.0.1) port 8443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: ca.crt
*  CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=localhost
*  start date: Apr 13 14:46:21 2023 GMT
*  expire date: Jan  7 14:46:21 2026 GMT
*  common name: localhost (matched)
*  issuer: CN=local-ca
*  SSL certificate verify ok.
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /core-data/api/v2/ping HTTP/1.1
> Host: localhost:8443
> User-Agent: curl/7.81.0
> Accept: */*
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Server: nginx
< Date: Thu, 13 Apr 2023 14:46:23 GMT
< Content-Type: text/html
< Content-Length: 172
< Connection: keep-alive
< 
<html>
<head><title>401 Authorization Required</title></head>
<body>
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host localhost left intact

@farshidtz farshidtz merged commit cc94d1f into edgexfoundry:main Apr 14, 2023
@farshidtz farshidtz deleted the snap-drop-secrets-config-options branch April 14, 2023 08:06
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.

None yet

3 participants