mirror of
https://github.com/evilsocket/arc.git
synced 2024-05-26 22:37:37 +03:00
misc: refactored with go-bindata and go modules
This commit is contained in:
4
.github/ISSUE_TEMPLATE.md
vendored
4
.github/ISSUE_TEMPLATE.md
vendored
@@ -15,8 +15,8 @@ Please provide:
|
||||
* Contents of the json configuration file you are using (**remove the password hash before posting**).
|
||||
* Operating system and browser versions used as clients.
|
||||
* If possible, any javascript log on the browser developer console.
|
||||
* `uname -a` of the arcd server.
|
||||
* Debug output while reproducing the issue ( `arcd --log-debug ...` ).
|
||||
* `uname -a` of the arc server.
|
||||
* Debug output while reproducing the issue ( `arc --log-debug ...` ).
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -2,11 +2,12 @@
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
build
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
arcd/_dependencies
|
||||
arc/_dependencies
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
@@ -25,3 +26,12 @@ _testmain.go
|
||||
dist
|
||||
cryptojs_decrypt.js
|
||||
sample_config.json
|
||||
|
||||
_vendor
|
||||
arc
|
||||
config.json
|
||||
*.db
|
||||
gomake.json
|
||||
|
||||
.DS_Store
|
||||
.idea
|
||||
@@ -1,6 +1,6 @@
|
||||
builds:
|
||||
- main: arcd/main.go
|
||||
binary: arcd
|
||||
- main: cmd/arc/*.go
|
||||
binary: arc
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
@@ -40,4 +40,3 @@ archive:
|
||||
- README.md
|
||||
- Dockerfile
|
||||
- sample_config.json
|
||||
- arc/**/*
|
||||
|
||||
@@ -6,12 +6,8 @@ go:
|
||||
git:
|
||||
depth: 3
|
||||
|
||||
before_install:
|
||||
- cd arcd
|
||||
install:
|
||||
- make deps
|
||||
|
||||
go_import_path: github.com/evilsocket/arc
|
||||
- make
|
||||
|
||||
script:
|
||||
- make test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM golang
|
||||
ADD . /go/src/github.com/evilsocket/arc
|
||||
WORKDIR /go/src/github.com/evilsocket/arc/arcd
|
||||
COPY arcd/sample_config.json config.json
|
||||
WORKDIR /go/src/github.com/evilsocket/arc
|
||||
COPY sample_config.json config.json
|
||||
RUN make
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ./arcd -config config.json -app ../arc
|
||||
EXPOSE 8443
|
||||
ENTRYPOINT ./build/arc -config config.json
|
||||
37
Makefile
Normal file
37
Makefile
Normal file
@@ -0,0 +1,37 @@
|
||||
.PHONY: build test install
|
||||
|
||||
SRC_PATH=cmd/arc/*.go
|
||||
TARGET=arc
|
||||
PREFIX_DIR=/usr/local
|
||||
BIN_DIR=$(PREFIX_DIR)/bin
|
||||
CONFIG_DIR=$(PREFIX_DIR)/etc
|
||||
SERVICE_DIR=/lib/systemd/system
|
||||
SERVICE_LN_DIR=/etc/systemd/system
|
||||
|
||||
all: build
|
||||
|
||||
build: assets
|
||||
@mkdir -p build
|
||||
@go build $(FLAGS) -o build/$(TARGET) $(SRC_PATH)
|
||||
|
||||
assets: bindata
|
||||
@rm -rf webui/compiled.go
|
||||
@go-bindata -o webui/compiled.go -pkg webui webui/...
|
||||
|
||||
bindata:
|
||||
@go get -u github.com/jteeuwen/go-bindata/...
|
||||
|
||||
test:
|
||||
@go test $(SRC_PATH)/...
|
||||
|
||||
clean:
|
||||
@rm -rf build
|
||||
|
||||
install: build
|
||||
@echo "Installing $(TARGET) in $(PREFIX_DIR)"
|
||||
@install -D -m 744 build/$(TARGET) $(BIN_DIR)/$(TARGET)
|
||||
@setcap 'cap_net_bind_service=+ep' $(BIN_DIR)/$(TARGET)
|
||||
@install -D -m 644 sample_config.json $(CONFIG_DIR)/$(TARGET)/config.json
|
||||
@install -D -m 644 arc.service $(SERVICE_DIR)/arc.service
|
||||
@ln -s $(SERVICE_DIR)/arc.service $(SERVICE_LN_DIR)/arc.service || echo "symlink already exists...skipping"
|
||||
@echo "Done."
|
||||
36
README.md
36
README.md
@@ -12,7 +12,7 @@
|
||||
|
||||
---
|
||||
|
||||
Arc is a manager for your secrets made of `arcd`, a RESTful API server written in Go which exposes read and write primitives for encrypted records, and `arc`, the client application implemented in HTML5 and javascript, which runs in every modern browser and it is served by `arcd` itself.
|
||||
Arc is a manager for your secrets made of `arc`, a RESTful API server written in Go which exposes read and write primitives for encrypted records, and `arc`, the client application implemented in HTML5 and javascript, which runs in every modern browser and it is served by `arc` itself.
|
||||
|
||||
Records are generated, encrypted and decrypted **client side** by `arc` (with AES256 in GCM mode, using 10000 iterations for the PBKDF2 key derivation function, everything [WebCrypto](https://www.w3.org/TR/WebCryptoAPI/) based ), which offers an intuitive management system equipped with UI widgets including:
|
||||
|
||||
@@ -26,7 +26,7 @@ Records are generated, encrypted and decrypted **client side** by `arc` (with AE
|
||||
- Bitcoin wallet address with auto updating balance.
|
||||
- Manager for [Time-based One-time Password Algorithm (TOTP) codes](http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm) as per the [TOTP RFC Draft](http://tools.ietf.org/id/draft-mraihi-totp-timebased-06.html). This component produces the same codes as the Google Authenticator app and can be used for 2FA.
|
||||
|
||||
Elements can be created (with optional expiration dates), arranged and edited using `arc` and are stored on `arcd` as AES256 encrypted (and compressed) raw data.
|
||||
Elements can be created (with optional expiration dates), arranged and edited using `arc` and are stored on `arc` as AES256 encrypted (and compressed) raw data.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/evilsocket/arc/master/screenshot.png" alt="ARC"/>
|
||||
@@ -34,7 +34,7 @@ Elements can be created (with optional expiration dates), arranged and edited us
|
||||
|
||||
## Hardware?
|
||||
|
||||
Ideally `arcd` should run on a dedicated portable hardware like a Raspberry Pi Zero, for instance it is possible to simply access it via Bluetooth and a modern browser once configured [btnap](https://github.com/bablokb/pi-btnap), but precompiled versions are available for [several operating systems and architectures](https://github.com/evilsocket/arc/releases) (including ARM, ARM64 and MIPS) therefore Arc can run on pretty much everything with a CPU, from [your smartphone](https://twitter.com/evilsocket/status/942846649713426434), your router, your Mac or your Windows computer. As a rule of thumb, the more [isolated](https://en.wikipedia.org/wiki/Compartmentalization_(information_security)) the hardware is, the better.
|
||||
Ideally `arc` should run on a dedicated portable hardware like a Raspberry Pi Zero, for instance it is possible to simply access it via Bluetooth and a modern browser once configured [btnap](https://github.com/bablokb/pi-btnap), but precompiled versions are available for [several operating systems and architectures](https://github.com/evilsocket/arc/releases) (including ARM, ARM64 and MIPS) therefore Arc can run on pretty much everything with a CPU, from [your smartphone](https://twitter.com/evilsocket/status/942846649713426434), your router, your Mac or your Windows computer. As a rule of thumb, the more [isolated](https://en.wikipedia.org/wiki/Compartmentalization_(information_security)) the hardware is, the better.
|
||||
|
||||
The idea is to use Arc as a single storage and manager for your passwords, encrypted notes, files and `-all the secret things here-`.
|
||||
|
||||
@@ -44,19 +44,17 @@ The idea is to use Arc as a single storage and manager for your passwords, encry
|
||||
|
||||
## Usage
|
||||
|
||||
You can find binary releases of Arc [here](https://github.com/evilsocket/arc/releases), if instead you want to build it from source, make sure you have Go >= 1.8 installed and configured correctly, then clone this repository, install the dependencies and compile the `arcd` server component:
|
||||
You can find binary releases of Arc [here](https://github.com/evilsocket/arc/releases), if instead you want to build it from source, make sure you have Go >= 1.8 installed and configured correctly, then clone this repository, install the dependencies and compile the `arc` server component:
|
||||
|
||||
git clone https://github.com/evilsocket/arc $GOPATH/src/github.com/evilsocket/arc
|
||||
cd $GOPATH/src/github.com/evilsocket/arc/arcd
|
||||
make
|
||||
go get github.com/evilsocket/arc/cmd/arc
|
||||
|
||||
Once you either extracted the release archive or compiled it yourself, copy `sample_config.json` to a new `config.json` file and customize it. The most important fields to change are the `secret` ( a key used for token authentication ), the `username` and the `password`, which is the `bcrypt` hash of the authentication password you want to use, you can generate a new one with:
|
||||
|
||||
./arcd password "your-new-password" <optional-cost>
|
||||
arc password "your-new-password" <optional-cost>
|
||||
|
||||
Once everything is ready, youn can finally start the `arcd` server:
|
||||
Once everything is ready, youn can finally start the `arc` server:
|
||||
|
||||
./arcd -config config.json -app arc
|
||||
arc -config config.json -app arc
|
||||
|
||||
Now browse `https://localhost:8443/` ( or the address and port you configured ) and login with the configured credentials (make sure to add the generated HTTPS certificate as an exception in your browser).
|
||||
|
||||
@@ -117,8 +115,8 @@ It is necessary to change only the `username` and `password` access parameters o
|
||||
|
||||
| Configuration | Description |
|
||||
| ------------- | ------------- |
|
||||
| address | IP address to bind the `arcd` server to. |
|
||||
| port | TCP to bind the `arcd` server to. |
|
||||
| address | IP address to bind the `arc` server to. |
|
||||
| port | TCP to bind the `arc` server to. |
|
||||
| max\_req\_size | Maximum size in bytes to accept as a JSON request, it does not include record data. |
|
||||
| username | API access username. |
|
||||
| password | API access password `bcrypt` hash. |
|
||||
@@ -136,7 +134,7 @@ It is necessary to change only the `username` and `password` access parameters o
|
||||
| scheduler.reports.to | Destination email address. |
|
||||
| scheduler.reports.smtp | SMTP server information. |
|
||||
| scheduler.reports.pgp.enabled | If true, email notifications will be encrypted with PGP. |
|
||||
| scheduler.reports.pgp.keys.private | Path of the private key file to use to encrypt emails, if not found or empty it will be automatically generated by `arcd`. |
|
||||
| scheduler.reports.pgp.keys.private | Path of the private key file to use to encrypt emails, if not found or empty it will be automatically generated by `arc`. |
|
||||
| scheduler.reports.pgp.keys.public | Path of the PGP public key of the email notifications recipient. |
|
||||
| backups.enabled | Enable automatic backups. |
|
||||
| backups.period | Number of seconds between one backup and the next one. |
|
||||
@@ -178,11 +176,11 @@ Email reports can be optionally encrypted by the server using PGP, in this case
|
||||
|
||||
You can export stores and their encrypted records to a TAR file:
|
||||
|
||||
./arcd -config config.json -output ~/backup.tar -export
|
||||
./arc -config config.json -output ~/backup.tar -export
|
||||
|
||||
Exported archives can be later imported with:
|
||||
|
||||
./arcd -config config.json -import ~/backup.tar
|
||||
./arc -config config.json -import ~/backup.tar
|
||||
|
||||
## Useful Commands
|
||||
|
||||
@@ -190,14 +188,14 @@ Generate self signed certificate in order to use Arc on HTTPS:
|
||||
|
||||
openssl req -new -x509 -sha256 -key key.pem -out certificate-pem -days 365
|
||||
|
||||
Allow the `arcd` binary to bind to privileged ports without having root privileges (bind to port 443 for HTTPS without root):
|
||||
Allow the `arc` binary to bind to privileged ports without having root privileges (bind to port 443 for HTTPS without root):
|
||||
|
||||
sudo setcap 'cap_net_bind_service=+ep' arcd
|
||||
sudo setcap 'cap_net_bind_service=+ep' arc
|
||||
|
||||
Lines to add to `/etc/rc.local` in order to make arcd start at boot (running as `pi` user, configuration, logs and and ui are in the home folder):
|
||||
Lines to add to `/etc/rc.local` in order to make arc start at boot (running as `pi` user, configuration, logs and and ui are in the home folder):
|
||||
|
||||
export ARC=/home/pi/
|
||||
sudo -H -u pi bash -c "$ARC/arcd -config $ARC/config.json -app $ARC/arc -log-file $ARC/arcd.log &"
|
||||
sudo -H -u pi bash -c "$ARC/arc -config $ARC/config.json -app $ARC/arc -log-file $ARC/arc.log &"
|
||||
|
||||
## Bugs
|
||||
|
||||
|
||||
10
arc.service
Normal file
10
arc.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=arc server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
ExecStart=/usr/local/bin/arc -config /usr/local/etc/arc/config.json
|
||||
StandardOutput=syslog
|
||||
Restart=on-failure
|
||||
@@ -1,8 +0,0 @@
|
||||
# arc
|
||||
|
||||
This is the `arc` client application component.
|
||||
|
||||
## License
|
||||
|
||||
Arc was made with ♥ by [Simone Margaritelli](https://www.evilsocket.net/) and it is released under the GPL 3 license.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"name": "arc",
|
||||
"description": "Your secrets keeper.",
|
||||
"version": "1.3.2",
|
||||
"index": "index.html",
|
||||
"author": {
|
||||
"name": "Simone Margaritelli",
|
||||
"email": "evilsocket@gmail.com",
|
||||
"license": "GPL 3"
|
||||
}
|
||||
}
|
||||
|
||||
5
arcd/.gitignore
vendored
5
arcd/.gitignore
vendored
@@ -1,5 +0,0 @@
|
||||
_vendor
|
||||
arcd
|
||||
config.json
|
||||
*.db
|
||||
gomake.json
|
||||
@@ -1,52 +0,0 @@
|
||||
.PHONY: build fmt lint run test vet deps install
|
||||
|
||||
SRC_PATH=.
|
||||
TARGET=arcd
|
||||
PREFIX_DIR=/usr/local
|
||||
BIN_DIR=$(PREFIX_DIR)/bin
|
||||
CONFIG_DIR=$(PREFIX_DIR)/etc
|
||||
WEBAPP_DIR=$(PREFIX_DIR)/share
|
||||
SERVICE_DIR=/lib/systemd/system
|
||||
SERVICE_LN_DIR=/etc/systemd/system
|
||||
|
||||
default: build
|
||||
|
||||
build: deps fmt vet lint
|
||||
@go build $(FLAGS) -o $(TARGET) $(SRC_PATH)
|
||||
|
||||
vet:
|
||||
@go vet $(SRC_PATH)
|
||||
|
||||
fmt:
|
||||
@go fmt $(SRC_PATH)/...
|
||||
|
||||
lint:
|
||||
@golint $(SRC_PATH)
|
||||
|
||||
test:
|
||||
@go test $(SRC_PATH)/...
|
||||
|
||||
clean:
|
||||
@rm -rf $(TARGET)
|
||||
|
||||
deps:
|
||||
@go get github.com/gin-gonic/gin
|
||||
@go get gopkg.in/unrolled/secure.v1
|
||||
@go get github.com/theckman/go-flock
|
||||
@go get gopkg.in/gomail.v2
|
||||
@go get github.com/stretchr/testify/assert
|
||||
@go get github.com/dgrijalva/jwt-go
|
||||
@go get golang.org/x/crypto/...
|
||||
@go get golang.org/x/crypto/openpgp
|
||||
@go get -u github.com/golang/lint/golint
|
||||
|
||||
# runs on previlege
|
||||
install: build
|
||||
@echo "Installing $(TARGET) in $(PREFIX_DIR)"
|
||||
@install -D -m 744 $(SRC_PATH)/$(TARGET) $(BIN_DIR)/$(TARGET)
|
||||
@setcap 'cap_net_bind_service=+ep' $(BIN_DIR)/$(TARGET)
|
||||
@cp -r ../arc $(WEBAPP_DIR)/arc
|
||||
@install -D -m 644 $(SRC_PATH)/sample_config.json $(CONFIG_DIR)/$(TARGET)/config.json
|
||||
@install -D -m 644 $(SRC_PATH)/arcd@.service $(SERVICE_DIR)/arcd@.service
|
||||
@ln -s $(SERVICE_DIR)/arcd@.service $(SERVICE_LN_DIR)/arcd@.service || echo "symlink already exists...skipping"
|
||||
@echo "Done."
|
||||
@@ -1,8 +0,0 @@
|
||||
# arcd
|
||||
|
||||
This is the `arcd` server component.
|
||||
|
||||
## License
|
||||
|
||||
Arc was made with ♥ by [Simone Margaritelli](https://www.evilsocket.net/) and it is released under the GPL 3 license.
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Arc - Copyleft of Simone 'evilsocket' Margaritelli.
|
||||
* evilsocket at protonmail dot com
|
||||
* https://www.evilsocket.net/
|
||||
*
|
||||
* See LICENSE.
|
||||
*/
|
||||
package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const (
|
||||
kManifestFileName = "manifest.json"
|
||||
)
|
||||
|
||||
// Information about the author of the web application.
|
||||
type Author struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
License string `json:"license"`
|
||||
}
|
||||
|
||||
// Information about the web application.
|
||||
// swagger:response
|
||||
type Manifest struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Version string `json:"version"`
|
||||
Author Author `json:"author"`
|
||||
Index string `json:"index"`
|
||||
}
|
||||
|
||||
type App struct {
|
||||
Path string
|
||||
Manifest Manifest
|
||||
}
|
||||
|
||||
func Open(path string) (err error, app *App) {
|
||||
if path, err = utils.ExpandPath(path); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
log.Debugf("Loading web application from %s ...", log.Bold(path))
|
||||
|
||||
if utils.IsFolder(path) == false {
|
||||
err = fmt.Errorf("Path %s is not a folder.", path)
|
||||
return
|
||||
}
|
||||
|
||||
manifest_fn := path + "/" + kManifestFileName
|
||||
manifest := Manifest{
|
||||
Name: "?",
|
||||
Version: "0.0.0",
|
||||
Description: "",
|
||||
}
|
||||
|
||||
if utils.Exists(manifest_fn) {
|
||||
log.Debugf("Loading manifest from %s ...", log.Bold(manifest_fn))
|
||||
raw, ferr := ioutil.ReadFile(manifest_fn)
|
||||
if ferr != nil {
|
||||
err = ferr
|
||||
return
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(raw, &manifest); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
app = &App{
|
||||
Path: path,
|
||||
Manifest: manifest,
|
||||
}
|
||||
|
||||
return nil, app
|
||||
}
|
||||
|
||||
func (app *App) String() string {
|
||||
return fmt.Sprintf("%s v%s", app.Manifest.Name, app.Manifest.Version)
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
[Unit]
|
||||
Description=arcd server (%I)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=%i
|
||||
ExecStart=/usr/local/bin/arcd -config /usr/local/etc/arcd/config.json -app /usr/local/share/arc
|
||||
StandardOutput=syslog
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
DefaultInstance=pi
|
||||
@@ -1,24 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
confFile = "sample_config.json"
|
||||
appPath = "../arc"
|
||||
}
|
||||
|
||||
func TestHomeRoute(t *testing.T) {
|
||||
router := setupRouter()
|
||||
|
||||
w := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
router.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(t, 200, w.Code)
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"address": "0.0.0.0",
|
||||
"port": 8443,
|
||||
"secret": "",
|
||||
"certificate": "~/arcd-certificate.pem",
|
||||
"key": "~/arcd-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,
|
||||
"reports": {
|
||||
"enabled": false,
|
||||
"rate_limit": 60,
|
||||
"filter": [ "login_ok", "login_ko", "token_ko", "update", "record_expired" ],
|
||||
"to": "youremail@gmail.com",
|
||||
"smtp":{
|
||||
"address": "smtp.gmail.com",
|
||||
"port": 587,
|
||||
"username": "youremail@gmail.com",
|
||||
"password": "your smtp password"
|
||||
},
|
||||
"pgp": {
|
||||
"enabled": true,
|
||||
"keys":{
|
||||
"private": "~/server.private.key.asc",
|
||||
"public": "~/my.public.key.asc"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"backups": {
|
||||
"enabled": false,
|
||||
"period": 1800,
|
||||
"folder": "/some/backup/path/",
|
||||
"run": "scp arc-backup.tar user@backup-server:/media/arc_backup/"
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@ package backup
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"os/exec"
|
||||
"path"
|
||||
"runtime"
|
||||
@@ -2,34 +2,29 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/arc/arcd/app"
|
||||
"github.com/evilsocket/arc/arcd/backup"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/controllers"
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/middlewares"
|
||||
"github.com/evilsocket/arc/arcd/scheduler"
|
||||
"github.com/evilsocket/arc/arcd/tls"
|
||||
"github.com/evilsocket/arc/arcd/updater"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
"github.com/evilsocket/arc/backup"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/controllers"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/middlewares"
|
||||
"github.com/evilsocket/arc/scheduler"
|
||||
"github.com/evilsocket/arc/tls"
|
||||
"github.com/evilsocket/arc/updater"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/evilsocket/arc/webui"
|
||||
"github.com/gin-gonic/contrib/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
signals = make(chan os.Signal, 1)
|
||||
appPath = ""
|
||||
confFile = ""
|
||||
debug = false
|
||||
logfile = ""
|
||||
@@ -45,7 +40,6 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&appPath, "app", ".", "Path of the web application to serve.")
|
||||
flag.StringVar(&confFile, "config", "", "JSON configuration file.")
|
||||
flag.BoolVar(&noAuth, "no-auth", noAuth, "Disable authentication.")
|
||||
flag.BoolVar(&noUpdates, "no-updates", noUpdates, "Disable updates check.")
|
||||
@@ -59,15 +53,6 @@ func init() {
|
||||
flag.StringVar(&output, "output", output, "Export file name.")
|
||||
}
|
||||
|
||||
func arcSignalHandler() {
|
||||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
|
||||
s := <-signals
|
||||
log.Raw("\n")
|
||||
log.Importantf("RECEIVED SIGNAL: %s", s)
|
||||
db.Flush()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func setupLogging() {
|
||||
var err error
|
||||
|
||||
@@ -166,18 +151,44 @@ func setupTLS() {
|
||||
log.Importantf("TLS certificate fingerprint is %s", log.Bold(tlsFingerprint))
|
||||
}
|
||||
|
||||
type binaryFileSystem struct {
|
||||
fs http.FileSystem
|
||||
}
|
||||
|
||||
func (b *binaryFileSystem) Open(name string) (http.File, error) {
|
||||
return b.fs.Open(name)
|
||||
}
|
||||
|
||||
func (b *binaryFileSystem) Exists(prefix string, filepath string) bool {
|
||||
if p := strings.TrimPrefix(filepath, prefix); len(p) < len(filepath) {
|
||||
if _, err := b.fs.Open(p); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func BinaryFileSystem(root string) *binaryFileSystem {
|
||||
fs := &assetfs.AssetFS{
|
||||
Asset: webui.Asset,
|
||||
AssetDir: webui.AssetDir,
|
||||
Prefix: root}
|
||||
return &binaryFileSystem{
|
||||
fs,
|
||||
}
|
||||
}
|
||||
|
||||
func setupRouter() *gin.Engine {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
router = gin.New()
|
||||
|
||||
err, webapp := app.Open(appPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
router.Use(middlewares.Security(tlsFingerprint))
|
||||
router.Use(middlewares.ServeStatic("/", webapp.Path, webapp.Manifest.Index))
|
||||
|
||||
router.Use(static.Serve("/", BinaryFileSystem("webui")))
|
||||
|
||||
// router.Use(middlewares.ServeStatic("/", webapp.Path, webapp.Manifest.Index))
|
||||
|
||||
api := router.Group("/api")
|
||||
router.POST("/auth", controllers.Auth)
|
||||
@@ -188,10 +199,7 @@ func setupRouter() *gin.Engine {
|
||||
log.Importantf("API authentication is disabled.")
|
||||
}
|
||||
|
||||
controllers.App = webapp
|
||||
|
||||
api.GET("/status", controllers.GetStatus)
|
||||
api.GET("/manifest", controllers.GetManifest)
|
||||
api.GET("/config", controllers.GetConfig)
|
||||
|
||||
api.GET("/events/clear", controllers.ClearEvents)
|
||||
@@ -211,49 +219,3 @@ func setupRouter() *gin.Engine {
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) >= 3 && os.Args[1] == "password" {
|
||||
password := os.Args[2]
|
||||
cost := bcrypt.DefaultCost
|
||||
if len(os.Args) == 4 {
|
||||
n, err := strconv.Atoi(os.Args[3])
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
cost = n
|
||||
}
|
||||
fmt.Println(config.Conf.HashPassword(password, cost))
|
||||
return
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
|
||||
go arcSignalHandler()
|
||||
|
||||
setupLogging()
|
||||
|
||||
log.Infof("%s (%s %s) is starting ...", log.Bold(config.APP_NAME+" v"+config.APP_VERSION), runtime.GOOS, runtime.GOARCH)
|
||||
if confFile != "" {
|
||||
if err := config.Load(confFile); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
setupDatabase()
|
||||
setupScheduler()
|
||||
setupBackups()
|
||||
setupUpdates()
|
||||
setupTLS()
|
||||
setupRouter()
|
||||
|
||||
address := fmt.Sprintf("%s:%d", config.Conf.Address, config.Conf.Port)
|
||||
if address[0] == ':' {
|
||||
address = "0.0.0.0" + address
|
||||
}
|
||||
|
||||
log.Infof("Running on %s ...", log.Bold("https://"+address+"/"))
|
||||
if err := router.RunTLS(address, config.Conf.Certificate, config.Conf.Key); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -21,8 +21,8 @@ const (
|
||||
defAddress = "127.0.0.1"
|
||||
defPort = 8443
|
||||
defMaxReqSize = int64(512 * 1024)
|
||||
defCertificate = "arcd-tls-cert.pem"
|
||||
defKey = "arcd-tls-key.pem"
|
||||
defCertificate = "arc-tls-cert.pem"
|
||||
defKey = "arc-tls-key.pem"
|
||||
defDatabaseName = "arc.db"
|
||||
defUsername = "arc"
|
||||
defPassword = "$2a$10$gwnHUhLVV9tgPtZfX4.jDOz6qzGgRHZmtE2YpMr9K1RpIO71YJViO"
|
||||
@@ -11,8 +11,8 @@ var testConf = Configuration{
|
||||
Address: "127.0.0.1",
|
||||
Port: 8443,
|
||||
MaxReqSize: int64(512 * 1024),
|
||||
Certificate: "arcd-tls-cert.pem",
|
||||
Key: "arcd-tls-key.pem",
|
||||
Certificate: "arc-tls-cert.pem",
|
||||
Key: "arc-tls-key.pem",
|
||||
Database: "arc.db",
|
||||
Secret: "changeme",
|
||||
Username: "arc",
|
||||
@@ -8,6 +8,6 @@
|
||||
package config
|
||||
|
||||
const (
|
||||
APP_NAME = "arcd"
|
||||
APP_NAME = "arc"
|
||||
APP_VERSION = "1.3.2"
|
||||
)
|
||||
@@ -8,11 +8,11 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/middlewares"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/middlewares"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"strings"
|
||||
)
|
||||
@@ -25,11 +25,10 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/evilsocket/arc/arcd/app"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
@@ -42,7 +41,6 @@ type Status struct {
|
||||
Events *[]events.Event `json:"events"`
|
||||
}
|
||||
|
||||
var App *app.App
|
||||
var ServerStatus = Status{
|
||||
Online: true,
|
||||
Started: time.Now(),
|
||||
@@ -85,20 +83,6 @@ func ClearEvents(c *gin.Context) {
|
||||
c.JSON(200, ServerStatus)
|
||||
}
|
||||
|
||||
// swagger:route GET /api/manifest manifest getManifest
|
||||
//
|
||||
// Handler returning the current web application manifest.
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: Manifest
|
||||
func GetManifest(c *gin.Context) {
|
||||
log.Api(log.DEBUG, c, "Requested manifest.")
|
||||
c.JSON(200, App.Manifest)
|
||||
}
|
||||
|
||||
// swagger:route GET /api/config configuration getConfig
|
||||
//
|
||||
// Handler returning the current server configuration.
|
||||
@@ -10,10 +10,10 @@ package controllers
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"sort"
|
||||
"time"
|
||||
)
|
||||
@@ -9,7 +9,7 @@ package db
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -9,7 +9,7 @@ package db
|
||||
|
||||
import (
|
||||
"archive/tar"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -8,8 +8,8 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/theckman/go-flock"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -9,7 +9,7 @@ package db
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/theckman/go-flock"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
@@ -10,9 +10,9 @@ package db
|
||||
import (
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -8,9 +8,9 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
@@ -9,7 +9,7 @@ package events
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -10,10 +10,10 @@ package events
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/pgp"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/pgp"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"gopkg.in/gomail.v2"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -9,7 +9,7 @@ package events
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"html/template"
|
||||
)
|
||||
|
||||
15
go.mod
Normal file
15
go.mod
Normal file
@@ -0,0 +1,15 @@
|
||||
module github.com/evilsocket/arc
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect
|
||||
github.com/gin-gonic/contrib v0.0.0-20190923054218-35076c1b2bea // indirect
|
||||
github.com/gin-gonic/gin v1.4.0
|
||||
github.com/stretchr/testify v1.4.0 // indirect
|
||||
github.com/theckman/go-flock v0.7.1
|
||||
golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||
gopkg.in/unrolled/secure.v1 v1.0.0
|
||||
)
|
||||
48
go.sum
Normal file
48
go.sum
Normal file
@@ -0,0 +1,48 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 h1:t8FVkw33L+wilf2QiWkw0UV77qRpcH/JHPKGpKa2E8g=
|
||||
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
||||
github.com/gin-gonic/contrib v0.0.0-20190923054218-35076c1b2bea h1:tPQfr1S0mubDv/jvdbS1xbKOJzDgvIHi7db/MYr4EKg=
|
||||
github.com/gin-gonic/contrib v0.0.0-20190923054218-35076c1b2bea/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
|
||||
github.com/gin-gonic/gin v1.4.0 h1:3tMoCCfM7ppqsR0ptz/wi1impNpT7/9wQtMZ8lr1mCQ=
|
||||
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
|
||||
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
|
||||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/theckman/go-flock v0.7.1 h1:YdJyIjDuQdEU7voZ9YaeXSO4OnrxdI+WejPUwyZ/Txs=
|
||||
github.com/theckman/go-flock v0.7.1/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
|
||||
github.com/ugorji/go v1.1.4 h1:j4s+tAvLfL3bZyefP2SEWmhBzmuIlH/eqNuPdFPgngw=
|
||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f h1:kz4KIr+xcPUsI3VMoqWfPMvtnJ6MGfiVwsWSVzphMO4=
|
||||
golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ=
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
|
||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
|
||||
gopkg.in/unrolled/secure.v1 v1.0.0 h1:2HVb4NzBPCMbw7pL2Z/lh0IPNnLVUoONtgRbvLiDqE8=
|
||||
gopkg.in/unrolled/secure.v1 v1.0.0/go.mod h1:pg8V8gdKceNGAVsmUaeFnZ49s30z9L4RkCXd4Y8vEtU=
|
||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
@@ -9,10 +9,10 @@ package middlewares
|
||||
|
||||
import (
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -9,7 +9,7 @@ package middlewares
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"gopkg.in/unrolled/secure.v1"
|
||||
"strings"
|
||||
@@ -10,7 +10,7 @@ package middlewares
|
||||
// This middleware is a variation of github.com/gin-gonic/contrib/static
|
||||
// created because of this https://github.com/evilsocket/arc/issues/64
|
||||
import (
|
||||
// "github.com/evilsocket/arc/arcd/log"
|
||||
// "github.com/evilsocket/arc/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -1,31 +1,29 @@
|
||||
#!/bin/bash
|
||||
# nothing to see here, just a utility i use to create new releases ^_^
|
||||
|
||||
CURRENT_VERSION=$(cat arcd/config/version.go | grep APP_VERSION | cut -d '"' -f 2)
|
||||
VERSION_FILE=$(dirname "${BASH_SOURCE[0]}")/config/version.go
|
||||
echo "version file is $VERSION_FILE"
|
||||
CURRENT_VERSION=$(cat $VERSION_FILE | grep Version | cut -d '"' -f 2)
|
||||
TO_UPDATE=(
|
||||
arcd/config/version.go
|
||||
arc/manifest.json
|
||||
arc/js/version.js
|
||||
"$VERSION_FILE"
|
||||
webui/js/version.js
|
||||
)
|
||||
|
||||
echo -n "Current version is $CURRENT_VERSION, select new version: "
|
||||
echo -n "current version is $CURRENT_VERSION, select new version: "
|
||||
read NEW_VERSION
|
||||
echo "Creating version $NEW_VERSION ...\n"
|
||||
echo "creating version $NEW_VERSION ...\n"
|
||||
|
||||
for file in "${TO_UPDATE[@]}"
|
||||
do
|
||||
echo "Patching $file ..."
|
||||
sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" $file
|
||||
git add $file
|
||||
for file in "${TO_UPDATE[@]}"; do
|
||||
echo "patching $file ..."
|
||||
sed -i.bak "s/$CURRENT_VERSION/$NEW_VERSION/g" "$file"
|
||||
rm -rf "$file.bak"
|
||||
git add $file
|
||||
done
|
||||
|
||||
git commit -m "Releasing v$NEW_VERSION"
|
||||
git commit -m "releasing v$NEW_VERSION"
|
||||
git push
|
||||
|
||||
git tag -a v$NEW_VERSION -m "Release v$NEW_VERSION"
|
||||
git tag -a v$NEW_VERSION -m "release v$NEW_VERSION"
|
||||
git push origin v$NEW_VERSION
|
||||
|
||||
cp arcd/sample_config.json .
|
||||
rm -rf dist
|
||||
|
||||
echo "\nAll done, just run goreleaser now ^_^"
|
||||
echo
|
||||
echo "All done, v$NEW_VERSION released ^_^"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"crypto/rsa"
|
||||
_ "crypto/sha256"
|
||||
"fmt"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"golang.org/x/crypto/openpgp"
|
||||
"golang.org/x/crypto/openpgp/armor"
|
||||
"golang.org/x/crypto/openpgp/packet"
|
||||
@@ -9,8 +9,8 @@ package pgp
|
||||
|
||||
import (
|
||||
_ "crypto/sha256"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/utils"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/utils"
|
||||
_ "golang.org/x/crypto/ripemd160"
|
||||
"os"
|
||||
"path"
|
||||
@@ -24,11 +24,11 @@ func Setup(pgp *config.PGPConfig) error {
|
||||
|
||||
if pgp.Keys.Private == "" {
|
||||
cwd, _ := os.Getwd()
|
||||
pgp.Keys.Private = path.Join(cwd, "arcd-pgp-private.key")
|
||||
pgp.Keys.Private = path.Join(cwd, "arc-pgp-private.key")
|
||||
}
|
||||
|
||||
pgp.Keys.Private, _ = utils.ExpandPath(pgp.Keys.Private)
|
||||
public := path.Join(path.Dir(pgp.Keys.Private), "arcd-pgp-public.key")
|
||||
public := path.Join(path.Dir(pgp.Keys.Private), "arc-pgp-public.key")
|
||||
if utils.Exists(pgp.Keys.Private) == false {
|
||||
if err := GenerateKeys(pgp.Keys.Private, public); err != nil {
|
||||
return err
|
||||
@@ -61,12 +61,12 @@ tar -zxf $ARCHIVE_FILE -C $DEST_PATH
|
||||
|
||||
cd - &>/dev/null
|
||||
|
||||
echo "@ Stopping arcd ..."
|
||||
sudo killall -9 arcd &>/dev/null
|
||||
echo "@ Stopping arc ..."
|
||||
sudo killall -9 arc &>/dev/null
|
||||
|
||||
echo "@ Restarting ..."
|
||||
rm -rf $DEST_PATH/*.log
|
||||
sudo setcap 'cap_net_bind_service=+ep' $DEST_PATH/arcd
|
||||
sudo setcap 'cap_net_bind_service=+ep' $DEST_PATH/arc
|
||||
|
||||
sudo /etc/rc.local
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/db"
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/db"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -16,8 +16,8 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/pem"
|
||||
"errors"
|
||||
"github.com/evilsocket/arc/arcd/config"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/config"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"os"
|
||||
@@ -8,8 +8,8 @@
|
||||
package updater
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/events"
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/events"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"time"
|
||||
@@ -8,7 +8,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"github.com/evilsocket/arc/arcd/log"
|
||||
"github.com/evilsocket/arc/log"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
7171
webui/compiled.go
Normal file
7171
webui/compiled.go
Normal file
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 434 KiB After Width: | Height: | Size: 434 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user