Use sysconfdir for the agent certificate paths.

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-12 19:42:28 +02:00
parent a57e3041a5
commit 585d352378
2 changed files with 15 additions and 7 deletions

View File

@ -20,6 +20,7 @@ add_subdirectory(mkembedconfig)
if(UNIX OR CYGWIN)
configure_file(icinga2-enable-feature.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2-enable-feature @ONLY)
configure_file(icinga2-discover-agent.cmake ${CMAKE_CURRENT_BINARY_DIR}/icinga2-discover-agent @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/icinga2-enable-feature
@ -30,7 +31,7 @@ if(UNIX OR CYGWIN)
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ./icinga2-enable-feature \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_SBINDIR}/icinga2-disable-feature\")")
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/migration/icinga2-migrate-config ${CMAKE_CURRENT_SOURCE_DIR}/icinga2-discover-agent
FILES ${CMAKE_CURRENT_SOURCE_DIR}/migration/icinga2-migrate-config ${CMAKE_CURRENT_BINARY_DIR}/icinga2-discover-agent
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

View File

@ -109,20 +109,27 @@ class NetstringParser(object):
# along with this program; if not, write to the Free Software Foundation
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
import socket, ssl, pprint, sys, json
import socket, ssl, pprint, sys, json, os
def warning(*objs):
print(*objs, file=sys.stderr)
if len(sys.argv) < 6:
warning("Syntax: %s <host> <port> <certfile> <keyfile> <cafile>" % (sys.argv[0]))
if len(sys.argv) < 3:
warning("Syntax: %s <host> <port>" % (sys.argv[0]))
sys.exit(1)
host = sys.argv[1]
port = int(sys.argv[2])
certfile = sys.argv[3]
keyfile = sys.argv[4]
cafile = sys.argv[5]
agentpki = "@CMAKE_INSTALL_FULL_SYSCONFDIR@/icinga2/pki/agent"
keyfile = agentpki + "/agent.key"
certfile = agentpki + "/agent.crt"
cafile = agentpki + "/ca.crt"
if not os.path.isfile(certfile):
warning("Certificate file (" + certfile + ") not found.")
warning("Make sure the agent certificates are set up properly.")
sys.exit(1)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)