1
0
forked from bip/bip

bipdir improvements

- more documentation
- don't die if environment variable $HOME isn't defined but '-s'
  parameter is used
- oidentd: change path, file is located in bipdir
This commit is contained in:
Pierre-Louis Bonicoli 2015-11-30 10:59:32 +01:00
parent 39414f8ff9
commit 20f39abc56
5 changed files with 30 additions and 37 deletions

18
TODO
View File

@ -1,22 +1,4 @@
<jj> home = getenv("HOME");
<jj> if (!home) {
<jj> conf_die(&bip, "no $HOME !, do you live in a trailer ?");
<jj> faudrait virer ca
<nohar> pourquoi ?
<jj> bah mon bip a pas de HOME
<nohar> ?
<nohar> un user sans home ?
<jj> et je le definis juste pour pas qu'il conf_die
<nohar> c'est possible ca ? :)
<gromit> sarko
<jj> env - bip
<jj> le -s suffit
<nohar> hum ok :)
<nohar> c'est complètement élite "env -" :)
<jj> faudrait ptet pouvoir specifier directement le oidentd_path <jj> faudrait ptet pouvoir specifier directement le oidentd_path
<nohar> oui et documenter -s
<jj> rajoute le -s au --help aussi a l'occasion
<jj> voila
- Allow to dump a config file, so that when the config is dynamically - Allow to dump a config file, so that when the config is dynamically

6
bip.1
View File

@ -24,8 +24,10 @@ Use config_file as the configuration file.
If no config file is given, bip will try to open ~/.bip/bip.conf. If no config file is given, bip will try to open ~/.bip/bip.conf.
.TP .TP
\fB-s\fP homedir \fB-s\fP bipdir
Set bip home directory to homedir instead of $HOME/.bip. Set bip home directory to bipdir instead of $HOME/.bip. \fBbipdir\fP is
the default parent directory for client certificate, configuration, logs, pid,
oidentd.
.TP .TP
\fB-h\fP \fB-h\fP

View File

@ -59,13 +59,19 @@ If you use vim you will probably want to use vim with the provided
\fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can \fBbip.vim\fP syntax file to avoid common syntax and lexical mistakes. You can
also find an example configuration file along with BIP. also find an example configuration file along with BIP.
By default, \fBbipdir\fR is the \fB$HOME/.bip\fP directory and the parent
directory for client certificate, configuration, logs, pid, oidentd. If
environment variable \fB$HOME\fP doesn't exist, \fB-s\fP parameter must be
used.
.SH GLOBAL OPTIONS .SH GLOBAL OPTIONS
.TP .TP
\fBclient_side_ssl\fP (default: \fBfalse\fP) \fBclient_side_ssl\fP (default: \fBfalse\fP)
When true, clients will need to connect to BIP using SSL. When true, clients will need to connect to BIP using SSL.
You'll also need to generate a SSL cert/key pair in <bipdir>/bip.pem (usually You'll also need to generate a SSL cert/key pair in \fBbipdir\fR/bip.pem
~/.bip/bip.pem or /var/lib/bip/bip.pem) or <client_side_ssl_pem> if defined. (usually ~/.bip/bip.pem or /var/lib/bip/bip.pem) or <client_side_ssl_pem> if
defined.
.TP .TP
\fBclient_side_ssl_pem\fP (default: \fB<bipdir>/bip.pem\fP) \fBclient_side_ssl_pem\fP (default: \fB<bipdir>/bip.pem\fP)
@ -106,7 +112,7 @@ Determines the log file name depending on :
Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output) Specify the verbosity of BIP from 0 (fatal errors) to 6 (huge debug output)
.TP .TP
\fBlog_root\fP (default: \fBHOME/.bip/logs\fP) \fBlog_root\fP (default: \fB<bipdir>/logs\fP)
Main log directory. Sub-directories and files will be created from there Main log directory. Sub-directories and files will be created from there
depending on \fBlog_format\fP. depending on \fBlog_format\fP.
@ -122,7 +128,7 @@ The delay increases with the number of attempts:
delay = reconn_timer * number of attempts delay = reconn_timer * number of attempts
.TP .TP
\fBpid_file\fP (default: \fBHOME/.bip/bip.pid\fP) \fBpid_file\fP (default: \fB<bipdir>/bip.pid\fP)
Defines the file where BIP's pid will be stored. BIP checks if this file exists Defines the file where BIP's pid will be stored. BIP checks if this file exists
and if the pid is still alive upon startup. If true, BIP refuses to start. and if the pid is still alive upon startup. If true, BIP refuses to start.

