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(security): Replace security-proxy-setup for adding users #2808

Merged
merged 1 commit into from
Dec 3, 2020
Merged

feat(security): Replace security-proxy-setup for adding users #2808

merged 1 commit into from
Dec 3, 2020

Conversation

bnevis-i
Copy link
Collaborator

@bnevis-i bnevis-i commented Oct 16, 2020

Replaces security-proxy-setup for adding users to the Kong proxy.

This new utility changes the JWT authentication mode from HS256 to
RS256, thus avoiding exposure of the HMAC secret on the server side.
This new utility also puts the client_id and client_secret for
OAuth2 authentication in the hands of the user.
Although in the new scheme the user is responsible for generating
tokens via either the client_credentials OAuth2 flow,
or client-side JWT signing, utility methods are provided
for that function that do not depend upon the server.

The new utility eliminates the requirement from security-proxy-setup
that a valid security secret store token is available.

Signed-off-by: Bryon Nevis bryon.nevis@intel.com

PR Checklist

Please check if your PR fulfills the following requirements:

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-examples/blob/master/.github/CONTRIBUTING.md.

What is the current behavior?

Issue Number:

Fixes #2477
Fixes #2549
Fixes #2568

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

New Imports

Are there any new imports or modules? Ivi dof so, what are they used for and why?

Specific Instructions

Are there any specific instructions or things that should be known prior to reviewing?

Testing instructions (JWT)

Start up a minimal set of containers: docker-compose -f docker-compose-nexus.yml up -d edgex-proxy metadata

(Wait a few minutes for things to spin up.)

Do the following initial setup (after fetching the pull request branch)

make cmd/secrets-config/secrets-config
cp -r cmd/security-proxy-setup/res/ cmd/secrets-config/res/
cd cmd/secrets-config
openssl genpkey -algorithm RSA -out rsa4096.key -pkeyopt rsa_keygen_bits:4096
openssl rsa -in rsa4096.key -pubout -out rsa4096.pub
openssl ecparam -name prime256v1 -genkey -noout -out ec256.key
cat ec256.key | openssl ec -out ec256.pub

Create a JWT user and test it (RSA):

./secrets-config proxy adduser --token-type jwt --algorithm RS256 --public_key rsa4096.pub --user myuser
./secrets-config proxy jwt --algorithm RS256 --id Uw9HX51Yx8Iq1wsjHwPrdBdlssw2KET0 --private_key rsa4096.key
(Note: use the id output by adduser above)
curl -k -H'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDM0MDk3MDEsImlhdCI6MTYwMzQwNjEwMSwiaXNzIjoiVXc5SFg1MVl4OElxMXdzakh3UHJkQmRsc3N3MktFVDAiLCJuYmYiOjE2MDM0MDYxMDF9.jom6J1uZplvkZBCnB8VdhdvfmEpYj5_IuuUWt6VeKNb3jb3EBX98du0Vaj7rqVBCTtkFFWBcrxSy1UfHgLOLDAXSSI9g1mP9pZya8y7PNZYEPSHz_nU5DCp4OCvyPz_I3SXBjaNQZTnTwJbjuaF0k4upyCDvwa6XzC4W2hKgaoo6QVsb2nlP1O1yJaFAWHXh6ohvHEOggKTFJs9Z30-9TaF32NWRipcREd953gYZ9mx2_I5blQreqQ6aM1ML0RT_CY3y9YEjXJ1fqDWc1Dim2PoP-IFVHTU5mDkcNT1Aa0wSODUkisM0VFQBpDg_iCpjwvQIxTuCc3AbVV6_Mma4ew0IEivOEoFO0hEAqInDN5ccWpC-YY-nxh52cxBctfAvHmuEdqlcpi6y6f3PdhC03W2JPuPLwxETEVae9--7CUMtVR093fLNbuRYuuyt9g0f7DJAzxssaGFxOgQeOSr0X-5kUFew8riqyMTufLby7qITYvWsgFQ8UsnzrcKc4MTwd2ehmSbDZ42zavEOiCRb3c1Aur3GloVLqpgteZEBbmkoC4IBVN73ntXgTOnztLW2gQU7WZmy-Xlem5kPw4SVQYvSsZBeprEB8C-N-T4U2mb57MyJA7mTr_799FvFzhU_bPR7sdEeX5zw0JkB2yAxfCkGAX9yQSC1f-0PKNhxOR8' https://localhost:8443/metadata/api/v1/ping
pong
(Note: use the token output by the jwt command above.)
./secrets-config proxy deluser --token-type jwt --user myuser

Create a JWT user and test it (EC-DSA):

./secrets-config proxy adduser --token-type jwt --algorithm ES256 --public_key ec256.pub --user myuser
./secrets-config proxy jwt --algorithm ES256 --id 0fjxWo34kmgtFEEdw1FC97hU74TmwM3a --private_key ec256.key 
curl -k -H'Authorization: Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDM0MTAxNDksImlhdCI6MTYwMzQwNjU0OSwiaXNzIjoiMGZqeFdvMzRrbWd0RkVFZHcxRkM5N2hVNzRUbXdNM2EiLCJuYmYiOjE2MDM0MDY1NDl9.PWT-e_6PrFZ-NOWZagUn_ERCsddkHZ-00C8eAMvwqe1FgzIKCqwGCi2Ephb4Xo3-EGxgl2X09xn8MSdP1kq0Ww' https://localhost:8443/metadata/api/v1/ping
ping
./secrets-config proxy deluser --token-type jwt --user myuser

Shut it all down

docker-compose -f docker-compose-nexus.yml down -t 0
docker volume prune -f

Testing instructions (OAuth2)

First, edit docker-compose-nexus.yml and override the authentication algorithm to specify oauth2

  edgex-proxy:
    environment:
      KONGAUTH_NAME: oauth2

Start up a minimal set of containers: docker-compose -f docker-compose-nexus.yml up -d edgex-proxy metadata

(Wait a few minutes for things to spin up.)

Create an oauth2 user and test it (use IDs returned from previous steps)

./secrets-config proxy adduser --token-type oauth2 --user myuser --redirect_uris https://placeholder
./secrets-config proxy oauth2 --client_id 5W1DXcN9RElxOe9YQX5nfL8zbI4bBaxu --client_secret wHD6lHmy8ydGxxvYOX4AVew4S3g32JRx
curl -ki -H'Authorization: Bearer vQpHei2aaJtRIctFChyjAK4pO29ZhE2i' https://localhost:8443/metadata/api/v1/ping
pong
./secrets-config proxy deluser --user myuser

Shut it all down

docker-compose -f docker-compose-nexus.yml down -t 0
docker volume prune -f

Other information

@bnevis-i bnevis-i added enhancement New feature or request security-services security_audit Track issues that are related to CVE/CVSS/CWE auditing etc labels Oct 16, 2020
@bnevis-i bnevis-i added this to the Hanoi milestone Oct 16, 2020
@codecov-io
Copy link

codecov-io commented Oct 16, 2020

Codecov Report

Merging #2808 (4688ef4) into master (0d0448a) will increase coverage by 0.73%.
The diff coverage is 69.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2808      +/-   ##
==========================================
+ Coverage   39.52%   40.25%   +0.73%     
==========================================
  Files         168      174       +6     
  Lines       13919    14255     +336     
==========================================
+ Hits         5501     5739     +238     
- Misses       8078     8140      +62     
- Partials      340      376      +36     
Impacted Files Coverage Δ
...l/security/config/command/proxy/adduser/command.go 58.62% <58.62%> (ø)
...al/security/config/command/proxy/oauth2/command.go 72.72% <72.72%> (ø)
...l/security/config/command/proxy/deluser/command.go 74.19% <74.19%> (ø)
...ernal/security/config/command/proxy/jwt/command.go 77.77% <77.77%> (ø)
internal/security/config/command/help/command.go 100.00% <100.00%> (ø)
...ernal/security/config/command/proxy/tls/command.go 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d0448a...4688ef4. Read the comment docs.

Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

I still have much more to review, but is some initial feedback

cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/testdata/res/configuration.toml Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/main.go Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/main.go Outdated Show resolved Hide resolved
cmd/security-proxy-setup/Dockerfile Show resolved Hide resolved
internal/security/config/bootstraphandler.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/adduser/command.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/adduser/command.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/adduser/command.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/deluser/command.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/deluser/command.go Outdated Show resolved Hide resolved
internal/security/config/command/proxy/oauth2/command.go Outdated Show resolved Hide resolved
internal/security/config/config/config.go Outdated Show resolved Hide resolved
internal/security/config/container/config.go Outdated Show resolved Hide resolved
internal/security/config/contract/command.go Outdated Show resolved Hide resolved
@bnevis-i
Copy link
Collaborator Author

Detailed integration testing instructions added to PR description.

@bnevis-i
Copy link
Collaborator Author

@lenny-intel First round of review comments addressed.

@lenny-goodell
Copy link
Member

@bnevis-i , commit bot doesn't like fixup! feat . Suggest you put the fixup! in the title after the :

@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Oct 23, 2020

@bnevis-i , commit bot doesn't like fixup! feat . Suggest you put the fixup! in the title after the :

Unfortunately, this behavior is mandated by git for --autosquash to work.
See https://git-scm.com/docs/git-commit (under --fixup)

Possible options are to
(1) Fix the conventional commits checker to overlook fixups
(2) Just squash it all into one commit at the end of the PR feedback process.

It's nice to keep the commit history during the reviews, rather than force-pushing, as force pushing seems to break github's code comment hyperlinks.

@lenny-goodell
Copy link
Member

Possible options are to
(1) Fix the conventional commits checker to overlook fixups
(2) Just squash it all into one commit at the end of the PR feedback process.

It's nice to keep the commit history during the reviews, rather than force-pushing, as force pushing seems to break github's code comment hyperlinks.

The bot is not in our control and sticks to strict conventional commit syntax.

Option 3 is to follow conventional commits syntax and then squash the commits when merging. I agree the additional commits are useful during PR review.

@bnevis-i
Copy link
Collaborator Author

The bot is not in our control and sticks to strict conventional commit syntax.

We could possibly make an upstream code contribution.... The code is quite simple and easy to extend.

