check_tcp.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*****************************************************************************
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  13. $Id$
  14. *****************************************************************************/
  15. /* progname "check_tcp" changes depending on symlink called */
  16. char *progname;
  17. const char *revision = "$Revision$";
  18. const char *copyright = "1999-2004";
  19. const char *email = "nagiosplug-devel@lists.sourceforge.net";
  20. #include "common.h"
  21. #include "netutils.h"
  22. #include "utils.h"
  23. #ifdef HAVE_SSL
  24. static int check_cert = FALSE;
  25. static int days_till_exp;
  26. # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len))
  27. # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0))
  28. #else
  29. # define my_recv(buf, len) read(sd, buf, len)
  30. # define my_send(buf, len) send(sd, buf, len, 0)
  31. #endif
  32. /* int my_recv(char *, size_t); */
  33. static int process_arguments (int, char **);
  34. void print_help (void);
  35. void print_usage (void);
  36. #define EXPECT server_expect[0]
  37. static char *SERVICE = "TCP";
  38. static char *SEND = NULL;
  39. static char *QUIT = NULL;
  40. static int PROTOCOL = IPPROTO_TCP; /* most common is default */
  41. static int PORT = 0;
  42. static int server_port = 0;
  43. static char *server_address = NULL;
  44. static char *server_send = NULL;
  45. static char *server_quit = NULL;
  46. static char **server_expect;
  47. static size_t server_expect_count = 0;
  48. static size_t maxbytes = 0;
  49. static char **warn_codes = NULL;
  50. static size_t warn_codes_count = 0;
  51. static char **crit_codes = NULL;
  52. static size_t crit_codes_count = 0;
  53. static unsigned int delay = 0;
  54. static double warning_time = 0;
  55. static double critical_time = 0;
  56. static double elapsed_time = 0;
  57. static long microsec;
  58. static int sd = 0;
  59. #define MAXBUF 1024
  60. static char buffer[MAXBUF];
  61. static int expect_mismatch_state = STATE_WARNING;
  62. #define FLAG_SSL 0x01
  63. #define FLAG_VERBOSE 0x02
  64. #define FLAG_EXACT_MATCH 0x04
  65. #define FLAG_TIME_WARN 0x08
  66. #define FLAG_TIME_CRIT 0x10
  67. #define FLAG_HIDE_OUTPUT 0x20
  68. static size_t flags = FLAG_EXACT_MATCH;
  69. int
  70. main (int argc, char **argv)
  71. {
  72. int result = STATE_UNKNOWN;
  73. int i;
  74. char *status = NULL;
  75. struct timeval tv;
  76. size_t len, match = -1;
  77. setlocale (LC_ALL, "");
  78. bindtextdomain (PACKAGE, LOCALEDIR);
  79. textdomain (PACKAGE);
  80. /* determine program- and service-name quickly */
  81. progname = strrchr(argv[0], '/');
  82. if(progname != NULL) progname++;
  83. else progname = argv[0];
  84. len = strlen(progname);
  85. if(len > 6 && !memcmp(progname, "check_", 6)) {
  86. SERVICE = progname + 6;
  87. for(i = 0; i < len - 6; i++)
  88. SERVICE[i] = toupper(SERVICE[i]);
  89. }
  90. /* set up a resonable buffer at first (will be realloc()'ed if
  91. * user specifies other options) */
  92. server_expect = calloc(sizeof(char *), 2);
  93. /* determine defaults for this service's protocol */
  94. if (!strncmp(SERVICE, "UDP", 3)) {
  95. PROTOCOL = IPPROTO_UDP;
  96. }
  97. else if (!strncmp(SERVICE, "FTP", 3)) {
  98. EXPECT = "220";
  99. QUIT = "QUIT\r\n";
  100. PORT = 21;
  101. }
  102. else if (!strncmp(SERVICE, "POP", 3) || !strncmp(SERVICE, "POP3", 4)) {
  103. EXPECT = "+OK";
  104. QUIT = "QUIT\r\n";
  105. PORT = 110;
  106. }
  107. else if (!strncmp(SERVICE, "SMTP", 4)) {
  108. EXPECT = "220";
  109. QUIT = "QUIT\r\n";
  110. PORT = 25;
  111. }
  112. else if (!strncmp(SERVICE, "IMAP", 4)) {
  113. EXPECT = "* OK";
  114. QUIT = "a1 LOGOUT\r\n";
  115. PORT = 143;
  116. }
  117. #ifdef HAVE_SSL
  118. else if (!strncmp(SERVICE, "SIMAP", 5)) {
  119. EXPECT = "* OK";
  120. QUIT = "a1 LOGOUT\r\n";
  121. flags |= FLAG_SSL;
  122. PORT = 993;
  123. }
  124. else if (!strncmp(SERVICE, "SPOP", 4)) {
  125. EXPECT = "+OK";
  126. QUIT = "QUIT\r\n";
  127. flags |= FLAG_SSL;
  128. PORT = 995;
  129. }
  130. else if (!strncmp(SERVICE, "SSMTP", 5)) {
  131. EXPECT = "220";
  132. QUIT = "QUIT\r\n";
  133. flags |= FLAG_SSL;
  134. PORT = 465;
  135. }
  136. else if (!strncmp(SERVICE, "JABBER", 6)) {
  137. SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n";
  138. EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'";
  139. QUIT = "</stream:stream>\n";
  140. flags |= FLAG_SSL | FLAG_HIDE_OUTPUT;
  141. PORT = 5222;
  142. }
  143. else if (!strncmp (SERVICE, "NNTPS", 5)) {
  144. server_expect_count = 2;
  145. server_expect[0] = "200";
  146. server_expect[1] = "201";
  147. QUIT = "QUIT\r\n";
  148. flags |= FLAG_SSL;
  149. PORT = 563;
  150. }
  151. #endif
  152. else if (!strncmp (SERVICE, "NNTP", 4)) {
  153. server_expect_count = 2;
  154. server_expect = malloc(sizeof(char *) * server_expect_count);
  155. server_expect[0] = strdup("200");
  156. server_expect[1] = strdup("201");
  157. QUIT = "QUIT\r\n";
  158. PORT = 119;
  159. }
  160. else if (!strncmp(SERVICE, "CLAMD", 5)) {
  161. SEND = "PING";
  162. EXPECT = "PONG";
  163. QUIT = NULL;
  164. PORT = 3310;
  165. }
  166. /* fallthrough check, so it's supposed to use reverse matching */
  167. else if (strcmp (SERVICE, "TCP"))
  168. usage (_("CRITICAL - Generic check_tcp called with unknown service\n"));
  169. server_address = "127.0.0.1";
  170. server_port = PORT;
  171. server_send = SEND;
  172. server_quit = QUIT;
  173. status = NULL;
  174. if (process_arguments (argc, argv) == ERROR)
  175. usage4 (_("Could not parse arguments"));
  176. if(flags & FLAG_VERBOSE) {
  177. printf("Using service %s\n", SERVICE);
  178. printf("Port: %d\n", PORT);
  179. printf("flags: 0x%x\n", (int)flags);
  180. }
  181. if(EXPECT && !server_expect_count)
  182. server_expect_count++;
  183. /* set up the timer */
  184. signal (SIGALRM, socket_timeout_alarm_handler);
  185. alarm (socket_timeout);
  186. /* try to connect to the host at the given port number */
  187. gettimeofday (&tv, NULL);
  188. result = np_net_connect (server_address, server_port, &sd, PROTOCOL);
  189. if (result == STATE_CRITICAL) return STATE_CRITICAL;
  190. #ifdef HAVE_SSL
  191. if (flags & FLAG_SSL){
  192. result = np_net_ssl_init(sd);
  193. if (result == STATE_OK && check_cert == TRUE) {
  194. result = np_net_ssl_check_cert(days_till_exp);
  195. if(result != STATE_OK) {
  196. printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
  197. }
  198. }
  199. }
  200. if(result != STATE_OK){
  201. np_net_ssl_cleanup();
  202. if(sd) close(sd);
  203. return result;
  204. }
  205. #endif /* HAVE_SSL */
  206. if (server_send != NULL) { /* Something to send? */
  207. my_send(server_send, strlen(server_send));
  208. }
  209. if (delay > 0) {
  210. tv.tv_sec += delay;
  211. sleep (delay);
  212. }
  213. if(flags & FLAG_VERBOSE) {
  214. printf("server_expect_count: %d\n", (int)server_expect_count);
  215. for(i = 0; i < server_expect_count; i++)
  216. printf("\t%d: %s\n", i, server_expect[i]);
  217. }
  218. /* if(len) later on, we know we have a non-NULL response */
  219. len = 0;
  220. if (server_expect_count) {
  221. /* watch for the expect string */
  222. while ((i = my_recv(buffer, sizeof(buffer))) > 0) {
  223. status = realloc(status, len + i + 1);
  224. memcpy(&status[len], buffer, i);
  225. len += i;
  226. /* stop reading if user-forced or data-starved */
  227. if(i < sizeof(buffer) || (maxbytes && len >= maxbytes))
  228. break;
  229. if (maxbytes && len >= maxbytes)
  230. break;
  231. }
  232. /* no data when expected, so return critical */
  233. if (len == 0)
  234. die (STATE_CRITICAL, _("No data received from host\n"));
  235. /* force null-termination and strip whitespace from end of output */
  236. status[len--] = '\0';
  237. /* print raw output if we're debugging */
  238. if(flags & FLAG_VERBOSE)
  239. printf("received %d bytes from host\n#-raw-recv-------#\n%s\n#-raw-recv-------#\n",
  240. (int)len + 1, status);
  241. while(isspace(status[len])) status[len--] = '\0';
  242. for (i = 0; i < server_expect_count; i++) {
  243. match = -2; /* tag it so we know if we tried and failed */
  244. if (flags & FLAG_VERBOSE)
  245. printf ("looking for [%s] %s [%s]\n", server_expect[i],
  246. (flags & FLAG_EXACT_MATCH) ? "in beginning of" : "anywhere in",
  247. status);
  248. /* match it. math first in short-circuit */
  249. if ((flags & FLAG_EXACT_MATCH && !strncmp(status, server_expect[i], strlen(server_expect[i]))) ||
  250. (!(flags & FLAG_EXACT_MATCH) && strstr(status, server_expect[i])))
  251. {
  252. if(flags & FLAG_VERBOSE) puts("found it");
  253. match = i;
  254. break;
  255. }
  256. }
  257. }
  258. if (server_quit != NULL) {
  259. my_send(server_quit, strlen(server_quit));
  260. }
  261. #ifdef HAVE_SSL
  262. np_net_ssl_cleanup();
  263. #endif
  264. if (sd) close (sd);
  265. microsec = deltime (tv);
  266. elapsed_time = (double)microsec / 1.0e6;
  267. if (flags & FLAG_TIME_CRIT && elapsed_time > critical_time)
  268. result = STATE_CRITICAL;
  269. else if (flags & FLAG_TIME_WARN && elapsed_time > warning_time)
  270. result = STATE_WARNING;
  271. /* did we get the response we hoped? */
  272. if(match == -2 && result != STATE_CRITICAL)
  273. result = expect_mismatch_state;
  274. /* reset the alarm */
  275. alarm (0);
  276. /* this is a bit stupid, because we don't want to print the
  277. * response time (which can look ok to the user) if we didn't get
  278. * the response we were looking for. if-else */
  279. printf(_("%s %s - "), SERVICE, state_text(result));
  280. if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT))
  281. printf("Unexpected response from host/socket: %s", status);
  282. else {
  283. printf("%.3f second response time on ", elapsed_time);
  284. if(server_address[0] != '/')
  285. printf("port %d", server_port);
  286. else
  287. printf("socket %s", server_address);
  288. }
  289. if (match != -2 && !(flags & FLAG_HIDE_OUTPUT) && len)
  290. printf (" [%s]", status);
  291. /* perf-data doesn't apply when server doesn't talk properly,
  292. * so print all zeroes on warn and crit */
  293. if(match == -2)
  294. printf ("|time=%fs;0.0;0.0;0.0;0.0", elapsed_time);
  295. else
  296. printf("|%s",
  297. fperfdata ("time", elapsed_time, "s",
  298. TRUE, warning_time,
  299. TRUE, critical_time,
  300. TRUE, 0,
  301. TRUE, socket_timeout)
  302. );
  303. putchar('\n');
  304. return result;
  305. }
  306. /* process command-line arguments */
  307. static int
  308. process_arguments (int argc, char **argv)
  309. {
  310. int c;
  311. int option = 0;
  312. static struct option longopts[] = {
  313. {"hostname", required_argument, 0, 'H'},
  314. {"critical-time", required_argument, 0, 'c'},
  315. {"warning-time", required_argument, 0, 'w'},
  316. {"critical-codes", required_argument, 0, 'C'},
  317. {"warning-codes", required_argument, 0, 'W'},
  318. {"timeout", required_argument, 0, 't'},
  319. {"protocol", required_argument, 0, 'P'},
  320. {"port", required_argument, 0, 'p'},
  321. {"send", required_argument, 0, 's'},
  322. {"expect", required_argument, 0, 'e'},
  323. {"maxbytes", required_argument, 0, 'm'},
  324. {"quit", required_argument, 0, 'q'},
  325. {"jail", required_argument, 0, 'j'},
  326. {"delay", required_argument, 0, 'd'},
  327. {"refuse", required_argument, 0, 'r'},
  328. {"mismatch", required_argument, 0, 'M'},
  329. {"use-ipv4", no_argument, 0, '4'},
  330. {"use-ipv6", no_argument, 0, '6'},
  331. {"verbose", no_argument, 0, 'v'},
  332. {"version", no_argument, 0, 'V'},
  333. {"help", no_argument, 0, 'h'},
  334. #ifdef HAVE_SSL
  335. {"ssl", no_argument, 0, 'S'},
  336. {"certificate", required_argument, 0, 'D'},
  337. #endif
  338. {0, 0, 0, 0}
  339. };
  340. if (argc < 2)
  341. usage4 (_("No arguments found"));
  342. /* backwards compatibility */
  343. for (c = 1; c < argc; c++) {
  344. if (strcmp ("-to", argv[c]) == 0)
  345. strcpy (argv[c], "-t");
  346. else if (strcmp ("-wt", argv[c]) == 0)
  347. strcpy (argv[c], "-w");
  348. else if (strcmp ("-ct", argv[c]) == 0)
  349. strcpy (argv[c], "-c");
  350. }
  351. if (!is_option (argv[1])) {
  352. server_address = argv[1];
  353. argv[1] = argv[0];
  354. argv = &argv[1];
  355. argc--;
  356. }
  357. while (1) {
  358. c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:",
  359. longopts, &option);
  360. if (c == -1 || c == EOF || c == 1)
  361. break;
  362. switch (c) {
  363. case '?': /* print short usage statement if args not parsable */
  364. usage2 (_("Unknown argument"), optarg);
  365. case 'h': /* help */
  366. print_help ();
  367. exit (STATE_OK);
  368. case 'V': /* version */
  369. print_revision (progname, revision);
  370. exit (STATE_OK);
  371. case 'v': /* verbose mode */
  372. flags |= FLAG_VERBOSE;
  373. break;
  374. case '4':
  375. address_family = AF_INET;
  376. break;
  377. case '6':
  378. #ifdef USE_IPV6
  379. address_family = AF_INET6;
  380. #else
  381. usage4 (_("IPv6 support not available"));
  382. #endif
  383. break;
  384. case 'H': /* hostname */
  385. server_address = optarg;
  386. break;
  387. case 'c': /* critical */
  388. if (!is_intnonneg (optarg))
  389. usage4 (_("Critical threshold must be a positive integer"));
  390. else
  391. critical_time = strtod (optarg, NULL);
  392. flags |= FLAG_TIME_CRIT;
  393. break;
  394. case 'j': /* hide output */
  395. flags |= FLAG_HIDE_OUTPUT;
  396. break;
  397. case 'w': /* warning */
  398. if (!is_intnonneg (optarg))
  399. usage4 (_("Warning threshold must be a positive integer"));
  400. else
  401. warning_time = strtod (optarg, NULL);
  402. flags |= FLAG_TIME_WARN;
  403. break;
  404. case 'C':
  405. crit_codes = realloc (crit_codes, ++crit_codes_count);
  406. crit_codes[crit_codes_count - 1] = optarg;
  407. break;
  408. case 'W':
  409. warn_codes = realloc (warn_codes, ++warn_codes_count);
  410. warn_codes[warn_codes_count - 1] = optarg;
  411. break;
  412. case 't': /* timeout */
  413. if (!is_intpos (optarg))
  414. usage4 (_("Timeout interval must be a positive integer"));
  415. else
  416. socket_timeout = atoi (optarg);
  417. break;
  418. case 'p': /* port */
  419. if (!is_intpos (optarg))
  420. usage4 (_("Port must be a positive integer"));
  421. else
  422. server_port = atoi (optarg);
  423. break;
  424. case 's':
  425. server_send = optarg;
  426. break;
  427. case 'e': /* expect string (may be repeated) */
  428. EXPECT = NULL;
  429. flags &= ~FLAG_EXACT_MATCH;
  430. if (server_expect_count == 0)
  431. server_expect = malloc (sizeof (char *) * (++server_expect_count));
  432. else
  433. server_expect = realloc (server_expect, sizeof (char *) * (++server_expect_count));
  434. server_expect[server_expect_count - 1] = optarg;
  435. break;
  436. case 'm':
  437. if (!is_intpos (optarg))
  438. usage4 (_("Maxbytes must be a positive integer"));
  439. else
  440. maxbytes = strtol (optarg, NULL, 0);
  441. case 'q':
  442. asprintf(&server_quit, "%s\r\n", optarg);
  443. break;
  444. case 'r':
  445. if (!strncmp(optarg,"ok",2))
  446. econn_refuse_state = STATE_OK;
  447. else if (!strncmp(optarg,"warn",4))
  448. econn_refuse_state = STATE_WARNING;
  449. else if (!strncmp(optarg,"crit",4))
  450. econn_refuse_state = STATE_CRITICAL;
  451. else
  452. usage4 (_("Refuse must be one of ok, warn, crit"));
  453. break;
  454. case 'M':
  455. if (!strncmp(optarg,"ok",2))
  456. expect_mismatch_state = STATE_OK;
  457. else if (!strncmp(optarg,"warn",4))
  458. expect_mismatch_state = STATE_WARNING;
  459. else if (!strncmp(optarg,"crit",4))
  460. expect_mismatch_state = STATE_CRITICAL;
  461. else
  462. usage4 (_("Mismatch must be one of ok, warn, crit"));
  463. break;
  464. case 'd':
  465. if (is_intpos (optarg))
  466. delay = atoi (optarg);
  467. else
  468. usage4 (_("Delay must be a positive integer"));
  469. break;
  470. case 'D': /* Check SSL cert validity - days 'til certificate expiration */
  471. #ifdef HAVE_SSL
  472. # ifdef USE_OPENSSL /* XXX */
  473. if (!is_intnonneg (optarg))
  474. usage2 (_("Invalid certificate expiration period"), optarg);
  475. days_till_exp = atoi (optarg);
  476. check_cert = TRUE;
  477. flags |= FLAG_SSL;
  478. break;
  479. # endif /* USE_OPENSSL */
  480. #endif
  481. /* fallthrough if we don't have ssl */
  482. case 'S':
  483. #ifdef HAVE_SSL
  484. flags |= FLAG_SSL;
  485. #else
  486. die (STATE_UNKNOWN, _("Invalid option - SSL is not available"));
  487. #endif
  488. break;
  489. }
  490. }
  491. if (server_address == NULL)
  492. usage4 (_("You must provide a server address"));
  493. else if (server_address[0] != '/' && is_host (server_address) == FALSE)
  494. die (STATE_CRITICAL, "%s: %s - %s\n", progname, _("Invalid hostname, address or socket"), server_address);
  495. return TRUE;
  496. }
  497. void
  498. print_help (void)
  499. {
  500. print_revision (progname, revision);
  501. printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
  502. printf (COPYRIGHT, copyright, email);
  503. printf (_("This plugin tests %s connections with the specified host (or unix socket).\n\n"),
  504. SERVICE);
  505. print_usage ();
  506. printf (_(UT_HELP_VRSN));
  507. printf (_(UT_HOST_PORT), 'p', "none");
  508. printf (_(UT_IPv46));
  509. printf (_("\
  510. -s, --send=STRING\n\
  511. String to send to the server\n\
  512. -e, --expect=STRING\n\
  513. String to expect in server response\n\
  514. -q, --quit=STRING\n\
  515. String to send server to initiate a clean close of the connection\n"));
  516. printf (_("\
  517. -r, --refuse=ok|warn|crit\n\
  518. Accept tcp refusals with states ok, warn, crit (default: crit)\n\
  519. -M, --mismatch=ok|warn|crit\n\
  520. Accept expected string mismatches with states ok, warn, crit (default: warn)\n\
  521. -j, --jail\n\
  522. Hide output from TCP socket\n\
  523. -m, --maxbytes=INTEGER\n\
  524. Close connection once more than this number of bytes are received\n\
  525. -d, --delay=INTEGER\n\
  526. Seconds to wait between sending string and polling for response\n"));
  527. #ifdef HAVE_SSL
  528. printf (_("\
  529. -D, --certificate=INTEGER\n\
  530. Minimum number of days a certificate has to be valid.\n\
  531. -S, --ssl\n\
  532. Use SSL for the connection.\n"));
  533. #endif
  534. printf (_(UT_WARN_CRIT));
  535. printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
  536. printf (_(UT_VERBOSE));
  537. printf (_(UT_SUPPORT));
  538. }
  539. void
  540. print_usage (void)
  541. {
  542. printf ("\
  543. Usage: %s -H host -p port [-w <warning time>] [-c <critical time>]\n\
  544. [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
  545. [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
  546. [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\
  547. [-D <days to cert expiry>] [-S <use SSL>]\n", progname);
  548. }