diff --git a/pkg/cwhub/cwhub.go b/pkg/cwhub/cwhub.go index aff0b1f27..b8dac1935 100644 --- a/pkg/cwhub/cwhub.go +++ b/pkg/cwhub/cwhub.go @@ -26,7 +26,7 @@ var ItemTypes = []string{PARSERS, PARSERS_OVFLW, SCENARIOS, COLLECTIONS} var hubIdx map[string]map[string]Item -var RawFileURLTemplate = "https://raw.githubusercontent.com/crowdsecurity/hub/%s/%s" +var RawFileURLTemplate = "https://hub-cdn.crowdsec.net/%s/%s" var HubBranch = "master" var HubIndexFile = ".index.json" diff --git a/pkg/cwhub/cwhub_test.go b/pkg/cwhub/cwhub_test.go index a5c47b57d..867fc6f33 100644 --- a/pkg/cwhub/cwhub_test.go +++ b/pkg/cwhub/cwhub_test.go @@ -386,7 +386,7 @@ func (t *mockTransport) RoundTrip(req *http.Request) (*http.Response, error) { log.Printf("---> %s", req.URL.Path) /*FAKE PARSER*/ - if req.URL.Path == "/crowdsecurity/hub/master/parsers/s01-parse/crowdsecurity/foobar_parser.yaml" { + if req.URL.Path == "/master/parsers/s01-parse/crowdsecurity/foobar_parser.yaml" { responseBody = `onsuccess: next_stage filter: evt.Parsed.program == 'foobar_parser' name: crowdsecurity/foobar_parser @@ -397,7 +397,7 @@ grok: apply_on: message ` - } else if req.URL.Path == "/crowdsecurity/hub/master/parsers/s01-parse/crowdsecurity/foobar_subparser.yaml" { + } else if req.URL.Path == "/master/parsers/s01-parse/crowdsecurity/foobar_subparser.yaml" { responseBody = `onsuccess: next_stage filter: evt.Parsed.program == 'foobar_parser' name: crowdsecurity/foobar_parser @@ -409,19 +409,19 @@ grok: ` /*FAKE SCENARIO*/ - } else if req.URL.Path == "/crowdsecurity/hub/master/scenarios/crowdsecurity/foobar_scenario.yaml" { + } else if req.URL.Path == "/master/scenarios/crowdsecurity/foobar_scenario.yaml" { responseBody = `filter: true name: crowdsecurity/foobar_scenario` /*FAKE COLLECTIONS*/ - } else if req.URL.Path == "/crowdsecurity/hub/master/collections/crowdsecurity/foobar.yaml" { + } else if req.URL.Path == "/master/collections/crowdsecurity/foobar.yaml" { responseBody = ` blah: blalala qwe: jejwejejw` - } else if req.URL.Path == "/crowdsecurity/hub/master/collections/crowdsecurity/foobar_subcollection.yaml" { + } else if req.URL.Path == "/master/collections/crowdsecurity/foobar_subcollection.yaml" { responseBody = ` blah: blalala qwe: jejwejejw` - } else if req.URL.Path == "/crowdsecurity/hub/master/.index.json" { + } else if req.URL.Path == "/master/.index.json" { responseBody = `{ "collections": { diff --git a/pkg/cwhub/download_test.go b/pkg/cwhub/download_test.go index 15ba5a64c..156c41322 100644 --- a/pkg/cwhub/download_test.go +++ b/pkg/cwhub/download_test.go @@ -22,7 +22,7 @@ func TestDownloadHubIdx(t *testing.T) { //bad domain fmt.Println("Test 'bad domain'") - RawFileURLTemplate = "https://baddomain/crowdsecurity/hub/%s/%s" + RawFileURLTemplate = "https://baddomain/%s/%s" ret, err = DownloadHubIdx(&csconfig.Hub{}) if err == nil || !strings.HasPrefix(fmt.Sprintf("%s", err), "failed http request for hub index: Get") { log.Errorf("unexpected error %s", err) diff --git a/pkg/cwversion/version.go b/pkg/cwversion/version.go index 4ac64d1ec..472c5dbba 100644 --- a/pkg/cwversion/version.go +++ b/pkg/cwversion/version.go @@ -84,7 +84,7 @@ func Statisfies(strvers string, constraint string) (bool, error) { func Latest() (string, error) { latest := make(map[string]interface{}) - resp, err := http.Get("https://api.github.com/repos/crowdsecurity/crowdsec/releases/latest") + resp, err := http.Get("https://version.crowdsec.net/latest") if err != nil { return "", err }