2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 /* TODO: make these customizable */
25 #define KD_CONF_FILE "/etc/kamid.conf"
26 #define KD_USER "_kamid"
27 #define KD_SOCKET "/var/run/kamid.sock"
29 #define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
36 IMSG_CTL_DEBUG_BACK, /* kd_debug_info */
45 IMSG_AUTH, /* kd_auth_proc */
46 IMSG_AUTH_TLS, /* kd_auth_req */
53 struct kd_options_conf {
61 struct kd_listen_conf {
62 STAILQ_ENTRY(kd_listen_conf) entry;
69 /* certificate hash => (virtual) user */
70 struct table *auth_table;
72 /* virtual user => local user */
73 struct table *virtual_table;
75 /* (virtual) user => export directory */
76 struct table *userdata_table;
84 STAILQ_ENTRY(kd_pki_conf) entry;
90 struct tls_config *tlsconf;
93 struct kd_tables_conf {
94 STAILQ_ENTRY(kd_tables_conf) entry;
99 struct kd_options_conf kd_options;
100 STAILQ_HEAD(kd_pki_conf_head, kd_pki_conf) pki_head;
101 STAILQ_HEAD(kd_tables_conf_head, kd_tables_conf) table_head;
102 STAILQ_HEAD(kd_listen_conf_head, kd_listen_conf) listen_head;
110 struct kd_auth_proc {
111 char uname[LOGIN_NAME_MAX];
115 struct kd_debug_info {
123 int main_reload(void);
124 int main_imsg_compose_listener(int, int, uint32_t, const void *, uint16_t);
125 void merge_config(struct kd_conf *, struct kd_conf *);
127 struct kd_conf *config_new_empty(void);
128 void config_clear(struct kd_conf *);
131 struct kd_conf *parse_config(const char *);
132 int cmdline_symset(char *);
133 void clear_config(struct kd_conf *);