mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	Merge branch 'main' into dependabot/github_actions/docker/metadata-action-4
This commit is contained in:
		
						commit
						18fa093257
					
				
							
								
								
									
										4
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							@ -52,7 +52,7 @@ jobs:
 | 
				
			|||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        if: github.event_name != 'release'
 | 
					        if: github.event_name != 'release'
 | 
				
			||||||
        uses: docker/build-push-action@v2
 | 
					        uses: docker/build-push-action@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
          push: ${{ github.event_name != 'pull_request' }}
 | 
					          push: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
@ -64,7 +64,7 @@ jobs:
 | 
				
			|||||||
      -
 | 
					      -
 | 
				
			||||||
        name: Build and push
 | 
					        name: Build and push
 | 
				
			||||||
        if: github.event_name == 'release'
 | 
					        if: github.event_name == 'release'
 | 
				
			||||||
        uses: docker/build-push-action@v2
 | 
					        uses: docker/build-push-action@v3
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          context: .
 | 
					          context: .
 | 
				
			||||||
          push: true
 | 
					          push: true
 | 
				
			||||||
 | 
				
			|||||||
@ -117,10 +117,7 @@ where
 | 
				
			|||||||
        config.ldap_user_dn.clone(),
 | 
					        config.ldap_user_dn.clone(),
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let tls_context = (
 | 
					    let context_for_tls = context.clone();
 | 
				
			||||||
        context.clone(),
 | 
					 | 
				
			||||||
        get_tls_acceptor(config).context("while setting up the SSL certificate")?,
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let binder = move || {
 | 
					    let binder = move || {
 | 
				
			||||||
        let context = context.clone();
 | 
					        let context = context.clone();
 | 
				
			||||||
@ -134,23 +131,27 @@ where
 | 
				
			|||||||
        .map_err(|err: anyhow::Error| error!("[LDAP] Service Error: {:#}", err))
 | 
					        .map_err(|err: anyhow::Error| error!("[LDAP] Service Error: {:#}", err))
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let tls_binder = move || {
 | 
					 | 
				
			||||||
        let tls_context = tls_context.clone();
 | 
					 | 
				
			||||||
        fn_service(move |stream: TcpStream| {
 | 
					 | 
				
			||||||
            let tls_context = tls_context.clone();
 | 
					 | 
				
			||||||
            async move {
 | 
					 | 
				
			||||||
                let ((handler, base_dn, user_dn), tls_acceptor) = tls_context;
 | 
					 | 
				
			||||||
                let tls_stream = tls_acceptor.clone().accept(stream).await?;
 | 
					 | 
				
			||||||
                handle_ldap_stream(tls_stream, handler, base_dn, user_dn).await
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
        .map_err(|err: anyhow::Error| error!("[LDAPS] Service Error: {:#}", err))
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    let server_builder = server_builder
 | 
					    let server_builder = server_builder
 | 
				
			||||||
        .bind("ldap", ("0.0.0.0", config.ldap_port), binder)
 | 
					        .bind("ldap", ("0.0.0.0", config.ldap_port), binder)
 | 
				
			||||||
        .with_context(|| format!("while binding to the port {}", config.ldap_port));
 | 
					        .with_context(|| format!("while binding to the port {}", config.ldap_port));
 | 
				
			||||||
    if config.ldaps_options.enabled {
 | 
					    if config.ldaps_options.enabled {
 | 
				
			||||||
 | 
					        let tls_context = (
 | 
				
			||||||
 | 
					            context_for_tls,
 | 
				
			||||||
 | 
					            get_tls_acceptor(config).context("while setting up the SSL certificate")?,
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        let tls_binder = move || {
 | 
				
			||||||
 | 
					            let tls_context = tls_context.clone();
 | 
				
			||||||
 | 
					            fn_service(move |stream: TcpStream| {
 | 
				
			||||||
 | 
					                let tls_context = tls_context.clone();
 | 
				
			||||||
 | 
					                async move {
 | 
				
			||||||
 | 
					                    let ((handler, base_dn, user_dn), tls_acceptor) = tls_context;
 | 
				
			||||||
 | 
					                    let tls_stream = tls_acceptor.accept(stream).await?;
 | 
				
			||||||
 | 
					                    handle_ldap_stream(tls_stream, handler, base_dn, user_dn).await
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            })
 | 
				
			||||||
 | 
					            .map_err(|err: anyhow::Error| error!("[LDAPS] Service Error: {:#}", err))
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        server_builder.and_then(|s| {
 | 
					        server_builder.and_then(|s| {
 | 
				
			||||||
            s.bind("ldaps", ("0.0.0.0", config.ldaps_options.port), tls_binder)
 | 
					            s.bind("ldaps", ("0.0.0.0", config.ldaps_options.port), tls_binder)
 | 
				
			||||||
                .with_context(|| format!("while binding to the port {}", config.ldaps_options.port))
 | 
					                .with_context(|| format!("while binding to the port {}", config.ldaps_options.port))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user