zenbot icon indicating copy to clipboard operation
zenbot copied to clipboard

How to password protect output API?

Open rcoenen opened this issue 8 years ago • 7 comments

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)

rcoenen avatar Jan 20 '18 18:01 rcoenen

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.

defkev avatar Jan 20 '18 22:01 defkev

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

rcoenen avatar Jan 20 '18 23:01 rcoenen

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.

defkev avatar Jan 21 '18 00:01 defkev

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

sergejostir avatar Jan 21 '18 09:01 sergejostir

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.

jaredallard avatar Jan 25 '18 03:01 jaredallard

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
}

}

JulesBern avatar Feb 22 '18 17:02 JulesBern

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

rcoenen avatar Feb 22 '18 17:02 rcoenen