Port 636 (LDAPS)
Key facts
- Port
- 636
- Protocols
- TCP
- Range
- System port (Well-Known), 0-1023
- IANA service name
- ldaps
IANA assigns ports in this range to well-known services, under RFC 6335.
About port 636
Port 636 is the port of LDAPS, meaning LDAP over a connection encrypted with TLS from the very first moment, over TCP. Applications and systems use it to access a directory service of users, groups, and permissions, with the whole connection, including the password, encrypted.
The LDAP standard, in RFC 4511, defines encryption with the StartTLS operation on port 389, but many directory servers and clients also support LDAPS. In the IANA port registry, port 636 is registered for the ldaps service.
What port 636 is used for
- Applications that authenticate users: mail systems, portals, and VPN servers connect to the directory at an address that starts with ldaps://.
- Active Directory: domain controllers with a suitable certificate installed answer LDAPS connections on port 636.
- Software that doesn't support StartTLS: some applications allow an encrypted connection to the directory only over LDAPS.
Port 636 in the firewall
As with port 389, a directory server serves the internal network, so allow access to port 636 only from the servers that need it:
- UFW:
ufw allow from 10.0.0.0/24 to any port 636 proto tcp - firewalld:
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/24" port port="636" protocol="tcp" accept'
On a directory server that isn't an Active Directory domain controller, when every application connects over LDAPS, you can keep port 389 closed to every address except the server itself.
Risks and security
Encryption protects the password and the data in transit, but protecting the directory itself depends on other settings:
- Install a valid certificate for the server name you connect to, and make sure applications verify the certificate rather than skip the check.
- Allow only current TLS versions.
- Limit access to the internal network and the servers that need it.
- Create service accounts for applications with read-only permissions.
Commands to check and configure
-
ss -tlnp | grep ':636 'Checks whether the directory server is listening on port 636.
-
nc -zv ldap.example.com 636Checks from your computer whether port 636 on the directory server is reachable.
-
openssl s_client -connect ldap.example.com:636 -showcertsConnects over an encrypted connection and shows the server's certificate chain.
-
ldapsearch -x -H ldaps://ldap.example.com -D "cn=reader,dc=example,dc=com" -W -b "dc=example,dc=com" "(uid=jdoe)"Searches the directory for a user over an LDAPS connection. The password is prompted for separately.
-
ufw allow from 10.0.0.0/24 to any port 636 proto tcpAllows access to port 636 only from the given internal network (UFW).
-
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/24" port port="636" protocol="tcp" accept'Allows access to port 636 only from the given internal network in firewalld. Then run firewall-cmd --reload.
Port 636 in the IANA registry
| Port | Protocol | Service | IANA registry description |
|---|---|---|---|
| 636 | TCP | ldaps | ldap protocol over TLS/SSL (was sldap) |
| 636 | UDP | ldaps | ldap protocol over TLS/SSL (was sldap) |
Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)
Port 636 FAQ
Should I use port 636 or port 389 with StartTLS?
Either way, the connection is encrypted before the password is sent. On port 636, encryption is on from the very first moment, so it's easier to make sure no application connects without encryption by mistake. On port 389, you need to set both the application and the server to require the switch to StartTLS.
Why does the LDAPS connection fail with a certificate error?
In most cases, the name you connect to isn't listed in the certificate, or the connecting computer doesn't recognize the certificate authority that issued it. Set the application to use the exact server name listed in the certificate, and add the organization's certificate authority certificate to the list of trusted certificates. The SSL errors page explains other common errors.
Do I need a special certificate for LDAPS?
No. Any server certificate that includes the name of the server you connect to will do. On an internal network, you can use a certificate from the organization's internal certificate authority, as long as the connecting computers trust it.
Does LDAPS encrypt the password too?
Yes. On port 636, the connection is encrypted before any data is sent, so the username, the password, and the search results all travel encrypted.