I am facing issue with accessing imap.gmail.com in azure pipeline - gmail-imap

In selenium for my automation script I have to retrieve MFA code from my external test user(something#gmail.com). I am using talking to the IMAP gmail incoming server with this code
using (ImapClient client = new ImapClient(GmailHostName, 993, email, ClientEmailPassword, AuthMethod.Login, true))
When I run this test locally it works successfully getting the MFA code from gmail account. But in Azure Devops Pipeline the same test fails to retrieve the code. This is the error from Azure:
System.Net.Sockets.SocketException : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 108.177.122.109:993
at S22.Imap.ImapClient.Connect(String hostname, Int32 port, Boolean ssl, RemoteCertificateValidationCallback validate)```
at S22.Imap.ImapClient..ctor(String hostname, Int32 port, String username, String password, AuthMethod method, Boolean ssl, RemoteCertificateValidationCallback validate)
Has anyone faced an issue like this? Any and all help will be highly appreciated.

Related

How to trigger a jenkins build with a Web Activity in Azure Data Factory

I'm trying to trigger a jenkins job using the API. I got the set the token, got to run it successfully in the browser and got a json output from the API call using:
https://<MY_JENKINS_ADDRESS>/job/path/job_name/api/json/build?token=my_token
I tried to use this call in a POST or GET web activity in Azure Data Factory but I'm getting this error:
Error calling the endpoint '<MY_JENKINS_ADDRESS>'. Response status code: 'NA - Unknown'. More details: Exception message: 'NA - Unknown [ClientSideException] Invalid Url:https://<MY_JENKINS_ADDRESS>/job/path/job_name/api/json/build?token=my_token. Please verify Url or integration runtime is valid and retry. Localhost URLs are allowed only with SelfHosted Integration Runtime'.
Request didn't reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout.
It is clear data factory can't access the url. How can I solve this issue? Any thoughts?
I am assumimg that the <https://<MY_JENKINS_ADDRESS/job/path/job_name/api/json/build?token=my_token>> is not a publically available and if that the case you should know that with ADF you can only access public facing urls . What that means is that If there anything whch is running on my local network or say on my laptop , ADF will be not abe able to access that .

Postfix Connection Timeout for Outgoing Mail - Port 25 is ***not*** blocked by ISP

Many similar questions have been asked here, but most have the issue of port 25 being blocked by a cloud provider (i.e. DigitalOcean) or the ISP (i.e. Xfinity). I have neither of these problems, but still can't send outgoing mail.
I try to send outgoing mail, but get this error from posfix/smtp
connect to alt2.gmail-smtp-in.l.google.com[142.250.152.27]:25: Connection timed out
I am running a postfix from a spare laptop that is running Ubuntu Server, so I know it isn't a problem with a cloud provider. Additionally, I have Google Fiber, and they do not block any ports, including port 25. Just as a test, when I telnet to the above address, I can successfully connect.
$ telnet alt2.gmail-smtp-in.l.google.com 25
Trying 2607:f8b0:4001:c56::1a...
Connected to alt2.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP x17si5369573iow.10 - gsmtp
Any ideas what the final blocker is? The one thing I can think of is my postfix main.cf variables below might need tweaking. Also, FYI I am running the postfix server in a Docker container.
mydestination = localhost.$mydomain, localhost
proxy_interfaces = X.X.X.X # Static IP of Google Fiber router that is externally facing to WAN
After some digging, I looked up my hostname on Realtime Blackhole Lists, or RBLs, and discovered that my hostname and therefore mail server were being rejected as spam by any mail server that checks the public RBLs.
The solution to this was to set up SPF, DKIM, and DMARC through my DNS provider. Each of these play a role in reducing hostname spoofing, spam email, and other malicious activites. There are many tutorials online on how to do this.
SPF is Sender Policy Framework. This is used to prevent others from spoofing your domain.
DKIM is DomainKeys Identified Mail. This allows the senders to authenticate their emails by including a digital signature in the email header. DKIM uses public-key cryptography to verify that an email message was sent from an authorized mail server.
DMARC is Domain-based Message Authentication Reporting & Conformance, which builds on SPF and DKIM to prevent domain spoofing.

Event Hub Error: Exception: Put token failed. status-code: 401 Unauthorized TrackingId

I am working on an MVC Web Application which sends data as a producer to an Event Hub.
I have successfully set up event hub name space and event hub and was able to successfully send data while running a project in my local machine via local-host.
However when i deployed an application to Azure's Cloud i am getting the following error exception
while trying to send data:
Put token failed. status-code: 401, status-description: Unauthorized TrackingId:XXXX-XXXXX
Both Event Hub and Web Application is under the same subscription.
SAS Policy Connection string is from the root of a name-space.
Works fine locally, but receiving error on the Azure's Cloud when accessing that page.
Thanks in advance.
Couple of things you may need to check:
Make sure VNET and IP rules are properly configured.
Make sure both local and cloud deployments use the same connection string.

Issue with ConnectSSL using IMAP4

I am using IMAP 4 protocol in my c# dotnet windows service, which continuously monitor a configured mail account for downloading mail and then performs a series of business logic. Everything works fine as long as the windows service is installed and configured with in the domain to which the mail exchange is part.
Once the service is installed outside the domain I get certificate issue and I am aware since the mail exchange have a test certificate the below error is logged, I tried to ignore the certificate validation, but this has not worked and also installed the mail exchange test certificate on the machine in which the service is installed but even this failed to work.
The remote certificate is invalid according to the validation procedure.
at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)
I wanted to know if there are any other protocol(component) apart from IMAP4, which I can use and that allow me to ignore the certificate validation issue.
Any suggestion or help on this would be of great help.

How to fix System.Net.Sockets.SocketException

I'm working on an ASP.NET MVC website, it has been installed on three different servers (the same code version), it works on two of the servers i.e the user can login, but on one server after the user has submitted their username and password, the following server error is displayed in the browser:
Security Exception
System.Security.SecurityException: Token not found
The event viewer for the environment the error is occuring on shows the following two error messages at the point where th euser attempts to login:
Could not init pool.
System.Net.Sockets.SocketException (0x80004005):
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond (server ip address)
And this error:
Error: System.Security.SecurityException: Token not found
Which is the server error displayed in the browser. This has in the past been resolved by deleting an authentication cookie, but that doesn't work for this error.
I have tried setting the trust level in the web.config to full which didn't work. I have tried restarting IIS.
Has anyone else come accross a similar problem? Could this problem be caused because a service of some kind isn't running? Any suggestions will be appreciated.
Most of the time these are connectivity timeouts due to different IP protocols (IPV4/IPV6) between the two server/computers trying to communicate or extra authentication rules setup on one of the computers for outgoing or incoming connectivity.
Ways to troubleshoot the issue:
Review IIS logs
Review EventLogs
Try adjusting TCP/IP parameters in the registry to increase the time allowed to connect
http://msdn.microsoft.com/en-us/library/aa560610(d=printer,v=bts.20).aspx
Even though the above article references Windows 2003, I've discovered it applies to some 2008 environments.
I was getting 0x80004005 & The requested name is valid, but no data of the requested type was found. My complete error
Check You have proper internet connection are there on your machine or not. And you are able to ping the remote server or not. I solved by checking both.
We were getting this error when one of a third party API hosted on of our server(Azure) was not able to communicate with one of our web services on a different machine(iNetU). Options were to open ports so that these machines could talk or to move the web service to the machine hosting the third party API.

Resources