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

[Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs #19793

Merged
merged 2 commits into from
Jul 9, 2020

Conversation

blakerouse
Copy link
Contributor

@blakerouse blakerouse commented Jul 9, 2020

What does this PR do?

Currently Elastic Agent only set unix based permissions and did not set proper ACL's on Windows. This adds a new module github.com/hectane/go-acl that ensures that a call to acl.Chmod sets the proper ACL on windows, just the same as it does on unix based systems.

Why is it important?

Both the fleet.yml and action_store.yml can include sensitive information, so the information needs to have strong permissions so only users with enough permissions can read those files.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Relates

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 9, 2020
Copy link
Contributor

@michalpristas michalpristas left a comment

Choose a reason for hiding this comment

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

lgtm

@elasticmachine
Copy link
Collaborator

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19793 opened]

  • Start Time: 2020-07-09T14:45:53.889+0000

  • Duration: 97 min 32 sec

Test stats 🧪

Test Results
Failed 2
Passed 9735
Skipped 1579
Total 11316

Test errors

Expand to view the tests failures

  • Name: Build and Test / Metricbeat OSS Unit tests / test_process – test_system.Test

    • Age: 1
    • Duration: 0.829
    • Error Details: False is not true : fd not found in any process events
  • Name: Build and Test / Metricbeat OSS Integration tests / TestFetch – activity

    • Age: 1
    • Duration: 34.41
    • Error Details: Failed

Steps errors

Expand to view the steps failures

  • Name: Report to Codecov

    • Description: curl -sSLo codecov https://codecov.io/bash for i in auditbeat filebeat heartbeat libbeat metricbeat packetbeat winlogbeat journalbeat do FILE="${i}/build/coverage/full.cov" if [ -f "${FILE}" ]; then bash codecov -f "${FILE}" fi done

    • Duration: 2 min 22 sec

    • Start Time: 2020-07-09T15:09:53.904+0000

    • log

  • Name: Mage build unitTest

    • Description: mage build unitTest

    • Duration: 6 min 53 sec

    • Start Time: 2020-07-09T15:09:24.603+0000

    • log

  • Name: Mage goIntegTest

    • Description: mage goIntegTest

    • Duration: 38 min 28 sec

    • Start Time: 2020-07-09T15:09:32.763+0000

    • log

  • Name: Install docker-compose 1.21.0

    • Description: .ci/scripts/install-docker-compose.sh

    • Duration: 1 min 57 sec

    • Start Time: 2020-07-09T15:11:40.058+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-07-09T16:21:40.634Z]  OS/Arch:           darwin/amd64
