error getting access token for service account (connection time out) error - firebase-cloud-messaging

I want to solve for that error.
[error log]
error getting access token for service account (connection time out)
I add hosts AND firewall add ip but connetiocn time out or operation time out throw an error
netstat -ano
TCP x.x.x.x:18795 142.250.206.205 ESTABLISHED
Communication works, but it seems to be blocked by other hosts.
URL url = new URL("https://accounts.google.com/o/oauth2/auth");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
※ connection time out
I want to know the answer
[ADD LIST]
port (80,443)
142.250.206.205 accounts.google.com
172.217.25.173 accounts.google.com
142.250.76.141 accounts.google.com
142.250.206.237 accounts.google.com
172.217.161.234 oauth2.googleapis.com
142.250.207.106 oauth2.googleapis.com
142.250.76.138 oauth2.googleapis.com
142.250.206.202 oauth2.googleapis.com
142.250.206.234 oauth2.googleapis.com
172.217.161.202 oauth2.googleapis.com
172.217.25.170 oauth2.googleapis.com
216.239.38.57 fcm.googleapis.com
216.239.36.57 fcm.googleapis.com
216.239.36.55 fcm.googleapis.com
216.239.38.55 fcm.googleapis.com

Related

Two sites same IIS server, RunImpersonation HttpClient passing empty NTLM credential

I have two sites on the same IIS instance. One uses HttpClient to request data from the other. They are both configured with Windows Authentication only. These are both ASPNET Core 3.1.
When I browse to the first site, it authenticates, but when it calls through to the other, it returns a 401. I validated that the user identity is correct.
var baseUri = new Uri(AppSettings.CurrentValue.MyBaseUrl);
var user = (WindowsIdentity)HttpContext.User.Identity;
WindowsIdentity.RunImpersonated(user.AccessToken, () =>
{
AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);
var credentialCache = new CredentialCache {{baseUri, "NTLM", CredentialCache.DefaultNetworkCredentials}};
var httpClientHandler = new HttpClientHandler {Credentials = credentialCache};
using HttpClient httpClient = new HttpClient(httpClientHandler) { BaseAddress = baseUri };
var response = httpClient.GetAsync("/home/test").Result;
var content = response.IsSuccessStatusCode
? response.Content.ReadAsStringAsync().Result
: response.StatusCode.ToString();
}
Wireshark shows the call into the first site, /home/test1, and shows the user credentials being passed correctly,
GET /home/test1 HTTP/1.1
HTTP/1.1 401 Unauthorized (text/html)
GET /home/test1 HTTP/1.1 , NTLMSSP_NEGOTIATE
HTTP/1.1 401 Unauthorized , NTLMSSP_CHALLENGE (text/html)
GET /home/test1 HTTP/1.1 , NTLMSSP_AUTH, User: COMPANY\fbloggs
The same trace shows the jump to the second site, /home/test2, and shows null domain and username,
GET /home/test2 HTTP/1.1
HTTP/1.1 401 Unauthorized (text/html)
GET /home/test2 HTTP/1.1 , NTLMSSP_NEGOTIATE
HTTP/1.1 401 Unauthorized , NTLMSSP_CHALLENGE (text/html)
GET /home/test2 HTTP/1.1 , NTLMSSP_AUTH, ** User: \ **
GET /home/test2 HTTP/1.1\r\n
[Expert Info (Chat/Sequence): GET /home/test2 HTTP/1.1\r\n]
[GET /home/test2 HTTP/1.1\r\n]
[Severity level: Chat]
[Group: Sequence]
Request Method: GET
Request URI: /home/test2
Request Version: HTTP/1.1
Connection: Keep-Alive\r\n
Request-Id: |60fb71bd-482efe66c05094ec.1.\r\n
Host: testserver\r\n
Authorization: NTLM TlRMTVNTUAADAAAAAQDADEIAAAAAAAAAcwAAAAAAAABYAAAAAAAAAFgAAAAaABoAWAAzAAAABYqIogoAY0UAAAAPvaq0nk2I7YcqJmq01EbY20IASDTATGSAGVAALQBXAEUAQgAyADEAAA==\r\n
NTLM Secure Service Provider
NTLMSSP identifier: NTLMSSP
NTLM Message Type: NTLMSSP_AUTH (0x00000003)
Lan Manager Response: 00
NTLM Response: Empty
Domain name: NULL
User name: NULL
Host name: TESTSERVER
Session Key: Empty
Negotiate Flags: 0xa2888a05, Negotiate 56, Negotiate 128, Negotiate Version, Negotiate Target Info, Negotiate Extended Security, Negotiate Always Sign, Negotiate Anonymous, Negotiate NTLM key, Request Target, Negotiate UNICODE
Version 10.0 (Build 17763); NTLM Current Revision 15
Major Version: 10
Minor Version: 0
Build Number: 17763
NTLM Current Revision: 15
MIC: bdaab49e4d88ed872a266ab4d446d8db
HTTP/1.1 401 Unauthorized (text/html)

