wfexs_backend.workdir#

Module Contents#

Classes#

API#

exception wfexs_backend.workdir.WorkdirException#

Bases: wfexs_backend.common.AbstractWfExSException

class wfexs_backend.workdir.Workdir(pass_gen: wfexs_backend.utils.passphrase_wrapper.WfExSPassphraseGenerator, uniqueRawWorkDir: pathlib.Path, instanceId: WfExSInstanceId | None = None, nickname: str | None = None, orcids: Sequence[str] | None = [], create_ok: bool = False)#

Initialization

ID_JSON_FILENAME: Final[str] = '.id.json'#
LOCKFILE_PREFIX: Final[str] = '._lock_'#
LOCKFILE_MOUNT: Final[str] = None#
WORKDIR_PASSPHRASE_FILE: Final[RelPath] = 'cast(...)'#
FUSE_SYSTEM_CONF: Final[str] = '/etc/fuse.conf'#
_NotInitialized: ClassVar[bool] = True#
DefaultEncfsCmd: ClassVar[AnyPath] = None#
DefaultEncfsType: ClassVar[EncryptedFSType] = None#
DefaultPrivKey: ClassVar[bytes] = None#
DefaultPubKey: ClassVar[bytes] = None#
EncfsIdleMinutes: ClassVar[int] = None#
FusermountCmd: ClassVar[AnyPath] = None#
classmethod InitFromConfig(default_priv_key: bytes, default_pub_key: bytes, logger: logging.Logger, encfs_sect: Mapping[str, Any] | None = None) wfexs_backend.common.AnyPath#
property workdir_passphrase_file: pathlib.Path#
isSecure() bool#
_writePassphrase(private_key_filename: pathlib.Path | None = None, private_key_passphrase: str | None = None, public_key_filenames: Sequence[pathlib.Path] | None = None, passphrase_length: int = 4) Tuple[EncryptedFSType, AnyPath, str, Sequence[bytes]]#

This method generates a random passphrase, which is stored in a crypt4gh encrypted file (along with the FUSE filesystem used) using either the default WfExS-backend public key, or the public keys stored in the files provided as a parameter. It returns the FUSE filesystem, the command to be used to mount, the generated passphrase (to be consumed in memory) and the list of public keys used to encrypt the passphrase file, which can be used later for some additional purposes.

_readPassphrase(private_key_filename: pathlib.Path | None = None, private_key_passphrase: str | None = None) Tuple[EncryptedFSType, AnyPath, str]#

This method decrypts a crypt4gh file containing a passphrase which has been encrypted with either the WfExS installation public key (if the filename is not provided), or the public key paired with the provided private key stored in the file.

static _wakeupEncDir(cond: threading.Condition, workDir: pathlib.Path, logger: logging.Logger) None#

This method periodically checks whether the directory is still available

setup(try_secure: bool, paranoid_mode: bool, fail_ok: bool = False, public_key_filenames: Sequence[pathlib.Path] | None = None, private_key_filename: pathlib.Path | None = None, private_key_passphrase: str | None = None) Tuple[bool, pathlib.Path]#
unmount() None#
destroy() None#