Article delegate-en/4921 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A4919@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] DYCONF for dynamic/conditional configuration (Re: conditional mount on arbitrary protocol)
09 Oct 2010 14:09:34 GMT feedback@delegate.org (Yutaka Sato)
The DeleGate Project


Hi,

In message <_A4919@delegate-en.ML_> on 09/29/10(01:48:05)
you "Jehan-Guillaume (ioguix) de Rorthais" <pg4jqbdyi-aipitibjyktr.ml@ml.delegate.org> wrote:
 |I played today with delegate trying to figure if I can use it to route some
 |PostgreSQL clients based on their database connection. meaning:
 |
 |  client want to connect to database "db1" -> connect to server1
 |  client want to connect to database "db2" -> connect to server2
...
 |However, I still cannot route based on the application layer content. I read in
 |the manual tcprelay cannot use the MOUNT option and it seems to me FCI script
 |can't helps here.

Routing based on the content in an application layer could be realized 
several ways with the existing DeleGate as follows:

  SERVER=http + FCL(to generate CONNECT method)
  SERVER=socks + FCL(to generate CONNECT command)
  SERVER=delegate + FCL(to generate SERVER command)
  ...

 |./delegated -P9999 SERVER=tcprelay \
 |  MOUNT="* tcprelay://destination1:port match=*some-regex-or-glob*"
 |  MOUNT="* tcprelay://destination2:port match=*another-regex-or-glob*"
 |
 |Is it possible ? How hard would it be and where should I start ?
 |If not possible, maybe I could try to add a basic support for pgsql protocol ?
 |Any pointers/advices as well ?
 
There can be so many possible solutions to support your requirement.
It can be solved in a general mechanism I have in mind for a long time
that is "changing/generating configuration dynamically and conditionally".
What I wish to cover and generalize in a new mechanism are the following
ways for dynamic/conditional configration.

  1) (Condition)Parameter
  2) SERVER=Server:-:Condition
  3) SCREEN=reject
  4) INETD="Port - - - - - SERVER=Server"

To do so I added a simple tentative mechanism controled with a parameter
"DYCONF" in DeleGate/9.9.8-pre17.  Using it, your case will be configured
as follows:

  delegated -P9999 SERVER=tcprelay \
    DYCONF="qrex/rexp1,arg:SERVER=tcprelay://host1:port1" \
    DYCONF="qrex/rexp2,arg:SERVER=tcprelay://host2:port2" \
    ...

Give it a try.

Cheers,
Yutaka
--
  9 9   Yutaka Sato, CSDP#005482 <y.sato@delegate.org> http://delegate.org/y.sato/
 ( ~ )  National Institute of Advanced Industrial Science and Technology
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
Do the more with the less -- B. Fuller

---- Manual.htm#DYCONF ----------------------------
YCONF parameter*   ==  DYCONF=[conditions]parameters
        parameters  ==  file:path | cgi:path | arg:{listOfParameters}
                    --  default: none
DYCONF specifies configuration parameters to be loaded dynamically on the
beginning of relaying application protocol after the acception of a TCP
connection from a client before starting a session over it. The loading
of parameters can be conditional based on the specified conditions, and
the parameter value can be generated and/or evaluated on each loading.

A condition for loading can be based on the identity (address or name) of
the host of a client which is requesting over the new connection. Or it
can be based on the content (sub-string or pattern) of the initial request
data which is sent from a client over a connection. The request data is
polled for a specified period (15sec. by default) and peeked by a
specified size (4K bytes at max. by default).

Conditions:
  qstr/string ... matching by request sub-string
  qreq/pattern ... matching by request pattern
  {from/hostList} ... matching by client hosts
  excl[/number] ... exclusive with other DYCONFs
  poll/seconds ... timeout of polling request [4k]
  peek/bytes ... max. bytes of peeking request [15.0s]
  skip ... purge peeked data before starting relay
  debug ... enable logging for debugging of DYCONF

Example:
  DYCONF="file:path.txt" # load parameters from path.txt
  DYCONF="cgi:path.cgi" # load parameters generated by path.cgi
  DYCONF="qstr/string,arg:{SERVER=tcprelay://sv1:1234;TIMEOUT=io:3}"
  DYCONF="{qrex/[a-z][0-9]*},arg:{SERVER=tcprelay://sv1:1234}"
---- DeleGate/9.9.8-pre17 -------------------------

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V