mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Added password-crypted to root-password plugin
This commit is contained in:
parent
9445273b8e
commit
f95f62588b
4 changed files with 25 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,11 @@ 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]
|
properties:
|
||||||
|
password-crypted: {type: string}
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
|
|
|
@ -9,5 +9,11 @@ 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(['chpasswd', '--root', info.root, '--encrypted'],
|
||||||
|
'root:' + password_crypted)
|
||||||
|
else:
|
||||||
|
log_check_call(['chroot', info.root, '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