1 /* IPSec VPN client compatible with Cisco equipment.
2 Copyright (C) 2004-2005 Maurice Massar
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include <sys/types.h>
32 #include <sys/utsname.h>
41 #include "decrypt-utils.h"
43 const char *config
[LAST_CONFIG
];
47 int opt_1des
, opt_no_encryption
, opt_auth_mode
;
48 enum natt_mode_enum opt_natt_mode
;
49 enum vendor_enum opt_vendor
;
50 enum if_mode_enum opt_if_mode
;
51 uint16_t opt_udpencapport
;
53 static void log_to_stderr(int priority
__attribute__((unused
)), const char *format
, ...)
57 fprintf(stderr
, "vpnc: ");
59 vfprintf(stderr
, format
, ap
);
60 fprintf(stderr
, "\n");
64 void (*logmsg
)(int priority
, const char *format
, ...) = log_to_stderr
;
67 void hex_dump(const char *str
, const void *data
, ssize_t len
, const struct debug_strings
*decode
)
70 const uint8_t *p
= data
;
71 const char *decodedval
;
79 decodedval
= val_to_string(*(uint8_t *)p
, decode
);
80 printf("%s: %02x%s\n", str
, *(uint8_t *)p
, decodedval
);
83 decodedval
= val_to_string(*(uint16_t *)p
, decode
);
84 printf("%s: %04x%s\n", str
, *(uint16_t *)p
, decodedval
);
87 decodedval
= val_to_string(*(uint32_t *)p
, decode
);
88 printf("%s: %08x%s\n", str
, *(uint32_t *)p
, decodedval
);
92 printf("%s:%s", str
, (len
<= 16) ? " " : "\n ");
93 for (i
= 0; i
< (size_t)len
; i
++) {
96 else if (i
&& !(i
% 4))
103 #define GETLINE_MAX_BUFLEN 200
106 * mostly match getline() semantics but:
107 * 1) accept CEOT (Ctrl-D, 0x04) at begining of line as an input terminator
108 * 2) allocate the buffer at max line size of GETLINE_MAX_BUFLEN bytes
109 * 3) remove trailing newline
112 * -1 for errors or no line (EOF or CEOT)
113 * n the characters in line, excluding (removed) newline and training '\0'
115 static ssize_t
vpnc_getline(char **lineptr
, size_t *n
, FILE *stream
)
118 size_t buflen
, llen
= 0;
119 int c
, buf_allocated
= 0;
121 if (lineptr
== NULL
|| n
== NULL
) {
128 if (buf
== NULL
|| buflen
== 0) {
129 buflen
= GETLINE_MAX_BUFLEN
;
130 buf
= (char *)malloc(buflen
);
136 /* Read a line from the input */
137 while (llen
< buflen
- 1) {
139 if (c
== EOF
|| feof(stream
)) {
145 if (llen
== 0 && c
== CEOT
)
147 if (c
== '\n' || c
== '\r')
149 buf
[llen
++] = (char) c
;
165 static char *vpnc_getpass_program(const char *prompt
)
169 int fds
[2] = {-1, -1};
181 const char *program
= config
[CONFIG_PASSWORD_HELPER
];
186 if (dup2(fds
[1], 1) == -1)
192 execl(program
, program
, prompt
, NULL
);
200 while ((r
= waitpid(pid
, &status
, 0)) == 0 ||
201 (r
== -1 && errno
== EINTR
))
207 if (!WIFEXITED(status
)) {
212 if (WEXITSTATUS(status
) != 0) {
217 pass
= (char *)malloc(GETLINE_MAX_BUFLEN
);
221 bytes
= read(fds
[0], pass
, GETLINE_MAX_BUFLEN
- 1);
229 for (i
= 0 ; i
< bytes
; i
++)
230 if (pass
[i
] == '\n' || pass
[i
] == '\r') {
245 char *vpnc_getpass(const char *prompt
)
251 if (config
[CONFIG_PASSWORD_HELPER
]) {
252 buf
= vpnc_getpass_program(prompt
);
254 error(1, errno
, "can't run password helper program");
258 printf("%s", prompt
);
261 tcgetattr(STDIN_FILENO
, &t
);
263 tcsetattr(STDIN_FILENO
, TCSANOW
, &t
);
265 vpnc_getline(&buf
, &len
, stdin
);
268 tcsetattr(STDIN_FILENO
, TCSANOW
, &t
);
274 static void config_deobfuscate(int obfuscated
, int clear
)
279 if (config
[obfuscated
] == NULL
)
282 if (config
[clear
] != NULL
) {
283 config
[obfuscated
] = NULL
;
284 error(0, 0, "warning: ignoring obfuscated password because cleartext password set");
288 ret
= hex2bin(config
[obfuscated
], &bin
, &len
);
290 error(1, 0, "error: deobfuscating of password failed (input not a hex string)");
293 ret
= deobfuscate(bin
, len
, config
+clear
, NULL
);
296 error(1, 0, "error: deobfuscating of password failed");
299 config
[obfuscated
] = NULL
;
303 static const char *config_def_ike_dh(void)
308 static const char *config_def_pfs(void)
313 static const char *config_def_local_addr(void)
318 static const char *config_def_local_port(void)
323 static const char *config_def_if_mode(void)
328 static const char *config_def_natt_mode(void)
333 static const char *config_def_udp_port(void)
338 static const char *config_def_dpd_idle(void)
343 static const char *config_ca_dir(void)
345 return "/etc/ssl/certs";
348 static const char *config_def_auth_mode(void)
353 static const char *config_def_app_version(void)
359 asprintf(&version
, "Cisco Systems VPN Client %s:%s", VERSION
, uts
.sysname
);
363 static const char *config_def_script(void)
365 return "/etc/vpnc/vpnc-script";
368 static const char *config_def_pid_file(void)
370 return "/var/run/vpnc.pid";
373 static const char *config_def_vendor(void)
378 static const char *config_def_target_network(void)
380 return "0.0.0.0/0.0.0.0";
383 static const struct config_names_s
{
385 const int needsArgument
;
391 const char *(*get_def
) (void);
393 /* Note: broken config file parser does only support option
394 * names where one is a prefix of another option IF the longer
395 * option name comes first in this list. */
397 CONFIG_IPSEC_GATEWAY
, 1, 0,
401 "IP/name of your IPSec gateway",
404 CONFIG_IPSEC_ID
, 1, 0,
411 CONFIG_IPSEC_SECRET
, 1, 0,
415 "your group password (cleartext)",
418 CONFIG_IPSEC_SECRET_OBF
, 1, 1,
420 "IPSec obfuscated secret",
422 "your group password (obfuscated)",
425 CONFIG_XAUTH_USERNAME
, 1, 0,
432 CONFIG_XAUTH_PASSWORD
, 1, 0,
436 "your password (cleartext)",
439 CONFIG_XAUTH_PASSWORD_OBF
, 1, 1,
441 "Xauth obfuscated password",
443 "your password (obfuscated)",
450 "(NT-) Domain name for authentication",
453 CONFIG_XAUTH_INTERACTIVE
, 0, 1,
457 "enable interactive extended authentication (for challenge response auth)",
464 "vendor of your IPSec gateway",
467 CONFIG_NATT_MODE
, 1, 1,
469 "NAT Traversal Mode",
470 "<natt/none/force-natt/cisco-udp>",
471 "Which NAT-Traversal Method to use:\n"
472 " * natt -- NAT-T as defined in RFC3947\n"
473 " * none -- disable use of any NAT-T method\n"
474 " * force-natt -- always use NAT-T encapsulation even\n"
475 " without presence of a NAT device\n"
476 " (useful if the OS captures all ESP traffic)\n"
477 " * cisco-udp -- Cisco proprietary UDP encapsulation, commonly over Port 10000\n"
478 "Note: cisco-tcp encapsulation is not yet supported\n",
485 "command is executed using system() to configure the interface,\n"
486 "routing and so on. Device name, IP, etc. are passed using environment\n"
487 "variables, see README. This script is executed right after ISAKMP is\n"
488 "done, but before tunneling is enabled. It is called when vpnc\n"
496 "name of the IKE DH Group",
499 CONFIG_IPSEC_PFS
, 1, 1,
501 "Perfect Forward Secrecy",
502 "<nopfs/dh1/dh2/dh5/server>",
503 "Diffie-Hellman group to use for PFS",
506 CONFIG_ENABLE_1DES
, 0, 1,
510 "enables weak single DES encryption",
513 CONFIG_ENABLE_NO_ENCRYPTION
, 0, 1,
514 "--enable-no-encryption",
515 "Enable no encryption",
517 "enables using no encryption for data traffic (key exchanged must be encrypted)",
520 CONFIG_VERSION
, 1, 1,
521 "--application-version",
522 "Application version",
524 "Application Version to report. Note: Default string is generated at runtime.",
525 config_def_app_version
527 CONFIG_IF_NAME
, 1, 1,
531 "visible name of the TUN/TAP interface",
534 CONFIG_IF_MODE
, 1, 1,
538 "mode of TUN/TAP interface:\n"
539 " * tun: virtual point to point interface (default)\n"
540 " * tap: virtual ethernet interface\n",
547 "Set MTU for TUN/TAP interface (default 0 == automatic detect)",
554 "Show verbose debug messages\n"
555 " * 0: Do not print debug information.\n"
556 " * 1: Print minimal debug information.\n"
557 " * 2: Show statemachine and packet/payload type information.\n"
558 " * 3: Dump everything exluding authentication data.\n"
559 " * 99: Dump everything INCLUDING AUTHENTICATION data (e.g. PASSWORDS).\n",
566 "Don't detach from the console after login",
569 CONFIG_PID_FILE
, 1, 1,
573 "store the pid of background process in <filename>",
576 CONFIG_LOCAL_ADDR
, 1, 1,
580 "local IP to use for ISAKMP / ESP / ... (0.0.0.0 == automatically assign)",
581 config_def_local_addr
583 CONFIG_LOCAL_PORT
, 1, 1,
587 "local ISAKMP port number to use (0 == use random port)",
588 config_def_local_port
590 CONFIG_UDP_ENCAP_PORT
, 1, 1,
592 "Cisco UDP Encapsulation Port",
594 "Local UDP port number to use (0 == use random port).\n"
595 "This is only relevant if cisco-udp nat-traversal is used.\n"
596 "This is the _local_ port, the remote udp port is discovered automatically.\n"
597 "It is especially not the cisco-tcp port.\n",
600 CONFIG_DPD_IDLE
, 1, 1,
602 "DPD idle timeout (our side)",
604 "Send DPD packet after not receiving anything for <idle> seconds.\n"
605 "Use 0 to disable DPD completely (both ways).\n",
608 CONFIG_NON_INTERACTIVE
, 0, 1,
612 "Don't ask anything, exit on missing options",
615 CONFIG_AUTH_MODE
, 1, 1,
619 "Authentication mode:\n"
620 " * psk: pre-shared key (default)\n"
621 " * cert: server + client certificate (not implemented yet)\n"
622 " * hybrid: server certificate + xauth (if built with openssl support)\n",
625 CONFIG_CA_FILE
, 1, 1,
629 "filename and path to the CA-PEM-File",
636 "path of the trusted CA-Directory",
639 CONFIG_IPSEC_TARGET_NETWORK
, 1, 1,
641 "IPSEC target network",
642 "<target network/netmask>",
643 "Target network in dotted decimal or CIDR notation\n",
644 config_def_target_network
646 CONFIG_PASSWORD_HELPER
, 1, 1,
650 "path to password program or helper name\n",
653 0, 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
657 static char *get_config_filename(const char *name
, int add_dot_conf
)
661 asprintf(&realname
, "%s%s%s", index(name
, '/') ? "" : "/etc/vpnc/", name
, add_dot_conf
? ".conf" : "");
665 static void read_config_file(const char *name
, const char **configs
, int missingok
)
669 size_t line_length
= 0;
673 if (!strcmp(name
, "-")) {
675 realname
= strdup("stdin");
677 realname
= get_config_filename(name
, 0);
678 f
= fopen(realname
, "r");
679 if (f
== NULL
&& errno
== ENOENT
) {
681 realname
= get_config_filename(name
, 1);
682 f
= fopen(realname
, "r");
684 if (missingok
&& f
== NULL
&& errno
== ENOENT
) {
689 error(1, errno
, "couldn't open `%s'", realname
);
696 llen
= vpnc_getline(&line
, &line_length
, f
);
697 if (llen
== -1 && errno
)
698 error(1, errno
, "reading `%s'", realname
);
702 for (i
= 0; config_names
[i
].name
!= NULL
; i
++) {
703 if (strncasecmp(config_names
[i
].name
, line
,
704 strlen(config_names
[i
].name
)) == 0) {
705 /* boolean implementation, using harmless pointer targets as true */
706 if (!config_names
[i
].needsArgument
) {
707 configs
[config_names
[i
].nm
] = config_names
[i
].name
;
710 /* get option value*/
711 if (configs
[config_names
[i
].nm
] == NULL
) {
713 start
= strlen(config_names
[i
].name
);
714 /* ensure whitespace after option name */
715 if (line
[start
] == 0)
716 error(0, 0, "option '%s' requires a value!", config_names
[i
].name
);
717 if (!(line
[start
] == ' ' || line
[start
] == '\t'))
718 continue; /* fallthrough: "unknown configuration directive" */
719 /* skip further trailing and leading whitespace */
720 for (llen
--; line
[llen
] == ' ' || line
[llen
] == '\t' ; llen
--)
722 for (start
++; line
[start
] == ' ' || line
[start
] == '\t'; start
++)
724 /* remove optional quotes */
725 if (start
!= llen
&& line
[start
] == '"' && line
[llen
] == '"') {
730 error(0, 0, "option '%s' requires a value!", config_names
[i
].name
);
731 configs
[config_names
[i
].nm
] = strdup(line
+ start
);
733 if (configs
[config_names
[i
].nm
] == NULL
)
734 error(1, errno
, "can't allocate memory");
738 if (config_names
[i
].name
== NULL
&& line
[0] != '#' && line
[0] != 0)
739 error(0, 0, "warning: unknown configuration directive in %s at line %d",
744 if (strcmp(name
, "-"))
748 static void print_desc(const char *pre
, const char *text
)
752 for (p
= text
, q
= strchr(p
, '\n'); q
; p
= q
+1, q
= strchr(p
, '\n'))
753 printf("%s%.*s\n", pre
, (int)(q
-p
), p
);
756 printf("%s%s\n", pre
, p
);
759 static void print_usage(char *argv0
, int print_level
)
763 printf("Usage: %s [--version] [--print-config] [--help] [--long-help] [options] [config files]\n\n",
765 printf("Options:\n");
766 for (c
= 0; config_names
[c
].name
!= NULL
; c
++) {
767 if (config_names
[c
].long_only
> print_level
)
770 printf(" %s %s\n", (config_names
[c
].option
== NULL
?
771 "(configfile only option)" : config_names
[c
].option
),
772 ((config_names
[c
].type
== NULL
|| config_names
[c
].option
== NULL
) ?
773 "" : config_names
[c
].type
));
775 print_desc(" ", config_names
[c
].desc
);
777 if (config_names
[c
].get_def
!= NULL
)
778 printf(" Default: %s\n", config_names
[c
].get_def());
780 printf(" conf-variable: %s%s\n", config_names
[c
].name
,
781 (config_names
[c
].type
== NULL
? "" : config_names
[c
].type
));
787 printf("Use --long-help to see all options\n\n");
789 printf("Report bugs to vpnc@unix-ag.uni-kl.de\n");
792 static void print_version(void)
796 printf("vpnc version " VERSION
"\n");
797 printf("Copyright (C) 2002-2006 Geoffrey Keating, Maurice Massar, others\n");
798 printf("vpnc comes with NO WARRANTY, to the extent permitted by law.\n"
799 "You may redistribute copies of vpnc under the terms of the GNU General\n"
800 "Public License. For more information about these matters, see the files\n"
802 #ifdef OPENSSL_GPL_VIOLATION
803 printf("Built with openssl certificate support. Be aware of the\n"
804 "license implications.\n");
805 #else /* OPENSSL_GPL_VIOLATION */
806 printf("Built with certificate support.\n");
807 #endif /* OPENSSL_GPL_VIOLATION */
810 printf("Supported DH-Groups:");
811 for (i
= 0; supp_dh_group
[i
].name
!= NULL
; i
++)
812 printf(" %s", supp_dh_group
[i
].name
);
815 printf("Supported Hash-Methods:");
816 for (i
= 0; supp_hash
[i
].name
!= NULL
; i
++)
817 printf(" %s", supp_hash
[i
].name
);
820 printf("Supported Encryptions:");
821 for (i
= 0; supp_crypt
[i
].name
!= NULL
; i
++)
822 printf(" %s", supp_crypt
[i
].name
);
825 printf("Supported Auth-Methods:");
826 for (i
= 0; supp_auth
[i
].name
!= NULL
; i
++)
827 printf(" %s", supp_auth
[i
].name
);
831 void do_config(int argc
, char **argv
)
835 int got_conffile
= 0, print_config
= 0;
838 for (i
= 1; i
< argc
; i
++) {
839 if (argv
[i
][0] && (argv
[i
][0] != '-' || argv
[i
][1] == '\0')) {
840 read_config_file(argv
[i
], config
, 0);
847 for (c
= 0; config_names
[c
].name
!= NULL
&& !known
; c
++) {
848 if (config_names
[c
].option
== NULL
849 || strncmp(argv
[i
], config_names
[c
].option
,
850 strlen(config_names
[c
].option
)) != 0)
856 if (argv
[i
][strlen(config_names
[c
].option
)] == '=')
857 s
= argv
[i
] + strlen(config_names
[c
].option
) + 1;
858 else if (argv
[i
][strlen(config_names
[c
].option
)] == 0) {
859 if (config_names
[c
].needsArgument
) {
865 s
= argv
[i
]; /* no arg, fill in something */
869 config
[config_names
[c
].nm
] = s
;
872 if (!known
&& strcmp(argv
[i
], "--version") == 0) {
876 if (!known
&& strcmp(argv
[i
], "--print-config") == 0) {
880 if (!known
&& strcmp(argv
[i
], "--help") == 0) {
881 print_usage(argv
[0], 0);
884 if (!known
&& strcmp(argv
[i
], "--long-help") == 0) {
885 print_usage(argv
[0], 1);
889 printf("%s: unknown option %s\n\n", argv
[0], argv
[i
]);
891 print_usage(argv
[0], 1);
897 read_config_file("/etc/vpnc/default.conf", config
, 1);
898 read_config_file("/etc/vpnc.conf", config
, 1);
902 for (i
= 0; config_names
[i
].name
!= NULL
; i
++)
903 if (!config
[config_names
[i
].nm
]
904 && config_names
[i
].get_def
!= NULL
)
905 config
[config_names
[i
].nm
] = config_names
[i
].get_def();
907 opt_debug
= (config
[CONFIG_DEBUG
]) ? atoi(config
[CONFIG_DEBUG
]) : 0;
908 opt_nd
= (config
[CONFIG_ND
]) ? 1 : 0;
909 opt_1des
= (config
[CONFIG_ENABLE_1DES
]) ? 1 : 0;
911 if (!strcmp(config
[CONFIG_AUTH_MODE
], "psk")) {
912 opt_auth_mode
= AUTH_MODE_PSK
;
913 } else if (!strcmp(config
[CONFIG_AUTH_MODE
], "cert")) {
914 opt_auth_mode
= AUTH_MODE_CERT
;
915 } else if (!strcmp(config
[CONFIG_AUTH_MODE
], "hybrid")) {
916 opt_auth_mode
= AUTH_MODE_HYBRID
;
918 printf("%s: unknown authentication mode %s\nknown modes: psk cert hybrid\n", argv
[0], config
[CONFIG_AUTH_MODE
]);
921 opt_no_encryption
= (config
[CONFIG_ENABLE_NO_ENCRYPTION
]) ? 1 : 0;
922 opt_udpencapport
=atoi(config
[CONFIG_UDP_ENCAP_PORT
]);
924 if (!strcmp(config
[CONFIG_NATT_MODE
], "natt")) {
925 opt_natt_mode
= NATT_NORMAL
;
926 } else if (!strcmp(config
[CONFIG_NATT_MODE
], "none")) {
927 opt_natt_mode
= NATT_NONE
;
928 } else if (!strcmp(config
[CONFIG_NATT_MODE
], "force-natt")) {
929 opt_natt_mode
= NATT_FORCE
;
930 } else if (!strcmp(config
[CONFIG_NATT_MODE
], "cisco-udp")) {
931 opt_natt_mode
= NATT_CISCO_UDP
;
933 printf("%s: unknown nat traversal mode %s\nknown modes: natt none force-natt cisco-udp\n", argv
[0], config
[CONFIG_NATT_MODE
]);
937 if (!strcmp(config
[CONFIG_IF_MODE
], "tun")) {
938 opt_if_mode
= IF_MODE_TUN
;
939 } else if (!strcmp(config
[CONFIG_IF_MODE
], "tap")) {
940 opt_if_mode
= IF_MODE_TAP
;
942 printf("%s: unknown interface mode %s\nknown modes: tun tap\n", argv
[0], config
[CONFIG_IF_MODE
]);
946 if (!strcmp(config
[CONFIG_VENDOR
], "cisco")) {
947 opt_vendor
= VENDOR_CISCO
;
948 } else if (!strcmp(config
[CONFIG_VENDOR
], "netscreen")) {
949 opt_vendor
= VENDOR_NETSCREEN
;
951 printf("%s: unknown vendor %s\nknown vendors: cisco netscreen\n", argv
[0], config
[CONFIG_VENDOR
]);
956 if (opt_debug
>= 99) {
957 printf("WARNING! active debug level is >= 99, output includes username and password (hex encoded)\n");
959 "WARNING! active debug level is >= 99, output includes username and password (hex encoded)\n");
962 config_deobfuscate(CONFIG_IPSEC_SECRET_OBF
, CONFIG_IPSEC_SECRET
);
963 config_deobfuscate(CONFIG_XAUTH_PASSWORD_OBF
, CONFIG_XAUTH_PASSWORD
);
965 for (i
= 0; i
< LAST_CONFIG
; i
++) {
966 if (config
[i
] != NULL
|| config
[CONFIG_NON_INTERACTIVE
] != NULL
)
968 if (config
[CONFIG_XAUTH_INTERACTIVE
] && i
== CONFIG_XAUTH_PASSWORD
)
975 case CONFIG_IPSEC_GATEWAY
:
976 printf("Enter IPSec gateway address: ");
978 case CONFIG_IPSEC_ID
:
979 printf("Enter IPSec ID for %s: ", config
[CONFIG_IPSEC_GATEWAY
]);
981 case CONFIG_IPSEC_SECRET
:
982 asprintf(&prompt
, "Enter IPSec secret for %s@%s: ",
983 config
[CONFIG_IPSEC_ID
], config
[CONFIG_IPSEC_GATEWAY
]);
985 case CONFIG_XAUTH_USERNAME
:
986 printf("Enter username for %s: ", config
[CONFIG_IPSEC_GATEWAY
]);
988 case CONFIG_XAUTH_PASSWORD
:
989 asprintf(&prompt
, "Enter password for %s@%s: ",
990 config
[CONFIG_XAUTH_USERNAME
],
991 config
[CONFIG_IPSEC_GATEWAY
]);
998 case CONFIG_IPSEC_SECRET
:
999 case CONFIG_XAUTH_PASSWORD
:
1000 s
= vpnc_getpass(prompt
);
1003 error(1, 0, "unable to get password");
1005 case CONFIG_IPSEC_GATEWAY
:
1006 case CONFIG_IPSEC_ID
:
1007 case CONFIG_XAUTH_USERNAME
:
1008 vpnc_getline(&s
, &s_len
, stdin
);
1014 fprintf(stderr
, "vpnc.conf:\n\n");
1015 for (i
= 0; config_names
[i
].name
!= NULL
; i
++) {
1016 if (config
[config_names
[i
].nm
] == NULL
|| config
[config_names
[i
].nm
][0] == 0)
1018 printf("%s", config_names
[i
].name
);
1019 if (config_names
[i
].needsArgument
) {
1021 last
= strlen(config
[config_names
[i
].nm
]) - 1;
1022 if ( config
[config_names
[i
].nm
][0] == ' ' || config
[config_names
[i
].nm
][last
] == ' '
1023 || config
[config_names
[i
].nm
][0] == '\t' || config
[config_names
[i
].nm
][last
] == '\t'
1024 || ( config
[config_names
[i
].nm
][0] == '"' && config
[config_names
[i
].nm
][last
] == '"' )
1026 printf(" %s%s%s", "\"", config
[config_names
[i
].nm
], "\"");
1028 printf(" %s", config
[config_names
[i
].nm
]);
1036 if (!config
[CONFIG_IPSEC_GATEWAY
])
1037 error(1, 0, "missing IPSec gatway address");
1038 if (!config
[CONFIG_IPSEC_ID
])
1039 error(1, 0, "missing IPSec ID");
1040 if (!config
[CONFIG_IPSEC_SECRET
])
1041 error(1, 0, "missing IPSec secret");
1042 if (!config
[CONFIG_XAUTH_USERNAME
])
1043 error(1, 0, "missing Xauth username");
1044 if (!config
[CONFIG_XAUTH_PASSWORD
] && !config
[CONFIG_XAUTH_INTERACTIVE
])
1045 error(1, 0, "missing Xauth password");
1046 if (get_dh_group_ike() == NULL
)
1047 error(1, 0, "IKE DH Group \"%s\" unsupported\n", config
[CONFIG_IKE_DH
]);
1048 if (get_dh_group_ipsec(-1) == NULL
)
1049 error(1, 0, "Perfect Forward Secrecy \"%s\" unsupported\n",
1050 config
[CONFIG_IPSEC_PFS
]);
1051 if (get_dh_group_ike()->ike_sa_id
== 0)
1052 error(1, 0, "IKE DH Group must not be nopfs\n");