-
Notifications
You must be signed in to change notification settings - Fork 60
Auth
Hannibal doesn't support authentication yet. If you want to make Hannibal reachable from the Internet, it's recommended to put a web server in front of it that takes care of handling authentication.
If you do that, we also recommend enabling SSL so the user name and password are not transmitted in clear text. Obtaining a SSL certificate is outside of the scope of this document so the example uses plain HTTP.
These examples assume that Hannibal is running on port 9000 on the same host as the web server and is running on a Debian or Ubuntu server. If you're using another OS, you should adapt the paths to those used by your OS.
Generate a password file first (replace [USER]
with desired user name):
htpasswd -c /etc/apache2/hannibal.htpasswd [USER]
You need mod_auth_basic
, mod_authn_file
, mod_proxy
, mod_proxy_http
and mod_ssl
:
a2enmod auth_basic authn_file proxy proxy_http ssl
Create a new VirtualHost for Hannibal in /etc/apache2/sites-available/hannibal
:
<VirtualHost *:80>
ServerName hannibal.example.org
ProxyRequests Off
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
<Location />
AuthType Basic
AuthName "Hannibal"
AuthBasicProvider file
AuthUserFile /etc/apache2/hannibal.htpasswd
Require valid-user
</Location>
</VirtualHost>
Enable that site and restart Apache:
a2ensite hannibal && /etc/init.d/apache2 restart