Skip to content

Commit 94fb60d

Browse files
authored
Merge pull request #12 from webishdev/improve_ui
Improve UI
2 parents e932758 + c55390b commit 94fb60d

26 files changed

+442
-169
lines changed

README.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,27 @@
55

66
A web-based dashboard for `fail2ban` which uses the `/var/run/fail2ban/fail2ban.sock` socket to access `fail2ban`.
77

8-
![Screenshot of fail2ban-dashboard](./images/screenshot.png "Screenshot of fail2ban-dashboard")
9-
108
Tested with the following `fail2ban` versions
119
- `0.11.1`
1210
- `0.11.2`
1311
- `1.0.1`
1412
- `1.0.2`
1513
- `1.1.0`
1614

17-
if the deshboard should be used with another version, please switch off the version check with the `--skip-version-check` flag.
15+
If the dashboard should be used with another version, please switch off the version check with the `--skip-version-check` flag.
1816

19-
## Build the application
2017

21-
To build the application, use make with the following options:
2218

23-
```
24-
make
19+
## Screenshots
2520

26-
build - Build the application
27-
28-
test - Run tests
29-
30-
clean - Remove build artifacts
31-
32-
help - Show this help message
33-
34-
all - Run tests and build the application (default)
21+
### Light mode
22+
![Screenshot of fail2ban-dashboard overview light](./images/overview_light.png "Screenshot of fail2ban-dashboard overview light")
23+
![Screenshot of fail2ban-dashboard detail view light](./images/detail_light.png "Screenshot of fail2ban-dashboard detail view light")
3524

36-
```
25+
### Dark mode
3726

27+
![Screenshot of fail2ban-dashboard overview dark](./images/overview_dark.png "Screenshot of fail2ban-dashboard overview dark")
28+
![Screenshot of fail2ban-dashboard detail view dark](./images/detail_dark.png "Screenshot of fail2ban-dashboard detail view dark")
3829

3930
## Usage
4031

@@ -86,16 +77,37 @@ When only `--auth-password` is provided, the user will be named `admin`.
8677

8778
Environment variables can be used to set parameters without using command line flags.
8879

89-
- `F2BD_ADDRESS`
90-
- `F2BD_AUTH_PASSWORD`
91-
- `F2BD_AUTH_USER`
92-
- `F2BD_BASE_PATH`
93-
- `F2BD_CACHE_DIR`
94-
- `F2BD_LOG_LEVEL`
95-
- `F2BD_REFRESH_SECONDS`
96-
- `F2BD_SKIP_VERSION_CHECK`
97-
- `F2BD_SOCKET`
98-
- `F2BD_TRUST_PROXY_HEADERS`
80+
| Environment Variable | Command Line Flag | Description | Default |
81+
|---------------------|-------------------|-------------|---------|
82+
| `F2BD_ADDRESS` | `-a, --address` | Address to serve the dashboard on | `127.0.0.1:3000` |
83+
| `F2BD_AUTH_PASSWORD` | `--auth-password` | Password for basic auth | - |
84+
| `F2BD_AUTH_USER` | `--auth-user` | Username for basic auth | - |
85+
| `F2BD_BASE_PATH` | `--base-path` | Base path of the application | `/` |
86+
| `F2BD_CACHE_DIR` | `-c, --cache-dir` | Directory to cache GeoIP data | Current working directory |
87+
| `F2BD_LOG_LEVEL` | `--log-level` | Log level (trace, debug, info, warn, error) | `info` |
88+
| `F2BD_REFRESH_SECONDS` | `--refresh-seconds` | Refresh seconds for fail2ban data (10-600) | `30` |
89+
| `F2BD_SKIP_VERSION_CHECK` | `--skip-version-check` | Skip fail2ban version check | `false` |
90+
| `F2BD_SOCKET` | `-s, --socket` | Fail2ban socket path | `/var/run/fail2ban/fail2ban.sock` |
91+
| `F2BD_TRUST_PROXY_HEADERS` | `--trust-proxy-headers` | Trust proxy headers like X-Forwarded-For | `false` |
92+
93+
## Build the application
94+
95+
To build the application, use make with the following options:
96+
97+
```
98+
make
99+
100+
build - Build the application
101+
102+
test - Run tests
103+
104+
clean - Remove build artifacts
105+
106+
help - Show this help message
107+
108+
all - Run tests and build the application (default)
109+
110+
```
99111

100112
## Inspired by
101113

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[foo]
1+
[postfix]
22
enabled = true
3-
filter = foo
3+
filter = postfix
44
logpath = /var/log/test/foo.log
55
bantime = 600
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[bar]
1+
[sshd]
22
enabled = true
3-
filter = bar
3+
filter = sshd
44
logpath = /var/log/test/bar.log
55
bantime = 300

e2e/data/script/ban.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/bin/bash
22

3-
echo "will add bans to 'foo' jail"
4-
fail2ban-client set foo banip 103.59.94.155 196.251.84.225 218.92.0.247
5-
fail2ban-client status foo
3+
echo "will add bans to 'sshd' jail"
4+
fail2ban-client set sshd banip 103.59.94.155 196.251.84.225 218.92.0.247 44.231.227.33 104.196.24.229 154.190.185.126 127.217.0.15 197.173.0.4 202.126.174.77 174.70.43.130 120.250.129.97 141.168.79.112 193.233.120.0 111.5.45.94 82.17.151.75 142.46.182.191 131.44.117.63 40.246.204.192 14.177.157.243 233.74.69.192 65.207.100.156 42.200.128.129 16.10.242.64 184.241.184.255 64.174.224.44 164.41.52.195 47.197.77.185 141.152.72.48 149.178.179.27 164.97.136.88 176.233.216.19 157.36.244.51 109.49.24.54
5+
fail2ban-client status sshd
66

