Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/sonroyaalmerol/ldap-saml-assertions

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sonroyaalmerol/ldap-saml-assertions

  • v0.2.10
  • Source
  • Go
  • Socket score

Version published
Created
Source

SAML Assertion verification via LDAP

Overview

This project implements a fake LDAP server designed to facilitate SAML authentication. My main use-case for this is SOGo with Dovecot as its mail backend. While SOGo supports SAML, Dovecot does not, necessitating this custom solution. The fake LDAP server validates SAML assertions and mimics LDAP authentication, allowing seamless integration with Dovecot's passdb configuration.

Features

  • SAML Assertion Handling: Validates SAML assertions received from SOGo.
  • LDAP BIND (only) Compatibility: Mimics LDAP behavior, allowing Dovecot to authenticate users using the fake LDAP server.

Prerequisites

  • Valid SAML Identity Provider (IdP) metadata

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/ldap-saml-assertions.git
    cd ldap-saml-assertions
    
  2. Build the application:

    go build -o ldap-saml-assertions
    
  3. Configure the application by creating a configuration file or by passing arguments directly.

Usage

Run the server with the following command:

./ldap-saml-assertions sp_cert=/path/to/sp-cert.pem sp_key=/path/to/sp-key.pem [other_arguments]

Command-Line Arguments

  • userid: Attribute of the username within the SAML assertion (default: uid).
  • sp_acs: ACS value of service provider to match "SubjectConfirmationData" recipient.
  • sp_cert: Path to the SP X.509 certificate file (only applicable if assertions are encrypted).
  • sp_key: Path to the SP private key file (only applicable if assertions are encrypted).
  • idp_metadata: URL or path to the IdP metadata XML.

Example

To run the server with a certificate and key:

./ldap-saml-assertions sp_cert=/etc/ssl/certs/sp-cert.pem sp_key=/etc/ssl/private/sp-key.pem idp_metadata=https://example.com/idp/metadata.xml

Dovecot Configuration

To configure Dovecot to use this fake LDAP server, you can add the following lines to your Dovecot configuration (dovecot.conf):

passdb {
  driver = ldap
  args = /path/to/your/ldap.conf
}

Sample ldap.conf for Dovecot

hosts = localhost:3389
ldap_version = 3
base = dc=saml
dn = cn=admin,dc=saml
dnpass = secret
auth_bind = yes
auth_bind_userdn = %u

Make sure to replace the placeholders with actual values relevant to your setup.

Testing the LDAP Server

To test the LDAP server, you can use the ldapsearch command as follows:

ldapsearch -x -H ldap://localhost:3389 -D "<uid>" -w "<base64 encoded SAML assertion>"

Replace <uid> with the actual username you want to test.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

FAQs

Package last updated on 22 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc