Commit 40b7e88
Enhancement/6394 allow deb rpm to upgrade with endpoint tamper protection (#6907)
* Update pkg/testing/tools/tools.go
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* enhancement(6394): updated preinstall script, updated service to use uninstall token
* enhancmenet(6394): updated the preinstall script
* enchancement(6394): started adding integraiton tests
* enhancement(6394): updated fixture install, updated endpoint security tests
* enhancement(6394): cleaned up fixture_install, added function that exposes fixture's uninstall tokens, updated tests
* enhancement(6394): refactored test code so that I can use it with rpm
* enhancement(6394): added tests to assert that tamper protection works
* enhancement(6394): updated the endpoint testing tools, fixture install functions and the deb rpm upgrade tests
* enhancement(6394): added test logs, updated rpm installation to set agent socket path
* enhancement(6394): remove commented code
* enhancement(6394): remove print statements
* enhancement(6394): remove unnecessary comments, refactor unused function
* enhancement(6394): revert var name change
* enhancement(6394): added changelog
* enchancement(6394): update test logs, add non integrative config to deb installation
* enhancement(6394): updated the endpoint version comparison and assertion
* enhancement(6394): added log in tests
* enhancement(6394): resorted to using previous major instead of minor in upgrade test
* enhancement(6394): updated endpoint version function in the tests, updated function name in testing tools
* enhancement(6394): use previous minor, fix log
* enhancement(6394): added comment explaining motive behind simple install functions
* enhancement(6394): updated return in tools
* Update changelog/fragments/1740166208-allow-deb-rpm-upgrade-with-tamper-protected-endpoint.yaml
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
* enhancement(6394): fixed function call in tests
* enhancement(6394): added systemctl start in postinstall, refactored preinstall and added condition to make same version installations work
* enhancement(6394): updated the preinstall and postinstall scripts to troubleshoot
* enhancement(6394): updated preinstall and postinstall script templates
- Updated preinstall to stop endpoint if it is an available service regardless of the version of endpoint that's install
- Updated postintall to start endpoint if the old endpoint version and the new version match.
* enhancement(6394): removed error exit from postinstall
* enhancement(6394): updated postinstall and preinstall templates
- Preinstall now does not use a state file. Recovery from failure start ElasticEndpoint if it is not running
- Preinstall does not stop endpoint if tamper protection is not enabled
- Postinstall does not print an error if service is still running
* enhancement(6394): removed debug logs
* enhancement(6394): removed unnecessary comment
* enhancement(6394): store uninstall token as local var, uninstall through the agent
* enhancement(6394): added setclient function
* enhancement(6394): added getInstallCommand and replaced SimpleInstall
* enhancement(6394): added test case for error recovery. removed unused fixture functions
* enhancement(6394): refactored tests, consolidated test scenarios into one function
* enhancement(6394): remove unnecessary test functions
* enhancement(6394): remove unused fixture function
* enhancement(6394): revert unwanted installDeb changes
* enhancement(6394): remove unwanted changes in testing tools
* enhancement(6394): remove unused function call
* enhancement(6394): replacing systemctl instead of adding new one to path
* enhancement(6394): update real systemctl path in mock systemctl script
* enhancement(6394): fix linting errors
* Update changelog/fragments/1740166208-allow-deb-rpm-upgrade-with-tamper-protected-endpoint.yaml
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* Update dev-tools/packaging/templates/linux/postinstall.sh.tmpl
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* Update pkg/testing/tools/tools.go
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* Update dev-tools/packaging/templates/linux/postinstall.sh.tmpl
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* Update dev-tools/packaging/templates/linux/postinstall.sh.tmpl
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* Update pkg/testing/tools/tools.go
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
* enhancement(6394): updated print statement
* enhancement(6394): remove unnecessary command
* enhancement(6394): use addressFromPath and SetClient
* enhancement(6394): using service name, fixed indentation
* test(debug): add detailed logging to Fixture.SetClient and installDeb for agent client setup debugging
* Revert "test(debug): add detailed logging to Fixture.SetClient and installDeb for agent client setup debugging"
This reverts commit 390c561.
* enhancement(6394): renamed SetClient to SetDebRpmClient. Using hardcoded working dir as fixture working dir does not work for determining socket path
* enhancement(6394): consolidated same version upgrade and regular upgrdade test functions
* enhancement(6394): simplify preinstall script and enhance upgrade tests for tamper protection
- Removed unnecessary endpoint handling logic from preinstall script.
- Improved checks for service installation and status before upgrade.
- Updated upgrade test functions to handle stopping the endpoint service before upgrades.
* enhancement(6394): remove
mock systemctl script for tamper protection tests
* enhancement(6394): remove unused import
* enhancement(6394): fixed order of execution in preinstall
* enhancement(6394): added tests to make sure deb/rpm upgrades work when endpoint is not tamper protected
---------
Co-authored-by: Paolo Chilà <paolo.chila@elastic.co>
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
(cherry picked from commit 8a6531f)
# Conflicts:
# dev-tools/packaging/templates/linux/preinstall.sh.tmpl1 parent 404e19f commit 40b7e88
File tree
7 files changed
+539
-41
lines changed- changelog/fragments
- dev-tools/packaging/templates/linux
- pkg/testing
- tools
- testing/integration
7 files changed
+539
-41
lines changedLines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
16 | 45 | | |
17 | 46 | | |
18 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
5 | 32 | | |
6 | 33 | | |
7 | 34 | | |
| |||
11 | 38 | | |
12 | 39 | | |
13 | 40 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
21 | 48 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
27 | 54 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
35 | 62 | | |
36 | 63 | | |
37 | 64 | | |
| |||
52 | 79 | | |
53 | 80 | | |
54 | 81 | | |
| 82 | + | |
55 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
56 | 103 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
349 | | - | |
350 | 349 | | |
351 | 350 | | |
352 | 351 | | |
| |||
401 | 400 | | |
402 | 401 | | |
403 | 402 | | |
404 | | - | |
| 403 | + | |
| 404 | + | |
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| |||
419 | 419 | | |
420 | 420 | | |
421 | 421 | | |
422 | | - | |
423 | 422 | | |
424 | 423 | | |
425 | 424 | | |
| |||
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
552 | | - | |
553 | 551 | | |
554 | 552 | | |
555 | 553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | | - | |
| 321 | + | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | | - | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
432 | 433 | | |
433 | 434 | | |
434 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
435 | 449 | | |
436 | 450 | | |
437 | 451 | | |
| |||
465 | 479 | | |
466 | 480 | | |
467 | 481 | | |
468 | | - | |
| 482 | + | |
469 | 483 | | |
470 | 484 | | |
471 | 485 | | |
| |||
485 | 499 | | |
486 | 500 | | |
487 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
488 | 507 | | |
489 | 508 | | |
490 | 509 | | |
| |||
503 | 522 | | |
504 | 523 | | |
505 | 524 | | |
506 | | - | |
507 | | - | |
| 525 | + | |
| 526 | + | |
508 | 527 | | |
509 | | - | |
510 | | - | |
| 528 | + | |
| 529 | + | |
511 | 530 | | |
512 | 531 | | |
513 | 532 | | |
| |||
572 | 591 | | |
573 | 592 | | |
574 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
575 | 599 | | |
576 | 600 | | |
577 | 601 | | |
| |||
590 | 614 | | |
591 | 615 | | |
592 | 616 | | |
593 | | - | |
594 | | - | |
| 617 | + | |
| 618 | + | |
595 | 619 | | |
596 | | - | |
597 | | - | |
| 620 | + | |
| 621 | + | |
598 | 622 | | |
599 | 623 | | |
600 | 624 | | |
| |||
696 | 720 | | |
697 | 721 | | |
698 | 722 | | |
699 | | - | |
| 723 | + | |
700 | 724 | | |
701 | 725 | | |
702 | 726 | | |
| |||
799 | 823 | | |
800 | 824 | | |
801 | 825 | | |
802 | | - | |
| 826 | + | |
803 | 827 | | |
804 | 828 | | |
805 | 829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| |||
137 | 153 | | |
138 | 154 | | |
139 | 155 | | |
140 | | - | |
141 | 156 | | |
142 | 157 | | |
143 | 158 | | |
| |||
0 commit comments