3 # Copyright (c) 2013 Holger Weiss <holger@weiss.in-berlin.de>
5 # This file is free software; Holger Weiss gives unlimited permission to copy
6 # and/or distribute it, with or without modifications, as long as this notice is
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY, to the extent permitted by law; without even the implied
11 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 default_config_file
='/etc/send_nsca.cfg'
27 die
"Usage: $0 [-c <config-file>] [-H <server>] [-p <port>]"
30 xxd
</dev
/null
>/dev
/null
2>&1 || die
"$0: xxd(1) is required"
32 while getopts c
:H
:hp
: option
50 shift `expr $OPTIND - 1`
51 test $# -eq 0 || usage
53 config_file
=${config_file:-$default_config_file}
55 if [ -r "$config_file" ]
57 eval "`sed 's/[[:space:]]*=[[:space:]]*/=/' "$config_file"`"
59 echo >&2 "Cannot read $config_file (continuing anyway)"
62 server
=${server:-'localhost'}
63 server
=${opt_server:-$server}
64 port
=${port:-$default_port}
65 port
=${opt_port:-$port}
66 identity
=${identity:-`hostname -s`}
67 password
=${password:-'change-me'}
68 ciphers
=${tls_ciphers:-'PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA'}
70 exec openssl s_client \
73 -psk_identity "$identity" \
74 -psk `printf '%s' "$password" | xxd -p | tr -d '\n'` \
75 -connect "$server:$port"
77 # vim:set joinspaces noexpandtab textwidth=80: