Thank you very much, after printing all environment variable, here I have the environment variable complete, I send this for future reference I hope this will help some other people (I have edited for some values or even removed them for privacy reasons):
These variables are captured during OPENVPN_PLUGIN_CLIENT_CONNECT event, I don't know if there are avaiable on other events or if some others are missing. Other question: Will be any problem with the use of threads and sockets on the plugin? (I mean, can I use normal C programming techniques or are in the plugins some functions that can't be used?). Thanks all again for your help. /* Interesting environment variables * --------------------------------- * * ifconfig_pool_local_ip - "local" client gateway * ifconfig_pool_remote_ip - IP in the VPN * time_ascii - In format: Mon Sep 22 13:43:22 2008 * common_name - Client's name * * ========================================================================= * OTHER ENVIRONMENT VARIABLES (maybe can be useful in the future) * ========================================================================= * * trusted_port * trusted_ip * untrusted_port * untrusted_ip * * tls_serial_0=3 * tls_id_0=/C=ES/ST=State/O=Country/CN=hostname/emailAddress=m...@mail.tld * tls_serial_1 * tls_id_1=/C=ES/ST=State/L=Other/O=Other/CN=hostname/emailAddress=m...@mail.tld * * daemon_log_redirect=0 * daemon=0 * * verb=5 * * local_port=1194 * proto=tcp-server * * config=/etc/openvpn/server.conf * * ifconfig_local=10.8.0.1 * ifconfig_remote=10.8.0.2 * * route_net_gateway=192.168.X.X * route_vpn_gateway=10.8.0.2 * route_network_1=10.8.0.0 * route_netmask_1=255.255.255.0 * route_gateway_1=10.8.0.2 * * script_context=init * tun_mtu=1500 * link_mtu=1560 * dev=tun0 * */ El lun, 22-09-2008 a las 14:07 +0200, David Sommerseth escribió: > Jose Sanchez wrote: > > Thank you, I have figured out those things (but not all of them, so > > thanks for the detailed explanation). > > > > The problem that I have is that I have not found good examples about the > > structure of the environment variable (I have seen the: get_env function > > in simple.c so I will try to print that variable to the log or to the > > stdout to study its structure and data stored on it). > > I need to take things by memory now ... but if you want the "public" IP > address and the VPN ip address ... I would say you'll find them in these > environment variables: > > * untrusted_ip > Public IP address of the client, available before the session is properly > authenticated > > * untrusted_port > Port used by untrusted_ip > > * trusted_ip > Public IP address after the session is properly authenticated, and > available in the OPENVPN_PLUGIN_CLIENT_CONNECT and > OPENVPN_PLUGIN_CLIENT_DISCONNECT phases. > > * trusted_port > Port used by trusted_ip > > * ifconfig_pool_remote_ip, ifconfig_pool_netmask > The local VPN IP address and netmask the VPN client will be using. > Available during OPENVPN_PLUGIN_CLIENT_CONNECT and > OPENVPN_PLUGIN_CLIENT_DISCONNECT. > > > > Thanks to all for the help. As a suggestion, I would upload a mini-howto > > about making plugins at the website, description made by David Sommerset > > in this email can be very helpful and if it was a wiki, all people could > > collaborate. > > If my little quick description might be helpful for other, I do not mind if > it is published as a mini-howto, or whatever else suitable. > > > Thanks again, I will tell you about my success or not about making the > > plugin. > > Please do! And I am, at least, curious about what kind of work and > signalling your plug-in will do. > > > kind regards, > > David Sommerseth > -- Jose Sánchez <jose dot informatica at centrolamilagrosa dot org>