PageRenderTime 26ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/src/ipc.proto

https://gitlab.com/dawei101/ocserv
Protocol Buffers | 306 lines | 202 code | 34 blank | 70 comment | 0 complexity | 2850df15601b7b5d72d3dfc74af1f64f MD5 | raw file
  1. /* See doc/design.md for the IPC communication sequences.
  2. */
  3. enum AUTH_REP {
  4. OK = 1;
  5. MSG = 2;
  6. FAILED = 3;
  7. }
  8. /* AUTH_COOKIE_REQ */
  9. message auth_cookie_request_msg
  10. {
  11. required bytes cookie = 1;
  12. }
  13. message fw_port_st
  14. {
  15. required uint32 port = 1;
  16. /* fw_proto_t */
  17. required uint32 proto = 2;
  18. /* negative rule, i.e., if non zero reject this port */
  19. required uint32 negate = 3;
  20. }
  21. /* This is a structure for per-user/group supplemental configuration.
  22. */
  23. message group_cfg_st
  24. {
  25. /* sup - config, to add values, ensure we
  26. * apply a reasonable default in apply_default_config() */
  27. optional uint32 interim_update_secs = 2;
  28. optional uint32 session_timeout_secs = 3;
  29. optional bool no_udp = 10;
  30. optional bool deny_roaming = 11;
  31. repeated string routes = 13;
  32. repeated string iroutes = 14;
  33. repeated string dns = 15;
  34. repeated string nbns = 16;
  35. optional string ipv4_net = 17;
  36. optional string ipv4_netmask = 18;
  37. optional string ipv6_net = 19;
  38. optional uint32 ipv6_prefix = 20;
  39. optional string cgroup = 21;
  40. optional string xml_config_file = 22;
  41. optional uint32 rx_per_sec = 23;
  42. optional uint32 tx_per_sec = 24;
  43. optional uint32 net_priority = 25;
  44. optional string explicit_ipv4 = 26;
  45. optional string explicit_ipv6 = 27;
  46. repeated string no_routes = 28;
  47. optional uint32 ipv6_subnet_prefix = 29;
  48. optional uint32 dpd = 30;
  49. optional uint32 mobile_dpd = 31;
  50. optional uint32 keepalive = 32;
  51. optional uint32 max_same_clients = 33;
  52. optional uint32 tunnel_all_dns = 34;
  53. optional bool restrict_user_to_routes = 35;
  54. optional uint32 mtu = 36;
  55. optional uint32 idle_timeout = 37;
  56. optional uint32 mobile_idle_timeout = 38;
  57. repeated fw_port_st fw_ports = 39;
  58. optional string hostname = 40;
  59. }
  60. /* AUTH_COOKIE_REP */
  61. message auth_cookie_reply_msg
  62. {
  63. required AUTH_REP reply = 1;
  64. optional bytes session_id = 3; /* dtls */
  65. optional string vname = 4;
  66. optional string user_name = 5;
  67. optional string group_name = 6;
  68. /* the ips of the tun device */
  69. optional string ipv4 = 7;
  70. optional string ipv6 = 8;
  71. optional string ipv4_local = 9;
  72. optional string ipv6_local = 10;
  73. required bytes sid = 11;
  74. /* additional config */
  75. optional group_cfg_st config = 20;
  76. }
  77. /* RESUME_FETCH_REQ + RESUME_DELETE_REQ */
  78. message session_resume_fetch_msg
  79. {
  80. required bytes session_id = 1;
  81. /* this is of type sockaddr_storage,
  82. * and contains the address of the client.
  83. */
  84. required bytes cli_addr = 2;
  85. }
  86. /* RESUME_STORE_REQ */
  87. message session_resume_store_req_msg
  88. {
  89. required bytes session_id = 1;
  90. required bytes session_data = 2;
  91. /* this is of type sockaddr_storage,
  92. * and contains the address of the client.
  93. */
  94. required bytes cli_addr = 3;
  95. }
  96. /* RESUME_FETCH_REP */
  97. message session_resume_reply_msg
  98. {
  99. enum RESUME_REP {
  100. OK = 1;
  101. FAILED = 2;
  102. }
  103. required RESUME_REP reply = 1;
  104. optional bytes session_data = 2;
  105. }
  106. /* TUN_MTU */
  107. message tun_mtu_msg
  108. {
  109. required uint32 mtu = 1;
  110. }
  111. /* SEC_CLI_STATS */
  112. /* SECM_CLI_STATS */
  113. message cli_stats_msg
  114. {
  115. required uint64 bytes_in = 1;
  116. required uint64 bytes_out = 2;
  117. optional bytes sid = 3;
  118. required uint32 uptime = 4;
  119. optional string remote_ip = 5;
  120. optional string ipv4 = 6;
  121. optional string ipv6 = 7;
  122. optional uint32 discon_reason = 8;
  123. optional uint32 secmod_client_entries = 9; /* from sec-mod to main only */
  124. optional uint32 secmod_tlsdb_entries = 10; /* from sec-mod to main only */
  125. }
  126. /* UDP_FD */
  127. message udp_fd_msg
  128. {
  129. required bool hello = 1 [default = true]; /* is that a client hello? */
  130. required bytes data = 2; /* the first packet in the fd */
  131. }
  132. /* SESSION_INFO */
  133. message session_info_msg
  134. {
  135. required string tls_ciphersuite = 1;
  136. required string dtls_ciphersuite = 2;
  137. required string user_agent = 3;
  138. optional string cstp_compr = 4;
  139. optional string dtls_compr = 5;
  140. /* these two are of type sockaddr_storage,
  141. * and contain the addresses we got from proxy
  142. * protocol (if any).
  143. */
  144. optional bytes our_addr = 6;
  145. optional bytes remote_addr = 7;
  146. optional string hostname = 8;
  147. }
  148. /* WORKER_BAN_IP: sent from worker to main */
  149. message ban_ip_msg
  150. {
  151. required string ip = 1;
  152. required uint32 score = 2;
  153. optional bytes sid = 3; /* sec-mod sends it */
  154. }
  155. message ban_ip_reply_msg
  156. {
  157. /* whether to disconnect the user */
  158. required AUTH_REP reply = 1;
  159. optional bytes sid = 2; /* sec-mod needs it */
  160. }
  161. /* Messages to and from the security module */
  162. /*
  163. * == Auth with username/password ==
  164. *
  165. * sec-mod worker
  166. * <------ AUTH_INIT (username)
  167. * AUTH_REP(MSG,SID) ------>
  168. * <------ AUTH_CONT (SID,password)
  169. * .
  170. * .
  171. * .
  172. * AUTH_REP(OK,COOKIE)------>
  173. *
  174. *
  175. * The authentication is now identical for openconnect and
  176. * legacy cisco anyconnect clients. That is because the
  177. * authentication method identifies the user using the SID.
  178. *
  179. */
  180. /* SEC_AUTH_INIT */
  181. message sec_auth_init_msg
  182. {
  183. required bool tls_auth_ok = 2 [default = false];
  184. required string user_name = 3;
  185. optional string group_name = 4; /* selected group name */
  186. optional string cert_user_name = 5;
  187. repeated string cert_group_names = 6;
  188. required string ip = 8;
  189. required uint32 auth_type = 9 [default = 0];
  190. optional string our_ip = 10;
  191. optional string user_agent = 11;
  192. }
  193. /* SEC_AUTH_CONT */
  194. message sec_auth_cont_msg
  195. {
  196. required string password = 2;
  197. required bytes sid = 3;
  198. required string ip = 4;
  199. }
  200. /* SEC_AUTH_REP */
  201. message sec_auth_reply_msg
  202. {
  203. required AUTH_REP reply = 1;
  204. optional string user_name = 3;
  205. optional string msg = 4; /* message to display to user */
  206. optional bytes dtls_session_id = 5;
  207. optional bytes sid = 6; /* cookie */
  208. optional uint32 passwd_counter = 8; /* if that's a password prompt indicates the number of password asked */
  209. }
  210. /* SEC_SIGN/DECRYPT */
  211. message sec_op_msg
  212. {
  213. optional uint32 key_idx = 1;
  214. required bytes data = 2;
  215. }
  216. /*
  217. * == Session Termination ==
  218. *
  219. * main sec-mod
  220. * SECM_SESSION_OPEN/CLOSE ------>
  221. * <------ SECM_SESSION_REPLY
  222. */
  223. /* SECM_SESSION_OPEN */
  224. message secm_session_open_msg
  225. {
  226. required bytes sid = 1; /* cookie */
  227. optional string ipv4 = 6;
  228. optional string ipv6 = 7;
  229. }
  230. /* SECM_SESSION_CLOSE */
  231. message secm_session_close_msg
  232. {
  233. required bytes sid = 1; /* cookie */
  234. optional uint32 uptime = 3;
  235. optional uint64 bytes_in = 4;
  236. optional uint64 bytes_out = 5;
  237. optional string ipv4 = 6;
  238. optional string ipv6 = 7;
  239. }
  240. /* SECM_SESSION_REPLY */
  241. message secm_session_reply_msg
  242. {
  243. required AUTH_REP reply = 1;
  244. required group_cfg_st config = 2;
  245. required string username = 3;
  246. required string groupname = 4;
  247. required string ip = 6;
  248. required uint32 ipv4_seed = 8;
  249. required bytes sid = 9;
  250. required bool tls_auth_ok = 10;
  251. }
  252. /* internal struct */
  253. message cookie_int_msg
  254. {
  255. required bytes sid = 1;
  256. required bool session_is_open = 2;
  257. required bool tls_auth_ok = 3;
  258. required uint32 last_modified = 4;
  259. required string username = 5;
  260. optional string groupname = 6;
  261. required string user_agent = 7;
  262. required string remote_ip = 8;
  263. required uint32 status = 10; /* the authentication status (PS_*) */
  264. }
  265. /* SECM_LIST_COOKIES - no content */
  266. /* SECM_LIST_COOKIES_REPLY */
  267. message secm_list_cookies_reply_msg
  268. {
  269. repeated cookie_int_msg cookies = 1;
  270. }
  271. /* SECM_BAN_IP: sent from sec-mod to main */
  272. /* same as: ban_ip_msg */