How to configure basic authentication for SOCKs Proxy - apache-httpclient-4.x

I am using Apache HttpClient 4.2.3 library for for accessing resources via HTTP/HTTPS. Requests are sent through SOCKs proxy which requires 'basic authentication'.
I looked at the API doc and found that there is class ProxyAuthenticationStrategy, which looks like serves the purpose.
But I am not able to figure it out how to use it. Specifically I am not able to find how to provide proxy credentials to ProxyAuthenticationStrategy.
I looked at the documentation & searched over net but could not find appropriate help over this topic.
Can someone please guide me on how to configure basic authentication for SOCKs Proxy?
Note: I am successfully able to communicate using Apache HttpClient 4.2.3 library through SOCKs proxy without authentication.
Thanks,
Sachin

SOCKS is a TCP/IP level proxy protocol. It has nothing to do with HTTP and is out of scope as far HttpClient is concerned. HttpClient can be configured to connect all network sockets it creates via a SOCKS proxy but it will make no attempt to provide any user credentials to the SOCKS proxy.

Related

Have connected to other website but am having trouble connecting to a AWS webpage via sim900 using arduino

I have connected to other websites but have been able to connect to AWS I have seen others had this issue before me but none of the threads I found were answered. I am hoping someone has suggestion I can post the code if necessary. Is there a special way to connect to the AWS website? The goal of the project is to send data to a web page which was created using Amazons AWS services. We are using an Access point and are using a Json format.
To establish a connection with AWS you must need a secured connection (https TLS 1.2) but the SIM900 firmware only provide TLS 1.0 (see the doc here : https://simcom.ee/documents/SIM900/SIM900_HTTPS%20AT%20Command%20Set_V1%2000.pdf)
I think I see somebody with the same configuration than yours (Arduino + sim900) who used a lib to connect to AWS.
Or you can establish a TCP connection with AWS and then use a lib to handshake and send data with TLS 1.2 protocol. More informations about TCP and TLS : https://medium.facilelogin.com/nuts-and-bolts-of-transport-layer-security-tls-2c5af298c4be

How to make ELB pass protocol to node.js process (Elastic Beanstalk)

I have ELB balancing TCP traffic to my Node.js processes. When ELB is balancing TCP connections it does not send the X-Forwarded-Proto header like it does with http connections. But I still need to know if the connection is using SSL/TLS so I can respond with a redirect from my Node process if it is not a secure connection.
Is there a way to make ELB send this header when balancing TCP connections?
Thanks
You can configure proxy protocol for your ELB to get connection related information. In case of HTTP the ELB adds headers telling about the client information, in case of TCP however, AWS ELB simply passes through the headers from the client without any modifications, this causes the back end server to lose client connection information as it is happening in your case.
To enable proxy control for your ELB, you will have to do it via API, there is currently no way to do it via UI.
http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-proxy-protocol.html
The above doc is a step-by-step guide on how to do this, I don't want to paste the same here as that information might change over time.
EDIT:
As it turns out, Amazon implements Version 1 of the proxy protocol only which does not give away SSL information. It does however give port numbers which was requested by the client and a process can be developed stating something like if the request was over port 443 then it was SSL. I don't like it as it is indirect, requires hardocoding and coordination between devops and developers... seems to be the only way for now...lets hope AWS ELB starts supporting Version 2 of the proxy protocol which does have SSL info soon.

How to secure different fiware GE in the same virtual machine?

I'm deploying some Generic Enablers(Orion, Cygnus, Proton-Cep, Wirecloud) in the same VM using dockers.
Reading the fiware documentation it uses has an example a wilma proxy securing an instance of orion and getting the authorization through IdM.
Wilma configurations do not seem to support different redirections
I need to secure all these services that I'm using which need to be accessed from outside the server, my question is if is it possible to use Wilma to secure all Generic Enablers or should I implement one instance of Wilma for each service provided?

Hosting html file over mosquitto

I just found that mosquitto had got a websockets upgrade which allows it to
host the HTTP services.
I tried hosting a html file using the websockets feature on the port 8080.
The mosquitto broker seems to start fine and the mqtt services on the other ports seem to function properly. But when i try to access the html file over the localhost I get the a response saying no data sent by the server.
I am not sure where my mistake lies..Any ideas?
Mosquitto is not a HTTP server, it can not serve generic files.
The HTTP listener is only there to facilitate an upgrade to the websocket protocol in order to run MQTT over a websocket connection.
You might want to look out for a different broker that is flexible enough to do what you're looking for. I don't know of any MQTT broker that allows you to do that out of the box, but many are fairly extensible. For one I can talk about is VerneMQ, as I am one of the core developers. Developing a simple VerneMQ plugin that serves some static files over HTTP is a matter of a few lines of code, as the plugin only requires to setup some configuration for the internal webserver.
However, unfortunately we haven't yet documented this feature. But feel free to drop us a line if such an approach sounds interesting for you.
Cheers,
Andre

Redirect TCP MySQL connection to proxy

I have a Delphi application which connects to a MySQL published database on Internet with address like mysql01.example.com:3306.
However, my client computer is behind a proxy and I just can connect if I pass by the proxy. I use the ZeosLib to connect and it doesn't have proxy authentication.
Is it possible to forward connection to the proxy using some kind of proxy forward program? Is there another possibility to solve this problem?
Thanks a lot.
Synapse framework has a socks proxy implementation.
Or you can make it yourself (quite easy, since socks protocol is really simple, even version 5). See:
SOCKS 4 SPECS
SOCKS 5 RFC
SOCKS 5 user/pass auth
SOCKS 5 GSS-API auth
Synapse blcksock code