2025-06-02 20:34:20 +02:00
2025-06-01 12:55:05 +02:00
2025-06-02 20:34:20 +02:00
2025-05-31 23:19:30 +02:00
2025-05-25 14:53:02 +02:00
2025-05-31 18:40:44 +02:00
2025-05-30 21:27:46 +02:00
2025-06-01 12:55:05 +02:00
2025-06-01 12:54:44 +02:00
2025-05-30 21:24:20 +02:00
2025-05-24 17:16:55 +02:00
2025-05-30 21:23:16 +02:00
2025-05-18 11:48:30 +02:00

HSP Guard

HSP Guard is an internal security service for your home lab, designed to manage user access to various home services and tools. It dynamically controls permissions and prevents unauthorized or unexpected users from accessing sensitive services.


📌 Overview

HSP Guard authorizes user requests and provides an efficient way to:

  • Manage permissions for individual services/tools
  • Define roles for easier access control
  • Validate and authorize users via JWT tokens
  • Securely integrate with new services during installation

📚 Concepts

🔐 Permission

Permissions define access to specific features or tools.
By default, HSP Guard includes predefined administrative permissions that allow an admin to log in and configure the system.

Once logged in, the admin can:

  • Manually create new permissions for specific applications
  • Allow new applications to register their own permissions
  • Assign permissions to users, granting them access to corresponding tools

🧩 Role

A Role is a named collection of permissions (e.g., GUEST, FRIEND, FAMILY_MEMBER) created by the admin.
Roles simplify user management by allowing bulk assignment of permissions. Instead of assigning multiple permissions individually, a role bundles them under one label.


👥 Group (Coming Soon)

This feature is planned for future releases. Groups will help organize users or services into logical clusters for simplified access control.


📡 API

User Authorization

To verify whether a request is made by a valid and authorized user, applications can require a JWT token as part of the request.
This token is sent to HSP Guard, which:

  • Validates the token
  • Returns user details (e.g., ID, name, email) for logging, auditing, or request tracing

🔑 Permission Checking

Applications can also verify whether a user holds specific permissions before granting access to certain services or features.

To do this, an app sends:

  • The user's JWT token
  • A list of required permissions

HSP Guard checks the users assigned permissions and responds with the authorization status.

Best Practice: Applications should directly integrate with HSP Guard to enforce permission-based access control.


🔄 User Authorization Flow

When a user tries to access a home lab service that requires authentication:

  1. The application will offer an authorization URL to the user.
  2. The user follows the URL and is taken to the HSP Guard login page.
  3. The user selects or signs into an account they wish to use for that service.
  4. Once authenticated and authorized, the user is redirected to the application-defined redirect URL.
  5. The application can now:
    • Retrieve a JWT token from the redirect callback
    • Optionally cache the session/token to avoid prompting the user every time

This process is similar to how external identity providers like Google Sign-In or GitHub OAuth work — providing a seamless and secure authentication experience for the user.


⚙️ Integrating New Services & Tools

When a new service or tool is installed:

  1. It provides a configuration file to HSP Guard
  2. Guard extracts and registers any defined permissions
  3. These permissions are isolated — even if a name overlaps with existing permissions, a prefix is added to avoid conflicts

👤 User Registration & Onboarding

New users (e.g., family, friends, guests) must complete a registration process to access your home lab.

They can:

  • Visit a user-friendly registration webpage
  • Fill out a form with basic information (name, email, password, etc.)

Once registered, the admin can assign roles or individual permissions as needed.


🚧 Roadmap

  • Group Management
  • Web UI Enhancements
  • Audit Logging
  • Permission Expiry & Time-Based Access

📬 Feedback & Contribution

Feel free to open an issue or pull request if youd like to contribute or report bugs. HSP Guard is a personal home lab project, but feedback is always welcome!

Description
Service that gently manages user credentials and permissions.
Readme MPL-2.0 9.4 MiB
Languages
TypeScript 66.5%
Go 30%
HTML 1.8%
Dockerfile 0.5%
Makefile 0.3%
Other 0.9%