View File

@ -17,10 +17,10 @@ port = 7778;
client_side_ssl = false; client_side_ssl = false;
# This is the file containing the SSL cert/key pair bip'll use to # This is the file containing the SSL cert/key pair bip'll use to
# serve SSL clients. If unset, it defaults to <biphome>/bip.pem # serve SSL clients. If unset, it defaults to <bipdir>/bip.pem
#client_side_ssl_pem = "/path/to/pemfile"; #client_side_ssl_pem = "/path/to/pemfile";
# Define where the pidfile should be stored. Defaults to <biphome>/bip.pid # Define where the pidfile should be stored. Defaults to <bipdir>/bip.pid
#pid_file="/var/run/bip/bip.pid"; #pid_file="/var/run/bip/bip.pid";
# Uncomment this line to disable logging and backlogging. # Uncomment this line to disable logging and backlogging.
@ -36,7 +36,7 @@ log_level = 3;
# This is where logs go. Channel and private messages will use that # This is where logs go. Channel and private messages will use that
# configuration value as a prefix, and then log_format to determine # configuration value as a prefix, and then log_format to determine
# full log filename. # full log filename. Defaults to <bipdir>/logs.
#log_root = "/var/proxy/logs"; #log_root = "/var/proxy/logs";
# Uncomment this line to disable bip's internal messages logging. # Uncomment this line to disable bip's internal messages logging.

View File

@ -269,6 +269,8 @@ static void usage(char *name)
" -f config_file: Use config_file as the configuration file\n" " -f config_file: Use config_file as the configuration file\n"
" If no config file is given %s will try to open ~/.bip/" S_CONF "\n" " If no config file is given %s will try to open ~/.bip/" S_CONF "\n"
" -n: Don't daemonize, log in stderr\n" " -n: Don't daemonize, log in stderr\n"
" -s: Bip HOME, default parent directory for client certificate,\n"
" configuration, logs, pid, oidentd\n"
" -v: Print version and exit\n" " -v: Print version and exit\n"
" -h: This help\n", name, name); " -h: This help\n", name, name);
exit(1); exit(1);
@ -1218,18 +1220,11 @@ int main(int argc, char **argv)
char *home = NULL; /* oidentd path searching ignores conf_biphome */ char *home = NULL; /* oidentd path searching ignores conf_biphome */
home = getenv("HOME"); home = getenv("HOME");
if (!home) { if (!home && !conf_biphome) {
conf_die(&bip, "no $HOME !, do you live in a trailer ?"); conf_die(&bip, "no value for environment variable $HOME,"
"use '-s' parameter");
return 0; return 0;
} }
#ifdef HAVE_OIDENTD
bip.oidentdpath = bip_malloc(strlen(home) + 1 +
strlen(OIDENTD_FILENAME) + 1);
strcpy(bip.oidentdpath, home);
strcat(bip.oidentdpath, "/");
strcat(bip.oidentdpath, OIDENTD_FILENAME);
#endif
if (!conf_biphome) { if (!conf_biphome) {
conf_biphome = bip_malloc(strlen(home) + strlen("/.bip") + 1); conf_biphome = bip_malloc(strlen(home) + strlen("/.bip") + 1);
@ -1237,6 +1232,14 @@ int main(int argc, char **argv)
strcat(conf_biphome, "/.bip"); strcat(conf_biphome, "/.bip");
} }
#ifdef HAVE_OIDENTD
bip.oidentdpath = bip_malloc(strlen(conf_biphome) + 1 +
strlen(OIDENTD_FILENAME) + 1);
strcpy(bip.oidentdpath, conf_biphome);
strcat(bip.oidentdpath, "/");
strcat(bip.oidentdpath, OIDENTD_FILENAME);
#endif
if (!confpath) { if (!confpath) {
confpath = bip_malloc(strlen(conf_biphome) + 1 + confpath = bip_malloc(strlen(conf_biphome) + 1 +
strlen(S_CONF) + 1); strlen(S_CONF) + 1);