Skip to content
Snippets Groups Projects
  1. Oct 20, 2022
    • Julian's avatar
      Remailer address format v2 · 879a04c5
      Julian authored
      Deprecates old case-sensitive format. Some software out there stores email
      addresses converted to lower case, breaking v1 remailer addresses. The new
      format is case-insensitive and generally more robust.
      
      Uffd continues to use and support the v1 format for services setup before
      this change. Support for the old format is planned to be remove in uffd v3.
      It is possbile to gradually migrate services to the new format with a service
      setting in the admin interface.
      
      Also fixes compatability issue with very recent SQLAlchemy versions introduced
      by b391e176 (whens parameter of case function).
      879a04c5
  2. Oct 19, 2022
    • Julian's avatar
      Per-service email preferences · b391e176
      Julian authored
      Also fixes a minor email-related bug in the admin interface and bad
      texts/translations in the selfservice UI.
      b391e176
  3. Aug 28, 2022
  4. Aug 27, 2022
    • nd's avatar
      Add prometheus metric endpoint at /metrics · 76dbf7b0
      nd authored
      Access control is done via normal api credentials.
      See README.md for details.
      Adds an optional dependency on python3-prometheus-client.
      76dbf7b0
  5. Aug 22, 2022
    • Julian's avatar
      Introduce ServiceUser · 6337c591
      Julian authored
      Preperation for future features that require per-service user settings
      or state, e.g. stateful sync or service-specific email settings.
      
      The additional JOIN of ServiceUser degrades getusers API performance
      by 30-50%. For API calls that return many users, this is compensated by
      an otherwise unrelated optimization (selectinload instead of joinedload).
      6337c591
  6. Aug 19, 2022
    • Julian's avatar
      Use UTC internally · ffcec8a4
      Julian authored
      Convert DateTime fields to UTC, use "utcnow" instead of "now" and use
      babel helper/filter when dates/times are displayed or parsed from user
      input.
      
      Uffd continues to use the system's timezone in the user interface by
      default.  However, it is now possible to overwrite this with the
      BABEL_DEFAULT_TIMEZONE config option.
      ffcec8a4
  7. Aug 15, 2022
    • Julian's avatar
      Cleanup CI tests and LDAP remnants · 3f82ec74
      Julian authored
      Unittest jobs now fail if any test fails. Unittests on Bullseye no longer
      fail due to jinja2 import errors. Linter jobs run faster.
      3f82ec74
    • Julian's avatar
      Restructure source tree · ac731bf4
      Julian authored
      Move all models, views, cli commands and templates into corresponding
      top-level folders. Detailed changes:
      
      - uffd/<NAME>/models.py -> uffd/models/<NAME>.py
      - uffd/<NAME>/cli.py -> uffd/commands/<NAME>.py
      - uffd/<NAME>/views.py -> uffd/views/<NAME>.py
      - uffd/<NAME>/templates/* -> uffd/templates/
      - uffd/ratelimit.py -> uffd/models/ratelimit.py (it contains models)
      - gendevcert from uffd/__init__.py -> uffd/commands/gendevcert.py
      - profile from uffd/__init__.py -> uffd/commands/profile.py
      - cleanup from uffd/tasks.py -> uffd/commands/cleanup.py
      - roles-update-all from uffd/role/views.py -> uffd/commands/...
      - Views from uffd/__init__.py -> uffd/views/__init__.py
      - All models can/should be imported from uffd.models
      - flask shell auto-imports all models instead of only a few
      
      The old structure was meant to keep the code modular and related
      code/resources close to each other. However, the modules turned out to
      be heavily interdependent and not very modular. Also importing was fragile
      due to ordering issues.
      
      With the new structure the dependency tree is much simpler: Infrastructure
      code (top-level *.py files) has no internal dependencies. Models only
      depend on infrastructure and other models. Views and cli commands depend
      on infrastructure, models and other views/commands.
      
      Going forward there is still some restructuring to do, e.g.:
      
      - Move mfa setup views to selfservice views
      - Move mfa auth views to session views
      - Move utility code from views to infrastructure (e.g. login_required)
      - In most cases views should not need to import from other views
      - Reorganize infrastructure code
      ac731bf4
  8. Aug 14, 2022
  9. Apr 25, 2022
    • Julian's avatar
      Remailer support · 10e37c17
      Julian authored
      With this feature, uffd can be configured to hide mail addresses of users
      from certain services while still allowing the services to send mails to the
      users.
      
      To these services uffd returns special remailer addresses instead of the real
      mail addresses. When a service sends an email to a remailer address the mail
      server queries uffd's API and replaces the remailer address with the real mail
      address in both envelope and headers.
      
      This feature requires additional mail server configuration (Postfix
      canonical_maps) and support in uffd-socketmapd.
      10e37c17
  10. Apr 22, 2022
  11. Apr 20, 2022
    • Julian's avatar
      Fix "new invite" form resetting on error · bfd759bd
      Julian authored
      When the "new invite" page was submitted with e.g. an invalid "Valid Until"
      value, uffd displayed an error and reset the whole form. This was confusing
      to users.
      
      Now the form content is preserved on errors. Also the "Valid Until" field now
      has min/max attributes to prevent submitting the form with invalid values.
      
      Fixes #134
      bfd759bd
  12. Mar 29, 2022
  13. Feb 28, 2022
    • Julian's avatar
    • Julian's avatar
      Fix regression in service overview access behavior · 3880be9a
      Julian authored
      When the service overview was introduced, it was meant to be optional. Thus
      if the SERVICES config option was empty (the default), uffd returned 404.
      
      Commit fa67bde0 (Migrate OAuth2 and API clients to database) introduced the
      regression that accessing the service overview page when no services are
      visible based on the permissions of the current user (or guest if not logged
      in), 404 is returned.
      
      This change fixes the regression and further changes the behavior to improve
      consistency. Since fa67bde0, the page is relevant to admin users regardless of
      the SERVICES config option. Therefore uffd asks for login or reports missing
      permissions in all cases it originally returned 404.
      3880be9a
  14. Feb 24, 2022
    • Julian's avatar
      Migrate OAuth2 and API clients to database · fa67bde0
      Julian authored
      Also adds a shallow Service model that coexists with the config-defined
      services to group multiple OAuth2 and API clients together.
      
      Clients defined in the config with OAUTH2_CLIENTS and API_CLIENTS_2 are
      imported by the database migrations.
      
      Removes support for complex values for the OAuth2 client group_required option.
      Only simple group names are supported, not (nested) lists of groups previously
      interpreted as AND/OR conjunctions. Also removes support for the login_message
      parameter of OAuth2 clients.
      fa67bde0
  15. Feb 17, 2022
    • Julian's avatar
      Refactor Unix UID/GID generation · 66df931d
      Julian authored
      The generation now happens in a subquery inside the INSERT statement instead
      of separate client-managed query. This should also reduce the risk of race
      conditions.
      
      Service and non-service users may now use the same UID range.
      66df931d
  16. Feb 16, 2022
  17. Feb 13, 2022
    • Julian's avatar
      Argon2 for user password hashing · ac003909
      Julian authored
      Argon2 is a modern password hashing algorithm. It is significantly more secure
      than the previous algorithm (salted SHA512). User logins with Argon2 are
      relativly slow and cause significant spikes in CPU and memory (100MB) usage.
      
      Existing passwords are gradually migrated to Argon2 on login.
      ac003909
    • Julian's avatar
      Unified password hashing for User and Signup · 117e257c
      Julian authored
      Previously User used salted SHA512 with OpenLDAP-style prefix syntax and
      Signup used crypt. Both models had their own hashing and verification
      code. Now both use OpenLDAP-style syntax with support for all traditional
      formats including crypt. Salted SHA512 is used for new User and Signup
      passwords.
      
      Existing Signup objects are migrated to the new format and remain functional.
      User passwords now support gradual migration to another hash algorithm when
      it is changed in the future.
      
      This code is planned to be used for database-stored API and OAuth2 client
      secrets.
      117e257c
  18. Feb 04, 2022
    • Julian's avatar
      Constrain mail receive addresses and fix case-folding in API · 17b99372
      Julian authored
      Previously the getmails API endpoint did not match "receive_address" values
      case-insensitivly like it did pre-v2. To solve this independent of database
      collations, all existing mail receive addresses are converted to lower-case
      and new/changed receive addresses are constraint to ASCII lower-case letters,
      digits and symbols.
      17b99372
  19. Feb 01, 2022
  20. Dec 11, 2021
  21. Dec 03, 2021
    • Julian's avatar
      HTTP Basic auth for API with new API_CLIENTS_2 · 917f9ecd
      Julian authored
      This change is going to be backported to v1.x.x to have a good migration path.
      Bearer auth with API_CLIENTS config key is deprecated and planned to be
      removed in v2.0.0.
      917f9ecd
  22. Oct 05, 2021
  23. Oct 02, 2021
    • Julian's avatar
      Move User, Group and Mail models from LDAP to DB · 4a9c455f
      Julian authored
      * Removal of ldapalchemy and LDAP mocking support
      * Removal of dependency on ldap3 (except for the migration)
      * Remaining "LDAP_<name>" config keys are renamed to "<name>"
      * Web interface to create, edit and delete groups
      * Consistent foreign key, cascading and nullable configuration on all models
      * User/Group.dn is replaced with numeric User/Group.id
      * User.uid is renamed to User.unix_uid (to differentiate with new User.id)
      * Group.gid is renamed to Group.unix_gid (to differentiate with new Group.id)
      * All User/Group/Mail related routes now use the database ids instead of uid/gid/dn
      * PasswordToken/MailToken now reference users directly instead of storing loginnames
      
      The database migration (optionally) uses the v1 config keys to connect to
      an LDAP server and to import all users, groups and mail forwardings.
      4a9c455f
  24. Sep 13, 2021
  25. Sep 10, 2021
  26. Sep 08, 2021
  27. Sep 05, 2021
    • Julian's avatar
      Refactor permission checking and differenciate login and selfservice access · e6df5bbe
      Julian authored
      Fixes #104.
      
      Replaced "group" keyword argument for login_required with "permission_check".
      Most views already define a *_acl_check function that returns whether the
      current user has the required permissions for use with register_navbar. The
      same function can now be passed to login_required as the "permission_check"
      argument.
      
      Differenciated login and selfservice access permissions. Previously
      ACL_SELFSERVICE_GROUP was required to login. Now ACL_ACCESS_GROUP is required
      to login and ACL_SELFSERVICE_GROUP is required to access selfservice functions
      (and to use role-granting invite links). A user with just ACL_ACCESS_GROUP can
      now login, access the services overview page and authenticate with OAuth2
      services he has access to, but not change his user attributes, password or
      roles/permissions.
      e6df5bbe
  28. Sep 04, 2021
    • Julian's avatar
      bf72b10d
    • Julian's avatar
      Removed TestUserViewsOLUserAsUser test cases · 0212237e
      Julian authored
      The test cases effectivly tested if the user_acl_check works which is already
      covered by other test cases.
      0212237e
    • Julian's avatar
      Dedicated error page for permission errors · 2d0ed84b
      Julian authored
      Prior to this change permission errors (i.e. the user is logged in but does
      not have a required group) were reported with flash('Access denied') and a
      redirect to the selfservice index page. This causes two problems: The error
      is reported with HTTP status 301/200 which is difficult to check for in tests.
      This can also cause redirect loops as soon as the selfservice uses more
      differentiated permission checks (see #104).
      
      With this change a dedicated error page is displayed in place the requested
      page and the HTTP status 403 is returned. This is implemented with
      flask's errorhandler concept for 403.
      2d0ed84b
  29. Sep 02, 2021
    • Julian's avatar
      Replace flask_oauthlib with plain oauthlib · 45d4598e
      Julian authored
      flask_oauthlib is no longer available in Debian Bullseye. It is only a
      wrapper around oauthlib, which is still available. While this change does
      increase the OAuth2 code size, it achieves compatability with both Debian
      Buster and Bullseye.
      
      Aside from error handling, this change has no noticable effects on OAuth2.0
      clients. In terms of error handling, a few cases that were not properly
      handled before now return appropriate error pages.
      
      Fixes #101
      45d4598e
Loading