I am trying to install JavaMail on a CentOS 7 development machine using localhost only for the emails. Towards this end, I have installed dovecot, postfix, and mailx. I just installed dovecot using the instructions in this tutorial. But my JavaMail test code has been giving me all sorts of authentication errors when I try to read an inbox. How can I resolve these authentication errors so that I can log in?
At first, I was getting errors related to not finding a certificate, but I was able to resolve all those errors by commenting out any mention of ssl in the config files, by changing the protocol to imap instead of imaps, and by changing authentication to plain instead of login. (I can do all these things because it is a development machine and I just want to get JavaMail working before adding security in afterwards.) But after all those changes, I am still getting:
javax.mail.MessagingException: * BYE Internal error occurred.
Refer to server log for more information.
The line of code that throws the error is:
store.connect("localhost.localdomain", "root", "somepassword");
Note that typing hostname in the CentOS terminal results in localhost.localdomain.
The /var/log/maillog records are:
Jan 8 16:08:01 localhost dovecot: imap-login: Login: user=<root>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=7965, secured, session=<yb8l8ywMdwB/AAAB>
Jan 8 16:08:01 localhost dovecot: imap: Error: user root: Invalid settings in userdb: userdb returned 0 as uid
Jan 8 16:08:01 localhost dovecot: imap: Error: Invalid user settings. Refer to server log for more information.
Dovecot won't let you log in as root. Use some other user and userid.
Related
I found one article that was close to the issue I am experiencing. It is this one:
SQL Server JDBC Error on Java 8: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption
I can provide the entire stack trace but the pruned version has this series of errors:
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.security.cert.CertificateException: Certificates do not conform to algorithm constraints". ClientConnectionId:e7a5ebc2-d489-4743-85ba-7873926508fe
Caused by: javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: Certificates do not conform to algorithm constraints
Caused by: java.security.cert.CertificateException: Certificates do not conform to algorithm constraints
Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on keysize limits. RSA 1024bit key used with certificate: CN=SSL_Self_Signed_Fallback. Usage was tls server
The JDBC connection is to a SQL Server 2012 that does NOT have connection encryption enabled or any security that I know of. I talked to our DB guy and he says there is no security on the connection that he knows of. So, I am not sure WHY the MS driver continues to complain about the SSL connection.
This Linux server (CentOS 8) has two tomcat installations that use JDBC connections. I have a Tomcat 8.0.32 instance that connects to the SQL Server 2012 instance using the JTDS driver that has no problem at all in connecting. I tried switching that driver to the MS driver and it then experienced the same errors. So I switched it back. But the second installation of Tomcat (9.0.33) has an app that requires a JDBC 4.0 or above driver and the JTDS driver is only a 3.0 driver so I have to use the MS driver. But, I cannot figure out how to get a successful connection.
Digging through the Internet I found reference to the jsse.jar and having the correct certs installed (although nothing specific as to how to do it or why). I also dug of an article that said that the JTDS driver uses NTLM to connect (not 100% sure about that since I have no reference to a domain in my connection for JTDS). In any case, I just need some guidance on how to configure the MS driver to connect from Linux to a non-secured SQL Server 2012. The Microsoft references I found addressed secured connections but nothing about connections that were not secured.
Running Java version:
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://192.168.80.214:1433;databaseName=DB_Central;
integratedSecurity=true;authenticationScheme=NTLM;domain=mydomain.org;
Also tried:
url=jdbc:sqlserver://192.168.80.214:1433;databaseName=DB_Central;encrypt=false;sslProtocol=TLSv1.2;
And just:
url=jdbc:sqlserver://192.168.80.214:1433;databaseName=DB_Central
JTDS that works (in the tomcat 8.0.32 / JDBC 3.0 environment):
driverClassName=net.sourceforge.jtds.jdbc.Driver
url=jdbc:jtds:sqlserver://192.168.80.214:1433;databaseName=DB_Central
ANYTHING that might point me in the right direction would be helpful especially why the MS driver wants (or thinks) the connection is secure. The other tidbit is that I see none of these errors when deployed to Windows 10...so it has something to do with Linux and maybe the Java config on Linux. Or, maybe I just need the correct incantation for the connection string when in Linux.....
The driver believes that the connection is secure , if it is connecting to a port that is meant to receive only secure connections.
1.Check the port
2.Check for any other explicit setting of TLS / SSL on the JDBC url
So, the way I was able to get this to work after much trial and error was to copy the java.security file from the windows 10 install to the CentOS 8 install. The ONLY thing I can see as different between the two was in this section:
'# List of comma-separated packages that start with or equal this string
'# will cause a security exception to be thrown when
'# passed to checkPackageDefinition unless the
'# corresponding RuntimePermission ("defineClassInPackage."+package) has
'# been granted.
'#
'# by default, none of the class loaders supplied with the JDK call
'# checkPackageDefinition.
'#
The entries in CentOS included at the end of the list:
org.GNOME.Accessibility.,\
org.GNOME.Bonobo.
The entries in the Windows version had only one entry at the end:
com.sun.java.accessibility.
That was the only difference I could find. And, I don't understand why that made a difference.. But it DOES connect without error now and that is all I wanted....
spend quite some time to solve the connection issues between centos 8 with tomcat and jdbc:sql server 2014.
I replaced the self-signed certificate in the properties of protocols in sql server configuration.
It is misleading that you can't see it on windows. It's only visible in the tomcat catalina.out file - use debug with -Djavax.net.debug=ssl:handshake:all.
You have to prepare a certificate from an authority (a self-signed should also work) and store it in local computer - own certificate of the windows server.
Make sure the service account of sql server has access right on the private key of the certificate. Otherwise, the sql service will not start.
Restart sql server.
Add the certificate and chain to your tomcat configuration cacerts file.
add -Djavax.net.ssl.trustStore= and -Djavax.net.ssl.trustStorePassword= to setenv.sh
The string in the webapps web.xml had to be as simple as:
jdbc:sqlserver://yourURL;DatabaseName=yourDB;user=youruser;password=secret
[other options did not work and led to further exceptions: integratedSecurity=true;encrypt=true;trustServerCertificate=true - trustStore=storeName;trustStorePassword=storePassword
and i've tried all boolean options i.e.: false/true]
Restart tomcat
It has to do something with openjdk version of java. We have switched to amazon correto 1.8 you can find it here, and everything worked perfectly.
If anyone having the same problem at a Redhat 8 Linux, below command worked for me (it lowers the security)
update-crypto-policies --set LEGACY
I have a problem on my EMM virtual machine.
When I go to my console an error appears, as the screen shows
I think I have done all the previous tasks correctly, but only the people who do not work are not mistaken, so the error can come from the previous steps.
I'm running Windows Server 2008 64-bit
I have Java JDK 8 update 121
I have the latest version of WSO2 EMM
I'm logged in admin
This is due to the SSL certificate available in wso2carbon.jks in set to localhost not to the ip address. You can simply navigate to the emm server by clicking on the WSO2 logo.
and you can create a self singed SSL certificate to the ip address and replace the current cert in order to prevent this screen.
I am configuring my glassfish server so that a java web application fetches data from an IP (162.17.17.53) instead of localhost. When I try PING button on the JDBC Resiurce Pool, I get the below error:
Access denied for user 'user'#'162.17.17.54' (using password: YES) Error Code: 0. Please see server.log for more details.
NB: The machine I am doing the configurations on has the IP 162.17.17.54. Please assist
I have a weblogic folder, From this - How can i find the adminurl that I can use with the below command
java weblogic.Deployer –adminurl t3://server:7001 –username system –password weblogic –listapps
I tried looking into setupinfo.txt, portlist.ini - but somehow this did not help/work. How can get this working?
I get errors/exceptions like these (after few attempts)
The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object
Unable to connect to 'http://server:7001': Destination unreachable; java.net.ConnectException: Tried all: 1 addresses, but could not connect over HTTPS to server: localhost port: 7102; No available router to destination
based on setupinfo.txt, I am able to login to the web console - but I need to know how to get this command working with adminurl !!!
Thanks,
Got it, thanks Alex.
Steps
Find startscript.xml under your weblogic domain , search this file for "ADMIN_URL"
The same can be done by web console UI ..... Admin Console Login to AdminConsole->Server->Configuration->ListenPort (enable and note down the port)
Bingo.
I am trying to connect to Mercury mail server with a java application and I am using JavaMail api. The connection is not successful and I’m getting this error in the log:
EHLO x.x.x.x
554 Invalid HELO format
Which means that it connects to the server but the helo format is not something that sever likes. I've tired to debug it and I got to this code in JavaMail “SMTPTransport” class which says:
serverOutput.write(cmdBytes);
serverOutput.write(CRLF);
serverOutput.flush();
and according to code:
private static final byte[] CRLF = { (byte)'\r', (byte)'\n' };
which seems consistent with RFC 821
I know that on windows \n has different meaning but I am not sure if this really is the root of problem? If it not then what can cause this?
I checked mail server with mail client and it works fine and I checked the code with James mails server and it also works fine!
JavaMail API version is: 1.4.5 (latest release)
Mercury/32 : 4.7
I did a Google search on 554 Invalid HELO format and got a ton of hits about your specific Mercury problem. It's a bug.
http://community.pmail.com/forums/thread/4136.aspx
http://www.mantisbt.org/bugs/view.php?id=9645
http://ellislab.com/codeigniter/forums/viewthread/153130/
etc...
You might need to check the logs on the server to figure out what it's really complaining about, but... One thing you can try is setting the mail.stmp.localhost property to the correct DNS host name for your machine. From the debug output it looks like your machine is unable to determine its own name and so is sending the IP address instead.
For me in a web project the PHPMailer() class was forcing Auth. Changing the Auth to false fixed it. Maybe check similar option for setting Auth to false in your language.
This is what I changed in my PHP code from true to false and adding sendmail_from in the php.ini file
$mail = new PHPMailer();
$mail->SMTPAuth = false;