From 5e6ac546cd3c9b9106f26023fe9a40113583c019 Mon Sep 17 00:00:00 2001 From: Olivier Sallou Date: Wed, 10 Jul 2013 16:34:12 +0200 Subject: [PATCH] add root password setting --- providers/one/__init__.py | 4 +++- providers/one/manifest-schema.json | 2 +- providers/one/tasks/security.py | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/providers/one/__init__.py b/providers/one/__init__.py index 426607f..067a964 100644 --- a/providers/one/__init__.py +++ b/providers/one/__init__.py @@ -48,7 +48,9 @@ def tasks(tasklist, manifest): boot.BlackListModules(), boot.DisableGetTTYs(), security.EnableShadowConfig(), - security.DisableSSHPasswordAuthentication(), + security.SetRootPassword(), + # Disable for the time of debugging + #security.DisableSSHPasswordAuthentication(), security.DisableSSHDNSLookup(), network.RemoveDNSInfo(), network.ConfigureNetworkIF(), diff --git a/providers/one/manifest-schema.json b/providers/one/manifest-schema.json index 0a6a038..8c9e8f5 100644 --- a/providers/one/manifest-schema.json +++ b/providers/one/manifest-schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-04/schema#", - "title": "EC2 manifest", + "title": "OpenNebula manifest", "type": "object", "properties": { "volume": { diff --git a/providers/one/tasks/security.py b/providers/one/tasks/security.py index 50d8db6..0178af2 100644 --- a/providers/one/tasks/security.py +++ b/providers/one/tasks/security.py @@ -11,6 +11,13 @@ class EnableShadowConfig(Task): from common.tools import log_check_call log_check_call(['/usr/sbin/chroot', info.root, '/sbin/shadowconfig', 'on']) +class SetRootPassword(Task): + description = 'Set password for root' + phase = phases.system_modification + + def run(self, info): + from common.tools import log_check_call + log_check_call(['/usr/sbin/chpasswd'], 'root:'+info.manifest.credentials['root']) class DisableSSHPasswordAuthentication(Task): description = 'Disabling SSH password authentication'