This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 7aabc1091f944ca2f9b0d48bda5f87a72ec87082 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri Mar 13 09:46:16 2015 +0100 ssh utilise clée privée + formulaire contient champ mot de passe --- app/app.py | 2 +- app/module_loader.py | 2 +- app/modules/connection_modules/ssh.py | 11 ++++++++--- conf.txt | 2 +- static/js/controllers/hostPageCtrl.js | 7 +++++-- views/hostpage.html | 12 +++++++++--- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/app/app.py b/app/app.py index 2bfb16b..eda7db5 100755 --- a/app/app.py +++ b/app/app.py @@ -180,6 +180,6 @@ if __name__ == '__main__': ml.load_all_connection_modules() ml.load_all_detection_modules() wsc = WebSocketContainer(ml.get_db()) - process_monitoring.init(ml, wsc) + #process_monitoring.init(ml, wsc) port = int(os.environ.get('PORT', 1337)) run(host='0.0.0.0', port=port, debug=True, server=GeventWebSocketServer) \ No newline at end of file diff --git a/app/module_loader.py b/app/module_loader.py index f4db97f..0c8aa74 100644 --- a/app/module_loader.py +++ b/app/module_loader.py @@ -30,7 +30,7 @@ class ModuleLoader: fconf.close() self.db_loc = dict_conf['db_location'] self.external_mod_loc = dict_conf['external_modules_location'] - self.public_keys_loc = dict_conf['public_keys_location'] + self.public_keys_loc = dict_conf['keys_location'] self.db = self.load_db(add_func, rem_func, self.public_keys_loc) self.loaded_mod_moni = {} # See load_all_monitoring_modules self.loaded_mod_detect = {} # See load_all_detection_modules diff --git a/app/modules/connection_modules/ssh.py b/app/modules/connection_modules/ssh.py index 7c6cabf..9ae2530 100644 --- a/app/modules/connection_modules/ssh.py +++ b/app/modules/connection_modules/ssh.py @@ -7,17 +7,22 @@ def get_class_name(): class SSH: def __init__(self, addr_host, params, key_loc, cnfe): - self.parameters = {"username": "string", "public_key": "file", "port": "int"} + print params + self.parameters = {"username": "string", "password": "string", "private_key": "file", "port": "int"} self.name = get_class_name() self.addr_host = addr_host self.CommandNotFoundException = cnfe if params is not None: - key_path = str(key_loc) + str(params['public_key']) + key_path = str(key_loc) + str(params['private_key']) + key = paramiko.RSAKey.from_private_key_file(key_path) + if params['password'] == "": + params['password'] = None self.ssh = paramiko.SSHClient() self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.ssh.connect(addr_host, username=params['username'], - key_filename=key_path, + password=params['password'], + pkey=key, port=params['port']) def get_name(self): diff --git a/conf.txt b/conf.txt index 99f99da..3235010 100644 --- a/conf.txt +++ b/conf.txt @@ -1,3 +1,3 @@ db_location=mum.db external_modules_location=/home/aguilbaud/external -public_keys_location=keys/ \ No newline at end of file +keys_location=keys/ \ No newline at end of file diff --git a/static/js/controllers/hostPageCtrl.js b/static/js/controllers/hostPageCtrl.js index 43771cc..0859b17 100644 --- a/static/js/controllers/hostPageCtrl.js +++ b/static/js/controllers/hostPageCtrl.js @@ -316,7 +316,9 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo $scope.username = $scope.conf_conn_args["current_config"]["ssh"]["username"]; - $scope.public_key = $scope.conf_conn_args["current_config"]["ssh"]["public_key"]; + $scope.password = $scope.conf_conn_args["current_config"]["ssh"]["password"]; + + $scope.private_key = $scope.conf_conn_args["current_config"]["ssh"]["private_key"]; $scope.keys_list = []; @@ -359,7 +361,8 @@ mumApp.controller('ModalConfConnInstanceCtrl', function ($scope, $rootScope, $mo args['current_config']['ssh'] = {} args['current_config']['ssh']['port'] = $scope.port; args['current_config']['ssh']['username'] = $scope.username; - args['current_config']['ssh']['public_key'] = $scope.public_key; + args['current_config']['ssh']['password'] = $scope.password; + args['current_config']['ssh']['private_key'] = $scope.private_key; $rootScope.$broadcast("sendViaWs", JSON.stringify({"CALL_FUNC_DB": {'func': 'set_conf_conn','args': args}})); diff --git a/views/hostpage.html b/views/hostpage.html index a90d2b0..e6a730f 100644 --- a/views/hostpage.html +++ b/views/hostpage.html @@ -198,14 +198,14 @@ </ul>--> <div class="row"> <div class="col-xs-3"> - <label for="public_key">Select a public key</label> - <select class="form-control input-sm" id="public_key" ng-model="public_key" ng-options="key as key for key in keys_list"></select> + <label for="private_key">Select a private key</label> + <select class="form-control input-sm" id="private_key" ng-model="private_key" ng-options="key as key for key in keys_list"></select> </div> </div> <div class="row"> <div class="col-xs-3"> <form action="/upload" method="post" enctype="multipart/form-data"> - <label for="upload_key">Or upload a new public key:</label> + <label for="upload_key">Or upload a new key couple:</label> <input type="file" id="upload_key" name="upload" /> <input type="submit" value="Start upload" /> </form> @@ -223,6 +223,12 @@ <input type="text" id="usrname" ng-model="username"/> </div> </div> + <div class="row"> + <div class="col-xs-3"> + <label for="password">Password</label> + <input type="password" id="password" ng-model="password"/> + </div> + </div> <!--<div ng-include=" 'templateForm.html' "></div>--> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.