mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Merge pull request #417 from ashegedus/password-crypt
Add password-crypt to root password plugin
This commit is contained in:
commit
105ff17e08
4 changed files with 23 additions and 4 deletions
|
@ -6,6 +6,15 @@ SSH password authentication.
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
``oneOf``
|
||||||
|
|
||||||
- ``password``: The password for the root user.
|
- ``password``: The password for the root user.
|
||||||
``required``
|
- ``password-crypted``: The password for the root user[crypt(3) hash]
|
||||||
|
|
||||||
|
The following command (available from the **whois** package) can be used
|
||||||
|
to generate a SHA-512 based crypt(3) hash for a password:
|
||||||
|
|
||||||
|
.. code-block:: shell
|
||||||
|
|
||||||
|
mkpasswd -m sha-512
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@ properties:
|
||||||
properties:
|
properties:
|
||||||
root_password:
|
root_password:
|
||||||
type: object
|
type: object
|
||||||
|
oneOf:
|
||||||
|
- required: [password]
|
||||||
|
- required: [password-crypted]
|
||||||
properties:
|
properties:
|
||||||
password: {type: string}
|
password: {type: string}
|
||||||
required: [password]
|
password-crypted: {type: string}
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|
|
@ -9,5 +9,10 @@ class SetRootPassword(Task):
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call
|
||||||
log_check_call(['chroot', info.root, 'chpasswd'],
|
password_crypted = info.manifest.plugins['root_password'].get('password-crypted', None)
|
||||||
'root:' + info.manifest.plugins['root_password']['password'])
|
if password_crypted is not None:
|
||||||
|
log_check_call(['chroot', info.root, '/usr/sbin/chpasswd', '--encrypted'],
|
||||||
|
'root:' + password_crypted)
|
||||||
|
else:
|
||||||
|
log_check_call(['chroot', info.root, '/usr/sbin/chpasswd'],
|
||||||
|
'root:' + info.manifest.plugins['root_password']['password'])
|
||||||
|
|
|
@ -28,3 +28,5 @@ volume:
|
||||||
packages: {}
|
packages: {}
|
||||||
plugins:
|
plugins:
|
||||||
vagrant: {}
|
vagrant: {}
|
||||||
|
root_password:
|
||||||
|
password-crypted: $6$MU3jLtZHS$UHdibqwOJrZw5yI7cqzG.AnzWqOVD9krryd3Y/SgXDSHUEMsaT7iAiQHhuCpjN4Q0tEssbJYoy4H1QFxOY3Tc/
|
||||||
|
|
Loading…
Add table
Reference in a new issue