[2020-07-09T16:21:40.634Z]  Experimental:      false
[2020-07-09T16:21:40.634Z] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[2020-07-09T16:21:40.634Z] It requires Docker daemon to be installed and running
[2020-07-09T16:21:55.033Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats
[2020-07-09T16:21:55.369Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-07-09T16:21:55.394Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Lint
[2020-07-09T16:21:55.554Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-07-09T16:21:55.718Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-07-09T16:21:55.877Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-07-09T16:21:56.041Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-07-09T16:21:56.203Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Winlogbeat-oss
[2020-07-09T16:21:56.364Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-07-09T16:21:56.524Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Dockerlogbeat
[2020-07-09T16:21:56.683Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-07-09T16:21:56.843Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Journalbeat-oss
[2020-07-09T16:21:57.006Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-07-09T16:21:57.190Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-07-09T16:21:57.349Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-07-09T16:21:57.512Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-07-09T16:21:57.671Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-07-09T16:21:57.846Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-07-09T16:21:58.015Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-07-09T16:21:58.172Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-07-09T16:21:58.333Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-07-09T16:21:58.507Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-07-09T16:21:58.664Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-07-09T16:21:58.832Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-07-09T16:21:58.996Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-Windows
[2020-07-09T16:21:59.157Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Heartbeat-oss
[2020-07-09T16:21:59.383Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-07-09T16:21:59.545Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Libbeat-x-pack
[2020-07-09T16:21:59.718Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-07-09T16:21:59.891Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-Windows
[2020-07-09T16:22:00.052Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Packetbeat-oss
[2020-07-09T16:22:00.242Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-07-09T16:22:00.418Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-07-09T16:22:00.591Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-x-pack
[2020-07-09T16:22:00.751Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-07-09T16:22:00.909Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-07-09T16:22:01.070Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Filebeat-oss
[2020-07-09T16:22:01.232Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Functionbeat-Windows
[2020-07-09T16:22:01.404Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Heartbeat-Mac-OS-X
[2020-07-09T16:22:01.565Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-07-09T16:22:01.724Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-07-09T16:22:01.900Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Heartbeat-Windows
[2020-07-09T16:22:02.098Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Libbeat-oss
[2020-07-09T16:22:02.281Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-07-09T16:22:02.455Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-07-09T16:22:02.628Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-07-09T16:22:02.788Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-07-09T16:22:02.956Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-07-09T16:22:03.398Z] + cat
[2020-07-09T16:22:03.398Z] + /usr/local/bin/runbld ./runbld-script
[2020-07-09T16:22:03.398Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-07-09T16:22:10.003Z] runbld>>> runbld started
[2020-07-09T16:22:10.003Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-07-09T16:22:10.949Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-19793' in order of occurrence in the config (last value wins).
[2020-07-09T16:22:11.940Z] runbld>>> Debug logging enabled.
[2020-07-09T16:22:12.248Z] runbld>>> Storing result
[2020-07-09T16:22:12.248Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-07-09T16:22:12.248Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200709162211-A534B546
[2020-07-09T16:22:12.248Z] runbld>>> Adding system facts.
[2020-07-09T16:22:13.195Z] runbld>>> Adding vcs info for the latest commit:  3dd06bf86140403c42297052fa3bca92423ed276
[2020-07-09T16:22:13.195Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-07-09T16:22:13.195Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-07-09T16:22:13.195Z] + echo 'Processing JUnit reports with runbld...'
[2020-07-09T16:22:13.195Z] Processing JUnit reports with runbld...
[2020-07-09T16:22:13.456Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-07-09T16:22:13.456Z] runbld>>> DURATION: 26ms
[2020-07-09T16:22:13.456Z] runbld>>> STDOUT: 40 bytes
[2020-07-09T16:22:13.456Z] runbld>>> STDERR: 49 bytes
[2020-07-09T16:22:13.456Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-07-09T16:22:13.456Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats
[2020-07-09T16:22:14.402Z] runbld>>> Storing build metadata: 
[2020-07-09T16:22:14.402Z] runbld>>> Adding test report.
[2020-07-09T16:22:14.402Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats
[2020-07-09T16:22:15.347Z] runbld>>> Found 115 test output files
[2020-07-09T16:22:15.919Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-07-09T16:22:15.919Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-07-09T16:22:15.920Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-07-09T16:22:15.920Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-07-09T16:22:15.920Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-07-09T16:22:17.369Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-07-09T16:22:17.369Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-07-09T16:22:17.369Z] runbld>>> Test output logs contained: Errors: 0 Failures: 2 Tests: 11170 Skipped: 1340
[2020-07-09T16:22:17.634Z] runbld>>> Storing result
[2020-07-09T16:22:17.634Z] runbld>>> FAILURES: 2
[2020-07-09T16:22:18.205Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-07-09T16:22:18.205Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200709162211-A534B546
[2020-07-09T16:22:18.496Z] runbld>>> Email notification disabled by environment variable.
[2020-07-09T16:22:18.496Z] runbld>>> Slack notification disabled by environment variable.
[2020-07-09T16:22:24.766Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-19793
[2020-07-09T16:22:24.975Z] [INFO] getVaultSecret: Getting secrets
[2020-07-09T16:22:25.083Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-07-09T16:22:26.323Z] + chmod 755 generate-build-data.sh
[2020-07-09T16:22:26.323Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19793/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19793/runs/1 FAILURE 5792158
[2020-07-09T16:22:26.323Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19793/runs/1/steps/?limit=10000 -o steps-info.json
[2020-07-09T16:22:28.825Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19793/runs/1/tests/?status=FAILED -o tests-errors.json
[2020-07-09T16:22:29.075Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-19793/runs/1/log/ -o pipeline-log.txt

@blakerouse blakerouse merged commit d91b0d8 into elastic:master Jul 9, 2020
@blakerouse blakerouse deleted the agent-fix-windows-acl branch July 9, 2020 17:02
blakerouse added a commit to blakerouse/beats that referenced this pull request Jul 9, 2020
…proper ACLs (elastic#19793)

* Fix permissions for windows to set proper ACLs

* Generate NOTICE.txt.

(cherry picked from commit d91b0d8)
v1v added a commit to v1v/beats that referenced this pull request Jul 9, 2020
* upstream/master:
  Add `docker logs` support to the Elastic Log Driver (elastic#19531)
  [Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs (elastic#19793)
  Send the config revision down to the endpoint application. (elastic#19759)
  [Elastic Agent] Add support for multiple hosts in connection to kibana (elastic#19628)
  Remove the downloadConfig and retryConfig from plugin/process.Application and plugin/service.Application. (elastic#19603)
  Update go version to 1.14.4 (elastic#19753)
  ci: set builds as skipped when they do not match the trigger (elastic#19750)
  [Auditbeat] Fix up socket dataset runaway CPU usage (elastic#19764)
  Convert cloudfoundry input to v2 (elastic#19717)
v1v added a commit to v1v/beats that referenced this pull request Jul 9, 2020
* upstream/master:
  Add `docker logs` support to the Elastic Log Driver (elastic#19531)
  [Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs (elastic#19793)
  Send the config revision down to the endpoint application. (elastic#19759)
  [Elastic Agent] Add support for multiple hosts in connection to kibana (elastic#19628)
v1v added a commit to v1v/beats that referenced this pull request Jul 9, 2020
* upstream/master:
  Add `docker logs` support to the Elastic Log Driver (elastic#19531)
  [Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs (elastic#19793)
v1v added a commit to v1v/beats that referenced this pull request Jul 9, 2020
* upstream/master:
  Add `docker logs` support to the Elastic Log Driver (elastic#19531)
  [Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs (elastic#19793)
  Send the config revision down to the endpoint application. (elastic#19759)
v1v added a commit to v1v/beats that referenced this pull request Jul 9, 2020
* upstream/master:
  Add `docker logs` support to the Elastic Log Driver (elastic#19531)
  [Elastic Agent] Fix saving of agent configuration on Windows to have proper ACLs (elastic#19793)
blakerouse added a commit that referenced this pull request Jul 9, 2020
…proper ACLs (#19793) (#19806)

* Fix permissions for windows to set proper ACLs

* Generate NOTICE.txt.

(cherry picked from commit d91b0d8)
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
…proper ACLs (elastic#19793)

* Fix permissions for windows to set proper ACLs

* Generate NOTICE.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants