Skip to content

Commit 34e175c

Browse files
committed
remove authentication when downloading dependencies from agent
1 parent 5f90dd9 commit 34e175c

6 files changed

Lines changed: 11 additions & 26 deletions

File tree

agent/serv/clean-old.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,8 @@ func CleanOldServices(cnf *config.Config) {
5151

5252
if oldVersion {
5353
utils.Logger.Info("old version of agent found, downloading new version")
54-
headers := map[string]string{
55-
"key": cnf.AgentKey,
56-
"id": fmt.Sprintf("%v", cnf.AgentID),
57-
"type": "agent",
58-
}
59-
6054
if runtime.GOOS != "darwin" {
61-
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, fmt.Sprintf(config.UpdaterSelf, "")), headers, fmt.Sprintf(config.UpdaterSelf, "_new"), utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
55+
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, fmt.Sprintf(config.UpdaterSelf, "")), map[string]string{}, fmt.Sprintf(config.UpdaterSelf, "_new"), utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
6256
utils.Logger.LogF(100, "error downloading updater: %v", err)
6357
return
6458
}

agent/updates/dependencies.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ import (
1212
)
1313

1414
func DownloadFirstDependencies(address string, authKey string, insecure bool) error {
15-
headers := map[string]string{"connection-key": authKey}
16-
17-
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, address, config.DependenciesPort, "version.json"), headers, "version.json", utils.GetMyPath(), insecure); err != nil {
15+
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, address, config.DependenciesPort, "version.json"), map[string]string{}, "version.json", utils.GetMyPath(), insecure); err != nil {
1816
return fmt.Errorf("error downloading version.json : %v", err)
1917
}
2018

2119
dependFiles := config.DependFiles
2220
for _, file := range dependFiles {
23-
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, address, config.DependenciesPort, file), headers, file, utils.GetMyPath(), insecure); err != nil {
21+
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, address, config.DependenciesPort, file), map[string]string{}, file, utils.GetMyPath(), insecure); err != nil {
2422
return fmt.Errorf("error downloading file %s: %v", file, err)
2523
}
2624
}

