fix: replaced deprecated function

This commit is contained in:
Simone Margaritelli
2024-04-04 15:16:09 -04:00
parent 80a5884f19
commit 04f6fb7270
4 changed files with 51 additions and 4 deletions

6
.gitignore vendored
View File

@@ -30,4 +30,8 @@ config.json
gomake.json
.DS_Store
.idea
.idea
dev_config.*
arc-tls-cert.pem
arc-tls-key.pem

View File

@@ -24,6 +24,9 @@ bindata:
test:
@go test ./...
run_dev: build
./build/$(TARGET) -config dev_config.toml
clean:
@rm -rf build

View File

@@ -10,11 +10,12 @@ package config
import (
"encoding/json"
"errors"
"os"
"github.com/evilsocket/arc/utils"
"github.com/evilsocket/islazy/log"
"github.com/evilsocket/islazy/tui"
"golang.org/x/crypto/bcrypt"
"io/ioutil"
)
const (
@@ -130,7 +131,7 @@ var Conf = Configuration{
// return err if secret param is empty
func Load(filename string) error {
log.Info("Loading configuration from %s ...", tui.Bold(filename))
raw, err := ioutil.ReadFile(filename)
raw, err := os.ReadFile(filename)
if err != nil {
return err
}
@@ -141,7 +142,7 @@ func Load(filename string) error {
}
if Conf.Secret == "" {
return errors.New("HMAC secret not found, please fill the 'secret' configuration field.")
return errors.New("HMAC secret not found, please fill the 'secret' configuration field")
}
// fix path

39
sample_config.toml Normal file
View File

@@ -0,0 +1,39 @@
address = "0.0.0.0"
port = 8_443
secret = ""
certificate = "~/arc-certificate.pem"
key = "~/arc-key.pem"
username = "arc"
password = "$2a$10$RuOcSEwPNNFlA/lxjpRY3.3J0tR0LG/FyfG/IXolgdDxPh7.urgGe"
database = "~/db"
token_duration = 60
compression = true
[scheduler]
enabled = true
period = 10
[scheduler.reports]
enabled = false
rate_limit = 60
filter = ["login_ok", "login_ko", "token_ko", "update", "record_expired"]
to = "youremail@gmail.com"
[scheduler.reports.smtp]
address = "smtp.gmail.com"
port = 587
username = "youremail@gmail.com"
password = "your smtp password"
[scheduler.reports.pgp]
enabled = true
[scheduler.reports.pgp.keys]
private = "~/server.private.key.asc"
public = "~/my.public.key.asc"
[backups]
enabled = false
period = 1_800
folder = "/some/backup/path/"
run = "scp arc-backup.tar user@backup-server:/media/arc_backup/"