-
Notifications
You must be signed in to change notification settings - Fork 148
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
Agent configuration encryption #398
Merged
Merged
Changes from 19 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
c10b579
Agent configuration encryption
aleksmaus 6afad66
Make linter happy
aleksmaus 17214e0
Address code review feedback
aleksmaus 750d0a4
Make linux linter happy
aleksmaus e94ccc7
Encode created on date/time with the vault key/value
aleksmaus 5922e7b
Check .seed file owner is root on load
aleksmaus 73da02a
Update upgrade code paths, rename configuration files fleet.yml and s…
aleksmaus a00e7f9
Make linter happy again
aleksmaus 0ea9f6c
Disable storage encryption for Darwin unit tests that do not run with…
aleksmaus 4e0d215
Make linter happy for the last commit touched files
aleksmaus 332cd63
Make check happy
aleksmaus bfaa47f
Fix Winderz linter: Error: naked return in func with 7 lines of code…
aleksmaus 05dcce7
Fix Winderz linter: internal/pkg/agent/vault/vault_windows.go#L57
aleksmaus 2bff2cb
Remove .seed file root owner check, makes it impossible to unit test …
aleksmaus bf54d72
Remove unused import
aleksmaus 20f6478
Add secret initialiation to non-darwin unit tests
aleksmaus fceee17
Add SkipCreateSecret to enroll_cmd, in order to pass run the unit tes…
aleksmaus 35eca70
Put the root owner check back with a hook that allows to disable it f…
aleksmaus 0fd625d
Fix disabling root check for tests on darwin
aleksmaus 23c0b48
Addressed code review comments
aleksmaus 32a6ff2
Replace ```os.IsNotExist(err)``` with ```errors.Is(err, fs.ErrNotExis…
aleksmaus 306f6b4
Add missing imports for windows implementation
aleksmaus 5f43096
Address the latest set of code review comments
aleksmaus 1f5d81c
Adjust paths for darwin to make linter happy
aleksmaus d8fc776
Additional unit test coverage
aleksmaus 4a53602
Add vault unit tests
aleksmaus 5745c97
Merge branch 'main' into feature/vault
aleksmaus 5a9db4e
Improve unit test coverage of vault package
aleksmaus 46f3a7d
Set Administrator permissions correctly on the vault directory to pro…
aleksmaus 5d3a388
Address code review feedback
aleksmaus a8a8be0
Address the licensing blocker for vault_darwin.c. Updated the default…
aleksmaus 9b0d1d5
Merge branch 'main' into feature/vault
aleksmaus c6cbaaf
Update imports order
aleksmaus 5f6fb6d
Adjusted the copyright header based on the latest feedback
aleksmaus 7311aad
Update the CHANGELOG with this PR change
aleksmaus 3f85788
Fix the issue on install. If the encrypted configuration file doesn't…
aleksmaus 6909b8f
Merge branch 'main' into feature/vault
aleksmaus 9442d6e
Update NOTICE.txt generation for the mDNSResponder open source project
aleksmaus 427a2e1
Addressed the latest round of code review
aleksmaus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,37 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/billgraziano/dpapi | ||
Version: v0.4.0 | ||
Licence type (autodetected): MIT | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/billgraziano/[email protected]/LICENSE: | ||
|
||
MIT License | ||
|
||
Copyright (c) 2019 Bill Graziano | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/blakesmith/ar | ||
Version: v0.0.0-20150311145944-8bd4349a67f2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,24 +7,50 @@ package paths | |
import ( | ||
"fmt" | ||
"path/filepath" | ||
"runtime" | ||
|
||
"github.com/elastic/elastic-agent/internal/pkg/agent/application/filelock" | ||
) | ||
|
||
// defaultAgentCapabilitiesFile is a name of file used to store agent capabilities | ||
const defaultAgentCapabilitiesFile = "capabilities.yml" | ||
|
||
// defaultAgentFleetFile is a name of file used to store agent information | ||
const defaultAgentFleetFile = "fleet.yml" | ||
// defaultAgentFleetYmlFile is a name of file used to store agent information | ||
const defaultAgentFleetYmlFile = "fleet.yml" | ||
|
||
// defaultAgentFleetFile is a name of file used to store agent information encrypted | ||
const defaultAgentFleetFile = "fleet.enc" | ||
|
||
// defaultAgentEnrollFile is a name of file used to enroll agent on first-start | ||
const defaultAgentEnrollFile = "enroll.yml" | ||
|
||
// defaultAgentActionStoreFile is the file that will contain the action that can be replayed after restart. | ||
const defaultAgentActionStoreFile = "action_store.yml" | ||
|
||
// defaultAgentStateStoreFile is the file that will contain the action that can be replayed after restart. | ||
const defaultAgentStateStoreFile = "state.yml" | ||
// defaultAgentStateStoreYmlFile is the file that will contain the action that can be replayed after restart. | ||
const defaultAgentStateStoreYmlFile = "state.yml" | ||
|
||
// defaultAgentStateStoreFile is the file that will contain the action that can be replayed after restart encrypted. | ||
const defaultAgentStateStoreFile = "state.enc" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good catch on this file |
||
|
||
// defaultAgentVaultName is keychain item name for mac | ||
const defaultAgentVaultName = "co.elastic.agent" | ||
|
||
// defaultAgentVaultPath is the directory for windows and linux where the vault store is located or the | ||
const defaultAgentVaultPath = "vault" | ||
|
||
// AgentConfigYmlFile is a name of file used to store agent information | ||
func AgentConfigYmlFile() string { | ||
return filepath.Join(Config(), defaultAgentFleetYmlFile) | ||
} | ||
|
||
// AgentConfigYmlFileLock is a locker for agent config file updates. | ||
func AgentConfigYmlFileLock() *filelock.AppLocker { | ||
return filelock.NewAppLocker( | ||
Config(), | ||
fmt.Sprintf("%s.lock", defaultAgentFleetYmlFile), | ||
) | ||
} | ||
|
||
// AgentConfigFile is a name of file used to store agent information | ||
func AgentConfigFile() string { | ||
|
@@ -54,7 +80,20 @@ func AgentActionStoreFile() string { | |
return filepath.Join(Home(), defaultAgentActionStoreFile) | ||
} | ||
|
||
// AgentStateStoreFile is the file that contains the persisted state of the agent including the action that can be replayed after restart. | ||
// AgentStateStoreYmlFile is the file that contains the persisted state of the agent including the action that can be replayed after restart. | ||
func AgentStateStoreYmlFile() string { | ||
return filepath.Join(Home(), defaultAgentStateStoreYmlFile) | ||
} | ||
|
||
// AgentStateStoreFile is the file that contains the persisted state of the agent including the action that can be replayed after restart encrypted. | ||
func AgentStateStoreFile() string { | ||
return filepath.Join(Home(), defaultAgentStateStoreFile) | ||
} | ||
|
||
// AgentVaultPath is the directory that contains all the files for the value for windows and linux | ||
func AgentVaultPath() string { | ||
if runtime.GOOS == "darwin" { | ||
return defaultAgentVaultName | ||
} | ||
return filepath.Join(Home(), defaultAgentVaultPath) | ||
} | ||
AndersonQ marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
add
//nolint:errcheck // comment
😛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.
yep, same issue as you stumbled upon with your PR earlier, will update