git ssb

0+

cel / sslh



Commit 5cd1fa18753c479f7eaef26b893016a37646364f

v1.13: 18MAY2012

	Write PID file before dropping privileges.

	Added --background, which overrides 'foreground'
	configuration file setting.

	Added example systemd service file from Archlinux in
	scripts/
	https://projects.archlinux.org/svntogit/community.git/tree/trunk/sslh.service?h=packages/sslh
	(S�bastien Luttringer)
Yves Rutschle committed on 7/10/2013, 9:16:50 PM
Parent: 9bcb2cdd7a920ebc78b59d0b5797d678424aa93a

Files changed

ChangeLogchanged
Makefilechanged
READMEchanged
common.cchanged
common.hchanged
scripts/systemd.sslh.serviceadded
sslh-main.cchanged
sslh.podchanged
ChangeLogView
@@ -1,4 +1,15 @@
1+v1.13: 18MAY2012
2+ Write PID file before dropping privileges.
3+
4+ Added --background, which overrides 'foreground'
5+ configuration file setting.
6+
7+ Added example systemd service file from Archlinux in
8+ scripts/
9+ https://projects.archlinux.org/svntogit/community.git/tree/trunk/sslh.service?h=packages/sslh
10+ (S�bastien Luttringer)
11+
112 v1.12: 08MAY2012
213 Added support for configuration file.
314
415 New protocol probes can be defined using regular
MakefileView
@@ -1,7 +1,7 @@
11 # Configuration
22
3-VERSION="v1.12"
3+VERSION="v1.13b"
44 USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files)
55 USELIBWRAP= # Use libwrap?
66 COV_TEST= # Perform test coverage?
77 PREFIX=/usr/local
@@ -72,9 +72,9 @@
7272 clean:
7373 rm -f sslh-fork sslh-select echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info
7474
7575 tags:
76- ctags -T *.[ch]
76+ ctags --globals -T *.[ch]
7777
7878 test:
7979 ./t
8080
READMEView
@@ -9,10 +9,27 @@
99
1010
1111 ==== Compile and install ====
1212
13-If you're lucky, the Makefile will work for you:
13+sslh uses libconfig (http://www.hyperrealm.com/libconfig/)
14+and libwrap.
1415
16+For Debian, these are contained in packages libwrap0-dev and
17+libconfig8-dev.
18+
19+For OpenSUSE, these are contained in packages libconfig9 and
20+libconfig-dev in repository
21+http://download.opensuse.org/repositories/multimedia:/libs/openSUSE_12.1/
22+
23+For Fedora, this package should work:
24+https://admin.fedoraproject.org/pkgdb/acls/name/libconfig
25+(feedback from Fedorans appreciated).
26+
27+If you can't find libconfig, or just don't want a
28+configuration file, set 'USELIBCONFIG=' in the Makefile.
29+
30+After this, the Makefile should work:
31+
1532 make install
1633
1734 There are a couple of configuration options at the beginning
1835 of the Makefile:
common.cView
@@ -23,8 +23,9 @@
2323 int verbose = 0;
2424 int probing_timeout = 2;
2525 int inetd = 0;
2626 int foreground = 0;
27+int background = 0;
2728 int numeric = 0;
2829 const char *user_name, *pid_file, *rule_filename;
2930
3031 struct addrinfo *addr_listen = NULL; /* what addresses do we listen to? */
common.hView
@@ -99,9 +99,9 @@
9999
100100 int defer_write(struct queue *q, void* data, int data_size);
101101 int flush_defered(struct queue *q);
102102
103-extern int probing_timeout, verbose, inetd, foreground, numeric;
103+extern int probing_timeout, verbose, inetd, foreground, background, numeric;
104104 extern struct sockaddr_storage addr_ssl, addr_ssh, addr_openvpn;
105105 extern struct addrinfo *addr_listen;
106106 extern const char* USAGE_STRING;
107107 extern const char* user_name, *pid_file, *rule_filename;
scripts/systemd.sslh.serviceView
@@ -1,0 +1,9 @@
1+[Unit]
2+Description=SSL/SSH multiplexer
3+
4+[Service]
5+EnvironmentFile=/etc/conf.d/sslh
6+ExecStart=/usr/bin/sslh --foreground $DAEMON_OPTS
7+
8+[Install]
9+WantedBy=multi-user.target
sslh-main.cView
@@ -1,6 +1,7 @@
11 /*
2-# main: processing of config file, command line options and start the main loop.
2+# main: processing of config file, command line options and start the main
3+# loop.
34 #
45 # Copyright (C) 2007-2012 Yves Rutschle
56 #
67 # This program is free software; you can redistribute it
@@ -50,8 +51,9 @@
5051
5152 static struct option const_options[] = {
5253 { "inetd", no_argument, &inetd, 1 },
5354 { "foreground", no_argument, &foreground, 1 },
55+ { "background", no_argument, &background, 1 },
5456 { "numeric", no_argument, &numeric, 1 },
5557 { "verbose", no_argument, &verbose, 1 },
5658 { "user", required_argument, 0, 'u' },
5759 { "config", required_argument, 0, 'F' },
@@ -427,8 +429,12 @@
427429 fprintf(stderr, "No listening address specified; use at least one -p option\n");
428430 exit(1);
429431 }
430432
433+ /* Did command-line override foreground setting? */
434+ if (background)
435+ foreground = 0;
436+
431437 }
432438
433439 int main(int argc, char *argv[])
434440 {
@@ -470,14 +476,14 @@
470476 }
471477
472478 setup_signals();
473479
480+ if (pid_file)
481+ write_pid_file(pid_file);
482+
474483 if (user_name)
475484 drop_privileges(user_name);
476485
477- if (pid_file)
478- write_pid_file(pid_file);
479-
480486 /* Open syslog connection */
481487 setup_syslog(argv[0]);
482488
483489 main_loop(listen_sockets, num_addr_listen);
sslh.podView
@@ -164,8 +164,15 @@
164164 Runs in foreground. The server will not fork and will remain connected
165165 to the terminal. Messages normally sent to B<syslog> will also be sent
166166 to I<stderr>.
167167
168+=item B<--background>
169+
170+Runs in background. This overrides B<foreground> if set in
171+the configuration file (or on the command line, but there is
172+no point setting both on the command line unless you have a
173+personality disorder).
174+
168175 =back
169176
170177 =head1 FILES
171178

Built with git-ssb-web