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
ChangeLog | changed |
Makefile | changed |
README | changed |
common.c | changed |
common.h | changed |
scripts/systemd.sslh.service | added |
sslh-main.c | changed |
sslh.pod | changed |
ChangeLog | ||
---|---|---|
@@ -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 | + | |
1 | 12 | v1.12: 08MAY2012 |
2 | 13 | Added support for configuration file. |
3 | 14 | |
4 | 15 | New protocol probes can be defined using regular |
Makefile | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 | # Configuration |
2 | 2 | |
3 | -VERSION="v1.12" | |
3 | +VERSION="v1.13b" | |
4 | 4 | USELIBCONFIG=1 # Use libconfig? (necessary to use configuration files) |
5 | 5 | USELIBWRAP= # Use libwrap? |
6 | 6 | COV_TEST= # Perform test coverage? |
7 | 7 | PREFIX=/usr/local |
@@ -72,9 +72,9 @@ | ||
72 | 72 | clean: |
73 | 73 | rm -f sslh-fork sslh-select echosrv $(MAN) *.o *.gcov *.gcno *.gcda *.png *.html *.css *.info |
74 | 74 | |
75 | 75 | tags: |
76 | - ctags -T *.[ch] | |
76 | + ctags --globals -T *.[ch] | |
77 | 77 | |
78 | 78 | test: |
79 | 79 | ./t |
80 | 80 |
README | ||
---|---|---|
@@ -9,10 +9,27 @@ | ||
9 | 9 | |
10 | 10 | |
11 | 11 | ==== Compile and install ==== |
12 | 12 | |
13 | -If you're lucky, the Makefile will work for you: | |
13 | +sslh uses libconfig (http://www.hyperrealm.com/libconfig/) | |
14 | +and libwrap. | |
14 | 15 | |
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 | + | |
15 | 32 | make install |
16 | 33 | |
17 | 34 | There are a couple of configuration options at the beginning |
18 | 35 | of the Makefile: |
common.c | ||
---|---|---|
@@ -23,8 +23,9 @@ | ||
23 | 23 | int verbose = 0; |
24 | 24 | int probing_timeout = 2; |
25 | 25 | int inetd = 0; |
26 | 26 | int foreground = 0; |
27 | +int background = 0; | |
27 | 28 | int numeric = 0; |
28 | 29 | const char *user_name, *pid_file, *rule_filename; |
29 | 30 | |
30 | 31 | struct addrinfo *addr_listen = NULL; /* what addresses do we listen to? */ |
common.h | ||
---|---|---|
@@ -99,9 +99,9 @@ | ||
99 | 99 | |
100 | 100 | int defer_write(struct queue *q, void* data, int data_size); |
101 | 101 | int flush_defered(struct queue *q); |
102 | 102 | |
103 | -extern int probing_timeout, verbose, inetd, foreground, numeric; | |
103 | +extern int probing_timeout, verbose, inetd, foreground, background, numeric; | |
104 | 104 | extern struct sockaddr_storage addr_ssl, addr_ssh, addr_openvpn; |
105 | 105 | extern struct addrinfo *addr_listen; |
106 | 106 | extern const char* USAGE_STRING; |
107 | 107 | extern const char* user_name, *pid_file, *rule_filename; |
scripts/systemd.sslh.service | ||
---|---|---|
@@ -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.c | ||
---|---|---|
@@ -1,6 +1,7 @@ | ||
1 | 1 | /* |
2 | - | |
2 | + | |
3 | + | |
3 | 4 | # |
4 | 5 | # Copyright (C) 2007-2012 Yves Rutschle |
5 | 6 | # |
6 | 7 | # This program is free software; you can redistribute it |
@@ -50,8 +51,9 @@ | ||
50 | 51 | |
51 | 52 | static struct option const_options[] = { |
52 | 53 | { "inetd", no_argument, &inetd, 1 }, |
53 | 54 | { "foreground", no_argument, &foreground, 1 }, |
55 | + { "background", no_argument, &background, 1 }, | |
54 | 56 | { "numeric", no_argument, &numeric, 1 }, |
55 | 57 | { "verbose", no_argument, &verbose, 1 }, |
56 | 58 | { "user", required_argument, 0, 'u' }, |
57 | 59 | { "config", required_argument, 0, 'F' }, |
@@ -427,8 +429,12 @@ | ||
427 | 429 | fprintf(stderr, "No listening address specified; use at least one -p option\n"); |
428 | 430 | exit(1); |
429 | 431 | } |
430 | 432 | |
433 | + /* Did command-line override foreground setting? */ | |
434 | + if (background) | |
435 | + foreground = 0; | |
436 | + | |
431 | 437 | } |
432 | 438 | |
433 | 439 | int main(int argc, char *argv[]) |
434 | 440 | { |
@@ -470,14 +476,14 @@ | ||
470 | 476 | } |
471 | 477 | |
472 | 478 | setup_signals(); |
473 | 479 | |
480 | + if (pid_file) | |
481 | + write_pid_file(pid_file); | |
482 | + | |
474 | 483 | if (user_name) |
475 | 484 | drop_privileges(user_name); |
476 | 485 | |
477 | - if (pid_file) | |
478 | - write_pid_file(pid_file); | |
479 | - | |
480 | 486 | /* Open syslog connection */ |
481 | 487 | setup_syslog(argv[0]); |
482 | 488 | |
483 | 489 | main_loop(listen_sockets, num_addr_listen); |
sslh.pod | ||
---|---|---|
@@ -164,8 +164,15 @@ | ||
164 | 164 | Runs in foreground. The server will not fork and will remain connected |
165 | 165 | to the terminal. Messages normally sent to B<syslog> will also be sent |
166 | 166 | to I<stderr>. |
167 | 167 | |
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 | + | |
168 | 175 | =back |
169 | 176 | |
170 | 177 | =head1 FILES |
171 | 178 |
Built with git-ssb-web