diff options
-rw-r--r-- | man/systemd-journal-gatewayd.service.xml | 50 | ||||
-rw-r--r-- | src/journal/journal-gatewayd.c | 19 |
2 files changed, 66 insertions, 3 deletions
diff --git a/man/systemd-journal-gatewayd.service.xml b/man/systemd-journal-gatewayd.service.xml index 562d22186b..37b39c2d3e 100644 --- a/man/systemd-journal-gatewayd.service.xml +++ b/man/systemd-journal-gatewayd.service.xml @@ -52,7 +52,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <refsynopsisdiv> <para><filename>systemd-journal-gatewayd.service</filename></para> <para><filename>systemd-journal-gatewayd.socket</filename></para> - <cmdsynopsis><command>/usr/lib/systemd/systemd-journal-gatewayd</command> + <cmdsynopsis> + <command>/usr/lib/systemd/systemd-journal-gatewayd</command> + <arg choice="opt" rep="repeat">OPTIONS</arg> </cmdsynopsis> </refsynopsisdiv> @@ -61,7 +63,9 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. <para><command>systemd-journal-gatewayd</command> serves journal events over the network. Clients must connect using - HTTP. The server listens on port 19531 by default.</para> + HTTP. The server listens on port 19531 by default. + If <option>--cert=</option> is specified, the server expects + HTTPS connections.</para> <para>The program is started by <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> @@ -72,6 +76,48 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. </refsect1> <refsect1> + <title>Options</title> + + <para>The following options are understood:</para> + + <variablelist> + <varlistentry> + <term><option>--help</option></term> + <term><option>-h</option></term> + + <listitem><para>Prints a short help + text and exits.</para></listitem> + </varlistentry> + + <varlistentry> + <term><option>--version</option></term> + + <listitem><para>Prints a short version + string and exits.</para></listitem> + </varlistentry> + + <varlistentry> + <term><option>--cert=</option></term> + + <listitem><para>Specify the path to a file containing a server + certificate in PEM format. This option switches + <command>systemd-journal-gatewayd</command> into HTTPS mode + and must be used together with + <option>--key=</option>.</para></listitem> + </varlistentry> + + <varlistentry> + <term><option>--key=</option></term> + + <listitem><para>Specify the path to a file containing a server + key in PEM format corresponding to the certificate specified + with <option>--cert=</option>.</para></listitem> + </varlistentry> + + </variablelist> + </refsect1> + + <refsect1> <title>Supported URLs</title> <para>The following URLs are recognized:</para> diff --git a/src/journal/journal-gatewayd.c b/src/journal/journal-gatewayd.c index 4a4905dbfb..dfec8352bb 100644 --- a/src/journal/journal-gatewayd.c +++ b/src/journal/journal-gatewayd.c @@ -862,6 +862,19 @@ static int request_handler( return respond_error(connection, MHD_HTTP_NOT_FOUND, "Not found.\n"); } +static int help(void) { + + printf("%s [OPTIONS...] ...\n\n" + "HTTP server for journal events.\n\n" + " -h --help Show this help\n" + " --version Show package version\n" + " --cert=CERT.PEM Specify server certificate in PEM format\n" + " --key=KEY.PEM Specify server key in PEM format\n", + program_invocation_short_name); + + return 0; +} + static char *key_pem = NULL; static char *cert_pem = NULL; @@ -875,6 +888,7 @@ static int parse_argv(int argc, char *argv[]) { int r, c; static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, ARG_VERSION }, { "key", required_argument, NULL, ARG_KEY }, { "cert", required_argument, NULL, ARG_CERT }, @@ -884,13 +898,16 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0) switch(c) { case ARG_VERSION: puts(PACKAGE_STRING); puts(SYSTEMD_FEATURES); return 0; + case 'h': + return help(); + case ARG_KEY: if (key_pem) { log_error("Key file specified twice"); |