TraefIk Forward Auth Request URI

I am using Traefik's Foward Auth middleware to authenticate my requests.
The auth server is hosted at http://localhost/auth
The requests that I want to authenticate are from http://rooms.localhost/:roomId
For example, http://rooms.localhost/ed455783-1502-4c9e-a403-28e621d77fb4?token=qwerty is my request URL. Now the URL is forwarded to the auth server for authentication. But at the auth server, I am not able to see the requested URL or header like X-Forwarded-URI.
The headers which I can see are
{
host: 'localhost',
'user-agent': 'PostmanRuntime/7.26.3',
accept: '*/*',
'accept-encoding': 'gzip, deflate, br',
x-forwarded-for': '127.0.0.1',
'x-forwarded-host': 'localhost',
'x-forwarded-port': '80',
'x-forwarded-prefix': '/faa054d5-0fe3-435e-83cb-9b817177d495',
'x-forwarded-proto': 'http',
'x-forwarded-server': 'b35a8676b5a8',
'x-real-ip': '127.0.0.1'
}
So how should I get the requested URI in order to access the token?
Note that passing token in cookies or headers is not an option for me because the WebSocket connections are also needed to be authenticated.
Following are my traefik labels
- traefik.http.middlewares.faa054d5-0fe3-435e-83cb-9b817177d495-auth.forwardauth.address: http://localhost/auth
- traefik.http.middlewares.faa054d5-0fe3-435e-83cb-9b817177d495-stripprefix.stripprefix.prefixes: /faa054d5-0fe3-435e-83cb-9b817177d495
- traefik.http.routers.faa054d5-0fe3-435e-83cb-9b817177d495.middlewares: faa054d5-0fe3-435e-83cb-9b817177d495-stripprefix, faa054d5-0fe3-435e-83cb-9b817177d495-auth
- traefik.http.routers.faa054d5-0fe3-435e-83cb-9b817177d495.rule: Host(`rooms.localhost`) && PathPrefix(`/faa054d5-0fe3-435e-83cb-9b817177d495`)
I was able to solve this problem using
--entryPoints.web.address=:80
--entryPoints.web.forwardedHeaders.insecure

Scrapy How to scrape HTTPS site through SSL proxy

I've SSL proxy server and I want to scrape https site. I mean the connection between scrapy and the proxy is encrypted then the proxy will open a connection to the website.
after some debugging I found the following:-
currently scrapy handle the situation as follows:-
if the site is http it use ScrapyProxyAgent which send client hello then send a connect request for the website to the proxy
but if the site is https
it use a TunnelingAgent which does not send client hello to the proxy and hence the connection is terminated.
What I need is to tell scrapy to first establish a connection via ScrapyProxyAgent then use a TunnelingAgent not sure how to do that.
I tried to create a https DOWNLOAD_HANDLERS but I'm not that expert
class MyHTTPDownloader(HTTP11DownloadHandler):
def download_request(self, request, spider):
"""Return a deferred for the HTTP download"""
timeout = request.meta.get('download_timeout') or self._connectTimeout
bindaddress = request.meta.get('bindaddress')
proxy = request.meta.get('proxy')
agent = ScrapyProxyAgent(reactor,proxyURI=to_bytes(proxy, encoding='ascii'),
connectTimeout=timeout, bindAddress=bindaddress, pool=self._pool)
_, _, proxyHost, proxyPort, proxyParams = _parse(proxy)
proxyHost = to_unicode(proxyHost)
url = urldefrag(request.url)[0]
method = to_bytes(request.method)
headers = TxHeaders(request.headers)
omitConnectTunnel = b'noconnect' in proxyParams
proxyConf = (proxyHost, proxyPort,
request.headers.get(b'Proxy-Authorization', None))
if request.body:
bodyproducer = _RequestBodyProducer(request.body)
if request.body:
bodyproducer = _RequestBodyProducer(request.body)
elif method == b'POST':
bodyproducer = _RequestBodyProducer(b'')
else:
bodyproducer = None
start_time = time()
tunnelingAgent = TunnelingAgent(reactor, proxyConf,
contextFactory=self._contextFactory, connectTimeout=timeout,
bindAddress=bindaddress, pool=self._pool)
agent.request(method, to_bytes(url, encoding='ascii'), headers, bodyproducer)
I need to establish a tunnel after the proxy agent is connected.
is that even possible?
thanks in advance

sending mail through phpmailer error

helo guys i have been trying to send a mail through php script for the last 8 days first i was using the php mail() on the server it returned false after alot of searching then company told me they have disabled this feature and told me to use my gmail account for sending mail then i googled it and found phpmailer swiftmailer and other software finally i decided to use phpmailer and included 3-4 files on my root folder as described here(http://phpmailer.worxware.com/index.php?pg=install#) i used this code
<?php
require("class.phpmailer.php");
include('class.smtp.php');
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->SMTPSecure = 'ssl';
$mail->Username = "myid#gmail.com"; // SMTP account username
$mail->Password = "xxxxxxx"; // SMTP account password
$mail->From = "myid#gmail.com";
$mail->AddAddress("hostimf#gmail.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>`
it is returning errors that are listed in my firefox browser like this
2015-07-24 20:12:02 CLIENT -> SERVER: EHLO localhost
2015-07-24 20:12:02 CLIENT -> SERVER: AUTH LOGIN
2015-07-24 20:12:03 CLIENT -> SERVER: c2lkZGhhbnRiYWh1Z3VuYUBnbWFpbC5jb20=
2015-07-24 20:12:03 CLIENT -> SERVER: Y2hpbXB1OTQ=
2015-07-24 20:12:04 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 2sm16058566pdp.68 - gsmtp
2015-07-24 20:12:04 SMTP Error: Could not authenticate.
2015-07-24 20:12:04 CLIENT -> SERVER: QUIT
2015-07-24 20:12:04 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message was not sent.Mailer error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting`
this i tried on my wamp server
pls help me i m going mad trying to solve this problem pls help..... thanks

error send email with phpmailer in server domain but succed in localhost

i have detail error with this problem,
SMTP -> FROM SERVER:220-server.modulindo.com ESMTP Exim 4.77 #2 Wed, 11 Jul 2012 10:57:22 +0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
SMTP -> FROM SERVER: 250-server.modulindo.com Hello mail.modulindo.com [202.67.9.42] 250-SIZE 52428800 250-PIPELINING 250-AUTH PLAIN LOGIN 250 HELP
SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data
SMTP -> FROM SERVER:250 Reset OK
please help me guys!?
i have a problem with phpmailer. i send email with phpmailer in localhost is succeed, but when i upload it in my server domain, there was an error happend. the error is..
SMTP Error: Could not authenticate. Mailer Error: SMTP Error: Could not authenticate.
this is my script..
....
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "wasis85#gmail.com";
$mail->Password = "password";
$mail->From = "wasis85#gmail.com";
$mail->FromName = "Wasis Lukito";
$mail->AddAddress($ema[$ari_no],"wasis");
$mail->AddCC("wasisl85#yahoo.com");
$mail->AddReplyTo("wasisl85#yahoo.com","Wasis Lukito");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Penolakan Data BPLPSE";
$mail->Body = "Alasan di tolak ";
$mail->AltBody = "This research is supported by Google.com";
...
i solved same problem with comment (or cancel) this line
// $mail->IsSMTP();
this because from some server i had same error: SMTP Error: Could not authenticate (also Password is incorrect...etc)
The script seems to be fine. I believe you have to check and make sure if your server supports SMTP or it has been properly configured for SMTP or not.