Open DineshReddyK opened 5 years ago
I Have Taken the word of DineshReddyK and s4nji about the OAUTH.
But my case is:
A close friend requested me to set up Janus for his Intranet, so he can set services on LAN on a easy way (Ansible/Docker). He'll not use OAUTH (github, FB, etc.).
How I can set up the janus.toml configuration, to use only BASIC AUTH?
users = {admin = "JF2CO4ZAM5XW6ZBAMVXG65LHNAQHI3ZAORUGS4ZAMZXWY2YK"}
The error is the same:
CLIENT:
$ curl -s -X "POST" http://127.0.0.1:10081/apis -H "Content-Type: application/json" -H "Authorization:Bearer $(cat .access_token)" -d @example.json
JANUS SERVER:
# ./janus_v4.0.0_linux_amd64 start
INFO[0000] Janus starting... version=4.0.0
[StatsGo] 2021/12/14 17:09:12 Stats counter incremented metric=app.init.ldapserver1.janus__v4_0_0__linux__amd64
[StatsGo] 2021/12/14 17:09:12 Stats counter incremented metric=total.app
{"level":"info","msg":"Invalid or no stats exporter was specified","stats.exporter":"","time":"2021-12-14T17:09:12-03:00"}
{"level":"info","msg":"Invalid or no tracing exporter was specified","time":"2021-12-14T17:09:12-03:00","tracing.exporter":""}
{"level":"info","msg":"Janus Admin API starting...","time":"2021-12-14T17:09:12-03:00"}
{"error":"could not create a file based repository for the oauth servers: open /etc/janus/auth: no such file or directory","event_name":"startup","level":"warning","msg":"an error occurred when an event was triggered","time":"2021-12-14T17:09:12-03:00"}
{"level":"info","msg":"Janus started","time":"2021-12-14T17:09:12-03:00"}
{"address":":10080","level":"info","msg":"Certificate and certificate key were not found, defaulting to HTTP","time":"2021-12-14T17:09:12-03:00"}
{"level":"info","msg":"Janus Admin API started","time":"2021-12-14T17:09:12-03:00"}
{"address":":10081","level":"info","msg":"Certificate and certificate key were not found, defaulting to HTTP","time":"2021-12-14T17:09:12-03:00"}
{"code":201,"duration":0,"duration-fmt":"784.844µs","host":"127.0.0.1:10081","level":"info","method":"POST","msg":"Completed handling request","referer":"","remote-addr":"127.0.0.1:39426","request":"/apis","request-id":"","time":"2021-12-14T17:09:17-03:00","user-agent":"curl/7.60.0"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa65905]
goroutine 31 [running]:
github.com/hellofresh/janus/pkg/plugin/oauth2.(*FileSystemRepository).FindAll(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
<autogenerated>:1 +0x5
github.com/hellofresh/janus/pkg/plugin/oauth2.(*OAuthLoader).getOAuthServers(0x0, 0xe533e0, 0x0, 0x0, 0x0, 0x0)
/home/runner/work/janus/janus/pkg/plugin/oauth2/loader.go:80 +0x49
github.com/hellofresh/janus/pkg/plugin/oauth2.(*OAuthLoader).LoadDefinitions(0x0, 0xe533e0, 0x0)
/home/runner/work/janus/janus/pkg/plugin/oauth2/loader.go:25 +0x3f
github.com/hellofresh/janus/pkg/plugin/oauth2.onReload(0xc1f420, 0xc000469e80, 0xd1cdbd, 0x6)
/home/runner/work/janus/janus/pkg/plugin/oauth2/setup.go:61 +0x5a
github.com/hellofresh/janus/pkg/plugin.EmitEvent(0xd1cdbd, 0x6, 0xc1f420, 0xc000469e80, 0x1, 0x60)
/home/runner/work/janus/janus/pkg/plugin/plugin.go:99 +0x176
github.com/hellofresh/janus/pkg/server.(*Server).handleEvent(0xc0000cd500, 0xc00000df20)
/home/runner/work/janus/janus/pkg/server/server.go:338 +0x120
github.com/hellofresh/janus/pkg/server.(*Server).startProvider.func1(0xc0000cd500, 0xe518a0, 0xc000115000)
/home/runner/work/janus/janus/pkg/server/server.go:204 +0x1c3
created by github.com/hellofresh/janus/pkg/server.(*Server).startProvider
/home/runner/work/janus/janus/pkg/server/server.go:189 +0x2e2
The janus.toml file is:
port = 10080
[web]
port = 10081
[web.credentials]
algorithm = "HS256"
secret = "secret key"
timeout = "1h"
[web.credentials.github]
organizations = ["JBOffice"]
teams = {yourOrganization = "devs"}
users = {admin = "JF2CO4ZAM5XW6ZBAMVXG65LHNAQHI3ZAORUGS4ZAMZXWY2YK"}
[database]
dsn = "file:///etc/janus"
Despite the fact of I'm testing on a OpenSuse Linux, but the final server will be a Windows Server without MongoDB. So any help about set the dsn to a Windows file system!
My guess is something like:
dsn = "file:///C:/etc/janus"
Does anybody can give a guidece?
-------x-------x
Janus daemon is crashing on hot reload when the /etc/janus/auth directory is missing. That seems to be because, on startup,
repo
is not built if auth directory is missing. and on reload, therepo
is used without any 'nil' checks.Reproduction Steps:
Expected behavior:
Janus should not crash
Observed behavior:
Janus crash
Janus version: master OS and version: fedora