Skip to content

Commit 475af39

Browse files
nschmellerafiune
andauthored
feat(cli): add server_url to agent install cmd (#1224)
* feat(cli): add `server_url` to `agent install` cmd Follow-on to 070ce61. Fixes RAIN-54457 Signed-off-by: Nick Schmeller <[email protected]> * test(cli): fix integration help test with new flag info Signed-off-by: Salim Afiune Maya <[email protected]> --------- Signed-off-by: Nick Schmeller <[email protected]> Signed-off-by: Salim Afiune Maya <[email protected]> Co-authored-by: Salim Afiune Maya <[email protected]>
1 parent 694a15b commit 475af39

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

cli/cmd/agent.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ pass it directly via the argument.
161161
162162
lacework agent install <user@host:port>
163163
164+
To explicitly specify the server URL that the agent will connect to:
165+
166+
lacework agent install --server_url https://api.fra.lacework.net
167+
164168
To list all active agents in your environment.
165169
166170
lacework agent list
@@ -245,6 +249,9 @@ func init() {
245249
agentInstallCmd.Flags().BoolVar(&agentCmdState.InstallTrustHostKey,
246250
"trust_host_key", false, "automatically add host keys to the ~/.ssh/known_hosts file",
247251
)
252+
agentInstallCmd.Flags().StringVar(&agentCmdState.InstallServerURL,
253+
"server_url", "https://api.lacework.net", "server URL that agents will talk to, prefixed with `https://`",
254+
)
248255
}
249256

250257
func showAgentToken(_ *cobra.Command, args []string) error {

cli/cmd/agent_install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func installRemoteAgent(_ *cobra.Command, args []string) error {
135135
return err
136136
}
137137
}
138-
cmd := fmt.Sprintf("sudo sh -c \"curl -sSL %s | sh -s -- %s\"", agentInstallDownloadURL, token)
138+
cmd := fmt.Sprintf("sudo sh -c \"curl -sSL %s | sh -s -- %s -U %s\"", agentInstallDownloadURL, token, agentCmdState.InstallServerURL)
139139
return runInstallCommandOnRemoteHost(runner, cmd)
140140
}
141141

integration/test_resources/help/agent_install

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pass it directly via the argument.
2121

2222
lacework agent install <user@host:port>
2323

24+
To explicitly specify the server URL that the agent will connect to:
25+
26+
lacework agent install --server_url https://api.fra.lacework.net
27+
2428
To list all active agents in your environment.
2529

2630
lacework agent list
@@ -34,6 +38,7 @@ Flags:
3438
--force override any pre-installed agent
3539
-h, --help help for install
3640
-i, --identity_file string identity (private key) for public key authentication (default "~/.ssh/id_rsa")
41+
--server_url https:// server URL that agents will talk to, prefixed with https:// (default "https://api.lacework.net")
3742
--ssh_password string password for authentication
3843
--ssh_port int port to connect to on the remote host (default 22)
3944
--ssh_username string username to login with

0 commit comments

Comments
 (0)