How to set client info while using JavaMail - jakarta-mail

I have an mail account can be managed by mail client foxmail, a mail desktop client by Tencent.
But when I using JavaMail to connect to the IMAP server, the connection request is denied by the server saying that the client is not an authorized one.
Is it possible to set some properties to make the IMAP server take my javamail client as an authorized one ?

The server might be using the IMAP ID command to identify the client. Both IMAPStore and IMAPFolder include an id method that allows you to issue the IMAP ID command. You'll probably need to call it right after connecting and right after opening a folder. You'll have to figure out what foxmail is sending if you want to send the same thing to "fake it".

DEBUG IMAP: enable STARTTLS
DEBUG IMAP: trying to connect to host "imap.exmail.qq.com", port 993, isSSL true
* OK [CAPABILITY IMAP4 IMAP4rev1 IDLE XAPPLEPUSHSERVICE ID UIDPLUS AUTH=LOGIN NAMESPACE] QQMail IMAP4Server ready
DEBUG IMAP: AUTH: LOGIN
DEBUG IMAP: protocolConnect login, host=imap.exmail.qq.com, user=moretradetest#yonanac.com, password=<non-null>
DEBUG IMAP: mechanism PLAIN disabled by property: mail.imap.auth.plain.disable
DEBUG IMAP: AUTHENTICATE LOGIN command trace suppressed
DEBUG IMAP: AUTHENTICATE LOGIN command result: A0 OK [CAPABILITY IMAP4REV1 X-NETSCAPE NAMESPACE MAILBOX-REFERRALS SCAN SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND ID UIDPLUS] User <login> authenticated
A1 ID ("vendor" "MaiQing Tech ltd." "name" "MaiqingCRM" "version" "2.1.3")
* ID NIL
A1 OK ID completed
does the above log means that my id methods works for the mail server ?

Related

The directory service failed to open a TCP port for exclusive use in DSRM mode

I am trying to browse ntds.dit database file using LDAP in DSRM mode using dsamain command line utility tool as shown below:
dsamain /dbpath C:\snapshot\Windows\NTDS\ntds.dit /ldapport 5000
But it's giving me the error
The directory service failed to open a TCP port for exclusive use in DSRM mode.
One thing to note here, is that the same command with same file is working perfectly in normal mode.
What I have tried till now is:
Tried to host it on multiple ports
Tried to add all the ports in the inbound rule to allow the connection if in any case the port is blocked in DSRM mode.
Tried creating a new snapshot and mounting the same
Checked if any other process is using the same port but it was not the case and I have tried to use some many different random free ports.
But everything failed.
I am attaching the event trace below:
EVENTLOG (Warning): NTDS General / Security : 3051
The directory has been configured to not enforce per-attribute authorization during LDAP add operations. Warning events will
be logged, but no requests will be blocked.
This setting is not secure and should only be used as a temporary troubleshooting step. Please review the suggested mitigations in the link below.
For more information, please see https://go.microsoft.com/fwlink/?linkid=2174032.
EVENTLOG (Warning): NTDS General / Security : 3054
The directory has been configured to allow implicit owner privileges when initially setting or modifying the nTSecurityDescriptor
attribute during LDAP add and modify operations. Warning events will be logged, but no requests will be blocked.
This setting is not secure and should only be used as a temporary troubleshooting step. Please review the suggested mitigations in the link below.
For more information, please see https://go.microsoft.com/fwlink/?linkid=2174032.
EVENTLOG (Informational): NTDS General / Service Control : 1000
Microsoft Active Directory Domain Services startup complete
EVENTLOG (Warning): NTDS LDAP / LDAP Interface : 2509
The Directory Service failed to open a TCP port for exclusive use.
Additional Data:
Port number:
5002
Error Value:
0 The operation completed successfully.
EVENTLOG (Warning): NTDS LDAP / LDAP Interface : 2509
The Directory Service failed to open a TCP port for exclusive use.
Additional Data:
Port number:
5003
Error Value:
0 The operation completed successfully.
EVENTLOG (Warning): NTDS LDAP / LDAP Interface : 2509
The Directory Service failed to open a TCP port for exclusive use.
Additional Data:
Port number:
5002
Error Value:
0 The operation completed successfully.
EVENTLOG (Warning): NTDS LDAP / LDAP Interface : 2509
The Directory Service failed to open a TCP port for exclusive use.
Additional Data:
Port number:
5003
Error Value:
0 The operation completed successfully.

Hikvsion Face - Remote Authentication - Server Response

I would like to know how Hikvsion DS-K1T671M-L remote release mode works
On the Device there is this option "Remote Authentication" in the Access Control Configuration.
When I enable this configuration, the equipment sends the event to my server, but it waits for a response from the server.
I would like to know what would be the answer I would have to send to the equipment, so that it releases the person, for example.

Failure writing file Log_File_Risk_Alert_Report : The permissions granted to user '' are insufficient for performing this operation

