Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

How to password protect output API? #1186

Open
rcoenen opened this issue Jan 20, 2018 · 7 comments
Open

How to password protect output API? #1186

rcoenen opened this issue Jan 20, 2018 · 7 comments

Comments

@rcoenen
Copy link

rcoenen commented Jan 20, 2018

Hi - I have Zenbot4 running on a public cloud instance.

How can I password protect the HTML interface/dashboard (or output API as it is known)

@defkev
Copy link
Contributor

defkev commented Jan 20, 2018

Bind to localhost
c.output.api.ip = 'localhost'
and put a reverse proxy with htaccess (or whatever floats your boat) in front of it.

Note that the option is currently only available in unstable.

@rcoenen
Copy link
Author

rcoenen commented Jan 20, 2018

Right - I suppose that will work. Any plans for adding simply a password option in?

@defkev
Copy link
Contributor

defkev commented Jan 21, 2018

If the API ever majors to the point that it actually allows control of the bot i'd say its pretty mandatory but for now no, at least not by me.

@sergejostir
Copy link

sergejostir commented Jan 21, 2018

Or just limit access to your IP (range) with firewall. But yeah, I agree that simple password protection would be nice.

@jaredallard
Copy link

I feel like this would be out of scope for zenbot, but a nice feature. nginx w/ whatever method of auth should always be the answer for securing things.

@JulesBern
Copy link

How to use with reverse proxy in Nginx:

server { # Zenbot reverse-proxy
listen 2004; # custom port that will be accessed publicly
server_name zenbot.yourdomain.com;

# serve static files
location ~ ^/(images|javascript|js|css|flash|media|static)/  {
  expires 30d;
}

# pass request
location / {
        proxy_pass      http://localhost:20084; # set this port in ->  c.output.api.port = 20084 
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd; #basic auth
}

}

@rcoenen
Copy link
Author

rcoenen commented Feb 22, 2018

@JulesBern That and then running the bot through Termux are a good enough way to set stuff up fairly securely

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants