Commit f42e98b
rzisholz
CP-21164: wire Conjur JWT config into the top-level CyberArk client
NewCyberArk and the agent config schema were still legacy-username/password-only
at the top level, even though the underlying authenticator selection (previous
PR) already supports Conjur JWT. Threads service_id/account/jwt_source/jwt_file_path
through cyberark.service_id in the agent config down to NewCyberArk, so the
config file is the single place an operator chooses which authentication method
to use.
config.go's call site and client_cyberark.go's signature change together —
splitting them across two PRs would leave one non-building at every commit
in between.
jwt_source validation now delegates to the shared cyberark.ValidateJWTSource
(previous PR) instead of re-implementing the same rule with different wording.
Requiring an auth method is now checked at config-validation time rather than
left to cyberark.selectAuthenticator alone — that only runs at first upload,
so a misconfigured agent could otherwise report healthy for up to a full
config.period before failing. Checks both ARK_USERNAME and ARK_SECRET, since
selectAuthenticator's hasUP requires both — checking only ARK_USERNAME would
pass validation and still fail at runtime for the one credential missing.
MachineHub's cluster_name fallback order is cluster_name > cluster_id >
ARK_USERNAME > empty. Explicit config always wins over the env var; the
ARK_USERNAME fallback exists only for pre-Conjur installs that set neither
config field — the chart never emits cluster_id, so a chart-installed agent
can't have set it. This also keeps a migrating install's reported name
unchanged: adding service_id to test Conjur alongside still-present
ARK_USERNAME, before also setting cluster_id, doesn't blank out the name.
Adds FakeCyberArkUsernamePassword and matching integration tests: the only
existing test exercising NewCyberArk's username/password path set
ARK_USERNAME/ARK_SECRET but also passed a non-empty serviceID, which
selectAuthenticator prioritises — so it silently tested Conjur regardless of
those env vars, leaving the legacy path with no coverage through this seam.
Also adds a two-upload regression test for the previous PR's cfg.Secret
zeroing fix, which a single-upload test can't catch.1 parent 7e4e017 commit f42e98b
5 files changed
Lines changed: 400 additions & 47 deletions
File tree
- pkg
- agent
- client
- testutil
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
104 | 121 | | |
105 | 122 | | |
106 | 123 | | |
| |||
459 | 476 | | |
460 | 477 | | |
461 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
462 | 482 | | |
463 | 483 | | |
464 | 484 | | |
| |||
753 | 773 | | |
754 | 774 | | |
755 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
756 | 780 | | |
757 | | - | |
758 | | - | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
759 | 793 | | |
760 | 794 | | |
761 | 795 | | |
762 | 796 | | |
763 | 797 | | |
764 | 798 | | |
765 | | - | |
766 | | - | |
| 799 | + | |
| 800 | + | |
767 | 801 | | |
768 | 802 | | |
769 | 803 | | |
| |||
773 | 807 | | |
774 | 808 | | |
775 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
776 | 831 | | |
777 | 832 | | |
778 | 833 | | |
| |||
987 | 1042 | | |
988 | 1043 | | |
989 | 1044 | | |
990 | | - | |
| 1045 | + | |
991 | 1046 | | |
992 | 1047 | | |
993 | 1048 | | |
| |||
0 commit comments