nginx-ad-auth is a Go program that serves as an authentication service for the NGINX email plugin. It authenticates users against Active Directory using LDAP.
Clone the repository:
git clone https://github.com/yourusername/nginx-ad-auth.git
Change to the project directory:
cd nginx-ad-auth
Build the program:
go build -o nginx-ad-auth
Run the program with the following command:
./nginx-ad-auth [flags]
--port: Port to listen on (default: 8080)--ldap-uri: LDAP URI--ldap-base: LDAP base--ad-domain: Active Directory domain--mail-server: Mail server address--mail-server-port: Mail server port--help: Show help messageYou can also use environment variables instead of flags:
NGINX_AUTH_PORTNGINX_AUTH_LDAP_URINGINX_AUTH_LDAP_BASENGINX_AUTH_AD_DOMAINNGINX_AUTH_MAIL_SERVERNGINX_AUTH_MAIL_SERVER_PORTTo build and run the Docker image:
Build the image:
docker build -t nginx-ad-auth .
Run the container:
docker run -p 8080:8080 -e NGINX_AUTH_LDAP_URI=ldap://your-ad-server nginx-ad-auth
To deploy on Kubernetes using Helm:
To deploy the nginx-ad-auth service using the provided Helm chart, follow these steps:
First, ensure you have Helm installed on your local machine and configured to work with your Kubernetes cluster.
Update the values.yaml file in the helm/nginx-ad-auth directory to match your environment. Pay special attention to the following fields:
image.repository: Update this to your Docker registry if you've pushed a custom image.env: Update the environment variables to match your Active Directory and mail server configuration.From the root of the project, run:
helm install nginx-ad-auth ./helm/nginx-ad-auth
To upgrade an existing deployment with new values:
helm upgrade nginx-ad-auth ./helm/nginx-ad-auth
You can customize the installation by overriding values:
helm install nginx-ad-auth ./helm/nginx-ad-auth --set replicaCount=3
Remember to configure your NGINX Ingress or other ingress controller to route traffic to the nginx-ad-auth service.
To configure NGINX as an email proxy to a mail server hosted in a private network at 192.168.1.1:993 via IMAPS, you can use the following NGINX configuration:
mail {
server_name mail.example.com;
auth_http localhost:8080/auth;
imap_capabilities "IMAP4rev1" "UIDPLUS";
server {
listen 993 ssl;
protocol imap;
ssl_certificate /path/to/your/certificate.crt;
ssl_certificate_key /path/to/your/certificate.key;
proxy on;
proxy_pass 192.168.1.1:993;
proxy_ssl on;
proxy_ssl_verify off;
}
}
This configuration does the following:
nginx-ad-auth service running on localhost:8080 for authentication.Remember to replace /path/to/your/certificate.crt and /path/to/your/certificate.key with the paths to your SSL certificate and key files. Also, ensure that the auth_http URL matches the location where your nginx-ad-auth service is running.
This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3).
For the full license text, see the LICENSE file in the project repository or visit GNU AGPL v3.0.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)If you encounter any problems or have any questions, please open an issue in the GitHub repository.
Content type
Image
Digest
sha256:536996c0b…
Size
7.5 MB
Last updated
about 2 years ago
docker pull sctg/nginx-ad-auth