Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
7ccd5688cc | |||
![]() |
cbf99996d8 | ||
![]() |
f1b9ac1027 | ||
![]() |
f52cca3841 | ||
![]() |
83906fe937 | ||
![]() |
ae6687b7d2 | ||
![]() |
4b52934656 |
3 changed files with 22 additions and 4 deletions
|
@ -3,6 +3,9 @@ FROM golang:alpine
|
||||||
# Update
|
# Update
|
||||||
RUN apk update upgrade;
|
RUN apk update upgrade;
|
||||||
|
|
||||||
|
# Install git
|
||||||
|
RUN apk add git
|
||||||
|
|
||||||
# Set timezone to Europe/Zurich
|
# Set timezone to Europe/Zurich
|
||||||
RUN apk add tzdata
|
RUN apk add tzdata
|
||||||
RUN ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
|
RUN ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
|
||||||
|
@ -21,8 +24,9 @@ RUN freshclam --quiet --no-dns
|
||||||
|
|
||||||
# Build go package
|
# Build go package
|
||||||
ADD . /go/src/clamav-rest/
|
ADD . /go/src/clamav-rest/
|
||||||
|
RUN go get github.com/dutchcoders/go-clamd
|
||||||
ADD ./server.* /etc/ssl/clamav-rest/
|
ADD ./server.* /etc/ssl/clamav-rest/
|
||||||
RUN cd /go/src/clamav-rest && go build -v
|
RUN cd /go/src/clamav-rest && go mod init && go mod vendor && go build -v
|
||||||
|
|
||||||
COPY entrypoint.sh /usr/bin/
|
COPY entrypoint.sh /usr/bin/
|
||||||
RUN mv /go/src/clamav-rest/clamav-rest /usr/bin/ && rm -Rf /go/src/clamav-rest
|
RUN mv /go/src/clamav-rest/clamav-rest /usr/bin/ && rm -Rf /go/src/clamav-rest
|
||||||
|
@ -43,6 +47,6 @@ ENV MAX_PARTITIONS=50
|
||||||
ENV MAX_ICONSPE=100
|
ENV MAX_ICONSPE=100
|
||||||
ENV PCRE_MATCHLIMIT=100000
|
ENV PCRE_MATCHLIMIT=100000
|
||||||
ENV PCRE_RECMATCHLIMIT=2000
|
ENV PCRE_RECMATCHLIMIT=2000
|
||||||
ENV SIGNATURE_CHECKS=24
|
ENV SIGNATURE_CHECKS=2
|
||||||
|
|
||||||
ENTRYPOINT [ "entrypoint.sh" ]
|
ENTRYPOINT [ "entrypoint.sh" ]
|
14
README.md
14
README.md
|
@ -8,8 +8,9 @@
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Environment Variables](#environment-variables)
|
- [Environment Variables](#environment-variables)
|
||||||
- [Networking](#networking)
|
- [Networking](#networking)
|
||||||
- [Maintenance](#maintenance)
|
- [Maintenance / Monitoring](#maintenance--monitoring)
|
||||||
- [Shell Access](#shell-access)
|
- [Shell Access](#shell-access)
|
||||||
|
|
||||||
- [Developing](#developing)
|
- [Developing](#developing)
|
||||||
- [References](#references)
|
- [References](#references)
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ Below is the complete list of available options that can be used to customize yo
|
||||||
|-----------|-------------|
|
|-----------|-------------|
|
||||||
| `3310` | ClamD Listening Port |
|
| `3310` | ClamD Listening Port |
|
||||||
|
|
||||||
# Maintenance
|
# Maintenance / Monitoring
|
||||||
|
|
||||||
## Shell Access
|
## Shell Access
|
||||||
|
|
||||||
|
@ -143,6 +144,15 @@ For debugging and maintenance purposes you may want access the containers shell.
|
||||||
```bash
|
```bash
|
||||||
docker exec -it (whatever your container name is e.g. clamav-rest) /bin/sh
|
docker exec -it (whatever your container name is e.g. clamav-rest) /bin/sh
|
||||||
```
|
```
|
||||||
|
## Prometheus
|
||||||
|
|
||||||
|
[Prometheus metrics](https://prometheus.io/docs/guides/go-application/) were implemented, which can be retrieved as follows
|
||||||
|
|
||||||
|
**HTTP**:
|
||||||
|
curl http://localhost:9000/metrics
|
||||||
|
|
||||||
|
**HTTPS:**
|
||||||
|
curl https://localhost:9443/metrics
|
||||||
|
|
||||||
# Developing
|
# Developing
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dutchcoders/go-clamd"
|
"github.com/dutchcoders/go-clamd"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
)
|
)
|
||||||
|
|
||||||
var opts map[string]string
|
var opts map[string]string
|
||||||
|
@ -184,6 +185,9 @@ func main() {
|
||||||
http.HandleFunc("/scanPath", scanPathHandler)
|
http.HandleFunc("/scanPath", scanPathHandler)
|
||||||
http.HandleFunc("/", home)
|
http.HandleFunc("/", home)
|
||||||
|
|
||||||
|
// Prometheus metrics
|
||||||
|
http.Handle("/metrics", promhttp.Handler())
|
||||||
|
|
||||||
// Start the HTTPS server in a goroutine
|
// Start the HTTPS server in a goroutine
|
||||||
go http.ListenAndServeTLS(SSL_PORT, "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)
|
go http.ListenAndServeTLS(SSL_PORT, "/etc/ssl/clamav-rest/server.crt", "/etc/ssl/clamav-rest/server.key", nil)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue