From e330fd50d022f1cd4c4623da5970a7e3e8defcff Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 19 May 2019 19:45:22 +0100 Subject: Change defaults (including default and example configuration files) to look for cert.pem and key.pem in ~/.blabouncer/. --- blabouncer.c | 8 ++++---- blabouncer.conf.example | 14 +++++++++----- config.c | 14 +++++++++----- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/blabouncer.c b/blabouncer.c index 0e9fda8..45b8648 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -2025,14 +2025,14 @@ int main(int argc, char *argv[]) { if (settings.clienttls) { // What is the certificate file path? if (!getconfstr("certfile", settings.conffile, settings.certfile)) { - printf("main(): error getting 'certfile' from configuration file.\n"); - exit(1); + // If none provided, set to default + snprintf(settings.certfile, PATH_MAX, "%s/.blabouncer/cert.pem", getenv("HOME")); } // What is the certificate key file path? if (!getconfstr("keyfile", settings.conffile, settings.keyfile)) { - printf("main(): error getting 'keyfile' from configuration file.\n"); - exit(1); + // If none provided, set to default + snprintf(settings.keyfile, PATH_MAX, "%s/.blabouncer/key.pem", getenv("HOME")); } } diff --git a/blabouncer.conf.example b/blabouncer.conf.example index fbbf3ce..2fd3df0 100644 --- a/blabouncer.conf.example +++ b/blabouncer.conf.example @@ -1,8 +1,12 @@ # blabouncer configuration file +# # Entries must be in the form: # option name, space, equals sign, space, double quote, option value, double quote # e.g. # realname = "Mr Bla Bouncer" +# +# Shell expansion is not supported, so do not try and specify e.g. +# "~/.blabouncer/" or "%HOME/.blabouncer/", instead use "/home/foo/.blabouncer" nick = "blabounce" nick2 = "bbounce2" @@ -10,7 +14,7 @@ nick3 = "bbounce3" username = "bounceusr" realname = "Mr Bla Bouncer" -# Channels to automatically join (comma-separated list) +# Channels to automatically join (comma-separated list, defaults to none) #channels = "#blabouncer,#test" # How many seconds of replay log should be sent to connecting clients @@ -35,13 +39,13 @@ ircserver = "irc.blatech.net" # Real IRC server port ircserverport = "6697" -# Certificate file +# Certificate file (defaults to $HOME/.blabouncer/cert.pem) # If clienttls = "0" then this need not be set -certfile = "cert.pem" +#certfile = "/home/foo/.blabouncer/cert.pem" -# Certificate key file +# Certificate key file (defaults to $HOME/.blabouncer/key.pem) # If clienttls = "0" then this need not be set -keyfile = "key.pem" +#keyfile = "/home/foo/.blabouncer/key.pem" # Base directory (defaults to $HOME/.blabouncer/) # Things such as the logs directory will be placed below this diff --git a/config.c b/config.c index 5ef6ffc..f557001 100644 --- a/config.c +++ b/config.c @@ -159,10 +159,14 @@ int createconfigfile(char *filename) { // Prepare the string char *string = "# blabouncer configuration file\n" + "#\n" "# Entries must be in the form:\n" "# option name, space, equals sign, space, double quote, option value, double quote\n" "# e.g.\n" "# realname = \"Mr Bla Bouncer\"\n" + "#\n" + "# Shell expansion is not supported, so do not try and specify e.g.\n" + "# \"~/.blabouncer/\" or \"%HOME/.blabouncer/\", instead use \"/home/foo/.blabouncer\"\n" "\n" "nick = \"blabounce\"\n" "nick2 = \"bbounce2\"\n" @@ -170,7 +174,7 @@ int createconfigfile(char *filename) { "username = \"bounceusr\"\n" "realname = \"Mr Bla Bouncer\"\n" "\n" - "# Channels to automatically join (comma-separated list)\n" + "# Channels to automatically join (comma-separated list, defaults to none)\n" "#channels = \"#blabouncer,#test\"\n" "\n" "# How many seconds of replay log should be sent to connecting clients\n" @@ -195,13 +199,13 @@ int createconfigfile(char *filename) { "# Real IRC server port\n" "ircserverport = \"6697\"\n" "\n" - "# Certificate file\n" + "# Certificate file (defaults to $HOME/.blabouncer/cert.pem)\n" "# If clienttls = \"0\" then this need not be set\n" - "certfile = \"cert.pem\"\n" + "#certfile = \"/home/foo/.blabouncer/cert.pem\"\n" "\n" - "# Certificate key file\n" + "# Certificate key file (defaults to $HOME/.blabouncer/key.pem)\n" "# If clienttls = \"0\" then this need not be set\n" - "keyfile = \"key.pem\"\n" + "#keyfile = \"/home/foo/.blabouncer/key.pem\"\n" "\n" "# Base directory (defaults to $HOME/.blabouncer/)\n" "# Things such as the logs directory will be placed below this\n" -- cgit v1.2.3