Skip to content

Commit

Permalink
version 0.7.3, simple auth mode available, docs for auth created
Browse files Browse the repository at this point in the history
  • Loading branch information
jirivrany committed Nov 3, 2023
1 parent 6913689 commit 4c1ece5
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 24 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Last part of the system is Guarda service. This systemctl service is running in
* [Local database instalation notes](./docs/DB_LOCAL.md)

## Change Log
- 0.7.3 - New possibility of external auth proxy.
- 0.7.2 - Dashboard and Main menu are now customizable in config. App is ready to be packaged using setup.py.
- 0.7.0 - ExaAPI now have two options - HTTP or RabbitMQ. ExaAPI process has been renamed, update of ExaBGP process value is needed for this version.
- 0.6.2 - External config for ExaAPI
Expand Down
43 changes: 43 additions & 0 deletions docs/AUTH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ExaFS tool
## Auth mechanism

Since version 0.7.3, the application supports three different forms of user authorization.

* SSO using Shibboleth
* Simple Auth proxy
* Local single-user mode

### SSO
To use SSO, you need to set up Apache + Shiboleth in the usual way. Then set `SSO_AUTH = True` in the application configuration file **config.py**

Shibboleth configuration example:

#### shibboleth config:
```
<Location />
AuthType shibboleth
ShibRequestSetting requireSession 1
require shib-session
</Location>
```


#### httpd ssl.conf
We recomend using app with https only. It's important to configure proxy pass to uwsgi in httpd config.
```
# Proxy everything to the WSGI server except /Shibboleth.sso and
# /shibboleth-sp
ProxyPass /kon.php !
ProxyPass /Shibboleth.sso !
ProxyPass /shibboleth-sp !
ProxyPass / uwsgi://127.0.0.1:8000/
```

### Simple Auth
This mode uses a WWW server (usually Apache) as an auth proxy. It is thus possible to use an external user database. Everything needs to be set in the web server configuration, then in **config.py** enable `HEADER_AUTH = True` and set `AUTH_HEADER_NAME = 'X-Authenticated-User'`

See [apache.conf.example]('./apache.example.conf') for more information about configuration.

### Local single user mode
This mode is used as a fallback if neither SSO nor Simple Auth is enabled. Configuration is done using **config.py**. The mode is more for testing purposes, it does not allow to set up multiple users with different permission levels and also does not perform user authentication.
24 changes: 3 additions & 21 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,12 @@ The default Python for RHEL9 is Python 3.9
Virtualenv with Python39 is used by uWSGI server to keep the packages for app separated from system.

## Prerequisites
First, choose how to [authenticate and authorize users]('./AUTH.md'). The application currently supports three options.

ExaFS is using Shibboleth auth and therefore we suggest to use Apache web server.
Install the Apache httpd as usual and then continue with this guide.
Depending on the selected WWW server, set up a proxy. We recommend using Apache + mod_uwsgi. If you use another solution, set up the WWW server as you are used to.

First configure Shibboleth

### shibboleth config:
```
<Location />
AuthType shibboleth
ShibRequestSetting requireSession 1
require shib-session
</Location>
```

### httpd ssl.conf
We are using https only. It's important to configure proxy pass to uwsgi in httpd config.
```
# Proxy everything to the WSGI server except /Shibboleth.sso and
# /shibboleth-sp
ProxyPass /kon.php !
ProxyPass /Shibboleth.sso !
ProxyPass /shibboleth-sp !
# Proxy everything to the WSGI server
ProxyPass / uwsgi://127.0.0.1:8000/
```

Expand Down
24 changes: 24 additions & 0 deletions docs/apache.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# mod_dbd configuration
DBDriver pgsql
DBDParams "dbname=exafs_users host=localhost user=exafs password=verysecurepassword"

DBDMin 4
DBDKeep 8
DBDMax 20
DBDExptime 300

# ExaFS authentication
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html

<Location />
AuthType Basic
AuthName "Database Authentication"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT pass_hash AS password FROM \"users\" WHERE email = %s"
Require valid-user
RequestHeader set X-Authenticated-User expr=%{REMOTE_USER}
ProxyPass http://127.0.0.1:8080/
</Location>
</VirtualHost>
2 changes: 1 addition & 1 deletion flowapp/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.2"
__version__ = "0.7.3"
2 changes: 0 additions & 2 deletions flowapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def login(user_info):
uuid = False
return redirect("/")
else:
user = db.session.query(models.User).filter_by(uuid=uuid).first()
try:
_register_user_to_session(uuid)
except AttributeError:
Expand Down Expand Up @@ -194,4 +193,3 @@ def _register_user_to_session(uuid: str):
session["can_edit"] = True if all(roles) and roles else []

return app

0 comments on commit 4c1ece5

Please sign in to comment.