This file is indexed.

/usr/lib/stonith/plugins/external/hetzner is in cluster-glue 1.0.12-5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh
#
# External STONITH module for Hetzner.
#
# Copyright (c) 2011 MMUL S.a.S. - Raoul Scarazzini <rasca@mmul.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#

# Read parameters from config file, format is based upon the hetzner OCF resource agent
# developed by Kumina: http://blog.kumina.nl/2011/02/hetzner-failover-ip-ocf-script/
conf_file="/etc/hetzner.cfg"

case $1 in
	get*) ;; # don't print errors if conf_file not present
	*)
		user=`sed -n 's/^user.*=\ *//p' $conf_file`
		pass=`sed -n 's/^pass.*=\ *//p' $conf_file`
	;;
esac

hetzner_server="https://robot-ws.your-server.de"

check_http_response() {
     # If the response is 200 then return 0
     if [ $1 = 200 ]
      then
       return 0
      else
       # If the response is not 200 then display a description of the problem and return 1
       case $1 in
        400) ha_log.sh err  "INVALID_INPUT - Invalid input parameters"
               ;;
        404) ha_log.sh err  "SERVER_NOT_FOUND - Server with ip $remote_ip not found"
               ;;
        409) ha_log.sh err  "RESET_MANUAL_ACTIVE - There is already a running manual reset"
               ;;
        500) ha_log.sh err "RESET_FAILED - Resetting failed due to an internal error"
               ;;
       esac
       return 1
     fi
}

case $1 in
gethosts)
        echo $hostname
	exit 0
	;;
on)
	# Can't really be implemented because Hetzner's webservice cannot power on a system
	ha_log.sh err "Power on is not available since Hetzner's webservice can't do this operation."
	exit 1
	;;
off)
	# Can't really be implemented because Hetzner's webservice cannot power on a system
	ha_log.sh err "Power off is not available since Hetzner's webservice can't do this operation."
	exit 1
	;;
reset)
        # Launching the reset action via webservice
        check_http_response $(curl --silent -o /dev/null -w '%{http_code}' -u $user:$pass $hetzner_server/reset/$remote_ip -d type=hw)
        exit $?
	;;
status)
        # Check if we can contact the webservice
        check_http_response "$(curl --silent -o /dev/null -w '%{http_code}' -u $user:$pass $hetzner_server/server/$remote_ip)"
        exit $?
	;;
getconfignames)
	echo "hostname"
	echo "remote_ip"
	exit 0
	;;
getinfo-devid)
	echo "Hetzner STONITH device"
	exit 0
	;;
getinfo-devname)
	echo "Hetzner STONITH external device"
	exit 0
	;;
getinfo-devdescr)
	echo "Hetzner host reset"
	echo "Manages the remote webservice for reset a remote server."
	exit 0
	;;
getinfo-devurl)
	echo "http://wiki.hetzner.de/index.php/Robot_Webservice_en"
	exit 0
	;;
getinfo-xml)
	cat << HETZNERXML
<parameters>
<parameter name="hostname" unique="1" required="1">
<content type="string" />
<shortdesc lang="en">
Hostname
</shortdesc>
<longdesc lang="en">
The name of the host to be managed by this STONITH device.
</longdesc>
</parameter>

<parameter name="remote_ip" unique="1" required="1">
<content type="string" />
<shortdesc lang="en">
Remote IP
</shortdesc>
<longdesc lang="en">
The address of the remote IP that manages this server.
</longdesc>
</parameter>
</parameters>
HETZNERXML
	exit 0
	;;
*)
	ha_log.sh err "Don't know what to do for '$remote_ip'"
	exit 1
	;;
esac