Go to the documentation of this file.
28 #define MF_SERVER (1<<0)
29 #define MF_QUERY_PASSWORDS (1<<1)
30 #define MF_HOLD (1<<2)
31 #define MF_SIGNAL (1<<3)
32 #define MF_FORGET_DISCONNECT (1<<4)
33 #define MF_CONNECT_AS_CLIENT (1<<5)
34 #define MF_CLIENT_AUTH (1<<6)
36 #define MF_UNIX_SOCK (1<<8)
37 #define MF_EXTERNAL_KEY (1<<9)
38 #define MF_EXTERNAL_KEY_NOPADDING (1<<10)
39 #define MF_EXTERNAL_KEY_PKCS1PAD (1<<11)
40 #define MF_UP_DOWN (1<<12)
41 #define MF_QUERY_REMOTE (1<<13)
42 #define MF_QUERY_PROXY (1<<14)
43 #define MF_EXTERNAL_CERT (1<<15)
44 #define MF_EXTERNAL_KEY_PSSPAD (1<<16)
45 #define MF_EXTERNAL_KEY_DIGEST (1<<17)
48 #ifdef ENABLE_MANAGEMENT
55 #define MANAGEMENT_VERSION 5
56 #define MANAGEMENT_N_PASSWORD_RETRIES 3
57 #define MANAGEMENT_LOG_HISTORY_INITIAL_SIZE 100
58 #define MANAGEMENT_ECHO_BUFFER_SIZE 100
59 #define MANAGEMENT_STATE_BUFFER_SIZE 100
67 #define DAF_CONNECTION_ESTABLISHED (1<<0)
68 #define DAF_CONNECTION_CLOSED (1<<1)
69 #define DAF_INITIAL_AUTH (1<<2)
119 #define LOG_PRINT_LOG_PREFIX (1<<0)
120 #define LOG_PRINT_ECHO_PREFIX (1<<1)
121 #define LOG_PRINT_STATE_PREFIX (1<<2)
123 #define LOG_PRINT_INT_DATE (1<<3)
124 #define LOG_PRINT_MSG_FLAGS (1<<4)
125 #define LOG_PRINT_STATE (1<<5)
126 #define LOG_PRINT_LOCAL_IP (1<<6)
128 #define LOG_PRINT_CRLF (1<<7)
129 #define LOG_FATAL_NOTIFY (1<<8)
131 #define LOG_PRINT_INTVAL (1<<9)
133 #define LOG_PRINT_REMOTE_IP (1<<10)
135 #define LOG_ECHO_TO_LOG (1<<11)
177 #define MCF_SERVER (1<<0)
189 const unsigned long cid,
190 const unsigned int mda_key_id,
193 const char *client_reason,
196 const unsigned long cid,
197 const unsigned int kid,
199 unsigned int timeout);
200 char *(*get_peer_info) (
void *
arg,
const unsigned long cid);
203 #ifdef TARGET_ANDROID
204 int (*network_change)(
void *
arg,
bool samenetwork);
248 #if UNIX_SOCK_SUPPORT
249 struct sockaddr_un local_unix;
260 #define MANSIG_IGNORE_USR1_HUP (1<<0)
261 #define MANSIG_MAP_USR1_TO_HUP (1<<1)
262 #define MANSIG_MAP_USR1_TO_TERM (1<<2)
267 #define UP_QUERY_DISABLED 0
268 #define UP_QUERY_USER_PASS 1
269 #define UP_QUERY_PASS 2
270 #define UP_QUERY_NEED_OK 3
271 #define UP_QUERY_NEED_STR 4
276 #define MS_CC_WAIT_READ 2
277 #define MS_CC_WAIT_WRITE 3
298 #define IEC_CLIENT_AUTH 1
300 #define IEC_RSA_SIGN 3
301 #define IEC_CERTIFICATE 4
302 #define IEC_PK_SIGN 5
308 #define EKS_SOLICIT 1
328 #ifdef TARGET_ANDROID
351 const char *pass_file,
352 const char *client_user,
353 const char *client_group,
354 const int log_history_cache,
355 const int echo_buffer_size,
356 const int state_buffer_size,
357 const int remap_sigusr1,
358 const unsigned int flags);
369 unsigned int *persistent);
381 const unsigned int flags,
382 const char *static_challenge);
384 #ifdef TARGET_ANDROID
385 bool management_android_control(
struct management *man,
const char *command,
const char *
msg);
387 #define ANDROID_KEEP_OLD_TUN 1
388 #define ANDROID_OPEN_BEFORE_CLOSE 2
389 int managment_android_persisttun_action(
struct management *man);
408 const unsigned int auth_id,
428 const char *response);
431 const char *algorithm);
471 #define OPENVPN_STATE_INITIAL 0
472 #define OPENVPN_STATE_CONNECTING 1
473 #define OPENVPN_STATE_ASSIGN_IP 2
474 #define OPENVPN_STATE_ADD_ROUTES 3
475 #define OPENVPN_STATE_CONNECTED 4
476 #define OPENVPN_STATE_RECONNECTING 5
477 #define OPENVPN_STATE_EXITING 6
480 #define OPENVPN_STATE_WAIT 7
481 #define OPENVPN_STATE_AUTH 8
482 #define OPENVPN_STATE_GET_CONFIG 9
483 #define OPENVPN_STATE_RESOLVE 10
484 #define OPENVPN_STATE_TCP_CONNECT 11
485 #define OPENVPN_STATE_AUTH_PENDING 12
488 #define OPENVPN_STATE_CLIENT_BASE 7
493 const in_addr_t *tun_local_ip,
494 const struct in6_addr *tun_local_ip6,
522 struct timeval *timeval);
bool(* client_auth)(void *arg, const unsigned long cid, const unsigned int mda_key_id, const bool auth, const char *reason, const char *client_reason, struct buffer_list *cc_config)
struct man_settings settings
struct openvpn_sockaddr remote_sock
void management_notify_client_needing_auth(struct management *management, const unsigned int auth_id, struct man_def_auth_context *mdac, const struct env_set *es)
void command_line_add(struct command_line *cl, const unsigned char *buf, const int len)
Contains all state information for one tunnel.
socket_descriptor_t sd_top
void management_up_down(struct management *man, const char *updown, const struct env_set *es)
void management_notify(struct management *man, const char *severity, const char *type, const char *text)
void management_echo(struct management *man, const char *string, const bool pull)
const char * special_state_msg
struct log_history * state
struct net_event_win32 ne32
bool(* remote_cmd)(void *arg, const char **p)
void management_set_state(struct management *man, const int state, const char *detail, const in_addr_t *tun_local_ip, const struct in6_addr *tun_local_ip6, const struct openvpn_sockaddr *local_addr, const struct openvpn_sockaddr *remote_addr)
int(* kill_by_cn)(void *arg, const char *common_name)
struct openvpn_sockaddr remote
socket_descriptor_t sd_cli
#define DAF_CONNECTION_CLOSED
void management_check_bytecount(struct context *c, struct management *man, struct timeval *timeval)
const char * log_entry_print(const struct log_entry *e, unsigned int flags, struct gc_arena *gc)
unsigned int in_extra_kid
void management_notify_client_cr_response(unsigned mda_key_id, const struct man_def_auth_context *mdac, const struct env_set *es, const char *response)
struct in6_addr local_ip6
void command_line_reset(struct command_line *cl)
void management_notify_generic(struct management *man, const char *str)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
bool management_open(struct management *man, const char *addr, const char *port, const char *pass_file, const char *client_user, const char *client_group, const int log_history_cache, const int echo_buffer_size, const int state_buffer_size, const int remap_sigusr1, const unsigned int flags)
void command_line_free(struct command_line *cl)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
struct buffer_list * ext_cert_input
const char * command_line_get(struct command_line *cl)
bool management_should_daemonize(struct management *man)
#define MF_QUERY_PASSWORDS
void log_history_add(struct log_history *h, const struct log_entry *le)
bool management_over_tunnel
struct buffer_list * in_extra
void man_bytecount_output_server(const counter_type *bytes_in_total, const counter_type *bytes_out_total, struct man_def_auth_context *mdac)
static bool management_connected(const struct management *man)
unsigned int(* remote_entry_count)(void *arg)
void(* show_net)(void *arg, const int msglevel)
static bool management_enable_def_auth(const struct management *man)
void man_persist_client_stats(struct management *man, struct context *c)
Wrapper structure for dynamically allocated memory.
const struct log_entry * log_history_ref(const struct log_history *h, const int index)
int bytecount_update_seconds
static int log_history_capacity(const struct log_history *h)
static bool management_query_user_pass_enabled(const struct management *man)
void log_history_close(struct log_history *h)
bool(* client_pending_auth)(void *arg, const unsigned long cid, const unsigned int kid, const char *extra, unsigned int timeout)
void(* status)(void *arg, const int version, struct status_output *so)
struct log_history * log_history_init(const int capacity)
void command_line_next(struct command_line *cl)
#define DAF_CONNECTION_ESTABLISHED
struct buffer_list * ext_key_input
static void management_bytes_server(struct management *man, const counter_type *bytes_in_total, const counter_type *bytes_out_total, struct man_def_auth_context *mdac)
Garbage collection arena used to keep track of dynamically allocated memory.
bool(* remote_entry_get)(void *arg, unsigned int index, char **remote)
void management_close(struct management *man)
void management_event_loop_n_seconds(struct management *man, int sec)
char * management_query_pk_sig(struct management *man, const char *b64_data, const char *algorithm)
bool management_hold(struct management *man, int holdtime)
struct management * management_init(void)
SOCKET socket_descriptor_t
void management_auth_failure(struct management *man, const char *type, const char *reason)
bool(* send_cc_message)(void *arg, const char *message, const char *parameter)
void management_set_callback(struct management *man, const struct management_callback *cb)
static void management_bytes_client(struct management *man, const int size_in, const int size_out)
static bool management_query_proxy_enabled(const struct management *man)
struct management_callback callback
static int buf_len(const struct buffer *buf)
struct management * management
unsigned int mda_key_id_counter
bool(* proxy_cmd)(void *arg, const char **p)
char * management_query_cert(struct management *man, const char *cert_name)
struct user_pass up_query
struct command_line * command_line_new(const int buf_len)
struct openvpn_sockaddr local_sock
void management_clear_callback(struct management *man)
void management_learn_addr(struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
struct log_history * echo
void management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip)
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
void management_io(struct management *man)
int(* kill_by_addr)(void *arg, const in_addr_t addr, const int port)
struct virtual_output vout
void management_connection_established(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
unsigned long in_extra_cid
const char * up_query_type
time_t bytecount_last_update
static int log_history_size(const struct log_history *h)
void(* delete_event)(void *arg, event_t event)
bool management_query_user_pass(struct management *man, struct user_pass *up, const char *type, const unsigned int flags, const char *static_challenge)
void log_history_resize(struct log_history *h, const int capacity)
struct event_timeout bytecount_update_interval
void management_pre_tunnel_close(struct management *man)
void management_socket_set(struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
static bool management_query_remote_enabled(const struct management *man)
int(* n_clients)(void *arg)
bool management_would_hold(struct management *man)
struct man_persist persist
struct man_connection connection
void management_auth_token(struct management *man, const char *token)