]> gitweb.fluxo.info Git - hydra.git/commitdiff
Deploy: check for passwordless connections and show a sample sudoers config
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Feb 2017 10:58:35 +0000 (08:58 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Feb 2017 10:58:35 +0000 (08:58 -0200)
share/hydra/deploy

index d8fd3f8053f2dd6c8532ecf6846615b44533075c..d3fc51362ac81de545fa4b1676b455e253c0f507 100755 (executable)
@@ -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