main
Robert 5 months ago
parent c9c06cde15
commit 1440c48191
  1. 10
      README
  2. 8
      cliVault.service
  3. 1
      default.yaml
  4. 4
      server.go

@ -1,20 +1,28 @@
```
go get github.com/mattn/go-sqlite3
go get golang.org/x/crypto/bcrypt
go get gopkg.in/yaml.v2
go mod download golang.org/x/term
go mod tidy
go run keygen.go
go run chaKey.go
nano default.yaml
cp default.yaml config.yaml
sudo mkdir /etc/cliVault
sudo mv encrypted_aes_key.pem /etc/cliVault/
sudo cp default.yaml /etc/cliVault/config.yaml
sudo apt install gcc
CGO_ENABLED=1 go build -o cliVault server.go
sudo cp cliVault /usr/local/bin/
```
## Systemd Unit file:
```
nano cliVault.service
<Edit USERNAME to be your user>
sudo cp cliVault.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable cliVault

@ -7,16 +7,16 @@ Type=simple
# REPLACE all USERNAME with actual user
User=USERNAME
Group=USERNAME
WorkingDirectory=/home/USERNAME/cliVault
ExecStart=/home/USERNAME/cliVault/cliVault
WorkingDirectory=/etc/cliVault
ExecStart=/usr/local/bin/cliVault
Restart=on-failure
RestartSec=5s
# Security restrictions
PrivateTmp=true
ProtectSystem=strict
ProtectHome=false
ReadWritePaths=/home/USERNAME/cliVault
ProtectHome=true
ReadWritePaths=/etc/cliVault
NoNewPrivileges=true
PrivateDevices=true
ProtectKernelTunables=true

@ -1,3 +1,4 @@
AllowRegistration: true
auth:
ChaKey: "b107568bf716da40f5f17fea0e6608816020118d2c10b488ef9777b3d626126f"
PEM: "encrypted_aes_key.pem"

@ -26,10 +26,10 @@ import (
_ "github.com/mattn/go-sqlite3"
)
const AllowRegistration = true // Disable after users are added!
var ChaKey = []byte("")
type Config struct {
AllowRegistration bool `yaml:"AllowRegistration"`
Auth struct {
ChaKey string `yaml:"ChaKey"`
PEM string `yaml:"PEM"`
@ -357,7 +357,7 @@ func handleConnection(conn net.Conn, db *sql.DB) {
}
if req.Operation == "register" {
if AllowRegistration == false {
if config.AllowRegistration == false {
enc.Encode(Response{Message: "Registration Disabled!", Enc: ""})
return
}

Loading…
Cancel
Save