aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-02-17 08:58:35 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-02-17 08:58:35 -0200
commit5a7539b7d4ebdf4a43e0125ada58f65595ea20a6 (patch)
treea46164df9f53bc29f969f6e60f0bebf95122442a
parent3c718bc6e844012fac2e37158b12487150127c21 (diff)
downloadhydra-5a7539b7d4ebdf4a43e0125ada58f65595ea20a6.tar.gz
hydra-5a7539b7d4ebdf4a43e0125ada58f65595ea20a6.tar.bz2
Deploy: check for passwordless connections and show a sample sudoers config
-rwxr-xr-xshare/hydra/deploy15
1 files changed, 15 insertions, 0 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index d8fd3f8..d3fc513 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -113,11 +113,26 @@ for node in $NODES; do
# Setup deploy environment
hydra_deploy_setup remote $node || continue
+ # Check for passwordless connections
+ # http://stackoverflow.com/questions/3830508/check-if-passwordless-access-has-been-setup#3830680
+ if ! $HYDRA_CONNECT -o NumberOfPasswordPrompts=0 $FQDN true; then
+ echo "Unable to connect to $FQDN via SSH without a password."
+ echo "Please set a passwordless login for your user at $FQDN using public key auth."
+ exit 1
+ fi
+
# Check remote environment
$HYDRA_CONNECT $FQDN <<EOF
##### BEGIN REMOTE SCRIPT #####
+ # Check for passwordless sudo
+ # See references like https://raymii.org/s/articles/Check_if_passwordless_sudo_can_be_used_in_a_bash_script_or_nagios_check.html
if ! sudo -n true; then
echo "Please set passwordless sudo on $FQDN."
+ echo "You can do that by adding the following line on /etc/sudoers.d/local:"
+ echo ""
+ echo "%sudo ALL=NOPASSWD: ALL"
+ echo ""
+ echo "And make sure your user is included in the 'sudo' group."
exit 1
fi