Context: I keep raising this error when I try to execute an SSRS Email or File Drop subscription - and I have no idea why. The empty string '' seems to imply I need to add some specific user information but I have no idea where.
I was able to send a test email through the Database Mail wizard in the management studio. I noticed in the SQL Server sysmail_event_log record for that event the last_mod_user was NTService\MSSQLSERVER. But the failed subscription execution attempts are showing up under the sa in the last_mod_user I suspect something is at play between this discrepancy but idk how to fix it.
The error description also reads:
The mail could not be sent to the recipients because of the mail
server failure. (Sending Mail using Account 4 (2022-04-22T17:41:01).
Exception Message: Cannot send mails to mail server. (The SMTP server
requires a secure connection or the client was not authenticated. The
server response was: 5.7.57 Client not authenticated to send mail.
[BN0P110CA0026.NAMP110.PROD.OUTLOOK.COM]). )
Questions: Can someone please assist?
Add the account to the Local Admin of the Machine to fix the Operation.Mail one

org.apache.curator.ConnectionState Connection timed out for connection string

I have been facing this issue for my Solr instance which is managed by Zookeeper.
It appears that Zookeeper is able to send requests to Zookeeper which momentarily accepts the request and then refuses it.
In Zookeeper logs, I have been seeing this error:
INFO org.apache.zookeeper.ZooKeeper.Client.environment:user.dir=/ [1635628661#qtp-2049348234-50]
INFO org.apache.zookeeper.ZooKeeper Initiating client connection, connectString=localhost:2181 sessionTimeout=150000 watcher=org.apache.curator.ConnectionState#c4f2fbd [1635628661#qtp-2049348234-50]
INFO org.apache.zookeeper.ClientCnxn Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) [1635628661#qtp-2049348234-50-SendThread(localhost:2181)]
INFO org.apache.zookeeper.ClientCnxn Socket connection established to localhost/127.0.0.1:2181, initiating session [1635628661#qtp-2049348234-50 SendThread(localhost:2181)]
ERROR org.apache.curator.ConnectionState Connection timed out for connection string (localhost:2181) and timeout (15000) / elapsed (15290) [1635628661#qtp-204934823450]
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:191)
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:86)
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:113)
at org.apache.curator.framework.imps.CuratorFrameworkImpl getZooKeeper(CuratorF
Any help is appreciated here.
According to log you have opened socket on localhost:2181, so line:
INFO org.apache.zookeeper.ClientCnxn Socket connection established to localhost/127.0.0.1:2181, initiating session [1635628661#qtp-2049348234-50 SendThread(localhost:2181)]
Is states like, ok, we found an opened socket, now we attempt to write some data. And it sends connection request sending sessionId and password. If session is not already established - it is sends 0 as session id, but sends password.
If you will enable debug output you would see in log then something like
Session establishment request sent on <remote address>
Log record you asking about -
ERROR org.apache.curator.ConnectionState Connection timed out for connection string (localhost:2181) and timeout (15000) / elapsed (15290) [1635628661#qtp-204934823450]
related to curator itself. If client not connected - it call checkTimeout() and if check timeout result is 'CONNECTION_TIMEOUT' generates record like above.
Not so much information but I try to guess there is zookeper on your localhost but connection rejected, may be password required or something else.
Hope it will help.
(my answer is based on curator code from master here -> https://github.com/apache/curator)

SQL Server 2012 DB mail failure

So, I never expected to spend 6 hours trying to get Send DBMail working on SQL Server 2012, but here we are.
I'm trying to simply set up an SMTP server to use with Database Mail. I've tried both Verizon and Google. I've tested the settings in Thunderbird, and yet I still receive the following error:
10/31/2013 14:56:30,,Error,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2013-10-31T14:56:30). Exception Message: Cannot send mails to mail server. (The operation has timed out.).),7084,6932,6038,,10/31/2013 2:56:30 PM,sa
This is getting ridiculous, I've scoured the web for similar issues and solutions, and found lots of ideas that didn't work. I even started an clean AWS instance with Server 2012 and it has the same problem. I've disabled Windows Firewall and Defender, and honestly I'm stumped and frustrated.
If you have access to add a role to your server then I would add the TELNET client for smtp testing. Test your smtp config using the following TELNET commands:
C:/>TELNET <mail server> 25
EHLO <mail server>
<IF AUTH REQUIRED ENTER CREDENTIALS>
MAIL FROM:<any account#yourdomain.com>
RCPT TO:<where you want mail to go #domain.com>
DATA
<ENTER>
<MESSAGE>
<PRESS PERIOD(".")>
If you do not get errors in telnet and/or the logs then Database Mail should work fine using MAIL SERVER. You need to set up a profile and mail account in sqlserver but the wizard is straight forward. Next, add a few operators with valid email addresses and you should receive your notifications.
So after much stress, and trying a different server/version, I found that MailJet worked flawlessly, and I'm back up and running.
I think Steoleary is on to something that somewhere along the line, the connection is being silently blocked. Either way, for anyone who runs into this problem, try another mail server, and another one, and another one.
My guess is the database mail feature is acting as a relay, and Verizon and Gmail are blocking it.

Resources