script-server icon indicating copy to clipboard operation
script-server copied to clipboard

Make first connected user to be an admin

Open bugy opened this issue 4 years ago • 17 comments

At the moment, if you install a new copy of script server without any config, it will give admin rights to a localhost user However, if you start it from docker, then there is no localhost user, so there are no default admins

It would be helpful for new users of Script server to treat the very first connected user as an admin. So they would be able to make script configurations from UI This should be enabled, only if "auth" and "access" configs are missing completely.

bugy avatar Mar 25 '20 19:03 bugy

Any progress on this? Would be very nice to have. I already have it behind a reverse proxy that manages authentication but I can't seem to get the configuration to allow me to modify the script. The following is my config:

{
  "port": 5000,
  "address": "0.0.0.0",
  "title": "SCRIPT-SERVER"
  "access": {
        "allowed_users": "*",
        "admin_users": "*",
  },
}

skluthe avatar Apr 19 '20 17:04 skluthe

Hi, I didn't work on this feature. Probably it won't even come with the next release

But regarding your case: you cannot enter admin.html page at all? What error do you see?

bugy avatar Apr 19 '20 17:04 bugy

It gives me a 403 forbidden error.

On Sun, Apr 19, 2020, 10:27 AM Iaroslav Shepilov [email protected] wrote:

Hi, I didn't work on this feature. Probably it won't even come with the next release

But regarding your case: you cannot enter admin.html page at all? What error do you see?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616189505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURNMF6XV5BG4HUJY3NZPTRNMX7BANCNFSM4LTWI67Q .

skluthe avatar Apr 19 '20 17:04 skluthe

Are you running inside docker?

bugy avatar Apr 19 '20 17:04 bugy

Yes I am.

On Sun, Apr 19, 2020, 10:50 AM Iaroslav Shepilov [email protected] wrote:

Are you running inside docker?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616194556, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURNMEH5FPTCBNDGVPYLFDRNM2XNANCNFSM4LTWI67Q .

skluthe avatar Apr 19 '20 17:04 skluthe

Here are the logs when I try to access a page:

2020-04-19 17:48:39,803 [tornado.access.INFO] 200 POST /executions/cleanup/8 (10.0.100.2) 2.36ms
2020-04-19 17:55:00,817 [script_server.audit_utils.WARNING] Could not get hostname for 192.168.0.101
2020-04-19 17:55:00,851 [script_server.audit_utils.WARNING] Could not get hostname for 10.0.100.2
2020-04-19 17:55:00,851 [web_server.WARNING] User 192.168.0.101-eaed84a3aba24bdc (user) tried to access admin static file admin.html
2020-04-19 17:55:00,852 [tornado.access.WARNING] 403 GET /admin.html (10.0.100.2) 68.69m

skluthe avatar Apr 19 '20 17:04 skluthe

Are you sure your config is picked? Please also note, that changing conf.json requires server restart

skluthe [email protected] schrieb am So., 19. Apr. 2020, 19:55:

Yes I am.

On Sun, Apr 19, 2020, 10:50 AM Iaroslav Shepilov <[email protected]

wrote:

Are you running inside docker?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/bugy/script-server/issues/274#issuecomment-616194556 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AFURNMEH5FPTCBNDGVPYLFDRNM2XNANCNFSM4LTWI67Q

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616195452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJJZUXS7XZMMIB4AODLRNM3HPANCNFSM4LTWI67Q .

bugy avatar Apr 19 '20 17:04 bugy

Is there any way for me to check that the config is getting picked up? I have it in /conf and have the bind mounted as /home/user/script-server/conf bound to /app/conf

skluthe avatar Apr 19 '20 18:04 skluthe

This is the content of /home/user/script-server/conf/

logging.json  runners  script-server.json

skluthe avatar Apr 19 '20 18:04 skluthe

Just try changing the port in the config and see if it will be changed

skluthe [email protected] schrieb am So., 19. Apr. 2020, 20:02:

Is there any way for me to check that the config is getting picked up? I have it in /conf and have the bind mounted as /home/user/script-server/conf bound to /app/conf

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616196781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJICUTTU6CHBI5GFTR3RNM4BZANCNFSM4LTWI67Q .

bugy avatar Apr 19 '20 18:04 bugy

I changed it in the config but the port didn't change.

On Sun, Apr 19, 2020, 11:33 AM Iaroslav Shepilov [email protected] wrote:

Just try changing the port in the config and see if it will be changed

skluthe [email protected] schrieb am So., 19. Apr. 2020, 20:02:

Is there any way for me to check that the config is getting picked up? I have it in /conf and have the bind mounted as /home/user/script-server/conf bound to /app/conf

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/bugy/script-server/issues/274#issuecomment-616196781 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAJXPJICUTTU6CHBI5GFTR3RNM4BZANCNFSM4LTWI67Q

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616203119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURNMGLLXU6V3I2DY4ELA3RNM7YHANCNFSM4LTWI67Q .

skluthe avatar Apr 19 '20 19:04 skluthe

The file should be not script-server.json but conf.json

bugy avatar Apr 19 '20 19:04 bugy

That did it. Thank you!

On Sun, Apr 19, 2020, 12:47 PM Iaroslav Shepilov [email protected] wrote:

The file should be not script-server.json but conf.json

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/274#issuecomment-616214248, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFURNMFMRV2LQBDHOIXEW6LRNNINNANCNFSM4LTWI67Q .

skluthe avatar Apr 19 '20 20:04 skluthe

I'm having the similar issue

I run the command below to install it via docker.

docker run -d -p 5000:5000 \
           -v /home/usr/scriptserver/conf.json:/app/conf.json \
           -v /home/usr/scriptserver/runners/:/app/conf/runners \
           -v /home/usr/scriptserver/scripts/:/app/scripts/ \
           --name ScriptServer \
           bugy/script-server:latest

Then I add below to conf.json

{
  "port": 5000,
  "address": "0.0.0.0",
  "title": "SCRIPT-SERVER"
  "access": {
        "allowed_users": "*",
        "admin_users": "*",
  },
}

Then I restart docker and I still get a 403 forbidden error on the admin page.

bamwasteland avatar Jan 06 '22 05:01 bamwasteland

Hi @bamwasteland, this should work. Most probably the config is not picked up by script server, please double check paths (I see syntax issues in the file, so with this config script server would fail to start)

bugy avatar Jan 06 '22 07:01 bugy

Hello, i install script server and i also have the same problem. I can't access to the admin page ( 403 error : forbidden)

christophe0001 avatar Mar 16 '22 08:03 christophe0001

I solved the problem by adding the authentication configuration. here is my conf.json file : { "port": 5000, "address": "0.0.0.0", "title": "SCRIPT-SERVER", "auth": { "type": "htpasswd", "htpasswd_path": "/root/any/path/script-server/conf/.htpasswd" }, "access": { "allowed_users": [ "admin" ], "admin_users": [ "admin" ] } }

christophe0001 avatar Mar 16 '22 09:03 christophe0001

I'd like to add: I got it working with the follging conf.json:

{
	"title": "SCRIPT SERVER",
	"access": {
		"admin_users": [ "*" ]
		}
}

Keeping "allowed users" left me unable to access the server at all (and might be the reason christpher0001 needed to setup auth?

anoderay avatar Jan 08 '23 19:01 anoderay