Compare commits
7 Commits
feature/te
...
2023.10.13
Author | SHA1 | Date | |
---|---|---|---|
752f1aed02 | |||
9068203e71 | |||
a84fa05c27 | |||
6c78bc5c7c | |||
75cab3264f | |||
1a270fa4d8 | |||
6318a8b497 |
@ -105,6 +105,9 @@ nfpms:
|
||||
file_info:
|
||||
mode: 0755
|
||||
packager: apk
|
||||
- src: misc/packaging/openrc/emissary-server.logrotate.conf
|
||||
dst: /etc/logrotate.d/emissary-server
|
||||
packager: apk
|
||||
- dst: /var/lib/emissary
|
||||
type: dir
|
||||
file_info:
|
||||
@ -147,5 +150,8 @@ nfpms:
|
||||
file_info:
|
||||
mode: 0755
|
||||
packager: apk
|
||||
- src: misc/packaging/openrc/emissary-agent.logrotate.conf
|
||||
dst: /etc/logrotate.d/emissary-agent
|
||||
packager: apk
|
||||
scripts:
|
||||
postinstall: "misc/packaging/common/postinstall-agent.sh"
|
||||
|
1
Makefile
1
Makefile
@ -126,6 +126,7 @@ load-sample-specs:
|
||||
cat misc/spec-samples/app.emissary.cadoles.com.json | ./bin/server api agent spec update -a $(AGENT_ID) --no-patch --spec-data - --spec-name app.emissary.cadoles.com
|
||||
cat misc/spec-samples/proxy.emissary.cadoles.com.json | ./bin/server api agent spec update -a $(AGENT_ID) --no-patch --spec-data - --spec-name proxy.emissary.cadoles.com
|
||||
cat misc/spec-samples/mdns.emissary.cadoles.com.json | ./bin/server api agent spec update -a $(AGENT_ID) --no-patch --spec-data - --spec-name mdns.emissary.cadoles.com
|
||||
cat misc/spec-samples/uci.emissary.cadoles.com.json | ./bin/server api agent spec update -a $(AGENT_ID) --no-patch --spec-data - --spec-name uci.emissary.cadoles.com
|
||||
|
||||
version: .mktools
|
||||
@echo $(MKT_PROJECT_VERSION)
|
||||
|
6
go.mod
6
go.mod
@ -3,7 +3,7 @@ module forge.cadoles.com/Cadoles/emissary
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20230426135323-17808d14c978
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20231003032536-4c6e979bb6bf
|
||||
github.com/Masterminds/sprig/v3 v3.2.3
|
||||
github.com/alecthomas/participle/v2 v2.0.0-beta.5
|
||||
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
|
||||
@ -37,6 +37,7 @@ require (
|
||||
github.com/barnybug/go-cast v0.0.0-20201201064555-a87ccbc26692 // indirect
|
||||
github.com/dop251/goja_nodejs v0.0.0-20230320130059-dcf93ba651dd // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.1 // indirect
|
||||
github.com/getsentry/sentry-go v0.25.0 // indirect
|
||||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/google/pprof v0.0.0-20230309165930-d61513b1440d // indirect
|
||||
@ -45,6 +46,7 @@ require (
|
||||
github.com/huandu/xstrings v1.3.3 // indirect
|
||||
github.com/igm/sockjs-go/v3 v3.0.2 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/keegancsmith/rpc v1.3.0 // indirect
|
||||
github.com/miekg/dns v1.1.53 // indirect
|
||||
github.com/mitchellh/copystructure v1.0.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.0 // indirect
|
||||
@ -104,7 +106,7 @@ require (
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/tools v0.8.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
google.golang.org/protobuf v1.29.1 // indirect
|
||||
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
modernc.org/cc/v3 v3.40.0 // indirect
|
||||
|
11
go.sum
11
go.sum
@ -54,8 +54,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20230426135323-17808d14c978 h1:fekSRSb8gYcVx8C0B9K6B7+KiFHVixIwvPUkxcnRFp4=
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20230426135323-17808d14c978/go.mod h1:uv3wBa+UbcEUb7IiJCj1T96Xo3cmx1BwNxbBYRZhln8=
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20231003032536-4c6e979bb6bf h1:jiQt6WdXCQlgMm+cC/vFd7aEibaXQUVZKB+tpLzyVao=
|
||||
forge.cadoles.com/arcad/edge v0.0.0-20231003032536-4c6e979bb6bf/go.mod h1:cHbSOTFy09i2RD+EpE76q/rZfTzxZLFD+iHxVfE6QxA=
|
||||
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20210715213245-6c3934b029d8/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg=
|
||||
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
|
||||
@ -504,6 +504,8 @@ github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkF
|
||||
github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M=
|
||||
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
|
||||
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
|
||||
github.com/getsentry/sentry-go v0.25.0 h1:q6Eo+hS+yoJlTO3uu/azhQadsD8V+jQn2D8VvX1eOyI=
|
||||
github.com/getsentry/sentry-go v0.25.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
|
||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
|
||||
@ -878,6 +880,8 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR
|
||||
github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/keegancsmith/rpc v1.3.0 h1:wGWOpjcNrZaY8GDYZJfvyxmlLljm3YQWF+p918DXtDk=
|
||||
github.com/keegancsmith/rpc v1.3.0/go.mod h1:6O2xnOGjPyvIPbvp0MdrOe5r6cu1GZ4JoTzpzDhWeo0=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
@ -1211,6 +1215,7 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
@ -1996,6 +2001,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
|
||||
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/auth/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||
"forge.cadoles.com/Cadoles/emissary/pkg/client"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/api"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -43,13 +44,17 @@ func (a *Agent) Run(ctx context.Context) error {
|
||||
logger.Debug(ctx, "registering agent")
|
||||
|
||||
if err := a.registerAgent(ctx, client, state); err != nil {
|
||||
logger.Error(ctx, "could not register agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not register agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
|
||||
logger.Debug(ctx, "state before reconciliation", logger.F("state", state))
|
||||
|
||||
if err := a.Reconcile(ctx, state); err != nil {
|
||||
logger.Error(ctx, "could not reconcile node with state", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not reconcile node with state", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
return
|
||||
}
|
||||
@ -79,7 +84,9 @@ func (a *Agent) Reconcile(ctx context.Context, state *State) error {
|
||||
)
|
||||
|
||||
if err := ctrl.Reconcile(ctrlCtx, state); err != nil {
|
||||
logger.Error(ctx, "could not reconcile", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not reconcile", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,10 +117,12 @@ func (a *Agent) collectMetadata(ctx context.Context) (map[string]any, error) {
|
||||
for _, collector := range a.collectors {
|
||||
name, value, err := collector.Collect(ctx)
|
||||
if err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not collect metadata",
|
||||
logger.E(errors.WithStack(err)), logger.F("name", name),
|
||||
logger.E(err), logger.F("name", name),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"net"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
@ -20,44 +19,55 @@ import (
|
||||
fetchModule "forge.cadoles.com/arcad/edge/pkg/module/fetch"
|
||||
netModule "forge.cadoles.com/arcad/edge/pkg/module/net"
|
||||
shareModule "forge.cadoles.com/arcad/edge/pkg/module/share"
|
||||
shareSqlite "forge.cadoles.com/arcad/edge/pkg/module/share/sqlite"
|
||||
"forge.cadoles.com/arcad/edge/pkg/storage"
|
||||
"forge.cadoles.com/arcad/edge/pkg/storage/sqlite"
|
||||
"forge.cadoles.com/arcad/edge/pkg/storage/driver"
|
||||
"forge.cadoles.com/arcad/edge/pkg/storage/share"
|
||||
"github.com/Masterminds/sprig/v3"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/lestrrat-go/jwx/v2/jwa"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
|
||||
// Register storage drivers
|
||||
_ "forge.cadoles.com/arcad/edge/pkg/storage/driver/rpc"
|
||||
_ "forge.cadoles.com/arcad/edge/pkg/storage/driver/sqlite"
|
||||
)
|
||||
|
||||
type Dependencies struct {
|
||||
Bus bus.Bus
|
||||
DocumentStore storage.DocumentStore
|
||||
BlobStore storage.BlobStore
|
||||
KeySet jwk.Set
|
||||
AppRepository appModule.Repository
|
||||
AppID app.ID
|
||||
ShareRepository shareModule.Repository
|
||||
Bus bus.Bus
|
||||
DocumentStore storage.DocumentStore
|
||||
BlobStore storage.BlobStore
|
||||
ShareStore share.Store
|
||||
KeySet jwk.Set
|
||||
AppRepository appModule.Repository
|
||||
AppID app.ID
|
||||
}
|
||||
|
||||
const defaultSQLiteParams = "?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000"
|
||||
|
||||
func (c *Controller) getHandlerOptions(ctx context.Context, appKey string, specs *spec.Spec) ([]edgeHTTP.HandlerOptionFunc, error) {
|
||||
dataDir, err := c.ensureAppDataDir(ctx, appKey)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not retrieve app data dir")
|
||||
appEntry, exists := specs.Apps[appKey]
|
||||
if !exists {
|
||||
return nil, errors.Errorf("could not find app entry '%s'", appKey)
|
||||
}
|
||||
|
||||
dbFile := filepath.Join(dataDir, appKey+".sqlite")
|
||||
db, err := sqlite.Open(dbFile + defaultSQLiteParams)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not open database file '%s'", dbFile)
|
||||
storage := appEntry.Storage
|
||||
if storage == nil {
|
||||
return nil, errors.Errorf("could not find app entry '%s' storage configuration", appKey)
|
||||
}
|
||||
|
||||
shareDBFile := filepath.Join(dataDir, "shared.sqlite")
|
||||
shareDB, err := sqlite.Open(shareDBFile + defaultSQLiteParams)
|
||||
documentStore, err := driver.NewDocumentStore(appEntry.Storage.DocumentStoreDSN)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "could not open database file '%s'", shareDBFile)
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
blobStore, err := driver.NewBlobStore(appEntry.Storage.BlobStoreDSN)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
shareStore, err := driver.NewShareStore(appEntry.Storage.ShareStoreDSN)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
keySet, err := getAuthKeySet(specs.Config)
|
||||
@ -79,21 +89,29 @@ func (c *Controller) getHandlerOptions(ctx context.Context, appKey string, specs
|
||||
mounts = append(mounts, appModule.Mount(c.appRepository))
|
||||
|
||||
deps := Dependencies{
|
||||
Bus: memory.NewBus(),
|
||||
DocumentStore: sqlite.NewDocumentStoreWithDB(db),
|
||||
BlobStore: sqlite.NewBlobStoreWithDB(db),
|
||||
KeySet: keySet,
|
||||
AppRepository: c.appRepository,
|
||||
AppID: app.ID(appKey),
|
||||
ShareRepository: shareSqlite.NewRepositoryWithDB(shareDB),
|
||||
Bus: memory.NewBus(),
|
||||
DocumentStore: documentStore,
|
||||
BlobStore: blobStore,
|
||||
ShareStore: shareStore,
|
||||
KeySet: keySet,
|
||||
AppRepository: c.appRepository,
|
||||
AppID: app.ID(appKey),
|
||||
}
|
||||
|
||||
modules := c.getAppModules(deps)
|
||||
|
||||
anonymousUserMiddleware, err := getAnonymousUserMiddleware(specs.Config.Auth)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get anonymous user middleware")
|
||||
}
|
||||
|
||||
options := []edgeHTTP.HandlerOptionFunc{
|
||||
edgeHTTP.WithBus(deps.Bus),
|
||||
edgeHTTP.WithServerModules(modules...),
|
||||
edgeHTTP.WithHTTPMounts(mounts...),
|
||||
edgeHTTP.WithHTTPMiddlewares(
|
||||
anonymousUserMiddleware,
|
||||
),
|
||||
}
|
||||
|
||||
return options, nil
|
||||
@ -180,21 +198,25 @@ func createResolveAppURL(specs *spec.Spec) (ResolveAppURLFunc, error) {
|
||||
for ifaceName, ifaceTmpl := range ifaceMappings {
|
||||
iface, err := net.InterfaceByName(ifaceName)
|
||||
if err != nil {
|
||||
logger.Error(
|
||||
err = errors.WithStack(err)
|
||||
logger.Warn(
|
||||
ctx, "could not find interface",
|
||||
logger.E(errors.WithStack(err)), logger.F("iface", ifaceName),
|
||||
logger.E(err), logger.F("iface", ifaceName),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
addresses, err := iface.Addrs()
|
||||
if err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not list interface addresses",
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
logger.F("iface", iface.Name),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
@ -202,11 +224,13 @@ func createResolveAppURL(specs *spec.Spec) (ResolveAppURLFunc, error) {
|
||||
for _, addr := range addresses {
|
||||
ifaIP, network, err := net.ParseCIDR(addr.String())
|
||||
if err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not parse interface ip",
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
logger.F("iface", iface.Name),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
@ -285,6 +309,6 @@ func (c *Controller) getAppModules(deps Dependencies) []app.ServerModuleFactory
|
||||
authModuleFactory(deps.KeySet),
|
||||
appModule.ModuleFactory(deps.AppRepository),
|
||||
fetchModule.ModuleFactory(deps.Bus),
|
||||
shareModule.ModuleFactory(deps.AppID, deps.ShareRepository),
|
||||
shareModule.ModuleFactory(deps.AppID, deps.ShareStore),
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"forge.cadoles.com/arcad/edge/pkg/app"
|
||||
"forge.cadoles.com/arcad/edge/pkg/bundle"
|
||||
appModule "forge.cadoles.com/arcad/edge/pkg/module/app"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -63,14 +64,18 @@ func (r *AppRepository) List(ctx context.Context) ([]*app.Manifest, error) {
|
||||
|
||||
bundle, err := bundle.FromPath(path)
|
||||
if err != nil {
|
||||
logger.Error(bundleCtx, "could not load bundle", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(bundleCtx, "could not load bundle", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
manifest, err := app.LoadManifest(bundle)
|
||||
if err != nil {
|
||||
logger.Error(bundleCtx, "could not load manifest", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(bundleCtx, "could not load manifest", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
@ -97,14 +102,18 @@ func (r *AppRepository) findManifest(ctx context.Context, id app.ID) (*app.Manif
|
||||
|
||||
bundle, err := bundle.FromPath(path)
|
||||
if err != nil {
|
||||
logger.Error(bundleCtx, "could not load bundle", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(bundleCtx, "could not load bundle", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
manifest, err := app.LoadManifest(bundle)
|
||||
if err != nil {
|
||||
logger.Error(bundleCtx, "could not load manifest", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(bundleCtx, "could not load manifest", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
appSpec "forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||
"forge.cadoles.com/arcad/edge/pkg/app"
|
||||
"forge.cadoles.com/arcad/edge/pkg/module"
|
||||
"forge.cadoles.com/arcad/edge/pkg/module/auth"
|
||||
authModule "forge.cadoles.com/arcad/edge/pkg/module/auth"
|
||||
authHTTP "forge.cadoles.com/arcad/edge/pkg/module/auth/http"
|
||||
authModuleMiddleware "forge.cadoles.com/arcad/edge/pkg/module/auth/middleware"
|
||||
|
||||
"github.com/dop251/goja"
|
||||
"github.com/lestrrat-go/jwx/v2/jwa"
|
||||
"github.com/pkg/errors"
|
||||
@ -54,7 +57,7 @@ func authModuleFactory(keySet jwk.Set) app.ServerModuleFactory {
|
||||
)
|
||||
}
|
||||
|
||||
func getAuthMount(auth *spec.Auth, keySet jwk.Set) (auth.MountFunc, error) {
|
||||
func getAuthMount(auth *appSpec.Auth, keySet jwk.Set) (auth.MountFunc, error) {
|
||||
switch {
|
||||
case auth.Local != nil:
|
||||
var rawKey any = auth.Local.Key
|
||||
@ -77,7 +80,8 @@ func getAuthMount(auth *spec.Auth, keySet jwk.Set) (auth.MountFunc, error) {
|
||||
|
||||
return authModule.Mount(
|
||||
authHTTP.NewLocalHandler(
|
||||
jwa.HS256, key,
|
||||
key,
|
||||
jwa.HS256,
|
||||
authHTTP.WithRoutePrefix("/auth"),
|
||||
authHTTP.WithAccounts(auth.Local.Accounts...),
|
||||
authHTTP.WithCookieOptions(getCookieDomain, cookieDuration),
|
||||
@ -91,3 +95,72 @@ func getAuthMount(auth *spec.Auth, keySet jwk.Set) (auth.MountFunc, error) {
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func getAnonymousUserMiddleware(auth *appSpec.Auth) (func(http.Handler) http.Handler, error) {
|
||||
anonymousUserSigningKey, err := getAnonymousUserSigningKey(auth)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get anonymous user signing key")
|
||||
}
|
||||
|
||||
cookieDuration := defaultCookieDuration
|
||||
if auth.Local.CookieDuration != "" {
|
||||
cookieDuration, err = time.ParseDuration(auth.Local.CookieDuration)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
}
|
||||
|
||||
middleware := authModuleMiddleware.AnonymousUser(
|
||||
anonymousUserSigningKey,
|
||||
auth.Local.SigningAlgorithm,
|
||||
authModuleMiddleware.WithCookieOptions(getCookieDomain, cookieDuration),
|
||||
)
|
||||
|
||||
return middleware, nil
|
||||
}
|
||||
|
||||
func getAnonymousUserSigningKey(auth *appSpec.Auth) (jwk.Key, error) {
|
||||
var (
|
||||
key jwk.Key
|
||||
err error
|
||||
)
|
||||
|
||||
generateNewKey := func() (jwk.Key, error) {
|
||||
key, err := jwk.Generate(2048)
|
||||
if err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
return key, nil
|
||||
}
|
||||
|
||||
switch {
|
||||
default:
|
||||
fallthrough
|
||||
case auth == nil:
|
||||
key, err = generateNewKey()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not generate anonymous user signing key")
|
||||
}
|
||||
|
||||
return key, nil
|
||||
|
||||
case auth.Local != nil:
|
||||
switch typedKey := auth.Local.Key.(type) {
|
||||
case string:
|
||||
key, err = jwk.FromRaw([]byte(typedKey))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse local auth key")
|
||||
}
|
||||
|
||||
if err := key.Set(jwk.AlgorithmKey, jwa.HS256); err != nil {
|
||||
return nil, errors.WithStack(err)
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, errors.Errorf("unexpected key type '%T'", auth.Local.Key)
|
||||
}
|
||||
}
|
||||
|
||||
return key, nil
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
"forge.cadoles.com/arcad/edge/pkg/app"
|
||||
"forge.cadoles.com/arcad/edge/pkg/bundle"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/mitchellh/hashstructure/v2"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -66,11 +67,13 @@ func (c *Controller) stopAllApps(ctx context.Context, spec *spec.Spec) {
|
||||
logger.Info(ctx, "stopping app", logger.F("appID", appID))
|
||||
|
||||
if err := entry.Server.Stop(); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "error while stopping app",
|
||||
logger.F("appID", appID),
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
delete(c.servers, appID)
|
||||
}
|
||||
@ -87,21 +90,25 @@ func (c *Controller) updateApps(ctx context.Context, specs *spec.Spec) {
|
||||
logger.Info(ctx, "stopping app", logger.F("appKey", appKey))
|
||||
|
||||
if err := server.Server.Stop(); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "error while stopping app",
|
||||
logger.F("appKey", appKey),
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
delete(c.servers, appKey)
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.updateAppRepository(ctx, specs); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not update app repository",
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
return
|
||||
}
|
||||
@ -111,7 +118,9 @@ func (c *Controller) updateApps(ctx context.Context, specs *spec.Spec) {
|
||||
appCtx := logger.With(ctx, logger.F("appKey", appKey))
|
||||
|
||||
if err := c.updateApp(ctx, specs, appKey); err != nil {
|
||||
logger.Error(appCtx, "could not update app", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(appCtx, "could not update app", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
appSpec "forge.cadoles.com/Cadoles/emissary/internal/agent/controller/app/spec"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/proxy/wildcard"
|
||||
edgeHTTP "forge.cadoles.com/arcad/edge/pkg/http"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
|
||||
"forge.cadoles.com/arcad/edge/pkg/bundle"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/pkg/errors"
|
||||
@ -73,7 +73,9 @@ func (s *Server) Start(ctx context.Context, addr string) (err error) {
|
||||
defer func() {
|
||||
if recovered := recover(); recovered != nil {
|
||||
if err, ok := recovered.(error); ok {
|
||||
logger.Error(ctx, err.Error(), logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, err.Error(), logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
return
|
||||
}
|
||||
@ -128,7 +130,7 @@ func (s *Server) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewServer(bundle bundle.Bundle, config *spec.Config, handlerOptions ...edgeHTTP.HandlerOptionFunc) *Server {
|
||||
func NewServer(bundle bundle.Bundle, config *appSpec.Config, handlerOptions ...edgeHTTP.HandlerOptionFunc) *Server {
|
||||
return &Server{
|
||||
bundle: bundle,
|
||||
config: config,
|
||||
|
@ -26,13 +26,34 @@
|
||||
"zip",
|
||||
"tar.gz"
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"blobStoreDsn": {
|
||||
"type": "string"
|
||||
},
|
||||
"documentStoreDsn": {
|
||||
"type": "string"
|
||||
},
|
||||
"shareStoreDsn": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"blobStoreDsn",
|
||||
"documentStoreDsn",
|
||||
"shareStoreDsn"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"url",
|
||||
"sha256sum",
|
||||
"address",
|
||||
"format"
|
||||
"format",
|
||||
"storage"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
@ -84,6 +105,9 @@
|
||||
"key": {
|
||||
"type": ["object", "string"]
|
||||
},
|
||||
"signingAlgorithm": {
|
||||
"type": "string"
|
||||
},
|
||||
"accounts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@ -117,7 +141,8 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"key"
|
||||
"key",
|
||||
"signingAlgorithm"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package spec
|
||||
import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||
edgeAuth "forge.cadoles.com/arcad/edge/pkg/module/auth/http"
|
||||
"github.com/lestrrat-go/jwx/v2/jwa"
|
||||
)
|
||||
|
||||
const Name spec.Name = "app.emissary.cadoles.com"
|
||||
@ -14,10 +15,17 @@ type Spec struct {
|
||||
}
|
||||
|
||||
type AppEntry struct {
|
||||
URL string `json:"url"`
|
||||
SHA256Sum string `json:"sha256sum"`
|
||||
Address string `json:"address"`
|
||||
Format string `json:"format"`
|
||||
URL string `json:"url"`
|
||||
SHA256Sum string `json:"sha256sum"`
|
||||
Address string `json:"address"`
|
||||
Format string `json:"format"`
|
||||
Storage *AppStorage `json:"storage"`
|
||||
}
|
||||
|
||||
type AppStorage struct {
|
||||
ShareStoreDSN string `json:"shareStoreDsn"`
|
||||
DocumentStoreDSN string `json:"documentStoreDsn"`
|
||||
BlobStoreDSN string `json:"blobStoreDsn"`
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
@ -25,10 +33,11 @@ type Auth struct {
|
||||
}
|
||||
|
||||
type LocalAuth struct {
|
||||
Key any `json:"key"`
|
||||
Accounts []edgeAuth.LocalAccount `json:"accounts"`
|
||||
CookieDomain string `json:"cookieDomain"`
|
||||
CookieDuration string `json:"cookieDuration"`
|
||||
Key any `json:"key"`
|
||||
SigningAlgorithm jwa.SignatureAlgorithm `json:"signingAlgorithm"`
|
||||
Accounts []edgeAuth.LocalAccount `json:"accounts"`
|
||||
CookieDomain string `json:"cookieDomain"`
|
||||
CookieDuration string `json:"cookieDuration"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
@ -6,7 +6,12 @@
|
||||
"url": "http://example.com/edge.sdk.client.test_0.0.0.zip",
|
||||
"sha256sum": "58019192dacdae17755707719707db007e26dac856102280583fbd18427dd352",
|
||||
"address": ":8081",
|
||||
"format": "zip"
|
||||
"format": "zip",
|
||||
"storage": {
|
||||
"blobStoreDsn": "sqlite://apps/data/edge.sdk.client.test/blobstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"shareStoreDsn": "sqlite://apps/data/sharestore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"documentStoreDsn": "sqlite://apps/data/edge.sdk.client.test/documentstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
@ -23,6 +28,7 @@
|
||||
"q": "yJJLNc9w6O4y2icME8k99FugV9E7ObwUxF3v5JN3y1cmAT0h2njyE3iAGqaDZwcY1_jGCisjwoqX6i5E8xqhxX3Gcy3J7SmUAf8fhY8wU3zv9DK7skg2IdvanDb8Y1OM6GchbYZAOVPEg2IvVio8zI-Ih3DDwDk8Df0ufzoHRb8",
|
||||
"qi": "zOE-4R3cjPesm3MX-4PdwmsaF9QZLUVRUvvHJ08pKs6kAXP18hzjctAoOjhQDxlTYqNYNePfKzKwost3OJoPgRIc9w9qwUCK1gNOS4Z_xozCIaXgMddNFhkoAfZ4JaKjNCiinzjGfqG99Lf-yzmmREuuhRv7SdS3ST4VQjiJQew"
|
||||
},
|
||||
"signingAlgorithm": "RS256",
|
||||
"accounts": [
|
||||
{
|
||||
"username": "foo",
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
mdns "forge.cadoles.com/Cadoles/emissary/internal/agent/controller/mdns/spec"
|
||||
"github.com/brutella/dnssd"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/mitchellh/hashstructure/v2"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -117,7 +118,9 @@ func (c *Controller) updateResponder(ctx context.Context, spec *mdns.Spec) error
|
||||
|
||||
service, err := dnssd.NewService(config)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not create mdns service", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not create mdns service", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
@ -132,7 +135,9 @@ func (c *Controller) updateResponder(ctx context.Context, spec *mdns.Spec) error
|
||||
|
||||
for _, service := range services {
|
||||
if _, err := responder.Add(service); err != nil {
|
||||
logger.Error(ctx, "could not add mdns service", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not add mdns service", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
continue
|
||||
}
|
||||
@ -148,7 +153,9 @@ func (c *Controller) updateResponder(ctx context.Context, spec *mdns.Spec) error
|
||||
defer c.stopResponder(ctx)
|
||||
|
||||
if err := responder.Respond(ctx); err != nil && !errors.Is(err, context.Canceled) {
|
||||
logger.Error(ctx, "could not respond to mdns queries", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not respond to mdns queries", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/controller/openwrt/spec/sysupgrade"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -64,11 +65,13 @@ func (c *SysUpgradeController) Reconcile(ctx context.Context, state *agent.State
|
||||
|
||||
defer func() {
|
||||
if err := os.RemoveAll(downloadDir); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not remove download direction",
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
logger.F("downloadDir", downloadDir),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/openwrt/uci"
|
||||
ucispec "forge.cadoles.com/Cadoles/emissary/internal/spec/uci"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -46,7 +47,9 @@ func (c *UCIController) Reconcile(ctx context.Context, state *agent.State) error
|
||||
}
|
||||
|
||||
if err := c.updateConfiguration(ctx, uciSpec); err != nil {
|
||||
logger.Error(ctx, "could not update configuration", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not update configuration", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -145,7 +146,9 @@ func (c *Controller) writeState(ctx context.Context, state *agent.State) error {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not remove temporary file", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not remove temporary file", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -155,7 +158,9 @@ func (c *Controller) writeState(ctx context.Context, state *agent.State) error {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not close temporary file", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not close temporary file", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/proxy"
|
||||
spec "forge.cadoles.com/Cadoles/emissary/internal/spec/proxy"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/mitchellh/hashstructure/v2"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -58,11 +59,13 @@ func (c *Controller) stopAllProxies(ctx context.Context) {
|
||||
logger.Info(ctx, "stopping proxy", logger.F("proxyID", proxyID))
|
||||
|
||||
if err := entry.Proxy.Stop(); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "error while stopping proxy",
|
||||
logger.F("proxyID", proxyID),
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
delete(c.proxies, proxyID)
|
||||
}
|
||||
@ -79,11 +82,13 @@ func (c *Controller) updateProxies(ctx context.Context, spec *spec.Spec) {
|
||||
logger.Info(ctx, "stopping proxy", logger.F("proxyID", proxyID))
|
||||
|
||||
if err := entry.Proxy.Stop(); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "error while stopping proxy",
|
||||
logger.F("proxyID", proxyID),
|
||||
logger.E(errors.WithStack(err)),
|
||||
logger.E(err),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
delete(c.proxies, proxyID)
|
||||
}
|
||||
@ -94,7 +99,9 @@ func (c *Controller) updateProxies(ctx context.Context, spec *spec.Spec) {
|
||||
proxyCtx := logger.With(ctx, logger.F("proxyID", proxyID))
|
||||
|
||||
if err := c.updateProxy(ctx, proxyID, proxySpec); err != nil {
|
||||
logger.Error(proxyCtx, "could not update proxy", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(proxyCtx, "could not update proxy", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/proxy"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -38,12 +39,16 @@ func (p *ReverseProxy) Start(ctx context.Context, addr string, funcs ...proxy.Op
|
||||
go func() {
|
||||
defer func() {
|
||||
if err := p.Stop(); err != nil {
|
||||
logger.Error(ctx, "error while stopping gateway", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "error while stopping gateway", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
logger.Error(ctx, "error while listening", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "error while listening", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||
"forge.cadoles.com/Cadoles/emissary/pkg/client"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
)
|
||||
@ -40,14 +41,16 @@ func (c *Controller) reconcileAgent(ctx context.Context, client *client.Client,
|
||||
ctx = logger.With(ctx, logger.F("agentID", agent.ID))
|
||||
|
||||
if agent.Status != datastore.AgentStatusAccepted {
|
||||
logger.Error(ctx, "unexpected agent status", logger.F("status", agent.Status))
|
||||
logger.Warn(ctx, "unexpected agent status", logger.F("status", agent.Status))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
specs, err := client.GetAgentSpecs(ctx, agent.ID)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not retrieve agent specs", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not retrieve agent specs", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@ -46,6 +49,25 @@ func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
conf, err := common.LoadConfig(ctx)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Could not load configuration")
|
||||
}
|
||||
|
||||
if conf.Sentry.DSN != "" {
|
||||
spew.Dump(conf.Sentry)
|
||||
|
||||
err = sentry.Init(sentry.ClientOptions{
|
||||
Dsn: conf.Sentry.DSN,
|
||||
Debug: ctx.Bool("debug"),
|
||||
AttachStacktrace: true,
|
||||
Environment: conf.Sentry.Environment,
|
||||
})
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
Flags: []cli.Flag{
|
||||
@ -84,11 +106,15 @@ func Main(buildDate, projectVersion, gitRef, defaultConfigPath string, commands
|
||||
},
|
||||
}
|
||||
|
||||
defer sentry.Flush(2 * time.Second)
|
||||
|
||||
app.ExitErrHandler = func(ctx *cli.Context, err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
|
||||
sentry.CaptureException(err)
|
||||
|
||||
debug := ctx.Bool("debug")
|
||||
|
||||
if !debug {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -32,7 +33,9 @@ func PingCommand() *cli.Command {
|
||||
|
||||
defer func() {
|
||||
if err := db.Close(); err != nil {
|
||||
logger.Error(ctx.Context, "error while closing database connection", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx.Context, "error while closing database connection", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
// Config definition
|
||||
type Config struct {
|
||||
Logger LoggerConfig `yaml:"logger"`
|
||||
Sentry SentryConfig `yaml:"sentry"`
|
||||
Server ServerConfig `yaml:"server"`
|
||||
Agent AgentConfig `yaml:"agent"`
|
||||
}
|
||||
@ -44,6 +45,7 @@ func NewDefault() *Config {
|
||||
Logger: NewDefaultLoggerConfig(),
|
||||
Agent: NewDefaultAgentConfig(),
|
||||
Server: NewDefaultServerConfig(),
|
||||
Sentry: NewDefaultSentryConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
|
18
internal/config/sentry.go
Normal file
18
internal/config/sentry.go
Normal file
@ -0,0 +1,18 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type SentryConfig struct {
|
||||
DSN string `yaml:"dsn"`
|
||||
Environment string `yaml:"environment"`
|
||||
}
|
||||
|
||||
func NewDefaultSentryConfig() SentryConfig {
|
||||
hostname, _ := os.Hostname()
|
||||
return SentryConfig{
|
||||
DSN: "",
|
||||
Environment: hostname,
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/lestrrat-go/jwx/v2/jwk"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -72,7 +73,9 @@ func (r *AgentRepository) GetSpecs(ctx context.Context, agentID datastore.AgentI
|
||||
|
||||
defer func() {
|
||||
if err := rows.Close(); err != nil {
|
||||
logger.Error(ctx, "could not close rows", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not close rows", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -226,7 +229,9 @@ func (r *AgentRepository) Query(ctx context.Context, opts ...datastore.AgentQuer
|
||||
|
||||
defer func() {
|
||||
if err := rows.Close(); err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not close rows", logger.E(errors.WithStack(err)))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -544,7 +549,9 @@ func (r *AgentRepository) withTx(ctx context.Context, fn func(*sql.Tx) error) er
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not rollback transaction", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not rollback transaction", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/agent/metadata"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/jwk"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/api"
|
||||
@ -39,7 +40,9 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
keySet, err := jwk.Parse(registerAgentReq.KeySet)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not parse key set", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not parse key set", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -51,14 +54,16 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
validSignature, err := jwk.Verify(keySet, registerAgentReq.Signature, registerAgentReq.Thumbprint, registerAgentReq.Metadata)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not validate signature", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not validate signature", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if !validSignature {
|
||||
logger.Error(ctx, "conflicting signature", logger.F("signature", registerAgentReq.Signature))
|
||||
logger.Warn(ctx, "conflicting signature", logger.F("signature", registerAgentReq.Signature))
|
||||
api.ErrorResponse(w, http.StatusConflict, ErrCodeConflict, nil)
|
||||
|
||||
return
|
||||
@ -74,7 +79,9 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
if err != nil {
|
||||
if !errors.Is(err, datastore.ErrAlreadyExist) {
|
||||
logger.Error(ctx, "could not create agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not create agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -86,14 +93,18 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
datastore.WithAgentQueryLimit(1),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not retrieve agents", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not retrieve agents", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if len(agents) == 0 {
|
||||
logger.Error(ctx, "could not retrieve matching agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not retrieve matching agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeNotFound, nil)
|
||||
|
||||
@ -104,10 +115,13 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
agent, err = s.agentRepo.Get(ctx, agentID)
|
||||
if err != nil {
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(
|
||||
ctx, "could not retrieve agent",
|
||||
logger.E(errors.WithStack(err)), logger.F("agentID", agentID),
|
||||
logger.E(err), logger.F("agentID", agentID),
|
||||
)
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -115,7 +129,9 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
validSignature, err = jwk.Verify(agent.KeySet.Set, registerAgentReq.Signature, registerAgentReq.Thumbprint, registerAgentReq.Metadata)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not validate signature using previous keyset", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not validate signature using previous keyset", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusConflict, ErrCodeConflict, nil)
|
||||
|
||||
@ -129,7 +145,10 @@ func (s *Server) registerAgent(w http.ResponseWriter, r *http.Request) {
|
||||
datastore.WithAgentUpdateThumbprint(registerAgentReq.Thumbprint),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not update agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not update agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -177,7 +196,10 @@ func (s *Server) updateAgent(w http.ResponseWriter, r *http.Request) {
|
||||
options...,
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not update agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not update agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -258,7 +280,10 @@ func (s *Server) queryAgents(w http.ResponseWriter, r *http.Request) {
|
||||
options...,
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not list agents", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not list agents", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -292,7 +317,10 @@ func (s *Server) deleteAgent(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not delete agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not delete agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -324,7 +352,10 @@ func (s *Server) getAgent(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not get agent", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not get agent", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -356,7 +387,10 @@ func getIntQueryParam(w http.ResponseWriter, r *http.Request, param string, defa
|
||||
if rawValue != "" {
|
||||
value, err := strconv.ParseInt(rawValue, 10, 64)
|
||||
if err != nil {
|
||||
logger.Error(r.Context(), "could not parse int param", logger.F("param", param), logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(r.Context(), "could not parse int param", logger.F("param", param), logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusBadRequest, api.ErrCodeMalformedRequest, nil)
|
||||
|
||||
return 0, false
|
||||
@ -389,7 +423,10 @@ func getIntSliceValues(w http.ResponseWriter, r *http.Request, param string, def
|
||||
for _, rv := range rawValues {
|
||||
value, err := strconv.ParseInt(rv, 10, 64)
|
||||
if err != nil {
|
||||
logger.Error(r.Context(), "could not parse int slice param", logger.F("param", param), logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(r.Context(), "could not parse int slice param", logger.F("param", param), logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusBadRequest, api.ErrCodeMalformedRequest, nil)
|
||||
|
||||
return nil, false
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/auth"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/auth/agent"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/auth/thirdparty"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/api"
|
||||
"gitlab.com/wpetit/goweb/logger"
|
||||
@ -124,7 +125,9 @@ func assertRequestUser(w http.ResponseWriter, r *http.Request) (auth.User, bool)
|
||||
ctx := r.Context()
|
||||
user, err := auth.CtxUser(ctx)
|
||||
if err != nil {
|
||||
logger.Error(ctx, "could not retrieve user", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not retrieve user", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
forbidden(w, r)
|
||||
|
||||
@ -147,7 +150,7 @@ func forbidden(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func logUnexpectedUserType(ctx context.Context, user auth.User) {
|
||||
logger.Error(
|
||||
logger.Warn(
|
||||
ctx, "unexpected user type",
|
||||
logger.F("subject", user.Subject()),
|
||||
logger.F("type", fmt.Sprintf("%T", user)),
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/datastore"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/spec"
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/pkg/errors"
|
||||
"gitlab.com/wpetit/goweb/api"
|
||||
@ -44,7 +45,10 @@ func (s *Server) updateSpec(w http.ResponseWriter, r *http.Request) {
|
||||
data.Message = validationErr.Error()
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not validate spec", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not validate spec", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusBadRequest, api.ErrCodeInvalidRequest, data)
|
||||
|
||||
return
|
||||
@ -70,7 +74,10 @@ func (s *Server) updateSpec(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not update spec", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not update spec", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -99,7 +106,10 @@ func (s *Server) getAgentSpecs(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not list specs", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not list specs", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -141,7 +151,10 @@ func (s *Server) deleteSpec(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logger.Error(ctx, "could not delete spec", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(ctx, "could not delete spec", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusInternalServerError, ErrCodeUnknownError, nil)
|
||||
|
||||
return
|
||||
@ -159,7 +172,10 @@ func getSpecID(w http.ResponseWriter, r *http.Request) (datastore.SpecID, bool)
|
||||
|
||||
specID, err := strconv.ParseInt(rawSpecID, 10, 64)
|
||||
if err != nil {
|
||||
logger.Error(r.Context(), "could not parse spec id", logger.E(errors.WithStack(err)))
|
||||
err = errors.WithStack(err)
|
||||
logger.Error(r.Context(), "could not parse spec id", logger.E(err))
|
||||
sentry.CaptureException(err)
|
||||
|
||||
api.ErrorResponse(w, http.StatusBadRequest, api.ErrCodeMalformedRequest, nil)
|
||||
|
||||
return 0, false
|
||||
|
@ -4,7 +4,7 @@ ARG HTTP_PROXY=
|
||||
ARG HTTPS_PROXY=
|
||||
ARG http_proxy=
|
||||
ARG https_proxy=
|
||||
ARG GO_VERSION=1.20.2
|
||||
ARG GO_VERSION=1.21.1
|
||||
|
||||
# Install dev environment dependencies
|
||||
RUN export DEBIAN_FRONTEND=noninteractive &&\
|
||||
|
7
misc/packaging/openrc/emissary-agent.logrotate.conf
Normal file
7
misc/packaging/openrc/emissary-agent.logrotate.conf
Normal file
@ -0,0 +1,7 @@
|
||||
/var/log/emissary/agent.log {
|
||||
missingok
|
||||
sharedscripts
|
||||
postrotate
|
||||
/etc/init.d/emissary-agent restart
|
||||
endscript
|
||||
}
|
7
misc/packaging/openrc/emissary-server.logrotate.conf
Normal file
7
misc/packaging/openrc/emissary-server.logrotate.conf
Normal file
@ -0,0 +1,7 @@
|
||||
/var/log/emissary/server.log {
|
||||
missingok
|
||||
sharedscripts
|
||||
postrotate
|
||||
/etc/init.d/emissary-server restart
|
||||
endscript
|
||||
}
|
@ -4,20 +4,40 @@
|
||||
"url": "https://emissary.cadol.es/files/apps/app.arcad.edge.hextris_v2023.4.20-2bbbe94.zip",
|
||||
"sha256sum": "67942ef4b623c46308c3f640b534bd4cb6b1d6021a422e40b62ab97658ba4586",
|
||||
"address": ":8083",
|
||||
"format": "zip"
|
||||
"format": "zip",
|
||||
"storage": {
|
||||
"blobStoreDsn": "sqlite://apps/data/app.arcad.edge.hextris/blobstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"shareStoreDsn": "sqlite://apps/data/sharestore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"documentStoreDsn": "sqlite://apps/data/app.arcad.edge.hextris/documentstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000"
|
||||
}
|
||||
},
|
||||
"edge.sdk.client.test": {
|
||||
"url": "https://emissary.cadol.es/files/apps/edge.sdk.client.test_v2023.4.20-20c4189.zip",
|
||||
"sha256sum": "1edeb4aa75c1675db49cf27367b1537234a04526848ea6657931ca63f26e5dae",
|
||||
"url": "https://emissary.cadol.es/files/apps/edge.sdk.client.test_2023.10.11-stable.943.4d064de.zip",
|
||||
"sha256sum": "5419054e09342f5b9834771c087385b0fb425ebdbca3d91aa69eab98d909ca57",
|
||||
"address": ":8084",
|
||||
"format": "zip"
|
||||
"format": "zip",
|
||||
"storage": {
|
||||
"blobStoreDsn": "sqlite://apps/data/edge.sdk.client.test/blobstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"shareStoreDsn": "sqlite://apps/data/sharestore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"documentStoreDsn": "sqlite://apps/data/edge.sdk.client.test/documentstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000"
|
||||
}
|
||||
},
|
||||
"arcad.diffusion": {
|
||||
"url": "https://emissary.cadol.es/files/apps/arcad.diffusion_v2023.10.12-cab0070.zip",
|
||||
"sha256sum": "db58ec1ed463092fea2ee27cfd33dea5259739f1c6a4c9bf909ffd22392ee449",
|
||||
"address": ":8085",
|
||||
"format": "zip",
|
||||
"storage": {
|
||||
"blobStoreDsn": "sqlite://apps/data/arcad.diffusion/blobstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"shareStoreDsn": "sqlite://apps/data/sharestore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000",
|
||||
"documentStoreDsn": "sqlite://apps/data/arcad.diffusion/documentstore.sqlite?_pragma=foreign_keys(1)&_pragma=busy_timeout=60000"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"appUrlResolving": {
|
||||
"ifaceMappings": {
|
||||
"eth0": "http://{{ .DeviceIP }}:{{ .AppPort }}",
|
||||
"eth1": "http://{{ .DeviceIP }}:{{ .AppPort }}"
|
||||
"lo": "http://{{ .DeviceIP }}:{{ .AppPort }}"
|
||||
},
|
||||
"defaultUrlTemplate": "http://{{ last ( splitList \".\" ( toString .Manifest.ID ) ) }}.localhost.arcad.lan:8080"
|
||||
},
|
||||
@ -28,6 +48,7 @@
|
||||
"auth": {
|
||||
"local": {
|
||||
"key": "absolutlynotsecret",
|
||||
"signingAlgorithm": "HS256",
|
||||
"cookieDuration": "1h",
|
||||
"accounts": [
|
||||
{
|
||||
|
@ -14,6 +14,11 @@
|
||||
"type": "_http._tcp",
|
||||
"port": 8080,
|
||||
"host": "arcad-test"
|
||||
},
|
||||
"diffusion": {
|
||||
"type": "_http._tcp",
|
||||
"port": 8080,
|
||||
"host": "arcad-diffusion"
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,10 @@
|
||||
"hostPattern": "test.localhost.arcad.lan:*",
|
||||
"target": "http://localhost:8084"
|
||||
},
|
||||
{
|
||||
"hostPattern": "diffusion.localhost.arcad.lan:*",
|
||||
"target": "http://localhost:8085"
|
||||
},
|
||||
{
|
||||
"hostPattern": "arcad-hextris.local:*",
|
||||
"target": "http://localhost:8083"
|
||||
@ -19,6 +23,10 @@
|
||||
"hostPattern": "arcad-test.local:*",
|
||||
"target": "http://localhost:8084"
|
||||
},
|
||||
{
|
||||
"hostPattern": "arcad-diffusion.local:*",
|
||||
"target": "http://localhost:8085"
|
||||
},
|
||||
{
|
||||
"hostPattern": "*",
|
||||
"target": "http://localhost:8084"
|
||||
|
2067
misc/spec-samples/uci.emissary.cadoles.com.json
Normal file
2067
misc/spec-samples/uci.emissary.cadoles.com.json
Normal file
@ -0,0 +1,2067 @@
|
||||
{
|
||||
"config": {
|
||||
"packages": [
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "dnsmasq",
|
||||
"options": [
|
||||
{
|
||||
"name": "domainneeded",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "boguspriv",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "filterwin2k",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "localise_queries",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "rebind_localhost",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "local",
|
||||
"type": "option",
|
||||
"value": "/lan/"
|
||||
},
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "expandhosts",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "nonegcache",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "authoritative",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "readethers",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "leasefile",
|
||||
"type": "option",
|
||||
"value": "/tmp/dhcp.leases"
|
||||
},
|
||||
{
|
||||
"name": "resolvfile",
|
||||
"type": "option",
|
||||
"value": "/tmp/resolv.conf.d/resolv.conf.auto"
|
||||
},
|
||||
{
|
||||
"name": "nonwildcard",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "localservice",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "ednspacket_max",
|
||||
"type": "option",
|
||||
"value": "1232"
|
||||
},
|
||||
{
|
||||
"name": "rebind_protection",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "interface",
|
||||
"type": "list",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "interface",
|
||||
"type": "list",
|
||||
"value": "guest"
|
||||
},
|
||||
{
|
||||
"name": "logqueries",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "address",
|
||||
"type": "list",
|
||||
"value": "/arcad.lan/10.10.10.1"
|
||||
},
|
||||
{
|
||||
"name": "address",
|
||||
"type": "list",
|
||||
"value": "/#/10.10.10.1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dhcp",
|
||||
"options": [
|
||||
{
|
||||
"name": "interface",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "start",
|
||||
"type": "option",
|
||||
"value": "100"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"type": "option",
|
||||
"value": "150"
|
||||
},
|
||||
{
|
||||
"name": "leasetime",
|
||||
"type": "option",
|
||||
"value": "12h"
|
||||
},
|
||||
{
|
||||
"name": "dhcpv4",
|
||||
"type": "option",
|
||||
"value": "server"
|
||||
},
|
||||
{
|
||||
"name": "dhcpv6",
|
||||
"type": "option",
|
||||
"value": "server"
|
||||
},
|
||||
{
|
||||
"name": "ra",
|
||||
"type": "option",
|
||||
"value": "server"
|
||||
},
|
||||
{
|
||||
"name": "ra_slaac",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "ra_flags",
|
||||
"type": "list",
|
||||
"value": "managed-config"
|
||||
},
|
||||
{
|
||||
"name": "ra_flags",
|
||||
"type": "list",
|
||||
"value": "other-config"
|
||||
}
|
||||
],
|
||||
"section": "lan"
|
||||
},
|
||||
{
|
||||
"name": "dhcp",
|
||||
"options": [
|
||||
{
|
||||
"name": "interface",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "ignore",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
}
|
||||
],
|
||||
"section": "wan"
|
||||
},
|
||||
{
|
||||
"name": "odhcpd",
|
||||
"options": [
|
||||
{
|
||||
"name": "maindhcp",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "leasefile",
|
||||
"type": "option",
|
||||
"value": "/tmp/hosts/odhcpd"
|
||||
},
|
||||
{
|
||||
"name": "leasetrigger",
|
||||
"type": "option",
|
||||
"value": "/usr/sbin/odhcpd-update"
|
||||
},
|
||||
{
|
||||
"name": "loglevel",
|
||||
"type": "option",
|
||||
"value": "4"
|
||||
}
|
||||
],
|
||||
"section": "odhcpd"
|
||||
},
|
||||
{
|
||||
"name": "dhcp",
|
||||
"options": [
|
||||
{
|
||||
"name": "interface",
|
||||
"type": "option",
|
||||
"value": "guest"
|
||||
},
|
||||
{
|
||||
"name": "start",
|
||||
"type": "option",
|
||||
"value": "100"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"type": "option",
|
||||
"value": "150"
|
||||
},
|
||||
{
|
||||
"name": "leasetime",
|
||||
"type": "option",
|
||||
"value": "12h"
|
||||
},
|
||||
{
|
||||
"name": "dhcp_option",
|
||||
"type": "list",
|
||||
"value": "160,http://arcad.lan"
|
||||
}
|
||||
],
|
||||
"section": "guest"
|
||||
}
|
||||
],
|
||||
"name": "dhcp"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "dropbear",
|
||||
"options": [
|
||||
{
|
||||
"name": "PasswordAuth",
|
||||
"type": "option",
|
||||
"value": "on"
|
||||
},
|
||||
{
|
||||
"name": "RootPasswordAuth",
|
||||
"type": "option",
|
||||
"value": "on"
|
||||
},
|
||||
{
|
||||
"name": "Port",
|
||||
"type": "option",
|
||||
"value": "22"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "dropbear"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "main",
|
||||
"options": [
|
||||
{
|
||||
"name": "reconciliation_interval",
|
||||
"type": "option",
|
||||
"value": "60"
|
||||
},
|
||||
{
|
||||
"name": "server_url",
|
||||
"type": "option",
|
||||
"value": "https://emissary.cadol.es"
|
||||
}
|
||||
],
|
||||
"section": "agent"
|
||||
}
|
||||
],
|
||||
"name": "emissary"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "defaults",
|
||||
"options": [
|
||||
{
|
||||
"name": "syn_flood",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "output",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "forward",
|
||||
"type": "option",
|
||||
"value": "REJECT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zone",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"type": "list",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "output",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "forward",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zone",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"type": "list",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"type": "list",
|
||||
"value": "wan6"
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "option",
|
||||
"value": "REJECT"
|
||||
},
|
||||
{
|
||||
"name": "output",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "forward",
|
||||
"type": "option",
|
||||
"value": "REJECT"
|
||||
},
|
||||
{
|
||||
"name": "masq",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "mtu_fix",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "forwarding",
|
||||
"options": [
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-DHCP-Renew"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "68"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv4"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-Ping"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "icmp"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "option",
|
||||
"value": "echo-request"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv4"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-IGMP"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "igmp"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv4"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-DHCPv6"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "546"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv6"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-MLD"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "icmp"
|
||||
},
|
||||
{
|
||||
"name": "src_ip",
|
||||
"type": "option",
|
||||
"value": "fe80::/10"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "130/0"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "131/0"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "132/0"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "143/0"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv6"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-ICMPv6-Input"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "icmp"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "echo-request"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "echo-reply"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "destination-unreachable"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "packet-too-big"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "time-exceeded"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "bad-header"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "unknown-header-type"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "router-solicitation"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "neighbour-solicitation"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "router-advertisement"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "neighbour-advertisement"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"type": "option",
|
||||
"value": "1000/sec"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv6"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-ICMPv6-Forward"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "option",
|
||||
"value": "*"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "icmp"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "echo-request"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "echo-reply"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "destination-unreachable"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "packet-too-big"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "time-exceeded"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "bad-header"
|
||||
},
|
||||
{
|
||||
"name": "icmp_type",
|
||||
"type": "list",
|
||||
"value": "unknown-header-type"
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"type": "option",
|
||||
"value": "1000/sec"
|
||||
},
|
||||
{
|
||||
"name": "family",
|
||||
"type": "option",
|
||||
"value": "ipv6"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-IPSec-ESP"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "esp"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow-ISAKMP"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest",
|
||||
"type": "option",
|
||||
"value": "lan"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "500"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow SSH on WAN"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "22"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow HTTP on WAN"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "80"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow HTTPS on WAN"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "443"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "zone",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "guest"
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "output",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "forward",
|
||||
"type": "option",
|
||||
"value": "REJECT"
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"type": "list",
|
||||
"value": "guest"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8080 on WAN"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8080"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8443 on WAN"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8443"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "5353"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow mDNS from device"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "src_port",
|
||||
"type": "option",
|
||||
"value": "5353"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow mDNS to device"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "*"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "redirect",
|
||||
"options": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "DNAT"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "udp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "guest"
|
||||
},
|
||||
{
|
||||
"name": "src_dport",
|
||||
"type": "option",
|
||||
"value": "53"
|
||||
},
|
||||
{
|
||||
"name": "dest_ip",
|
||||
"type": "option",
|
||||
"value": "10.10.10.1"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "53"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Redirect DNS"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "redirect",
|
||||
"options": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "DNAT"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Redirect HTTP"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "guest"
|
||||
},
|
||||
{
|
||||
"name": "src_dport",
|
||||
"type": "option",
|
||||
"value": "80"
|
||||
},
|
||||
{
|
||||
"name": "dest_ip",
|
||||
"type": "option",
|
||||
"value": "10.10.10.1"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "80"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8081 for edge.sdk.client.test on WAN"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8081"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8082 for app.arcad.edge.hextris on WAN"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8082"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8083 for arcad.diffusion on WAN"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8083"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"options": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "option",
|
||||
"value": "Allow 8084 for app.arcad.edge.menu on WAN"
|
||||
},
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "list",
|
||||
"value": "tcp"
|
||||
},
|
||||
{
|
||||
"name": "src",
|
||||
"type": "option",
|
||||
"value": "wan"
|
||||
},
|
||||
{
|
||||
"name": "dest_port",
|
||||
"type": "option",
|
||||
"value": "8084"
|
||||
},
|
||||
{
|
||||
"name": "target",
|
||||
"type": "option",
|
||||
"value": "ACCEPT"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "firewall"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "core",
|
||||
"options": [
|
||||
{
|
||||
"name": "lang",
|
||||
"type": "option",
|
||||
"value": "auto"
|
||||
},
|
||||
{
|
||||
"name": "mediaurlbase",
|
||||
"type": "option",
|
||||
"value": "/luci-static/bootstrap"
|
||||
},
|
||||
{
|
||||
"name": "resourcebase",
|
||||
"type": "option",
|
||||
"value": "/luci-static/resources"
|
||||
},
|
||||
{
|
||||
"name": "ubuspath",
|
||||
"type": "option",
|
||||
"value": "/ubus/"
|
||||
}
|
||||
],
|
||||
"section": "main"
|
||||
},
|
||||
{
|
||||
"name": "extern",
|
||||
"options": [
|
||||
{
|
||||
"name": "uci",
|
||||
"type": "option",
|
||||
"value": "/etc/config/"
|
||||
},
|
||||
{
|
||||
"name": "dropbear",
|
||||
"type": "option",
|
||||
"value": "/etc/dropbear/"
|
||||
},
|
||||
{
|
||||
"name": "openvpn",
|
||||
"type": "option",
|
||||
"value": "/etc/openvpn/"
|
||||
},
|
||||
{
|
||||
"name": "passwd",
|
||||
"type": "option",
|
||||
"value": "/etc/passwd"
|
||||
},
|
||||
{
|
||||
"name": "opkg",
|
||||
"type": "option",
|
||||
"value": "/etc/opkg.conf"
|
||||
},
|
||||
{
|
||||
"name": "firewall",
|
||||
"type": "option",
|
||||
"value": "/etc/firewall.user"
|
||||
},
|
||||
{
|
||||
"name": "uploads",
|
||||
"type": "option",
|
||||
"value": "/lib/uci/upload/"
|
||||
}
|
||||
],
|
||||
"section": "flash_keep"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": null,
|
||||
"section": "languages"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": [
|
||||
{
|
||||
"name": "sessionpath",
|
||||
"type": "option",
|
||||
"value": "/tmp/luci-sessions"
|
||||
},
|
||||
{
|
||||
"name": "sessiontime",
|
||||
"type": "option",
|
||||
"value": "3600"
|
||||
}
|
||||
],
|
||||
"section": "sauth"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": [
|
||||
{
|
||||
"name": "enable",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
}
|
||||
],
|
||||
"section": "ccache"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": [
|
||||
{
|
||||
"name": "Bootstrap",
|
||||
"type": "option",
|
||||
"value": "/luci-static/bootstrap"
|
||||
},
|
||||
{
|
||||
"name": "BootstrapDark",
|
||||
"type": "option",
|
||||
"value": "/luci-static/bootstrap-dark"
|
||||
},
|
||||
{
|
||||
"name": "BootstrapLight",
|
||||
"type": "option",
|
||||
"value": "/luci-static/bootstrap-light"
|
||||
}
|
||||
],
|
||||
"section": "themes"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": [
|
||||
{
|
||||
"name": "rollback",
|
||||
"type": "option",
|
||||
"value": "90"
|
||||
},
|
||||
{
|
||||
"name": "holdoff",
|
||||
"type": "option",
|
||||
"value": "4"
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "option",
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"name": "display",
|
||||
"type": "option",
|
||||
"value": "1.5"
|
||||
}
|
||||
],
|
||||
"section": "apply"
|
||||
},
|
||||
{
|
||||
"name": "internal",
|
||||
"options": [
|
||||
{
|
||||
"name": "dns",
|
||||
"type": "option",
|
||||
"value": "openwrt.org"
|
||||
},
|
||||
{
|
||||
"name": "ping",
|
||||
"type": "option",
|
||||
"value": "openwrt.org"
|
||||
},
|
||||
{
|
||||
"name": "route",
|
||||
"type": "option",
|
||||
"value": "openwrt.org"
|
||||
}
|
||||
],
|
||||
"section": "diag"
|
||||
}
|
||||
],
|
||||
"name": "luci"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "interface",
|
||||
"options": [
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "static"
|
||||
},
|
||||
{
|
||||
"name": "ipaddr",
|
||||
"type": "option",
|
||||
"value": "127.0.0.1"
|
||||
},
|
||||
{
|
||||
"name": "netmask",
|
||||
"type": "option",
|
||||
"value": "255.0.0.0"
|
||||
},
|
||||
{
|
||||
"name": "device",
|
||||
"type": "option",
|
||||
"value": "lo"
|
||||
}
|
||||
],
|
||||
"section": "loopback"
|
||||
},
|
||||
{
|
||||
"name": "interface",
|
||||
"options": [
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "dhcp"
|
||||
},
|
||||
{
|
||||
"name": "device",
|
||||
"type": "option",
|
||||
"value": "eth0"
|
||||
}
|
||||
],
|
||||
"section": "wan"
|
||||
},
|
||||
{
|
||||
"name": "interface",
|
||||
"options": [
|
||||
{
|
||||
"name": "proto",
|
||||
"type": "option",
|
||||
"value": "static"
|
||||
},
|
||||
{
|
||||
"name": "device",
|
||||
"type": "option",
|
||||
"value": "wlan0"
|
||||
},
|
||||
{
|
||||
"name": "ipaddr",
|
||||
"type": "option",
|
||||
"value": "10.10.10.1"
|
||||
},
|
||||
{
|
||||
"name": "netmask",
|
||||
"type": "option",
|
||||
"value": "255.255.255.0"
|
||||
}
|
||||
],
|
||||
"section": "guest"
|
||||
}
|
||||
],
|
||||
"name": "network"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "rpcd",
|
||||
"options": [
|
||||
{
|
||||
"name": "socket",
|
||||
"type": "option",
|
||||
"value": "/var/run/ubus/ubus.sock"
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "option",
|
||||
"value": "30"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "login",
|
||||
"options": [
|
||||
{
|
||||
"name": "username",
|
||||
"type": "option",
|
||||
"value": "root"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "option",
|
||||
"value": "$p$root"
|
||||
},
|
||||
{
|
||||
"name": "read",
|
||||
"type": "list",
|
||||
"value": "*"
|
||||
},
|
||||
{
|
||||
"name": "write",
|
||||
"type": "list",
|
||||
"value": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "rpcd"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "system",
|
||||
"options": [
|
||||
{
|
||||
"name": "hostname",
|
||||
"type": "option",
|
||||
"value": "arcad-will"
|
||||
},
|
||||
{
|
||||
"name": "timezone",
|
||||
"type": "option",
|
||||
"value": "UTC"
|
||||
},
|
||||
{
|
||||
"name": "ttylogin",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "log_size",
|
||||
"type": "option",
|
||||
"value": "64"
|
||||
},
|
||||
{
|
||||
"name": "urandom_seed",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "timeserver",
|
||||
"options": [
|
||||
{
|
||||
"name": "enabled",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "enable_server",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"type": "list",
|
||||
"value": "0.openwrt.pool.ntp.org"
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"type": "list",
|
||||
"value": "1.openwrt.pool.ntp.org"
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"type": "list",
|
||||
"value": "2.openwrt.pool.ntp.org"
|
||||
},
|
||||
{
|
||||
"name": "server",
|
||||
"type": "list",
|
||||
"value": "3.openwrt.pool.ntp.org"
|
||||
}
|
||||
],
|
||||
"section": "ntp"
|
||||
}
|
||||
],
|
||||
"name": "system"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "network",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "network"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "dhcp"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "wireless",
|
||||
"options": [
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "network"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "firewall",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "firewall"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "luci-splash"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "qos"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "miniupnpd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "olsr",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "olsrd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dhcp",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "dnsmasq"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "odhcpd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "odhcpd",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "odhcpd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "dropbear",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "dropbear"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "httpd",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "httpd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fstab",
|
||||
"options": [
|
||||
{
|
||||
"name": "exec",
|
||||
"type": "option",
|
||||
"value": "/sbin/block mount"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "qos",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "qos"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "system",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "led"
|
||||
},
|
||||
{
|
||||
"name": "exec",
|
||||
"type": "option",
|
||||
"value": "/etc/init.d/log reload"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "luci_statistics"
|
||||
},
|
||||
{
|
||||
"name": "affects",
|
||||
"type": "list",
|
||||
"value": "dhcp"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "luci_splash",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "luci_splash"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "upnpd",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "miniupnpd"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ntpclient",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "ntpclient"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "samba",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "samba"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "tinyproxy",
|
||||
"options": [
|
||||
{
|
||||
"name": "init",
|
||||
"type": "option",
|
||||
"value": "tinyproxy"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "ucitrack"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "uhttpd",
|
||||
"options": [
|
||||
{
|
||||
"name": "listen_http",
|
||||
"type": "list",
|
||||
"value": "0.0.0.0:8080"
|
||||
},
|
||||
{
|
||||
"name": "listen_http",
|
||||
"type": "list",
|
||||
"value": "[::]:8080"
|
||||
},
|
||||
{
|
||||
"name": "listen_https",
|
||||
"type": "list",
|
||||
"value": "0.0.0.0:8443"
|
||||
},
|
||||
{
|
||||
"name": "listen_https",
|
||||
"type": "list",
|
||||
"value": "[::]:8443"
|
||||
},
|
||||
{
|
||||
"name": "redirect_https",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"name": "home",
|
||||
"type": "option",
|
||||
"value": "/www"
|
||||
},
|
||||
{
|
||||
"name": "rfc1918_filter",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "max_requests",
|
||||
"type": "option",
|
||||
"value": "3"
|
||||
},
|
||||
{
|
||||
"name": "max_connections",
|
||||
"type": "option",
|
||||
"value": "100"
|
||||
},
|
||||
{
|
||||
"name": "cert",
|
||||
"type": "option",
|
||||
"value": "/etc/uhttpd.crt"
|
||||
},
|
||||
{
|
||||
"name": "key",
|
||||
"type": "option",
|
||||
"value": "/etc/uhttpd.key"
|
||||
},
|
||||
{
|
||||
"name": "cgi_prefix",
|
||||
"type": "option",
|
||||
"value": "/cgi-bin"
|
||||
},
|
||||
{
|
||||
"name": "lua_prefix",
|
||||
"type": "list",
|
||||
"value": "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
|
||||
},
|
||||
{
|
||||
"name": "script_timeout",
|
||||
"type": "option",
|
||||
"value": "60"
|
||||
},
|
||||
{
|
||||
"name": "network_timeout",
|
||||
"type": "option",
|
||||
"value": "30"
|
||||
},
|
||||
{
|
||||
"name": "http_keepalive",
|
||||
"type": "option",
|
||||
"value": "20"
|
||||
},
|
||||
{
|
||||
"name": "tcp_keepalive",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "ubus_prefix",
|
||||
"type": "option",
|
||||
"value": "/ubus"
|
||||
}
|
||||
],
|
||||
"section": "main"
|
||||
},
|
||||
{
|
||||
"name": "cert",
|
||||
"options": [
|
||||
{
|
||||
"name": "days",
|
||||
"type": "option",
|
||||
"value": "730"
|
||||
},
|
||||
{
|
||||
"name": "key_type",
|
||||
"type": "option",
|
||||
"value": "ec"
|
||||
},
|
||||
{
|
||||
"name": "bits",
|
||||
"type": "option",
|
||||
"value": "2048"
|
||||
},
|
||||
{
|
||||
"name": "ec_curve",
|
||||
"type": "option",
|
||||
"value": "P-256"
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "option",
|
||||
"value": "ZZ"
|
||||
},
|
||||
{
|
||||
"name": "state",
|
||||
"type": "option",
|
||||
"value": "Somewhere"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"type": "option",
|
||||
"value": "Unknown"
|
||||
},
|
||||
{
|
||||
"name": "commonname",
|
||||
"type": "option",
|
||||
"value": "OpenWrt"
|
||||
}
|
||||
],
|
||||
"section": "defaults"
|
||||
}
|
||||
],
|
||||
"name": "uhttpd"
|
||||
},
|
||||
{
|
||||
"configs": [
|
||||
{
|
||||
"name": "wifi-device",
|
||||
"options": [
|
||||
{
|
||||
"name": "type",
|
||||
"type": "option",
|
||||
"value": "mac80211"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "option",
|
||||
"value": "platform/soc/3f300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1"
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"type": "option",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"name": "band",
|
||||
"type": "option",
|
||||
"value": "2g"
|
||||
},
|
||||
{
|
||||
"name": "htmode",
|
||||
"type": "option",
|
||||
"value": "HT20"
|
||||
},
|
||||
{
|
||||
"name": "cell_density",
|
||||
"type": "option",
|
||||
"value": "0"
|
||||
}
|
||||
],
|
||||
"section": "radio0"
|
||||
},
|
||||
{
|
||||
"name": "wifi-iface",
|
||||
"options": [
|
||||
{
|
||||
"name": "device",
|
||||
"type": "option",
|
||||
"value": "radio0"
|
||||
},
|
||||
{
|
||||
"name": "mode",
|
||||
"type": "option",
|
||||
"value": "ap"
|
||||
},
|
||||
{
|
||||
"name": "ssid",
|
||||
"type": "option",
|
||||
"value": "Arcad - Connect and Play"
|
||||
},
|
||||
{
|
||||
"name": "encryption",
|
||||
"type": "option",
|
||||
"value": "none"
|
||||
},
|
||||
{
|
||||
"name": "network",
|
||||
"type": "option",
|
||||
"value": "guest"
|
||||
}
|
||||
],
|
||||
"section": "default_radio0"
|
||||
}
|
||||
],
|
||||
"name": "wireless"
|
||||
}
|
||||
]
|
||||
},
|
||||
"postImportCommands": []
|
||||
}
|
Reference in New Issue
Block a user