.NET does not want to connect to OpenLDAP over LDAPS - vb.net

I am currently very much stuck on trying to connect to an OpenLDAP Server using the .NET Framework 3.0.
I am using the following code:
Dim ldapDirectoryIdentifier As New System.DirectoryServices.Protocols.LdapDirectoryIdentifier("ldap.example.de", 636, True, False)
connection = New LdapConnection(ldapDirectoryIdentifier)
connection.AuthType = 2 '//Negotiate
connection.SessionOptions.ProtocolVersion = 3
connection.SessionOptions.SecureSocketLayer = True
'//This is set to true temporarily for test purposes
connection.SessionOptions.VerifyServerCertificate = true
connection.Credential = New System.Net.NetworkCredential("cn=LDAP_user,ou=Funktion-User,o=Comp", "******")
connection.Bind()
The output is "The supplied credentials are invalid", but entering the very same credentials into any other tool works quite fine.
I have also tried:
Username: "LDAP_user"
Username:
"cn=LDAP_user,ou=Funktion-User,o=Comp,dc=example,dc=de"
AuthType:
1-7
A different user altogether
ProcotolVersion = 2
a non-fully qualified hostname
I have tried every variable, and I am out of ideas.

Related

How can I change the Authentication method in connections between WinRm and Terraform with hyperv provider?

I'm trying to use an hyperv provider for create some virtual machines but I need to define some parameters for the HyperV API. The problem is that WinRm (that is the tool that try to connect with the host) can't access with my credentials using the Basic Auth. However, If I use the Negotiate Auth, it returns a successfully connection. So, I don't know how can I define a parameter in Terraform for that.
Here is my provider config's code in Terraform:
provider "hyperv" {
user = myusername
password = mypassword
host = myhost
port = 5985
https = false
insecure = true
timeout = "60s"
}
My winrm/config/client:
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = true
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = true
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = *
My winrm/config/service:
MaxConcurrentOperations = 4294967295
MaxConcurrentOperationsPerUser = 1500
EnumerationTimeoutms = 240000
MaxConnections = 300
MaxPacketRetrievalTimeSeconds = 120
AllowUnencrypted = true
Auth
Basic = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = true
CbtHardeningLevel = Relaxed
DefaultPorts
HTTP = 5985
HTTPS = 5986
IPv4Filter = *
IPv6Filter = *
EnableCompatibilityHttpListener = true
EnableCompatibilityHttpsListener = true
CertificateThumbprint
AllowRemoteAccess = true
Hy again guys. If someone have the same problem I resolve it on that way:
-I activate Administrador user from Local users.
-Then, one have to run this command in a CMD:
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
-Reboot the system
-Then, run winrm quickconfig in a CMD, and then it would work.
I hope it help you!

Trying to connect to on-prem SQL Server using ntlm and nodejs

looking for an example or code that allows to connect a very simple node.js console application to a SQL Server Instance (2019) using ntlm and no name and password, using tedious and/or mssql.
For tedious, the code below works fine:
but I cannot seem to get the code to use ntlm without providing a name and password.
//
var Connection = require('tedious').Connection;
var config = {
server: '(local)',
authentication: {
type: 'default',
options: {
userName: 'sa',
password: 'your_sa_password' //update me
}
},
options: {
// If you are on Microsoft Azure, you need encryption:
encrypt: true,
database: 'master',
trustServerCertificate: true
}
};
var connection = new Connection(config);
connection.on('connect', function(err) {
// If no error, then good to proceed.
console.log("Connected");
});
connection.connect();
//
(I have tried the above with and without the trustServerCertificate, it seems necessary)
For mssql, I am using the first example on this page:
https://tediousjs.github.io/node-mssql/#connect-callback
And it returns nothing - nothing at all, whether I use sql auth or ntlm. Not sure what is going on there - I have edited the catch block to have an error output, nothing happens.
The Instance is up, the code above runs, I have nothing special or unusual about the SQL Server that I know of at all.
Thoughts? Pointers? Any help deeply appreciated. I

javax.mail: Sending without authentication hangs inside Transport.send()

I am trying to send error reports from an application using a local send-only Postfix server. The server works fine (I have tested it using both telnet and mail) but I can't get the code below to work:
Properties props = new Properties();
props.put("mail.smtp.host",host); // "localhost"
props.put("mail.smtp.port",port); // "25"
props.put("mail.smtp.auth",auth); // false
props.put("mail.smtp.starttls.enable",tls); // false
props.put("mail.smtp.ssl.enable",ssl); // false
props.put("mail.smtp.sendpartial",true);
Session session = Session.getDefaultInstance(props);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO,new InternetAddress(to));
msg.setSubject(subject);
msg.setContent(content,"text/plain");
Transport.send(msg);
I have traced it up to the final call to send(), and it just hangs at that point -- it never returns from the call.
If I set "mail.smtp.auth" to true and replace the call to Transport.send() with this code:
Transport transport = s.getTransport("smtp");
transport.connect(host,Integer.parseInt(port,10),"foo","bar");
transport.sendMessage(msg,msg.getRecipients(Message.RecipientType.TO));
transport.close();
then it hangs inside the call to connect(). The same as true if I set "mail.smtp.auth" to false and set the username and password to null in the call to connect().
In /var/log/mail.log I see this:
connect from localhost[127.0.0.1]
and after I kill the hung process:
lost connection after CONNECT from localhost[127.0.0.1]
disconnect from localhost[127.0.0.1] commands=0/0
Can anyone see what I've done wrong here?
The problem turned out to be that the user "postfix" was being blocked by iptables. Adding an ACCEPT rule for postfix solved the problem.

Using TLS 1.1 with WinHttpRequest in classic ASP

I need to connect to another server from IIS 7.5 using TLS 1.1. I'm trying to run the code I found on this SO question, but I cannot write to nor read from httpRequest.option(9) -- the system says, invalid procedure call or argument: 'Option'. When I try Option(8) or other values, everything's OK. What am I doing wrong?
Here's the full code:
Const WinHttpRequestOption_SecureProtocols = 9
Const SecureProtocol_TLS1_1 = 512
Set WinHttpReq = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
WinHttpReq.Open "POST", url, false
WinHttpReq.Option(WinHttpRequestOption_SecureProtocols) = SecureProtocol_TLS1_1 'WinHttpReq.Option(9) = 512

GitLab Ldap insufficient access rights

Right!
I am getting ldap to work with GitLab 7.2.1. I have the correct LDAP connection details posted below:
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_host'] = '## company url ##'
gitlab_rails['ldap_port'] = 389
gitlab_rails['ldap_uid'] = 'mail'
gitlab_rails['ldap_method'] = 'plain' # 'ssl' or 'plain'
gitlab_rails['ldap_bind_dn'] = ''
gitlab_rails['ldap_password'] = ''
gitlab_rails['ldap_allow_username_or_email_login'] = false
gitlab_rails['ldap_base'] = '## company bind ##'
gitlab_rails['gitlab_signup_enabled'] = 'true'
gitlab_rails['gitlab_default_projects_limit'] = 0
gitlab_rails['gitlab_default_can_create_group'] = false
I have the right username and password tested with others in my team. I have tried ssl and plain ldap on ports 389 & 636.
After wiresharking the traffic I found this:
However it returns:
Could not authorize you from LDAP because "Invalid credentials".
At the login page. which is a 49 response.
Any ideas?