agent/updates/update.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ func UpdateDependencies(cnf *config.Config) {
2929
for {
3030
time.Sleep(checkEvery)
3131

32-
headers := map[string]string{
33-
"key": cnf.AgentKey,
34-
"id": fmt.Sprintf("%v", cnf.AgentID),
35-
"type": "agent",
36-
}
37-
38-
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, "version.json"), headers, "version_new.json", utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
32+
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, "version.json"), map[string]string{}, "version_new.json", utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
3933
utils.Logger.ErrorF("error downloading version.json: %v", err)
4034
continue
4135
}
@@ -48,7 +42,7 @@ func UpdateDependencies(cnf *config.Config) {
4842

4943
if newVersion.Version != currentVersion.Version {
5044
utils.Logger.Info("New version of agent found: %s", newVersion.Version)
51-
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, fmt.Sprintf(config.ServiceFile, "")), headers, fmt.Sprintf(config.ServiceFile, "_new"), utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
45+
if err := utils.DownloadFile(fmt.Sprintf(config.DependUrl, cnf.Server, config.DependenciesPort, fmt.Sprintf(config.ServiceFile, "")), map[string]string{}, fmt.Sprintf(config.ServiceFile, "_new"), utils.GetMyPath(), cnf.SkipCertValidation); err != nil {
5246
utils.Logger.ErrorF("error downloading agent: %v", err)
5347
continue
5448
}

frontend/src/app/app-module/guides/guide-as400/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const PLATFORM = [
55
name: 'WINDOWS',
66
install: `New-Item -ItemType Directory -Force -Path "C:\\Program Files\\UTMStack\\UTMStack Collectors\\AS400"; ` +
77
`cd "C:\\Program Files\\UTMStack\\UTMStack Collectors\\AS400"; ` +
8-
`& curl.exe -k -H "connection-key: <secret>V_TOKEN</secret>" -o ".\\windows-as400-collector.zip" ` +
8+
`& curl.exe -k -o ".\\windows-as400-collector.zip" ` +
99
`"https://V_IP:9001/private/dependencies/collector/windows-as400-collector.zip"; ` +
1010
`Expand-Archive -Path ".\\windows-as400-collector.zip" -DestinationPath "."; ` +
1111
`Remove-Item ".\\windows-as400-collector.zip"; Start-Process ".\\utmstack_collectors_installer.exe" ` +
@@ -30,7 +30,7 @@ export const PLATFORM = [
3030
name: 'LINUX UBUNTU',
3131
install: `sudo bash -c "apt update -y && apt install wget unzip -y && mkdir -p ` +
3232
`/opt/utmstack-linux-collectors/as400 && cd /opt/utmstack-linux-collectors/as400 && ` +
33-
`wget --no-check-certificate --header="connection-key: <secret>V_TOKEN</secret>"` +
33+
`wget --no-check-certificate ` +
3434
`https://V_IP:9001/private/dependencies/collector/linux-as400-collector.zip ` +
3535
`&& unzip linux-as400-collector.zip && rm linux-as400-collector.zip && chmod -R 777 ` +
3636
`utmstack_collectors_installer && ./utmstack_collectors_installer install as400 ` +

frontend/src/app/app-module/guides/guide-linux-agent/guide-linux-agent.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class GuideLinuxAgentComponent implements OnInit {
3737
const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host;
3838

3939
return `sudo bash -c "apt update -y && apt install wget -y && mkdir -p /opt/utmstack-linux-agent && \
40-
wget --no-check-certificate --header='connection-key: <secret>${this.token}</secret>' -P /opt/utmstack-linux-agent \
40+
wget --no-check-certificate -P /opt/utmstack-linux-agent \
4141
https://${ip}:9001/private/dependencies/agent/${installerName} && \
4242
chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \
4343
/opt/utmstack-linux-agent/${installerName} install ${ip} <secret>${this.token}</secret> yes"`;
@@ -47,7 +47,7 @@ export class GuideLinuxAgentComponent implements OnInit {
4747
const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host;
4848

4949
return `sudo bash -c "yum install wget -y && mkdir -p /opt/utmstack-linux-agent && \
50-
wget --no-check-certificate --header='connection-key: <secret>${this.token}</secret>' -P /opt/utmstack-linux-agent \
50+
wget --no-check-certificate -P /opt/utmstack-linux-agent \
5151
https://${ip}:9001/private/dependencies/agent/${installerName} && \
5252
chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \
5353
/opt/utmstack-linux-agent/${installerName} install ${ip} <secret>${this.token}</secret> yes"`;
@@ -57,7 +57,7 @@ export class GuideLinuxAgentComponent implements OnInit {
5757
const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host;
5858

5959
return `sudo bash -c "dnf install wget -y && mkdir -p /opt/utmstack-linux-agent && \
60-
wget --no-check-certificate --header='connection-key: <secret>${this.token}</secret>' -P /opt/utmstack-linux-agent \
60+
wget --no-check-certificate -P /opt/utmstack-linux-agent \
6161
https://${ip}:9001/private/dependencies/agent/${installerName} && \
6262
chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \
6363
/opt/utmstack-linux-agent/${installerName} install ${ip} <secret>${this.token}</secret> yes"`;

frontend/src/app/app-module/guides/guide-winlogbeat/guide-winlogbeat.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export class GuideWinlogbeatComponent implements OnInit {
5656
const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host;
5757

5858
return `New-Item -ItemType Directory -Force -Path "C:\\Program Files\\UTMStack\\UTMStack Agent"; ` +
59-
`& curl.exe -k -H "connection-key: <secret>${this.token}</secret>" ` +
60-
`-o "C:\\Program Files\\UTMStack\\UTMStack Agent\\${arch}" ` +
59+
`& curl.exe -k -o "C:\\Program Files\\UTMStack\\UTMStack Agent\\${arch}" ` +
6160
`"https://${ip}:9001/private/dependencies/agent/${arch}"; ` +
6261
`Start-Process "C:\\Program Files\\UTMStack\\UTMStack Agent\\${arch}" ` +
6362
`-ArgumentList 'install', '${ip}', '<secret>${this.token}</secret>', 'yes' -NoNewWindow -Wait`;

0 commit comments

Comments
 (0)