• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

How To Setup A Backup LDAP Server Through LDAP Replication With TLS Authentication

Scott S

  • 4 min read
How To Setup A Backup LDAP Server Through LDAP Replication With TLS Authentication

Generating audio, please wait...

If you have set up replication between servers, it is an always a better practice to encrypt (StartTLS) the replication traffic to stop others from sniffing your data. This is distinct from using encryption with authentication as we did in https://www.supportsages.com/2012/06/ldap-configuration-for-user-and-group-centralised-authentication-on-ubuntu-lts-12-04-part-3 . Le us see discuss how to do the LDAP replication with tls authetication.

The assumption here is that you have set up replication between Provider and Consumer following https://www.supportsages.com/2012/07/how-to-setup-a-backup-ldap-server-through-ldap-replication and have configured TLS for authentication on the Provider by following https://www.supportsages.com/2012/06/ldap-configuration-for-user-and-group-centralised-authentication-on-ubuntu-lts-12-04-part-3

 

As I mentioned before, the objective for us with replication is high availability for the LDAP service. Since we have TLS for authentication on the Provider we will require the same on the Consumer. What other things to be done is to create a key and certificate for the Consumer and then configure accordingly. We will generate the key/certificate on the Provider, to avoid having to create another CA certificate, and then transfer the necessary files over to the Consumer.

On the Provider(ldapserver.int.sages.com)

Create a holding directory (which will be used for the eventual transfer) and then the Consumer’s private key:

root@ldapserver:]# mkdir ldapreplserver-ssl

root@ldapserver:]# cd ldapreplserver-ssl

root@ldapserver:ldapreplserver-ssl]# certtool –generate-privkey –bits 1024 –outfile

ldapreplserver.int.sages.com_slapd_key.pem

Create an info file, ldapreplserver.info, for the Consumer server, adjusting it’s values accordingly:

root@ldapserver:]# vi ldapreplserver.info

=========================================================

organization = Support Sages

cn = ldapreplserver.int.sages.com

tls_www_server

encryption_key

signing_key

expiration_days = 3650

=========================================================

The expiration_days attribute define the number of days the cert is valid. The above certificate is good for 10 years.(Rough calculation)

Create the Consumer’s certificate:

root@ldapserver:]# certtool –generate-certificate –load-privkey ldapreplserver.int.sages.com_slapd_key.pem –load-ca-certificate /etc/ssl/certs/cacert.pem  –load-ca-privkey /etc/ssl/private/cakey.pem –template ldap02.info –outfile ldapreplserver.int.sages.com_slapd_cert.pem

 

Get a copy of the CA certificate:

root@ldapserver:ldapreplserver-ssl]# cp /etc/ssl/certs/cacert.pem .

We’re done. Now transfer the ldapreplserver-ssl directory to the Consumer.

Here we use scp (adjust accordingly):

root@ldapserver:ldapreplserver-ssl]# cd ..

root@ldapserver:]# scp -r ldapreplserver-ssl root@ldapreplserver:

On the Consumer

Install the ssl-cert package first:

root@ldapreplserver:]# apt-get install ssl-cert

Add the openldap user to ssl-cert group and adjust the permissions as shown below:

root@ldapreplserver:]# adduser openldap ssl-cert

root@ldapreplserver:]# cp ldapreplserver.int.sages.com_slapd_cert.pem /etc/ssl/certs

root@ldapreplserver:]# cp ldapreplserver.int.sages.com_slapd_key.pem /etc/ssl/private

root@ldapreplserver:]# chgrp ssl-cert /etc/ssl/private/ldapreplserver.int.sages.com_slapd_key.pem

root@ldapreplserver:]# chmod g+r /etc/ssl/private/ldapreplserver.int.sages.com_slapd_key.pem

root@ldapreplserver:]# chmod o-r /etc/ssl/private/ldapreplserver.int.sages.com_slapd_key.pem

Create the file /etc/ssl/certinfo.ldif with the following contents (adjust accordingly):

root@ldapreplserver:]# vi /etc/ssl/certinfo.ldif

=========================================

dn: cn=config

add: olcTLSCACertificateFile

olcTLSCACertificateFile: /etc/ssl/certs/cacert.pem

–

add: olcTLSCertificateFile

olcTLSCertificateFile: /etc/ssl/certs/ldapreplserver.int.sages.com_slapd_cert.pem

–

add: olcTLSCertificateKeyFile

olcTLSCertificateKeyFile: /etc/ssl/private/ldapreplserver.int.sages.com_slapd_key.pem

 

Configure the slapd-config database:

root@ldapreplserver:]# ldapmodify -Y EXTERNAL -H ldapi:/// -f certinfo.ldif

Configure /etc/default/slapd as on the Provider (SLAPD_SERVICES).

On the Consumer, configure TLS for Consumer-side replication. Modify the existing olcSyncrepl attribute by tacking on some TLS options. In so doing, we will see, for the first time, how to change an attribute’s value(s).

Create the file consumer_sync_tls.ldif with the following contents:

root@ldapreplserver:]# vi consumer_sync_tls.ldif

===================================================

dn: olcDatabase={1}hdb,cn=config

replace: olcSyncRepl

olcSyncRepl: rid=0 provider=ldap://ldapserver.int.sages.com bindmethod=simple binddn=”cn=admin,dc=int,dc=sages,dc=com” credentials=sages123 searchbase=”dc=int,dc=sages,dc=com” logbase=”cn=accesslog” logfilter=”(&(objectClass=auditWriteObject)(reqResult=0))”

schemachecking=on type=refreshAndPersist retry=”60 +” syncdata=accesslog

starttls=critical tls_reqcert=demand

===================================================

The extra options specify, respectively, that the consumer must use StartTLS and that the CA certificate is required to verify the Provider’s identity.

Implement these changes to our LDAP tree:

root@ldapreplserver:]# ldapmodify -Y EXTERNAL -H ldapi:/// -f consumer_sync_tls.ldif

And restart slapd:

root@ldapreplserver:]# /etc/init.d/slapd restart

 

 

On the Provider(ldapserver.int.sages.com),

Check to see that a TLS session has been established. In /var/log/syslog, providing you have ‘conns’-level logging set up, you should see messages similar to:

=============================================================

slapd[3620]: conn=1047 fd=20 ACCEPT from IP=xx.xx.xx.xx:57922 (IP=0.0.0.0:389)

slapd[3620]: conn=1047 op=0 EXT oid=1.3.6.1.4.1.1466.20037

slapd[3620]: conn=1047 op=0 STARTTLS

slapd[3620]: conn=1047 op=0 RESULT oid= err=0 text=

slapd[3620]: conn=1047 fd=20 TLS established tls_ssf=128 ssf=128

slapd[3620]: conn=1047 op=1 BIND dn=”cn=admin,dc=int,dc=sages,dc=com” method=128

slapd[3620]: conn=1047 op=1 BIND dn=”cn=admin,dc=int,dc=sages,dc=com” mech=SIMPLE ssf=0

slapd[3620]: conn=1047 op=1 RESULT tag=97 err=0 text

=============================================================

  • General
  • Howtos
  • Linux
How To Setup A Backup LDAP Server Through LDAP Replication With TLS Authentication

All you want to know about Asterisk – Asterisk PBX – Part 3

All you want to know about Asterisk – Asterisk PBX – Part 3
  • Linux
logo

All you want to know about Asterisk – VoIP system architecture – Part 2

All you want to know about Asterisk – VoIP system architecture – Part 2
  • Howtos
  • Linux
logo

All you want to know about Asterisk – VoIP Fundamentals – Part 1

All you want to know about Asterisk – VoIP Fundamentals – Part 1
  • Howtos
  • Linux
logo

Asterisk Setup – Frequently Asked Questions and Answers

Asterisk Setup – Frequently Asked Questions and Answers
  • Linux
logo

Posts by Scott S

Scott follows his heart and enjoys design and implementation of advanced, sophisticated enterprise solutions. His never ending passion towards technological advancements, unyielding affinity to perfection and excitement in exploration of new areas, helps him to be on the top of everything he is involved with. This amateur bike stunting expert probably loves cars and bikes much more than his family. He currently spearheads the Enterprise Solutions and Infrastructure Consultancy wing of SupportSages.