27#define MF_SERVER (1u << 0)
28#define MF_QUERY_PASSWORDS (1u << 1)
29#define MF_HOLD (1u << 2)
30#define MF_SIGNAL (1u << 3)
31#define MF_FORGET_DISCONNECT (1u << 4)
32#define MF_CONNECT_AS_CLIENT (1u << 5)
33#define MF_CLIENT_AUTH (1u << 6)
35#define MF_UNIX_SOCK (1u << 8)
36#define MF_EXTERNAL_KEY (1u << 9)
37#define MF_EXTERNAL_KEY_NOPADDING (1u << 10)
38#define MF_EXTERNAL_KEY_PKCS1PAD (1u << 11)
39#define MF_UP_DOWN (1u << 12)
40#define MF_QUERY_REMOTE (1u << 13)
41#define MF_QUERY_PROXY (1u << 14)
42#define MF_EXTERNAL_CERT (1u << 15)
43#define MF_EXTERNAL_KEY_PSSPAD (1u << 16)
44#define MF_EXTERNAL_KEY_DIGEST (1u << 17)
46#ifdef ENABLE_MANAGEMENT
53#define MANAGEMENT_VERSION 6
54#define MANAGEMENT_N_PASSWORD_RETRIES 3
55#define MANAGEMENT_LOG_HISTORY_INITIAL_SIZE 100
56#define MANAGEMENT_ECHO_BUFFER_SIZE 100
57#define MANAGEMENT_STATE_BUFFER_SIZE 100
66#define DAF_CONNECTION_ESTABLISHED (1u << 0)
67#define DAF_CONNECTION_CLOSED (1u << 1)
68#define DAF_INITIAL_AUTH (1u << 2)
117#define LOG_PRINT_LOG_PREFIX (1u << 0)
118#define LOG_PRINT_ECHO_PREFIX (1u << 1)
119#define LOG_PRINT_STATE_PREFIX (1u << 2)
121#define LOG_PRINT_INT_DATE (1u << 3)
122#define LOG_PRINT_MSG_FLAGS (1u << 4)
123#define LOG_PRINT_STATE (1u << 5)
124#define LOG_PRINT_LOCAL_IP (1u << 6)
126#define LOG_PRINT_CRLF (1u << 7)
127#define LOG_FATAL_NOTIFY (1u << 8)
129#define LOG_PRINT_INTVAL (1u << 9)
131#define LOG_PRINT_REMOTE_IP (1u << 10)
133#define LOG_ECHO_TO_LOG (1u << 11)
175#define MCF_SERVER (1u << 0)
186 bool (*
client_auth)(
void *
arg,
const unsigned long cid,
const unsigned int mda_key_id,
187 const bool auth,
const char *reason,
const char *client_reason,
190 const char *extra,
unsigned int timeout);
191 char *(*get_peer_info)(
void *
arg,
const unsigned long cid);
195 int (*network_change)(
void *
arg,
bool samenetwork);
244 struct sockaddr_un local_unix;
255#define MANSIG_IGNORE_USR1_HUP (1u << 0)
256#define MANSIG_MAP_USR1_TO_HUP (1u << 1)
257#define MANSIG_MAP_USR1_TO_TERM (1u << 2)
262#define UP_QUERY_DISABLED 0
263#define UP_QUERY_USER_PASS 1
264#define UP_QUERY_PASS 2
265#define UP_QUERY_NEED_OK 3
266#define UP_QUERY_NEED_STR 4
267#define UP_QUERY_USERNAME 5
272#define MS_CC_WAIT_READ 2
273#define MS_CC_WAIT_WRITE 3
295#define IEC_CLIENT_AUTH 1
297#define IEC_RSA_SIGN 3
298#define IEC_CERTIFICATE 4
300#define IEC_PASSWORD 6
347 const char *pass_file,
const char *client_user,
const char *client_group,
348 const int log_history_cache,
const int echo_buffer_size,
349 const int state_buffer_size,
const int remap_sigusr1,
350 const unsigned int flags);
359 unsigned int *persistent);
368 const unsigned int flags,
const char *static_challenge);
371bool management_android_control(
struct management *man,
const char *command,
const char *
msg);
373#define ANDROID_KEEP_OLD_TUN 1
374#define ANDROID_OPEN_BEFORE_CLOSE 2
375int managment_android_persisttun_action(
struct management *man);
393 const unsigned int auth_id,
404 const struct mroute_addr *addr,
const bool primary);
408 const struct env_set *
es,
const char *response);
450#define OPENVPN_STATE_INITIAL 0
451#define OPENVPN_STATE_CONNECTING 1
452#define OPENVPN_STATE_ASSIGN_IP 2
453#define OPENVPN_STATE_ADD_ROUTES 3
454#define OPENVPN_STATE_CONNECTED 4
455#define OPENVPN_STATE_RECONNECTING 5
456#define OPENVPN_STATE_EXITING 6
459#define OPENVPN_STATE_WAIT 7
460#define OPENVPN_STATE_AUTH 8
461#define OPENVPN_STATE_GET_CONFIG 9
462#define OPENVPN_STATE_RESOLVE 10
463#define OPENVPN_STATE_TCP_CONNECT 11
464#define OPENVPN_STATE_AUTH_PENDING \
468#define OPENVPN_STATE_CLIENT_BASE 7
471 const in_addr_t *tun_local_ip,
const struct in6_addr *tun_local_ip6,
static int buf_len(const struct buffer *buf)
Return the length of the buffer content.
void management_pre_tunnel_close(struct management *man)
void management_auth_failure(struct management *man, const char *type, const char *reason)
void log_history_close(struct log_history *h)
void management_check_bytecount_server(struct multi_context *multi, struct timeval *timeval)
static bool management_query_remote_enabled(const struct management *man)
void management_notify_client_close(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
static int log_history_capacity(const struct log_history *h)
void management_socket_set(struct management *man, struct event_set *es, void *arg, unsigned int *persistent)
void command_line_free(struct command_line *cl)
void command_line_next(struct command_line *cl)
void management_clear_callback(struct management *man)
char * management_query_cert(struct management *man, const char *cert_name)
struct command_line * command_line_new(const size_t buf_len)
bool management_hold(struct management *man, int holdtime)
static bool management_query_proxy_enabled(const struct management *man)
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)
static bool management_query_user_pass_enabled(const struct management *man)
struct log_history * log_history_init(const int capacity)
void management_learn_addr(struct management *management, struct man_def_auth_context *mdac, const struct mroute_addr *addr, const bool primary)
struct management * management_init(void)
void command_line_reset(struct command_line *cl)
bool management_would_hold(struct management *man)
bool management_query_user_pass(struct management *man, struct user_pass *up, const char *type, const unsigned int flags, const char *static_challenge)
static bool management_connected(const struct management *man)
void log_history_add(struct log_history *h, const struct log_entry *le)
static int log_history_size(const struct log_history *h)
void management_event_loop_n_seconds(struct management *man, int sec)
void management_close(struct management *man)
const char * log_entry_print(const struct log_entry *e, unsigned int flags, struct gc_arena *gc)
void management_auth_token(struct management *man, const char *token)
#define MF_QUERY_PASSWORDS
void management_io(struct management *man)
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 management_notify_generic(struct management *man, const char *str)
void management_connection_established(struct management *management, struct man_def_auth_context *mdac, const struct env_set *es)
void man_persist_client_stats(struct management *man, struct context *c)
static bool management_enable_def_auth(const struct management *man)
void management_set_callback(struct management *man, const struct management_callback *cb)
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)
void management_echo(struct management *man, const char *string, const bool pull)
const struct log_entry * log_history_ref(const struct log_history *h, const int index)
void management_check_bytecount_client(struct context *c, struct management *man, struct timeval *timeval)
void management_up_down(struct management *man, const char *updown, const struct env_set *es)
char * management_query_pk_sig(struct management *man, const char *b64_data, const char *algorithm)
void command_line_add(struct command_line *cl, const unsigned char *buf, const size_t len)
const char * command_line_get(struct command_line *cl)
void management_sleep(const int n)
A sleep function that services the management layer for n seconds rather than doing nothing.
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 log_history_resize(struct log_history *h, const int capacity)
void management_notify(struct management *man, const char *severity, const char *type, const char *text)
void management_post_tunnel_open(struct management *man, const in_addr_t tun_local_ip)
A singly-linked list of buffers, with head/tail pointers for O(1) push.
Wrapper structure for dynamically allocated memory.
Contains all state information for one tunnel.
Garbage collection arena used to keep track of dynamically allocated memory.
struct in6_addr local_ip6
struct openvpn_sockaddr local_sock
struct openvpn_sockaddr remote_sock
unsigned long in_extra_cid
const char * up_query_type
struct user_pass up_query
socket_descriptor_t sd_top
struct buffer_list * ext_cert_input
unsigned int in_extra_kid
struct openvpn_sockaddr remote
socket_descriptor_t sd_cli
struct buffer_list * ext_key_input
int bytecount_update_seconds
struct buffer_list * in_extra
struct event_timeout bytecount_update_interval
struct net_event_win32 ne32
unsigned int mda_key_id_counter
struct log_history * state
struct management_callback callback
struct virtual_output vout
struct log_history * echo
const char * special_state_msg
bool management_over_tunnel
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)
int(* kill_by_addr)(void *arg, const in_addr_t addr, const uint16_t port, const uint8_t proto)
void(* delete_event)(void *arg, event_t event)
bool(* push_update_broadcast)(void *arg, const char *options)
bool(* push_update_by_cid)(void *arg, unsigned long cid, const char *options)
bool(* client_pending_auth)(void *arg, const unsigned long cid, const unsigned int kid, const char *extra, unsigned int timeout)
int(* n_clients)(void *arg)
void(* status)(void *arg, const int version, struct status_output *so)
bool(* remote_entry_get)(void *arg, unsigned int index, char **remote)
unsigned int(* remote_entry_count)(void *arg)
bool(* send_cc_message)(void *arg, const char *message, const char *parameter)
bool(* proxy_cmd)(void *arg, const char **p)
void(* show_net)(void *arg, const msglvl_t msglevel)
bool(* remote_cmd)(void *arg, const char **p)
int(* kill_by_cn)(void *arg, const char *common_name)
bool(* kill_by_cid)(void *arg, const unsigned long cid, const char *kill_msg)
struct man_persist persist
struct man_connection connection
struct man_settings settings
Main OpenVPN server state structure.
SOCKET socket_descriptor_t