dashboard: Can restrict access by IP

This commit is contained in:
nemunaire 2022-06-06 11:02:35 +02:00
parent 437ed4d393
commit 0e6a6893f1
2 changed files with 52 additions and 4 deletions

View file

@ -70,6 +70,7 @@ func main() {
// Read parameters from command line
var bind = flag.String("bind", "127.0.0.1:8082", "Bind port/socket")
htpasswd_file := flag.String("htpasswd", "", "Restrict access with password, Apache htpasswd format")
restrict_ip := flag.String("restrict-to-ips", "", "Restrict access to IP listed in this JSON array")
flag.StringVar(&baseURL, "baseurl", baseURL, "URL prepended to each URL")
staticDir := flag.String("static", "./htdocs-dashboard/", "Directory containing static files")
flag.StringVar(&fic.FilesDir, "files", fic.FilesDir, "Base directory where found challenges files, local part")
@ -119,7 +120,7 @@ func main() {
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, syscall.SIGTERM)
app := NewApp(htpasswd_file, baseURL, *bind)
app := NewApp(htpasswd_file, restrict_ip, baseURL, *bind)
go app.Start()
// Wait shutdown signal