forked from crowdsecurity/crowdsec
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: AlteredCoder Co-authored-by: erenJag
- Loading branch information
Showing
563 changed files
with
64,237 additions
and
10,588 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,90 @@ | ||
name: Hub-CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- wip_lapi | ||
- master | ||
pull_request: | ||
branches: | ||
- wip_lapi | ||
- master | ||
|
||
jobs: | ||
build: | ||
name: Install generated release and perform basic tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Build release | ||
run: BUILD_VERSION=xxx make release | ||
- name: Install release | ||
run: | | ||
cd crowdsec-xxx | ||
sudo bash -x ./wizard.sh --bininstall | ||
sudo cscli machines add -a | ||
- name: Post-installation check | ||
run: | | ||
sudo cscli hub update | ||
- name: Install collection | ||
run: | | ||
sudo cscli hub list -a | ||
sudo cscli parsers install crowdsecurity/syslog-logs crowdsecurity/sshd-logs crowdsecurity/dateparse-enrich | ||
sudo cscli scenarios install crowdsecurity/ssh-bf | ||
- name: Crowdsec start service | ||
run: | | ||
sudo systemctl start crowdsec | ||
- name: Generate fake ssh bf logs | ||
run: | | ||
for i in `seq 1 10` ; do | ||
echo `date '+%b %d %H:%M:%S '`'sd-126005 sshd[12422]: Invalid user netflix from 1.1.1.172 port 35424' >> ssh-bf.log | ||
done; | ||
- name: Process ssh-bf logs in time-machine | ||
run: | | ||
sudo crowdsec -file ./ssh-bf.log -type syslog -no-api | ||
- name: Cscli ban list check | ||
#check that we got the expected ban and that the filters are working properly | ||
run: | | ||
sudo cscli decisions list | ||
sudo cscli decisions list -o=json | jq -e '.[].decisions[0].value == "1.1.1.172"' | ||
sudo cscli decisions list -r 1.1.1.0/24 -o=json | jq -e '.[].decisions[0].value == "1.1.1.172"' | ||
sudo cscli decisions list -r 1.1.2.0/24 -o=json | jq -e '. == null' | ||
sudo cscli decisions list -i 1.1.1.172 -o=json | jq -e '.[].decisions[0].value == "1.1.1.172"' | ||
sudo cscli decisions list -i 1.1.1.173 -o=json | jq -e '. == null' | ||
- name: Cscli ban del check | ||
#check that the delete is working and that filters are working properly | ||
run: | | ||
sudo cscli decisions delete -i 1.1.1.173 | ||
sudo cscli decisions list -o=json | jq -e '.[].decisions[0].value == "1.1.1.172"' | ||
sudo cscli decisions delete -i 1.1.1.172 | ||
sudo cscli decisions list -o=json | jq -e '. == null' | ||
- name: Metrics check | ||
run: | | ||
sudo cscli metrics | ||
- name: Service stop & config change | ||
#shutdown the service, edit that acquisition.yaml | ||
run: | | ||
sudo systemctl stop crowdsec | ||
echo "" | sudo tee -a /etc/crowdsec/acquis.yaml > /dev/null | ||
echo "filename: /tmp/test.log" | sudo tee -a /etc/crowdsec/acquis.yaml > /dev/null | ||
echo "labels:" | sudo tee -a /etc/crowdsec/acquis.yaml > /dev/null | ||
echo " type: syslog" | sudo tee -a /etc/crowdsec/acquis.yaml > /dev/null | ||
touch /tmp/test.log | ||
- name: Service start & check | ||
run: | | ||
sudo systemctl start crowdsec || sudo journalctl -xe | ||
- name: Trigger events via normal acquisition | ||
run: | | ||
cat ssh-bf.log >> /tmp/test.log | ||
sleep 1 | ||
- name: Check results | ||
run: | | ||
sudo cscli decisions list -o=json | jq -e '.[].decisions[0].value == "1.1.1.172"' | ||
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 |
---|---|---|
|
@@ -27,9 +27,9 @@ jobs: | |
uses: jandelgado/[email protected] | ||
with: | ||
infile: coverage.out | ||
outfile: coverage.lcov | ||
outfile: coverage.txt | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: coverage.lcov | ||
path-to-lcov: coverage.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
ARG GOVERSION=1.14 | ||
|
||
FROM golang:${GOVERSION}-alpine AS build | ||
|
||
WORKDIR /go/src/crowdsec | ||
COPY . . | ||
|
||
RUN apk update && apk add git jq gcc libc-dev make bash gettext | ||
RUN BUILD_VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)" make release | ||
RUN /bin/bash wizard.sh --docker-mode | ||
RUN cscli hub update && cscli collections install crowdsecurity/linux | ||
|
||
FROM alpine:latest | ||
COPY --from=build /etc/crowdsec /etc/crowdsec | ||
COPY --from=build /var/lib/crowdsec /var/lib/crowdsec | ||
COPY --from=build /usr/local/bin/crowdsec /usr/local/bin/crowdsec | ||
COPY --from=build /usr/local/bin/cscli /usr/local/bin/cscli | ||
COPY --from=build /go/src/crowdsec/docker/docker_start.sh / | ||
COPY --from=build /go/src/crowdsec/docker/config.yaml /etc/crowdsec/config.yaml | ||
|
||
|
||
ENTRYPOINT /bin/sh docker_start.sh |
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.