Warning: This document is for the development version of Bareos Documentation. The main version is bareos-23.

bareos.util.password.Password

class bareos.util.password.Password(password=None)[source]

Bases: object

Handle Bareos passwords.

Instead of working with plain text passwords, Bareos often uses the MD5 hash of the password.

This class make a password available in both forms.

Parameters:

password (str, optional) – Password as plain text.

Methods

md5

Get password as MD5 hash.

plaintext

Get password as plain text.

set_md5

Set the MD5 form of the password.

set_plaintext

Set new password.

md5()[source]

Get password as MD5 hash.

Returns:

Password as MD5 hash.

Return type:

bytes

plaintext()[source]

Get password as plain text.

Returns:

Password as plain text.

Return type:

str

set_md5(password)[source]

Set the MD5 form of the password.

If the password is initialized by this method, it is only available as MD5 hash, not as plain text password.

Parameters:

password (bytes) – Password as MD5 hash.

set_plaintext(password)[source]

Set new password.

Parameters:

password (str) – Password as plain text.