In my application, I have used apache HttpClient. Now I would like to monitor the request and response from the capture data transmitted by the httpclient. Is it possible to know which ports are opened by the HttpClient. I am using Linux, so can I use netstat to see which ports are open by my java application process?
You can get detailed info about connection management by turning on context logging as described here
Related
I am working on a project to log connection tracking events with ulogd2. I want to know if there is any way to send messages to a remote host in JSON format. So far, I was able to save the message to a JSON file on the local server, but I don't want to save it in the local machine, I just want to send it. Or maybe if there is a way to send the file and after that delete it.
I would really appreciate your help.
Usually syslog logs are sent to remote servers via one of the syslog network protocols, rsyslog is often used for this purpose. On the receiving end you can also use rsyslog to collect it into the syslog of the remote server.
On the receiving side you can also use tools like fluentd to collect the syslog messages and write them to a file as JSON or do a number of other tings with them. An alternative tool to do this as well is called filebeat.
You can also install tools on the server creating the logs, instead of rsyslog which you can configure to send them via some method other than the syslog protocol if you so desire. Filebeat can do this and fluent bit(lightweight version of fluentd) as well.
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
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.
Can TCPDump and TCPReplay be used to record(tcpdump) network traffic coming in to a application server/webserver/queue application etc., and then replayed using the dump on TCPReplay?
Let's say I setup a apache server and use TCPDump to capture the entire network traffic and dump it to a file. Now I run apache in a different machine and want to replay the traffic to this new apache server using the file. How can I achieve this?
I especially want to understand how TCPReplay would work in such a scenario. i.e. how would syn/ack responses work for TCP. How would a new a connection etc. be initiated?
Fred is right. Also, this question is answered in the Tcpreplay FAQ: http://tcpreplay.synfin.net/wiki/FAQ#Doestcpreplaysupportsendingtraffictoaserver
No, you cannot use Tcpreplay to replay traffic to a server. TCP sessions have random sequence numbers, and are fully stateful. Replaying previously recorded TCP traffic will be ignored by a server.
I already have a server with port and want to write a web app to get the information form the port. Will this be possible with WebPorts?
The Client doesn't even need to talk back to the server, which is the whole point of websockets I would imagine, but since I already have the ports setup, I might be easier and cleaner to just connect and get the info without having to refresh.
WebSockets are not intended as clear TCP channels over which other existing protocols can be implemented.
WebSockets are designed to allow messages to be sent between a client and server, where an event is raised each time a message is received.
Hence a WebSocket client cannot simply connect to an existing TCP server - that server also has to speak the WebSocket protocol.
You could of course write a WebSocket-based server that does nothing but act as a proxy to existing network services.
I think you want websockify which is a WebSocket to plain TCP socket bridge/proxy. It also allows sending and receiving of binary data with the older version of the WebSocket protocol which hadn't yet added direct binary data support.
Disclaimer: I created websockify.