PROXY protocol - test client /tool - haproxy

Proxy Protocol is implemented by various software including of course HAProxy itself.
When testing from a host via a proxy, it would be useful to have a simple command-line tool to establish connections, controlling the various parameters.
I've looked at netcat, socat and other similar tools and it looks like it doesn't (yet) exist.
Does anyone know of a nice command-line testing tool?

As I couldn't find something, here's a start. Will add documentation etc. shortly.

Related

Grpc C++ DNS overrides

I am trying to connect a grpc-c++ client to a grpc-c++ server. I already have a grpc-java client connected with working TLS so the server should be functioning correctly.
However inside grpc-java there is a method when building a channel named 'overrideAuthority'. From the documentation the method
"Overrides the authority used with TLS and HTTP virtual hosting. It does not change what host is actually connected to. Is commonly in the form host:port."
I was attempting to find something similar for the c++ client. However, so far all I have found is a function named set_authority() on the grpc::ClientContext as well as two options used with grpc_channel_args which are GRPC_ARG_DEFAULT_AUTHORITY and GRPC_SSL_TARGET_NAME_OVERRIDE_ARG.
None of these seem to have any effect on the authority at all. The server will always reject the connection with the error
No match found for server name: 0.0.0.0.
P.S. I am aware that I can add it to the common name on the certificate (and I will if I need to). However, if possible I would like to follow the same pattern as the grpc-java client.
GRPC_SSL_TARGET_NAME_OVERRIDE_ARG is the right channel arg. Please take a look at some of the tests https://github.com/grpc/grpc/blob/470a3066c74abc7c2a0a2cab3b35000b27b51af1/test/core/end2end/fixtures/h2_ssl.cc#L133
https://github.com/grpc/grpc/blob/470a3066c74abc7c2a0a2cab3b35000b27b51af1/test/cpp/end2end/xds/xds_end2end_test.cc#L1348
Additionally, if I remember correctly, this log just serves as a warning and does not result in disconnections. Please collect some more verbose logs https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md. That might give more hints as to what's going on here.

how to let the kamailio support Edge Proxy?

As the RFC http://www.rfc-editor.org/rfc/rfc5626.txt describes , how can i extends a Edge Proxy by Kamailio ? should i write a module , or just write the configure file ?
have any one already do it ,could give me some advice .
thanks .
You could use an already configured instance - SipWise.
It's free, it's Kamailo based, it has an edge-proxy acting as a load-balancer at /etc/ngcp-config/templates/etc/kamailio/lb/kamailio.cfg.tt2, it's available as appliance and requires minimal configuration steps to run it with the basic features up.
You can use it directly, or you can just run it somewhere and take a look at the configuration.
Why write a module? Edge proxy is a pretty much a SIP proxy for REGISTERs.
You could accomplish that with just the configuration routes.

How to implement node-postgres on a user's browser?

So I've tested this particular example on my local machine:
http://bjorngylling.com/2011-04-13/postgres-listen-notify-with-node-js.html
It worked! So now when I update a specific table, and am running my node.js file(from the tutorial) -I get an instant notification on my Terminal(mac)!! cool!
But how do I implement this onto a client's browser??
First of all, in the node.js script you'll notice that I have to connect to the database with my username and password:
pgConnectionString = "postgres://username:pswd#localhost/db";
I obviously can't have that floating around in the .js file the user's browser downloaded.
Plus I don't even know what scripts I'd have to include in the <head>. I can't find anything anywhere on how this is used in the real world.... All I see are neat little examples you can use in your command line.
Any advice, or guidance in the right direction would be awesome! Thanks.
You can't.
Node.js runs directly on your server, speaking directly to the native libraries on that machine. I'm not sure exactly what the postgres driver you are using does, but either it speaks to the postgres libraries OR it speaks directly with sockets on the local or a remote database server.
Neither of these methods can be used directly from a browser environment (it can't speak directly to the native libraries and it can't speak "raw" sockets).
What you can do is to have the web client speak to your own server process on a server (running node.js or similar), which would then speak to the database on behalf of the client.
Assuming you also need to database server to be able to initiate notifications to the client, you would need to use a bi-directional communication module like socket.io or similar.
You can do: combine your JS running on node.js which accesses Postgres listening for events with a node.js based WebSocket server, implement PubSub and push out to HTML5 browsers .. WebSocket capable ones.
Another option: use a generic WebSocket to TCP bridge like https://github.com/kanaka/websockify and implement the Postgres client protocol in JS to run in browser. That is doable, but probably not easy / for the faint hearted.

How to capture loopback traffic in Windows Server 2008

Setup:
I have client C connecting to server S
Both C and S are on the same machine
In C the server address is hardcoded to 127.0.0.1. Likewise, in S the client address is hardcoded to 127.0.0.1
Problem:
I want to be able to sniff the traffic between the client and the server.
Due to the configuration, I cannot move the client nor the server to different locations (the address are hardcoded)
Installing the loopback interface and using tools like Wireshark+WinPcap doesn't lead anywhere (was actually already known but was worth a try)
RawCap, suggested in another topic, doesn't work. IP 127.0.0.1 is listed, but does not record any traffic.
Using rinetd to route the traffic elsewhere, as suggested here doesn't work (cannot bind on 127.0.0.1)
Not interested in using a HTTP local proxy, such as Fiddler, because I'd like to capture also other protocols
Two commercial tools work, specifically CommView and Local Network Monitor, which means it must be possible to do that ;)
How can I do to capture the traffic?
Any pointer on functions I should use or documentation I should read?
Thanks!
Basically you need to write a TDI filter driver to achieve that... for some pointers see:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff565685%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/hardware/ff563317%28v=VS.85%29.aspx
Another option is to write a WinSock LSP.
BEWARE
Since Windows 8 it is strongly encouraged to use WFP (Windows Filtering Platform) for this sort of thing...
Although it might be more cost-effective to just use/buy an existing solution - esp. if you are not a very experienced driver developer...
Use RawCap, which can solve your concerns, see this

How can I find the IP of a network service from the iPhone

I want to use some sort of nmap-like functionality to autodiscover a ASP.NET web server (running on port 443) somewhere on the network. This way users don't have to find and enter the IP manually. Is there a good/clean way to do this?
Thanks to #ceejaoz's comment above, I was able to do this pretty easily in Bonjour.
I used Mono.Zeroconf, a .NET/Mono Bonjour library, to advertise the service, and the default iOS NSNetService stuff to resolve it on the iPhone. (There's plenty of tutorials on how to do this around the nets).
I made a Windows Service in Visual Studio to actually run the code that advertises the ip and port, since a web service isn't really a good place for that.
One big caveat (as of December 2010): the Bonjour DLLs that come with Mono.Zeroconf are totally broken (no errors, they just don't do anything). Steal the ones from Pidgin instead.