User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
services:lubelogger [2025/01/25 16:48] – created willyservices:lubelogger [2025/01/27 17:31] (current) – [Authentication] willy
Line 1: Line 1:
 ====== LubeLogger ====== ====== LubeLogger ======
  
-[[https://lubelogger.com/|LubeLogger]] is an aSelf-Hosted, Open-Source, Unconventionally-Named Vehicle Maintenance Records and Fuel Mileage Tracker for your cars and vehicles.+[[https://lubelogger.com/|LubeLogger]] is an aSelf-Hosted, Open-Source, Unconventionally-Named Vehicle Maintenance Records and Fuel Mileage Tracker for your cars and vehicles. In other words, you can use it to track expenditures, taxes and maintenance done (with costs) of you vehicles.
  
 ===== Installation ===== ===== Installation =====
Line 14: Line 14:
 Now, create the following **docker-compose.yml** as user //lubelogger//: Now, create the following **docker-compose.yml** as user //lubelogger//:
 <file - docker-compose.yml> <file - docker-compose.yml>
 +---
 +version: "3.4"
  
 +services:
 +  app:
 +    image: ghcr.io/hargata/lubelogger:latest
 +    build: .
 +    environment:
 +      - LC_ALL=it_IT.UTF-8 # this will affect how numbers, currencies, and dates are formatted.
 +      - LANG=it_IT.UTF-8   # Same as above. 
 +#      - EnableAuth=false  # See authentication below
 +    volumes:
 +      - /data/lubelogger/config:/App/config
 +      - /data/lubelogger/data:/App/data
 +      - /data/lubelogger/translations:/App/wwwroot/translations
 +      - /data/lubelogger/documents:/App/wwwroot/documents
 +      - /data/lubelogger/images:/App/wwwroot/images
 +      - /data/lubelogger/temp:/App/wwwroot/temp
 +      - /data/lubelogger/log:/App/log
 +      - /data/lubelogger/keys:/root/.aspnet/DataProtection-Keys
 +    ports:
 +      - 8485:8080
  
 +    networks:
 +      - lubelogger-net
 +
 +networks:
 +  lubelogger-net: {}
 </file> </file>
  
 Choose an available port, of course! Choose an available port, of course!
 +
 +Now pull it:
 +<code bash>
 +podman compose pull
 +</code>
 +
 +
 +===== Authentication =====
 +
 +Authentication with LubeLogger took a bit to figure out. First of all, it's pretty unconventional in a few respects:
 +  * Authentication is disabled by default, but once you mess with it, it can be managed only from web settings and the environment setting seems to be unresponsive
 +  * It does not support forwarded headers or similar proxy based stuff
 +  * It support OIDC (Authelia...) SSO type authentication but it still requires you to setup local authentication first
 +  * It does allow multiple users, but only via email registration with tokens, you cannot add users from the admin control panel. This is probably the weirdest choice.
 +
 +You have different options:
 +  * disable LubeLogger auth and use your own proxy-based authentication, but you lose additional users
 +  * enable internal LubeLogger auth, and disable your proxy autnehtication, but you need to create users 
 +  * enable LubeLogger authentication with your OIDC SSO (es Authelia), but you still need to create your LubeLogger root account and you will not be able to use your proxy authentication, not even via the SSO itself.
 +
 +In general enabling LubeLogger authentication is a bit of a mess. First of all, it starts with authentication disabled. As stated [[https://docs.lubelogger.com/Installation/Authentication|here]] you need to go to settings and enable authentication in order to create a //root// user and setup a password. Also note that to add users you **must** setup an email provider and have LubeLogger send out a token to the new user email address. Very annoying.
 +
 +Instead, if you want to enable SSO, you need to setup the following environments in your docker compose:
 +<code>
 +MailConfig__EmailServer="" <- Email SMTP settings used only for configuring multiple users(to send their registration token and forgot password tokens)
 +MailConfig__EmailFrom="" <- Same as above.
 +MailConfig__Port=587 <- Same as above.
 +MailConfig__Username="" <- Same as above.
 +MailConfig__Password="" <- Same as above.
 +OpenIDConfig__Name=Authelia
 +OpenIDConfig__ClientId=lube
 +OpenIDConfig__ClientSecret=client-secret-string
 +OpenIDConfig__AuthURL=Authorization URL to the Provider's Login Page
 +OpenIDConfig__TokenURL=URL to retrieve user JWT from the Provider
 +OpenIDConfig__RedirectURL=https://lubelogger.mydomain.com/Login/RemoteAuth
 +OpenIDConfig__Scope="openid email"
 +OpenIDConfig__ValidateState=true/false(default: false) - whether LubeLogger should validate state.
 +OpenIDConfig__UsePKCE=true/false(default: false) - whether LubeLogger should use PKCE
 +</code>
 +
 +My specific Authelia client setting is:
 +<code>
 +      - client_id: 'lube'
 +        client_name: 'LubeLogger'
 +        client_secret: 'client-secret-string'
 +        public: false
 +        authorization_policy: 'one_factor'
 +        pre_configured_consent_duration: 1M
 +        scopes:
 +          - openid
 +          - email
 +          - profile
 +        grant_types:
 +          - 'authorization_code'
 +        redirect_uris:
 +          - https://lubelogger.mydomain.com/Login/RemoteAuth
 +        userinfo_signed_response_alg: none
 +        token_endpoint_auth_method: 'client_secret_post'
 +</code>
 +
 +I suggest you also setup email notification by creating a dedicated email address for LubeLogger to send out emails or you will **not** be able to add users.
 +
 +I choose to fully disable LubeLogger authentication and go with proxy authentication since i only need one user account no matter who is actually logged in.
  
  
 ===== Reverse Proxy ===== ===== Reverse Proxy =====
  
-Running LubeLogger behind NGINX is easy, this is an example:+Running LubeLogger behind NGINX is easy, but it cannot be hosted (at the moment, see [[https://github.com/hargata/lubelog/issues/775|here]]) on a sub-path, so a sub-domain it must be. I assume you will host it under **https://lubelogger.mydomain.com**: 
 <file - lubelogger.conf> <file - lubelogger.conf>
-  location /lubelogger/ +server 
-        client_max_body_size 512M;+        server_name lubelogger.mydomain.com; 
 +        listen 443 ssl;  
 +        listen 8443 ssl
  
-        proxy_pass http://127.0.0.1:8584+        access_log /var/log/nginx/lubelogger.mydomain.com_access_log main; 
-        proxy_http_version 1.1;+        error_log /var/log/nginx/lubelogger.mydomain.com_error_log info
 +         
 +        # The following line enables proxy auth with SSO, uncomment to use LubeLogger auth 
 +        include "com.mydomain/authelia_location.conf";
  
-        proxy_set_header Connection $http_connection; 
-        proxy_set_header Connection 'upgrade'; 
-        proxy_cache_bypass $http_upgrade; 
-        proxy_set_header Host $host; 
-        proxy_set_header X-Real-IP $remote_addr; 
-        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
-        proxy_set_header X-Forwarded-Proto $scheme; 
  
 +         location / {
 +                # The following two lines enables proxy auth with SSO, uncomment to use LubeLogger auth
 +                include "com.mydomain.com/authelia_proxy.conf";
 +                include "com.mydomain.com/authelia_authrequest.conf";
 +                
 +                proxy_pass http://127.0.0.1:8485;
 +                client_max_body_size               50000M;
 +                
 +# The following lines are all commented to use NGINX SSO authentication and NOT LubeLogger
 +# authentication. IF you want to use LubeLogger authentication, uncomment them.
 +#                proxy_set_header Host              $http_host;
 +#                proxy_set_header X-Real-IP         $remote_addr;
 +#                proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
 +#                proxy_set_header X-Forwarded-Proto $scheme;
 +
 +                proxy_set_header   Upgrade    $http_upgrade;
 +                proxy_set_header   Connection "upgrade";
     }     }
 +}
 </file> </file>
 +
  
  
 ===== Running ===== ===== Running =====
 +
 +To start it, and set it up on boot, as usual follow my indications [[gentoo:containers|Using Containers on Gentoo]], so link the **user-containers** init script:
 +<code>
 +ln -s /etc/init.d/user-containers /etc/init.d/user-containers.lubelogger
 +</code>
 +
 +and create the following config file:
 +<file - /etc/conf.d/user-containers.lubelogger>
 +USER=grist
 +DESCRIPTION="Track your can maintenance"
 +</file>
 +
 +Add the service to the default runlevel and start it now:
 +<code bash>
 +rc-update add user-containers.lubelogger default
 +rc-service user-containers.lubelogger start
 +</code>
  
  

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information