7-
echo "will add bans to 'bar' jail"
8-
fail2ban-client set bar banip 78.88.88.99
9-
fail2ban-client status bar
7+
echo "will add bans to 'postfix' jail"
8+
fail2ban-client set postfix banip 78.88.88.99 111.151.117.83 205.66.31.57 116.248.244.228 146.89.110.76 164.23.12.99 58.167.196.83 186.198.88.118 68.73.173.96 191.38.166.106 159.80.97.239 1.253.120.60 190.65.166.192
9+
fail2ban-client status postfix

e2e/docker-compose.debug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ services:
1212
F2BD_LOG_LEVEL: "debug"
1313
F2BD_SKIP_VERSION_CHECK: "true"
1414
F2BD_SOCKET: "/var/run/fail2ban/fail2ban.sock"
15+
F2BD_BASE_PATH: "/dashboard"
1516
ports:
1617
- "40000:40000"
1718
- "4000:3000"

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/webishdev/fail2ban-dashboard
33
go 1.25.5
44

55
require (
6-
github.com/gofiber/fiber/v2 v2.52.10
6+
github.com/gofiber/fiber/v2 v2.52.11
77
github.com/kisielk/og-rek v1.3.0
88
github.com/nlpodyssey/gopickle v0.3.0
99
github.com/spf13/cobra v1.10.2
@@ -14,25 +14,25 @@ require (
1414
github.com/andybalholm/brotli v1.2.0 // indirect
1515
github.com/aristanetworks/gomap v0.0.0-20240919214256-2b26376628e1 // indirect
1616
github.com/clipperhouse/stringish v0.1.1 // indirect
17-
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
17+
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
1818
github.com/fsnotify/fsnotify v1.9.0 // indirect
19-
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
19+
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
2020
github.com/google/uuid v1.6.0 // indirect
2121
github.com/inconshreveable/mousetrap v1.1.0 // indirect
22-
github.com/klauspost/compress v1.18.2 // indirect
22+
github.com/klauspost/compress v1.18.3 // indirect
2323
github.com/mattn/go-colorable v0.1.14 // indirect
2424
github.com/mattn/go-isatty v0.0.20 // indirect
2525
github.com/mattn/go-runewidth v0.0.19 // indirect
2626
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
27-
github.com/sagikazarmark/locafero v0.11.0 // indirect
27+
github.com/sagikazarmark/locafero v0.12.0 // indirect
2828
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
2929
github.com/spf13/afero v1.15.0 // indirect
3030
github.com/spf13/cast v1.10.0 // indirect
3131
github.com/spf13/pflag v1.0.10 // indirect
3232
github.com/subosito/gotenv v1.6.0 // indirect
3333
github.com/valyala/bytebufferpool v1.0.0 // indirect
34-
github.com/valyala/fasthttp v1.68.0 // indirect
34+
github.com/valyala/fasthttp v1.69.0 // indirect
3535
go.yaml.in/yaml/v3 v3.0.4 // indirect
36-
golang.org/x/sys v0.38.0 // indirect
37-
golang.org/x/text v0.30.0 // indirect
36+
golang.org/x/sys v0.40.0 // indirect
37+
golang.org/x/text v0.33.0 // indirect
3838
)

go.sum

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfa
66
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
77
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
88
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
9+
github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U=
10+
github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
911
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
1012
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1113
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -15,10 +17,14 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
1517
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
1618
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
1719
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
20+
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
21+
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
1822
github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw=
1923
github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
2024
github.com/gofiber/fiber/v2 v2.52.10 h1:jRHROi2BuNti6NYXmZ6gbNSfT3zj/8c0xy94GOU5elY=
2125
github.com/gofiber/fiber/v2 v2.52.10/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
26+
github.com/gofiber/fiber/v2 v2.52.11 h1:5f4yzKLcBcF8ha1GQTWB+mpblWz3Vz6nSAbTL31HkWs=
27+
github.com/gofiber/fiber/v2 v2.52.11/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
2228
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
2329
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
2430
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -31,6 +37,8 @@ github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3J
3137
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
3238
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
3339
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
40+
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
41+
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
3442
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
3543
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
3644
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -52,6 +60,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
5260
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
5361
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
5462
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
63+
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
64+
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
5565
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
5666
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
5767
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
@@ -75,15 +85,21 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
7585
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
7686
github.com/valyala/fasthttp v1.68.0 h1:v12Nx16iepr8r9ySOwqI+5RBJ/DqTxhOy1HrHoDFnok=
7787
github.com/valyala/fasthttp v1.68.0/go.mod h1:5EXiRfYQAoiO/khu4oU9VISC/eVY6JqmSpPJoHCKsz4=
88+
github.com/valyala/fasthttp v1.69.0 h1:fNLLESD2SooWeh2cidsuFtOcrEi4uB4m1mPrkJMZyVI=
89+
github.com/valyala/fasthttp v1.69.0/go.mod h1:4wA4PfAraPlAsJ5jMSqCE2ug5tqUPwKXxVj8oNECGcw=
7890
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
7991
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
8092
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
8193
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
8294
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8395
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
8496
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
97+
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
98+
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
8599
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
86100
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
101+
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
102+
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
87103
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
88104
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
89105
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

images/detail_dark.png

605 KB
Loading

0 commit comments

Comments
 (0)