2 ******************************************************************************
6 * Author: Damien Stuart
8 * Purpose: Access.conf file processing for fwknop server.
10 * Copyright 2010 Damien Stuart (dstuart@dstuart.org)
12 * License (GNU Public License):
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
29 ******************************************************************************
34 #include <sys/socket.h>
37 #include "fwknopd_common.h"
38 #include <arpa/inet.h>
44 /* Add an access string entry
47 add_acc_string(char **var, const char *val)
49 if((*var = strdup(val)) == NULL)
52 "Fatal memory allocation error adding access list entry: %s", var
58 /* Add an access int entry
61 add_acc_int(int *var, const char *val)
63 return(*var = atoi(val));
66 /* Add an access bool entry (unsigned char of 1 or 0)
69 add_acc_bool(unsigned char *var, const char *val)
71 return(*var = (strncasecmp(val, "Y", 1) == 0) ? 1 : 0);
74 /* Add expiration time - convert date to epoch seconds
77 add_acc_expire_time(fko_srv_options_t *opts, time_t *access_expire_time, const char *val)
81 memset(&tm, 0, sizeof(struct tm));
83 if (sscanf(val, "%2d/%2d/%4d", &tm.tm_mon, &tm.tm_mday, &tm.tm_year) != 3)
87 "Fatal: invalid date value '%s' (need MM/DD/YYYY) for access stanza expiration time",
90 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
94 tm.tm_mon -= 1; /* 0-11 */
96 /* number of years since 1900
104 *access_expire_time = mktime(&tm);
109 /* Add expiration time via epoch seconds defined in access.conf
112 add_acc_expire_time_epoch(fko_srv_options_t *opts, time_t *access_expire_time, const char *val)
115 unsigned long expire_time = 0;
119 expire_time = (time_t) strtoul(val, &endptr, 10);
121 if (errno == ERANGE || (errno != 0 && expire_time == 0))
124 "Fatal: invalid epoch seconds value '%s' for access stanza expiration time",
127 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
130 *access_expire_time = (time_t) expire_time;
135 #if FIREWALL_IPTABLES
137 add_acc_force_nat(fko_srv_options_t *opts, acc_stanza_t *curr_acc, const char *val)
139 char ip_str[MAX_IPV4_STR_LEN] = {0};
141 if (sscanf(val, "%15s %5u", ip_str, &curr_acc->force_nat_port) != 2)
145 "Fatal: invalid FORCE_NAT arg '%s', need <IP> <PORT>",
148 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
151 if (curr_acc->force_nat_port > MAX_PORT)
154 "Fatal: invalid FORCE_NAT port '%d'", curr_acc->force_nat_port);
155 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
158 curr_acc->force_nat = 1;
159 add_acc_string(&(curr_acc->force_nat_ip), ip_str);
165 /* Take an IP or Subnet/Mask and convert it to mask for later
166 * comparisons of incoming source IPs against this mask.
169 add_source_mask(acc_stanza_t *acc, const char *ip)
172 char ip_str[MAX_IPV4_STR_LEN] = {0};
177 acc_int_list_t *last_sle, *new_sle, *tmp_sle;
179 if((new_sle = calloc(1, sizeof(acc_int_list_t))) == NULL)
182 "Fatal memory allocation error adding stanza source_list entry"
187 /* If this is not the first entry, we walk our pointer to the
190 if(acc->source_list == NULL)
192 acc->source_list = new_sle;
196 tmp_sle = acc->source_list;
200 } while((tmp_sle = tmp_sle->next));
202 last_sle->next = new_sle;
205 /* Convert the IP data into the appropriate mask
207 if(strcasecmp(ip, "ANY") == 0)
209 new_sle->maddr = 0x0;
214 /* See if we have a subnet component. If so pull out the IP and
215 * mask values, then create the final mask value.
217 if((ndx = strchr(ip, '/')) != NULL)
220 strlcpy(ip_str, ip, (ndx-ip)+1);
225 strlcpy(ip_str, ip, strlen(ip)+1);
228 if(inet_aton(ip_str, &in) == 0)
231 "Error parsing IP to int for: %s", ip_str
240 /* Store our mask converted from CIDR to a 32-bit value.
242 new_sle->mask = (0xFFFFFFFF << (32 - mask));
244 /* Store our masked address for comparisons with future incoming
247 new_sle->maddr = ntohl(in.s_addr) & new_sle->mask;
251 /* Expand the access SOURCE string to a list of masks.
254 expand_acc_source(acc_stanza_t *acc)
261 for(ndx = start; *ndx; ndx++)
265 /* Skip over any leading whitespace.
267 while(isspace(*start))
270 strlcpy(buf, start, (ndx-start)+1);
271 add_source_mask(acc, buf);
276 /* Skip over any leading whitespace (once again for the last in the list).
278 while(isspace(*start))
281 strlcpy(buf, start, (ndx-start)+1);
282 add_source_mask(acc, buf);
286 parse_proto_and_port(char *pstr, int *proto, int *port)
291 /* Parse the string into its components.
293 if((ndx = strchr(pstr, '/')) == NULL)
296 "Parse error on access port entry: %s", pstr);
301 strlcpy(proto_str, pstr, (ndx - pstr)+1);
305 if(strcasecmp(proto_str, "tcp") == 0)
307 else if(strcasecmp(proto_str, "udp") == 0)
312 "Invalid protocol in access port entry: %s", pstr);
320 /* Take a proto/port string and convert it to appropriate integer values
321 * for comparisons of incoming SPA requests.
324 add_port_list_ent(acc_port_list_t **plist, char *port_str)
328 acc_port_list_t *last_plist, *new_plist, *tmp_plist;
330 /* Parse the string into its components and continue only if there
331 * are no problems with the incoming string.
333 if(parse_proto_and_port(port_str, &proto_int, &port) != 0)
336 if((new_plist = calloc(1, sizeof(acc_port_list_t))) == NULL)
339 "Fatal memory allocation error adding stanza source_list entry"
344 /* If this is not the first entry, we walk our pointer to the
356 last_plist = tmp_plist;
357 } while((tmp_plist = tmp_plist->next));
359 last_plist->next = new_plist;
362 new_plist->proto = proto_int;
363 new_plist->port = port;
366 /* Add a string list entry to the given acc_string_list.
369 add_string_list_ent(acc_string_list_t **stlist, const char *str_str)
371 acc_string_list_t *last_stlist, *new_stlist, *tmp_stlist;
373 if((new_stlist = calloc(1, sizeof(acc_string_list_t))) == NULL)
376 "Fatal memory allocation error creating string list entry"
381 /* If this is not the first entry, we walk our pointer to the
386 *stlist = new_stlist;
390 tmp_stlist = *stlist;
393 last_stlist = tmp_stlist;
394 } while((tmp_stlist = tmp_stlist->next));
396 last_stlist->next = new_stlist;
399 new_stlist->str = strdup(str_str);
401 if(new_stlist->str == NULL)
404 "Fatal memory allocation error adding string list entry item"
411 /* Expand a proto/port access string to a list of access proto-port struct.
414 expand_acc_port_list(acc_port_list_t **plist, char *plist_str)
421 for(ndx = start; *ndx; ndx++)
425 /* Skip over any leading whitespace.
427 while(isspace(*start))
430 strlcpy(buf, start, (ndx-start)+1);
431 add_port_list_ent(plist, buf);
436 /* Skip over any leading whitespace (once again for the last in the list).
438 while(isspace(*start))
441 strlcpy(buf, start, (ndx-start)+1);
443 add_port_list_ent(plist, buf);
446 /* Expand a comma-separated string into a simple acc_string_list.
449 expand_acc_string_list(acc_string_list_t **stlist, char *stlist_str)
456 for(ndx = start; *ndx; ndx++)
460 /* Skip over any leading whitespace.
462 while(isspace(*start))
465 strlcpy(buf, start, (ndx-start)+1);
466 add_string_list_ent(stlist, buf);
471 /* Skip over any leading whitespace (once again for the last in the list).
473 while(isspace(*start))
476 strlcpy(buf, start, (ndx-start)+1);
478 add_string_list_ent(stlist, buf);
481 /* Free the acc source_list
484 free_acc_source_list(acc_int_list_t *sle)
486 acc_int_list_t *last_sle;
491 sle = last_sle->next;
500 free_acc_port_list(acc_port_list_t *ple)
502 acc_port_list_t *last_ple;
507 ple = last_ple->next;
513 /* Free a string_list
516 free_acc_string_list(acc_string_list_t *stl)
518 acc_string_list_t *last_stl;
523 stl = last_stl->next;
530 /* Free any allocated content of an access stanza.
532 * NOTE: If a new access.conf parameter is created, and it is a string
533 * value, it also needs to be added to the list of items to check
537 free_acc_stanza_data(acc_stanza_t *acc)
540 if(acc->source != NULL)
543 free_acc_source_list(acc->source_list);
546 if(acc->open_ports != NULL)
548 free(acc->open_ports);
549 free_acc_port_list(acc->oport_list);
552 if(acc->restrict_ports != NULL)
554 free(acc->restrict_ports);
555 free_acc_port_list(acc->rport_list);
558 if(acc->force_nat_ip != NULL)
559 free(acc->force_nat_ip);
564 if(acc->cmd_exec_user != NULL)
565 free(acc->cmd_exec_user);
567 if(acc->require_username != NULL)
568 free(acc->require_username);
570 if(acc->gpg_home_dir != NULL)
571 free(acc->gpg_home_dir);
573 if(acc->gpg_decrypt_id != NULL)
574 free(acc->gpg_decrypt_id);
576 if(acc->gpg_decrypt_pw != NULL)
577 free(acc->gpg_decrypt_pw);
579 if(acc->gpg_remote_id != NULL)
581 free(acc->gpg_remote_id);
582 free_acc_string_list(acc->gpg_remote_id_list);
586 /* Expand any access entries that may be multi-value.
589 expand_acc_ent_lists(fko_srv_options_t *opts)
591 acc_stanza_t *acc = opts->acc_stanzas;
593 /* We need to do this for each stanza.
597 /* Expand the source string to 32-bit integer masks foreach entry.
599 expand_acc_source(acc);
601 /* Now expand the open_ports string.
603 if(acc->open_ports != NULL && strlen(acc->open_ports))
604 expand_acc_port_list(&(acc->oport_list), acc->open_ports);
606 if(acc->restrict_ports != NULL && strlen(acc->restrict_ports))
607 expand_acc_port_list(&(acc->rport_list), acc->restrict_ports);
609 /* Expand the GPG_REMOTE_ID string.
611 if(acc->gpg_remote_id != NULL && strlen(acc->gpg_remote_id))
612 expand_acc_string_list(&(acc->gpg_remote_id_list), acc->gpg_remote_id);
619 free_acc_stanzas(fko_srv_options_t *opts)
621 acc_stanza_t *acc, *last_acc;
623 /* Free any resources first (in case of reconfig). Assume non-NULL
624 * entry needs to be freed.
626 acc = opts->acc_stanzas;
631 acc = last_acc->next;
633 free_acc_stanza_data(last_acc);
640 /* Wrapper for free_acc_stanzas(), we may put additional initialization
644 acc_stanza_init(fko_srv_options_t *opts)
646 /* Free any resources first (in case of reconfig). Assume non-NULL
647 * entry needs to be freed.
649 free_acc_stanzas(opts);
654 /* Add a new stanza bay allocating the required memory at the required
655 * location, yada-yada-yada.
658 acc_stanza_add(fko_srv_options_t *opts)
660 acc_stanza_t *acc = opts->acc_stanzas;
661 acc_stanza_t *new_acc = calloc(1, sizeof(acc_stanza_t));
662 acc_stanza_t *last_acc;
667 "Fatal memory allocation error adding access stanza"
669 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
672 /* If this is not the first acc entry, we walk our acc pointer to the
673 * end of the existing list.
677 opts->acc_stanzas = new_acc;
683 } while((acc = acc->next));
685 last_acc->next = new_acc;
691 /* Scan the access options for entries that have not bees set, but need
695 set_acc_defaults(fko_srv_options_t *opts)
697 acc_stanza_t *acc = opts->acc_stanzas;
704 /* set default fw_access_timeout if necessary
706 if(acc->fw_access_timeout < 1)
707 acc->fw_access_timeout = DEF_FW_ACCESS_TIMEOUT;
709 /* set default gpg keyring path if necessary
711 if(acc->gpg_decrypt_pw != NULL && acc->gpg_home_dir == NULL)
712 add_acc_string(&(acc->gpg_home_dir), opts->config[CONF_GPG_HOME_DIR]);
718 /* Perform some sanity checks on an acc stanza data.
721 acc_data_is_valid(const acc_stanza_t *acc)
723 if((acc->key == NULL || !strlen(acc->key))
724 && (acc->gpg_decrypt_pw == NULL || !strlen(acc->gpg_decrypt_pw)))
727 "[*] No keys found for access stanza source: '%s'\n", acc->source
735 /* Read and parse the access file, popluating the access data as we go.
738 parse_access_file(fko_srv_options_t *opts)
743 unsigned int num_lines = 0;
745 char access_line_buf[MAX_LINE_LEN] = {0};
746 char var[MAX_LINE_LEN] = {0};
747 char val[MAX_LINE_LEN] = {0};
752 acc_stanza_t *curr_acc = NULL;
754 /* First see if the access file exists. If it doesn't, complain
757 if(stat(opts->config[CONF_ACCESS_FILE], &st) != 0)
759 fprintf(stderr, "[*] Access file: '%s' was not found.\n",
760 opts->config[CONF_ACCESS_FILE]);
762 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
765 if ((file_ptr = fopen(opts->config[CONF_ACCESS_FILE], "r")) == NULL)
767 fprintf(stderr, "[*] Could not open access file: %s\n",
768 opts->config[CONF_ACCESS_FILE]);
771 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
774 /* Initialize the access list.
776 acc_stanza_init(opts);
778 /* Now walk through access file pulling the access entries into the
781 while ((fgets(access_line_buf, MAX_LINE_LEN, file_ptr)) != NULL)
784 access_line_buf[MAX_LINE_LEN-1] = '\0';
786 /* Get past comments and empty lines (note: we only look at the
789 if(IS_EMPTY_LINE(access_line_buf[0]))
792 if(sscanf(access_line_buf, "%s %[^;\n\r]", var, val) != 2)
795 "*Invalid access file entry in %s at line %i.\n - '%s'",
796 opts->config[CONF_ACCESS_FILE], num_lines, access_line_buf
801 /* Remove any colon that may be on the end of the var
803 if((ndx = strrchr(var, ':')) != NULL)
808 if(opts->verbose > 3)
810 "ACCESS FILE: %s, LINE: %s\tVar: %s, Val: '%s'\n",
811 opts->config[CONF_ACCESS_FILE], access_line_buf, var, val
814 /* Process the entry.
816 * NOTE: If a new access.conf parameter is created. It also needs
817 * to be accounted for in the following if/if else construct.
820 if(CONF_VAR_IS(var, "SOURCE"))
822 /* If this is not the first stanza, sanity check the previous
823 * stanza for the minimum required data.
825 if(curr_acc != NULL) {
826 if(!acc_data_is_valid(curr_acc))
829 "[*] Data error in access file: '%s'\n",
830 opts->config[CONF_ACCESS_FILE]);
831 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
837 curr_acc = acc_stanza_add(opts);
839 add_acc_string(&(curr_acc->source), val);
843 else if (curr_acc == NULL)
845 /* The stanza must start with the "SOURCE" variable
849 else if(CONF_VAR_IS(var, "OPEN_PORTS"))
851 add_acc_string(&(curr_acc->open_ports), val);
853 else if(CONF_VAR_IS(var, "RESTRICT_PORTS"))
855 add_acc_string(&(curr_acc->restrict_ports), val);
857 else if(CONF_VAR_IS(var, "KEY"))
859 if(strcasecmp(val, "__CHANGEME__") == 0)
862 "[*] KEY value is not properly set in stanza source '%s' in access file: '%s'\n",
863 curr_acc->source, opts->config[CONF_ACCESS_FILE]);
864 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
866 add_acc_string(&(curr_acc->key), val);
868 else if(CONF_VAR_IS(var, "FW_ACCESS_TIMEOUT"))
870 add_acc_int(&(curr_acc->fw_access_timeout), val);
872 else if(CONF_VAR_IS(var, "ENABLE_CMD_EXEC"))
874 add_acc_bool(&(curr_acc->enable_cmd_exec), val);
876 else if(CONF_VAR_IS(var, "CMD_EXEC_USER"))
878 add_acc_string(&(curr_acc->cmd_exec_user), val);
885 fprintf(stderr, "Unable to determine UID for CMD_EXEC_USER: %s.\n",
886 errno ? strerror(errno) : "Not a user on this system");
887 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
890 curr_acc->cmd_exec_uid = pw->pw_uid;
892 else if(CONF_VAR_IS(var, "REQUIRE_USERNAME"))
894 add_acc_string(&(curr_acc->require_username), val);
896 else if(CONF_VAR_IS(var, "REQUIRE_SOURCE_ADDRESS"))
898 add_acc_bool(&(curr_acc->require_source_address), val);
900 else if(CONF_VAR_IS(var, "REQUIRE_SOURCE")) /* synonym for REQUIRE_SOURCE_ADDRESS */
902 add_acc_bool(&(curr_acc->require_source_address), val);
904 else if(CONF_VAR_IS(var, "GPG_HOME_DIR"))
906 if (is_valid_dir(val))
908 add_acc_string(&(curr_acc->gpg_home_dir), val);
913 "[*] GPG_HOME_DIR directory '%s' stat()/existence problem in stanza source '%s' in access file: '%s'\n",
914 val, curr_acc->source, opts->config[CONF_ACCESS_FILE]);
915 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
918 else if(CONF_VAR_IS(var, "GPG_DECRYPT_ID"))
920 add_acc_string(&(curr_acc->gpg_decrypt_id), val);
922 else if(CONF_VAR_IS(var, "GPG_DECRYPT_PW"))
924 if(strcasecmp(val, "__CHANGEME__") == 0)
927 "[*] GPG_DECRYPT_PW value is not properly set in stanza source '%s' in access file: '%s'\n",
928 curr_acc->source, opts->config[CONF_ACCESS_FILE]);
929 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
931 add_acc_string(&(curr_acc->gpg_decrypt_pw), val);
933 else if(CONF_VAR_IS(var, "GPG_REQUIRE_SIG"))
935 add_acc_bool(&(curr_acc->gpg_require_sig), val);
937 else if(CONF_VAR_IS(var, "GPG_IGNORE_SIG_VERIFY_ERROR"))
939 add_acc_bool(&(curr_acc->gpg_ignore_sig_error), val);
941 else if(CONF_VAR_IS(var, "GPG_REMOTE_ID"))
943 add_acc_string(&(curr_acc->gpg_remote_id), val);
945 else if(CONF_VAR_IS(var, "ACCESS_EXPIRE"))
947 add_acc_expire_time(opts, &(curr_acc->access_expire_time), val);
949 else if(CONF_VAR_IS(var, "ACCESS_EXPIRE_EPOCH"))
951 add_acc_expire_time_epoch(opts, &(curr_acc->access_expire_time), val);
953 else if(CONF_VAR_IS(var, "FORCE_NAT"))
955 #if FIREWALL_IPTABLES
956 if(strncasecmp(opts->config[CONF_ENABLE_IPT_FORWARDING], "Y", 1) !=0 )
959 "[*] FORCE_NAT requires ENABLE_IPT_FORWARDING to be enabled in fwknopd.conf\n");
960 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
962 add_acc_force_nat(opts, curr_acc, val);
965 "[*] FORCE_NAT not supported.\n");
966 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
972 "*Ignoring unknown access parameter: '%s' in %s\n",
973 var, opts->config[CONF_ACCESS_FILE]
980 /* Basic check to ensure that we got at least one SOURCE stanza with
981 * a valid KEY defined (valid meaning it has a value that is not
987 "[*] Could not find valid SOURCE stanza in access file: '%s'\n",
988 opts->config[CONF_ACCESS_FILE]);
989 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
992 /* Sanity check the last stanza
994 if(!acc_data_is_valid(curr_acc))
997 "[*] Data error in access file: '%s'\n",
998 opts->config[CONF_ACCESS_FILE]);
999 clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
1002 /* Expand our the expandable fields into their respective data buckets.
1005 expand_acc_ent_lists(opts);
1007 /* Make sure default values are set where needed.
1010 set_acc_defaults(opts);
1016 compare_addr_list(acc_int_list_t *source_list, const uint32_t ip)
1022 if((ip & source_list->mask) == (source_list->maddr & source_list->mask))
1028 source_list = source_list->next;
1034 /* Compare the contents of 2 port lists. Return true on a match.
1035 * Match depends on the match_any flag. if match_any is 1 then any
1036 * entry in the incoming data need only match one item to return true.
1037 * Otherwise all entries in the incoming data must have a corresponding
1038 * match in the access port_list.
1041 compare_port_list(acc_port_list_t *in, acc_port_list_t *ac, const int match_any)
1046 acc_port_list_t *tlist;
1054 if(in->proto == tlist->proto && in->port == tlist->port)
1060 tlist = tlist->next;
1065 return(i_cnt == a_cnt);
1068 /* Take a proto/port string (or mulitple comma-separated strings) and check
1069 * them against the list for the given access stanza.
1071 * Return 1 if we are allowed
1074 acc_check_port_access(acc_stanza_t *acc, char *port_str)
1081 acc_port_list_t *o_pl = acc->oport_list;
1082 acc_port_list_t *r_pl = acc->rport_list;
1084 acc_port_list_t *in_pl = NULL;
1088 /* Create our own internal port_list from the incoming SPA data
1091 for(ndx = start; *ndx; ndx++)
1095 strlcpy(buf, start, (ndx-start)+1);
1096 add_port_list_ent(&in_pl, buf);
1100 strlcpy(buf, start, (ndx-start)+1);
1101 add_port_list_ent(&in_pl, buf);
1106 "Unable to create acc_port_list from incoming data: %s", port_str
1111 /* Start with restricted ports (if any). Any match (even if only one
1112 * entry) means not allowed.
1114 if((acc->rport_list != NULL) && (compare_port_list(in_pl, r_pl, 1)))
1117 goto cleanup_and_bail;
1120 /* For open port list, all must match.
1122 if((acc->oport_list != NULL) && (!compare_port_list(in_pl, o_pl, 0)))
1126 free_acc_port_list(in_pl);
1130 /* Take a GPG ID string and check it against the list of allowed
1133 * Return 1 if we are allowed
1136 acc_check_gpg_remote_id(acc_stanza_t *acc, const char *gpg_id)
1138 acc_string_list_t *ndx;
1140 for(ndx = acc->gpg_remote_id_list; ndx != NULL; ndx=ndx->next)
1141 if(strcasecmp(ndx->str, gpg_id) == 0)
1147 /* Dump the configuration
1150 dump_access_list(const fko_srv_options_t *opts)
1154 acc_stanza_t *acc = opts->acc_stanzas;
1156 fprintf(stdout, "Current fwknopd access settings:\n");
1160 fprintf(stderr, "\n ** No Access Settings Defined **\n\n");
1168 "==============================================================\n"
1170 " RESTRICT_PORTS: %s\n"
1171 " KEY: <see the access.conf file>\n"
1172 " FW_ACCESS_TIMEOUT: %i\n"
1173 " ENABLE_CMD_EXEC: %s\n"
1174 " CMD_EXEC_USER: %s\n"
1175 " REQUIRE_USERNAME: %s\n"
1176 " REQUIRE_SOURCE_ADDRESS: %s\n"
1177 " FORCE_NAT (ip): %s\n"
1178 " FORCE_NAT (proto): %s\n"
1179 " FORCE_NAT (port): %d\n"
1180 " ACCESS_EXPIRE: %s" /* asctime() adds a newline */
1181 " GPG_HOME_DIR: %s\n"
1182 " GPG_DECRYPT_ID: %s\n"
1183 " GPG_DECRYPT_PW: <see the access.conf file>\n"
1184 " GPG_REQUIRE_SIG: %s\n"
1185 "GPG_IGNORE_SIG_VERIFY_ERROR: %s\n"
1186 " GPG_REMOTE_ID: %s\n",
1189 (acc->open_ports == NULL) ? "<not set>" : acc->open_ports,
1190 (acc->restrict_ports == NULL) ? "<not set>" : acc->restrict_ports,
1191 //(acc->key == NULL) ? "<not set>" : acc->key,
1192 acc->fw_access_timeout,
1193 acc->enable_cmd_exec ? "Yes" : "No",
1194 (acc->cmd_exec_user == NULL) ? "<not set>" : acc->cmd_exec_user,
1195 (acc->require_username == NULL) ? "<not set>" : acc->require_username,
1196 acc->require_source_address ? "Yes" : "No",
1197 acc->force_nat ? acc->force_nat_ip : "<not set>",
1198 acc->force_nat && acc->force_nat_proto != NULL ? acc->force_nat_proto : "<not set>",
1199 acc->force_nat ? acc->force_nat_port : 0,
1200 (acc->access_expire_time > 0) ? asctime(localtime(&acc->access_expire_time)) : "<not set>\n",
1201 (acc->gpg_home_dir == NULL) ? "<not set>" : acc->gpg_home_dir,
1202 (acc->gpg_decrypt_id == NULL) ? "<not set>" : acc->gpg_decrypt_id,
1203 //(acc->gpg_decrypt_pw == NULL) ? "<not set>" : acc->gpg_decrypt_pw,
1204 acc->gpg_require_sig ? "Yes" : "No",
1205 acc->gpg_ignore_sig_error ? "Yes" : "No",
1206 (acc->gpg_remote_id == NULL) ? "<not set>" : acc->gpg_remote_id
1209 fprintf(stdout, "\n");
1214 fprintf(stdout, "\n");