-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update tests add cmd/cercat/main.go add pkg/model add pkg/homoglyph and config pkg add pkg/slack update Dockerfile use pointer to hymoglyph map rename NewSlackPayload to NewPayload fix missing file use pointer to hymoglyph map
- Loading branch information
Amine Benseddik
committed
Jul 13, 2020
1 parent
b3bfd96
commit 56c2a73
Showing
14 changed files
with
419 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,15 @@ WORKDIR /src | |
ADD . . | ||
|
||
RUN go mod download | ||
RUN go build -ldflags="-s -w" -o cercat | ||
RUN go build -ldflags="-s -w" -o cercat ./cmd/cercat | ||
|
||
# Final Docker image | ||
FROM alpine AS final-stage | ||
LABEL MAINTAINER "Thomas Labarussias <[email protected]>" | ||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
# Create user falcosidekick | ||
# Create user cercat | ||
RUN addgroup -S cercat && adduser -u 1234 -S cercat -G cercat | ||
USER 1234 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"cercat/config" | ||
"cercat/lib" | ||
"fmt" | ||
"net/http" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/pkg/errors" | ||
"gopkg.in/alecthomas/kingpin.v2" | ||
) | ||
|
||
func main() { | ||
a := kingpin.New(filepath.Base(os.Args[0]), "") | ||
configFile := a.Flag("configfile", "config file").Short('c').ExistingFile() | ||
a.HelpFlag.Short('h') | ||
|
||
_, err := a.Parse(os.Args[1:]) | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, errors.Wrapf(err, "Error parsing commandline arguments")) | ||
a.Usage(os.Args[1:]) | ||
os.Exit(2) | ||
} | ||
|
||
cfg := config.GetConfig(configFile) | ||
go http.ListenAndServe("localhost:6060", nil) | ||
for i := 0; i < cfg.Workers; i++ { | ||
go lib.CertCheckWorker(cfg.Regexp, &cfg.Homoglyph, cfg.Messages, cfg.Buffer) | ||
} | ||
go lib.Notifier(cfg) | ||
lib.LoopCertStream(cfg.Messages) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.