7 # Handle configuration for SSH security, implementing the --with-ssh-security
8 # option and checking for the relevant programs and options. Defines and substitutes
9 # SSH_SECURITY, searches for and defines SSH, and defines SSH_OPTIONS.
11 AC_DEFUN([AMANDA_SSH_SECURITY],
14 AC_ARG_WITH(ssh-security,
15 AS_HELP_STRING([--with-ssh-security],
16 [include SSH authentication]),
19 n | no) SSH_SECURITY=no ;;
20 y | ye | yes) SSH_SECURITY=yes ;;
21 *) AC_MSG_ERROR([*** You must not supply an argument to --with-ssh-security.])
27 if test "x$SSH_SECURITY" = "xyes"; then
29 AC_PATH_PROGS(SSH, ssh, , $LOCSYSPATH)
31 # see what options we should use
32 AC_ARG_WITH(ssh-options,
33 AS_HELP_STRING([ --with-ssh-options=@<:@OPTIONS@:>@],
34 [Use these ssh options for ssh security; the default should work]),
35 [ SSH_OPTIONS="$withval" ],
39 case "$SSH_OPTIONS" in
40 y | ye | yes | n | no)
41 AC_MSG_ERROR([*** You must supply an argument to --with-ssh-options.]);;
45 AC_MSG_CHECKING([SSH options])
46 # if we didn't get SSH options from the user, figure them out for ourselves
47 if test -z "$SSH_OPTIONS"; then
48 case `$SSH -V 2>&1` in
49 OpenSSH*) SSH_OPTIONS='-x -o BatchMode=yes -o PreferredAuthentications=publickey';;
50 *) SSH_OPTIONS='-x -o BatchMode=yes' ;;
54 # now convert that to a comma-separated list of C strings
55 eval "set dummy ${SSH_OPTIONS}"; shift
58 quoted="\"`echo "$i" | sed -e 's/\"/\\\"/'`\""
59 SSH_OPTIONS="${SSH_OPTIONS}${SSH_OPTIONS:+, }$quoted";
61 AC_MSG_RESULT($SSH_OPTIONS)
63 # finally, make the various outputs for all of this
64 AC_DEFINE(SSH_SECURITY,1,
65 [Define if SSH transport should be enabled. ])
66 AC_DEFINE_UNQUOTED(SSH, "$SSH",
67 [Path to the SSH binary])
68 AC_DEFINE_UNQUOTED(SSH_OPTIONS, $SSH_OPTIONS,
71 AM_CONDITIONAL(WANT_SSH_SECURITY, test x"$SSH_SECURITY" = x"yes")
73 AC_SUBST(SSH_SECURITY)
74 # (note -- don't just substitute SSH_OPTIONS -- shell quoting will break)