module.exports = function isSemanticMessage (message, validScopes, validTypes, allowMergeCommits, allowRevertCommits) {
  const isMergeCommit = message && message.startsWith('Merge')
  if (allowMergeCommits && isMergeCommit) return true

  const isRevertCommit = message && message.startsWith('Revert')
  if (allowRevertCommits && isRevertCommit) return true

lenny-goodell
lenny-goodell previously approved these changes Oct 23, 2020
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

hutchic
hutchic previously approved these changes Oct 28, 2020
Copy link
Member

@hutchic hutchic left a comment

Choose a reason for hiding this comment

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

I ran through one test case from jwt and oauth. Manually testing worked, Test coverage changes look acceptable. Hesitant +1 as I'm not fluent in go but this being unused makes me feel it's fine

@bnevis-i bnevis-i dismissed stale reviews from hutchic and lenny-goodell via 5533391 October 28, 2020 16:03
@bnevis-i
Copy link
Collaborator Author

Rebased and squashed.

@bnevis-i bnevis-i requested review from tonyespy and removed request for tonyespy and jim-wang-intel October 28, 2020 16:05
Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

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

Please see comments inline.

Also you didn't answer the new imports question in your PR description.

Kudos to you for providing test instructions...

cmd/edgex-secrets-config/Attribution.txt Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved

* **adduser**

Create a API gateway user using specified token type. Requires additional arguments:
Copy link
Member

Choose a reason for hiding this comment

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

"Create a..." --> "Create an..."

cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
fmt.Println("TODO: Configure inbound TLS certificate.")
fmt.Printf("--in %s\n", c.certificatePath)
fmt.Printf("--inkey %s\n", c.privateKeyPath)
err = fmt.Errorf("tls command is unimplemented")
Copy link
Member

Choose a reason for hiding this comment

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

Why isn't this implemented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ran out of time before code freeze.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe file an issue to track this once this PR lands?

internal/security/config/command/proxy/tls/command.go Outdated Show resolved Hide resolved
Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

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

@bnevis-i thanks for all the changes.

Also I've attached a patch which adds the new cli to the snap, which would be nice if you could include in your PR. I only tested JWT, but everything works as expected if I run the command in a directory that contains a sub-directory named res which contains a configuration.toml file. My first attempt added a --confdir to the snapcraft.yaml app command, and that fails because the command expects "proxy " before any command-line options. So I stripped that out and tried to specify --confdir on the command-line, but each time I tried, the command complained about not being able to find ./res/configuration.toml. Note, I tried both --confdir and -confdir, also tried with and without the trailing /res.

espy@sumo$ edgexfoundry.edgex-secrets-config proxy deluser --user myuser --confdir /var/snap/edgexfoundry/current/config/edgex-secrets-config/res
level=ERROR ts=2020-10-30T17:29:35.890938657Z app=edgex-secrets-config source=bootstrap.go:45 msg="could not load configuration file (./res/configuration.toml): open ./res/configuration.toml: no such file or directory"

0001-build-snap-add-edgex-secrets-config-app.patch.txt

In addition there's a separate file (pipeline snap build optimization) which just needs to be copied (first you need to strip the .txt extension) over the existing patch file of the same name in /snap/local/patches.

0001-optimize-build-for-pipeline-CI-check.patch.txt


* **--client\_id** _client\_id_ (required)

Optional manually-specified OAuth2 client_id. Will be generated if not present. Equivalent to a username.
Copy link
Member

Choose a reason for hiding this comment

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

So the usage says required, but then the text below says "Will be generated if not present". Which is it?


* **--client\_secret** _client\_secret_ (required)

Optional manually-specified OAuth2 client_secret. Will be generated if not present. Equivalent to a password.
Copy link
Member

Choose a reason for hiding this comment

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

So the usage says required, but then the text below says "Will be generated if not present". Which is it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Corrected this to say that it should have the values from the previous adduser command. Good catch.

fmt.Println("TODO: Configure inbound TLS certificate.")
fmt.Printf("--in %s\n", c.certificatePath)
fmt.Printf("--inkey %s\n", c.privateKeyPath)
err = fmt.Errorf("tls command is unimplemented")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe file an issue to track this once this PR lands?

// Suppress log messages except errors as this utility
// outputs generated identifiers to stdout that we
// might want to capture via redirection
_ = lc.SetLogLevel("ERROR")
Copy link
Member

Choose a reason for hiding this comment

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

@lenny-intel can you answer my question as to whether or not this overrides LogLevel from configuration, and if so, why?

cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
// Suppress log messages except errors as this utility
// outputs generated identifiers to stdout that we
// might want to capture via redirection
_ = lc.SetLogLevel("ERROR")
Copy link
Member

Choose a reason for hiding this comment

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

It seems like this doesn't override the configuration LogLevel, as when I run the command from the snap, I see all of log messages (ERROR and INFO) written to stdout.

That said, the LogLevel in the configuration.toml still doesn't seem to work, as I tried setting it to ERROR there, and I still see all of the INFO messages:

[Writable]
LogLevel = "ERROR"

cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
@bnevis-i
Copy link
Collaborator Author

@tonyespy Lenny has fixed the log quietness issue. Can you let me know what the outstanding issues are. I'd like to get this one merged before Thanksgiving if possible.

Makefile Outdated Show resolved Hide resolved
cmd/edgex-secrets-config/README.md Outdated Show resolved Hide resolved
internal/security/proxy/container/config.go Outdated Show resolved Hide resolved
internal/security/config/main.go Outdated Show resolved Hide resolved
lenny-goodell
lenny-goodell previously approved these changes Nov 30, 2020
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@bnevis-i
Copy link
Collaborator Author

@tonyespy You are currently blocking the merge for this one. Can you let me know what the outstanding issues are?

Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

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

The code changes all look good. I only had a few minor comments/questions inline.

One question about your test instructions. The first step is listed as:

make cmd/edgex-secrets-config/edgex-secrets-config

Did you actually mean cmd/edgex-secrets-config/res?

That said, when I built the snap from your branch and tried to test, the tool is panicking.

In my first attempt, since you're copying security-proxy-setup's configuration to $SNAP_DATA/config/secrets-config, I generated all of my certs & keys there. Then I ran the command without specifying --confdir:

$ cd /var/snap/edgexfoundry/current/config/secrets-config
$ edgexfoundry.secrets-config proxy adduser --token-type jwt --algorithm RS256 --public_key rsa4096.pub --user myuser
panic: interface conversion: interface {} is nil, not *config.ConfigurationStruct

goroutine 1 [running]:
github.com/edgexfoundry/edgex-go/internal/security/proxy/container.ConfigurationFrom(...)
	/root/parts/edgex-go/src/internal/security/proxy/container/config.go:30
github.com/edgexfoundry/edgex-go/internal/security/config.(*Bootstrap).BootstrapHandler(0xc00014fd60, 0x829b40, 0xc000062600, 0xc00001c430, 0xbfe9c9d565d74520, 0x911f2, 0x9fbbe0, 0xdf8475800, 0x3b9aca00, 0xc00000c700, ...)
	/root/parts/edgex-go/src/internal/security/config/bootstraphandler.go:36 +0x415
github.com/edgexfoundry/go-mod-bootstrap/bootstrap.RunAndReturnWaitGroup(0x829b40, 0xc000062600, 0xc000023230, 0x82c040, 0xc0000232c0, 0x7b5690, 0xe, 0x7b723e, 0x13, 0x82ad20, ...)
	/root/go/pkg/mod/github.com/edgexfoundry/go-mod-bootstrap@v0.0.60/bootstrap/bootstrap.go:154 +0x629
github.com/edgexfoundry/go-mod-bootstrap/bootstrap.Run(0x829b40, 0xc000062600, 0xc000023230, 0x82c040, 0xc0000232c0, 0x7b5690, 0xe, 0x7b723e, 0x13, 0x82ad20, ...)
	/root/go/pkg/mod/github.com/edgexfoundry/go-mod-bootstrap@v0.0.60/bootstrap/bootstrap.go:179 +0x149
github.com/edgexfoundry/edgex-go/internal/security/config.Main(0x829b40, 0xc000062600, 0xc000023230, 0xc000062600)
	/root/parts/edgex-go/src/internal/security/config/main.go:51 +0x511
main.main()
	/root/parts/edgex-go/src/cmd/secrets-config/main.go:18 +0x5b

Next, I tried the same command with the following permutations of --confdir, and all panic in the same way:

  • --confdir ./res
  • --confdir .
  • --confdir /var/snap/edgexfoundry/current/secrets-config/res

Any idea what's happening here?

cmd/secrets-config/README.md Outdated Show resolved Hide resolved
internal/security/config/command/proxy/adduser/command.go Outdated Show resolved Hide resolved
internal/security/config/main.go Show resolved Hide resolved
snap/hooks/install Outdated Show resolved Hide resolved
snap/snapcraft.yaml Outdated Show resolved Hide resolved
@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Dec 2, 2020

@tonyespy Ready for re-review. Panic fixed.

lenny-goodell
lenny-goodell previously approved these changes Dec 2, 2020
Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

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

No more panic, so progress!

That said, three comments inline.

Also a few other global comments:

  • will there ever be a situation where you'd want different configuration files between security-proxy-setup and secrets-config?
  • can you please add an issue to track implementation of the tls sub-command?
  • I don't love the log formatted errors the command produces:
$ edgexfoundry.secrets-config proxy
level=ERROR ts=2020-12-02T20:07:23.613509623Z app=secrets-config source=bootstraphandler.go:69 msg="subcommand required (adduser, deluser, jwt, oauth2, tls)"

Not sure it's worth adding an issue to track improvements to this??

  • And finally, your test instructions need minor tweaks (make cmd/secrets-config/secrets-config should be cmd/secrets-config/res? and get rid of the token type in your first deluser command).

snap/snapcraft.yaml Outdated Show resolved Hide resolved
cmd/secrets-config/README.md Show resolved Hide resolved
From: Tony Espy <espy@canonical.com>
Date: Wed, 28 Oct 2020 12:14:21 -0400
Subject: [PATCH] [PATCH] optimize snap build for pipeline CI check
Date: Mon, 2 Nov 2020 16:07:09 -0500
Copy link
Member

Choose a reason for hiding this comment

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

Your updated patch doesn't apply:

$ patch -p1 < ./snap/local/patches/0001-optimize-build-for-pipeline-CI-check.patch 
patching file snap/snapcraft.yaml
Hunk #3 FAILED at 218.
Hunk #4 succeeded at 275 (offset 1 line).
Hunk #5 succeeded at 309 (offset 1 line).
Hunk #6 succeeded at 343 (offset 1 line).
Hunk #7 FAILED at 398.
2 out of 7 hunks FAILED -- saving rejects to file snap/snapcraft.yaml.rej

@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Dec 2, 2020

  • will there ever be a situation where you'd want different configuration files between security-proxy-setup and secrets-config?

Hard to say. The plan is to put them into the same container for now. Eventually the bootstrapping ADR will probably result in refactoring of security-proxy-setup.

  • can you please add an issue to track implementation of the tls sub-command?

#2866

  • I don't love the log formatted errors the command produces:
    level=ERROR ts=2020-12-02T20:07:23.613509623Z app=secrets-config source=bootstraphandler.go:69 msg="subcommand required (adduser, deluser, jwt, oauth2, tls)"
    Not sure it's worth adding an issue to track improvements to this??

I don't think so.

  • And finally, your test instructions need minor tweaks (make cmd/secrets-config/secrets-config should be cmd/secrets-config/res? and get rid of the token type in your first deluser command).

I really do mean to make the executable here. I copy the res/configuration.toml from the other folder in the test instructions.

tonyespy
tonyespy previously approved these changes Dec 3, 2020
Copy link
Member

@tonyespy tonyespy left a comment

Choose a reason for hiding this comment

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

Thanks for your changes, LGTM!

jim-wang-intel
jim-wang-intel previously approved these changes Dec 3, 2020
Copy link
Contributor

@jim-wang-intel jim-wang-intel left a comment

Choose a reason for hiding this comment

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

LGTM

Replaces security-proxy-setup for adding users to the Kong proxy.

This new utility changes the JWT authentication mode from HS256 to
RS256, thus avoiding exposure of the HMAC secret on the server side.
This new utility also puts the client_id and client_secret for
OAuth2 authentication in the hands of the user.
Although in the new scheme the user is responsible for generating
tokens via either the client_credentials OAuth2 flow,
or client-side JWT signing, utility methods are provided
for that function that do not depend upon the server.

The new utility eliminates the requirement from security-proxy-setup
that a valid security secret store token is available.

Fixes #2477
Fixes #2549
Fixes #2568

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
@sonarcloud
Copy link

sonarcloud bot commented Dec 3, 2020

Kudos, SonarCloud Quality Gate passed!

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

No Coverage information No Coverage information
4.3% 4.3% Duplication

@bnevis-i bnevis-i merged commit ff93af4 into edgexfoundry:master Dec 3, 2020
@bnevis-i bnevis-i deleted the edgex-secrets-config branch December 3, 2020 20:14
jim-wang-intel pushed a commit to jim-wang-intel/edgex-go that referenced this pull request Dec 15, 2020
…oundry#2808)

Replaces security-proxy-setup for adding users to the Kong proxy.

This new utility changes the JWT authentication mode from HS256 to
RS256, thus avoiding exposure of the HMAC secret on the server side.
This new utility also puts the client_id and client_secret for
OAuth2 authentication in the hands of the user.
Although in the new scheme the user is responsible for generating
tokens via either the client_credentials OAuth2 flow,
or client-side JWT signing, utility methods are provided
for that function that do not depend upon the server.

The new utility eliminates the requirement from security-proxy-setup
that a valid security secret store token is available.

Fixes edgexfoundry#2477
Fixes edgexfoundry#2549
Fixes edgexfoundry#2568

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
siggiskulason pushed a commit to siggiskulason/edgex-go that referenced this pull request Mar 30, 2021
…oundry#2808)

Replaces security-proxy-setup for adding users to the Kong proxy.

This new utility changes the JWT authentication mode from HS256 to
RS256, thus avoiding exposure of the HMAC secret on the server side.
This new utility also puts the client_id and client_secret for
OAuth2 authentication in the hands of the user.
Although in the new scheme the user is responsible for generating
tokens via either the client_credentials OAuth2 flow,
or client-side JWT signing, utility methods are provided
for that function that do not depend upon the server.

The new utility eliminates the requirement from security-proxy-setup
that a valid security secret store token is available.

Fixes edgexfoundry#2477
Fixes edgexfoundry#2549
Fixes edgexfoundry#2568

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request security_audit Track issues that are related to CVE/CVSS/CWE auditing etc security-services
Projects
None yet
7 participants