zuluCrypt  5.7.1
About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.
  Fossies Dox: zuluCrypt-5.7.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

security.c File Reference
#include "includes.h"
#include "../lib/includes.h"
#include <errno.h>
#include <unistd.h>
#include <grp.h>
#include "../constants.h"
#include <sys/types.h>
#include <pwd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
Include dependency graph for security.c:

Go to the source code of this file.

Macros

#define ZULUDEBUG   0
 

Functions

const char * zuluCryptRunTimePath ()
 
void zuluCryptExeSetOriginalUID (uid_t s)
 
int zuluCryptExeOriginalUserIsNotRoot ()
 
int zuluCryptSecurityGainElevatedPrivileges (void)
 
int zuluCryptSecurityConvertUID (uid_t uid, const char *u_id)
 
void zuluCryptSetUserUIDForPrivilegeManagement (uid_t uid)
 
void zuluCryptSecuritySetPrivilegeElevationErrorFunction (void(*f)(const char *))
 
int zuluCryptSecurityDropElevatedPrivileges (void)
 
void zuluCryptSecuritySanitizeTheEnvironment (uid_t uid, stringList_t *stx)
 
int zuluCryptSecurityUserOwnTheFile (const char *device, uid_t uid)
 
void zuluCryptSecurityLockMemory_1 (string_t st)
 
void zuluCryptSecurityUnlockMemory_1 (string_t st)
 
void zuluCryptSecurityLockMemory (stringList_t stl)
 
void zuluCryptSecurityUnlockMemory (stringList_t stl)
 
void zuluCryptSecurityPrintPermissions (void)
 

Variables

static uid_t _original_UID
 
static const char * _run_time_path
 
uid_t global_variable_user_uid
 
void(* zuluCryptSecurityPrivilegeElevationError )(const char *) = NULL
 

Macro Definition Documentation

◆ ZULUDEBUG

#define ZULUDEBUG   0

Definition at line 44 of file security.c.

Function Documentation

◆ zuluCryptExeOriginalUserIsNotRoot()

◆ zuluCryptExeSetOriginalUID()

void zuluCryptExeSetOriginalUID ( uid_t  s)

Definition at line 54 of file security.c.

References _original_UID.

Referenced by main().

◆ zuluCryptRunTimePath()

const char* zuluCryptRunTimePath ( )

Definition at line 49 of file security.c.

References _run_time_path.

Referenced by zuluCryptEXEOpenVolume(), and zuluCryptGetPassFromFile().

◆ zuluCryptSecurityConvertUID()

int zuluCryptSecurityConvertUID ( uid_t  uid,
const char *  u_id 
)

Definition at line 81 of file security.c.

References StringConvertToInt().

Referenced by main().

◆ zuluCryptSecurityDropElevatedPrivileges()

int zuluCryptSecurityDropElevatedPrivileges ( void  )

Definition at line 109 of file security.c.

References global_variable_user_uid, and zuluCryptSecurityPrivilegeElevationError.

Referenced by _checkUnmount(), _create_path(), _create_work_directory(), _delete_mount_point(), _device_path(), _open_volume(), _print_device_properties(), _printOpenedVolumes(), _printResult(), _remove_btfs_multiple_devices(), _restore_header(), _save_header(), _secure_copy_file(), _secure_file_path(), _zuluCryptBindUnmountVolume(), _zuluCryptCheckEmptySlots(), _zuluCryptExECheckEmptySlots(), _zuluCryptGetFileSystemFromDevice(), _zuluCryptVolumeList_0(), _zuluMountExe(), _zuluMountPartitionAccess(), _zuluMountprintAListOfMountedVolumes(), _zuluMountPrintVolumeDeviceName(), _zuluPartitionHasCryptoFs(), create_mount_point(), main(), open_plain_as_me_1(), path_is_accessible(), zuluCryptBindMountVolume(), zuluCryptCheckInvalidKey(), zuluCryptClearDeadMappers(), zuluCryptCreateKeyFiles(), zuluCryptDeleteKeyFiles(), zuluCryptEvaluateDeviceTags(), zuluCryptEXEAddKey(), zuluCryptEXECheckEmptySlots(), zuluCryptEXECheckIfLuks(), zuluCryptEXECheckIfTcrypt(), zuluCryptEXECloseVolume(), zuluCryptEXECreateVolume(), zuluCryptEXEGetDevice(), zuluCryptEXEOpenVolume(), zuluCryptEXERemoveKey(), zuluCryptEXEVolumeInfo(), zuluCryptEXEWriteDeviceWithJunk(), zuluCryptGetPartitionFromConfigFile(), zuluCryptGetPassFromFile(), zuluCryptHeaderMatchBackUpHeader(), zuluCryptPartitions(), zuluCryptPrintPartitionProperties(), zuluCryptUUIDFromPath(), zuluExit_1(), zuluMountMount(), zuluMountPartitionProperties(), zuluMountPrintDeviceProperties(), zuluMountUMount(), and zuluMountUnEncryptedVolumeStatus().

◆ zuluCryptSecurityGainElevatedPrivileges()

int zuluCryptSecurityGainElevatedPrivileges ( void  )

Definition at line 64 of file security.c.

References zuluCryptSecurityPrivilegeElevationError.

Referenced by _checkUnmount(), _create_path(), _create_work_directory(), _delete_mount_point(), _device_path(), _modify_tcrypt(), _open_volume(), _print_device_properties(), _printOpenedVolumes(), _printResult(), _remove_btfs_multiple_devices(), _restore_header(), _save_header(), _secure_copy_file(), _secure_file_path(), _zuluCryptBindUnmountVolume(), _zuluCryptCheckEmptySlots(), _zuluCryptExECheckEmptySlots(), _zuluCryptGetFileSystemFromDevice(), _zuluCryptVolumeList_0(), _zuluMountExe(), _zuluMountPartitionAccess(), _zuluMountprintAListOfMountedVolumes(), _zuluMountPrintVolumeDeviceName(), _zuluPartitionHasCryptoFs(), create_mount_point(), open_plain_as_me_1(), path_is_accessible(), zuluCryptBindMountVolume(), zuluCryptCheckInvalidKey(), zuluCryptClearDeadMappers(), zuluCryptCreateKeyFiles(), zuluCryptDeleteKeyFiles(), zuluCryptEvaluateDeviceTags(), zuluCryptEXEAddKey(), zuluCryptEXECheckEmptySlots(), zuluCryptEXECheckIfLuks(), zuluCryptEXECheckIfTcrypt(), zuluCryptEXECloseVolume(), zuluCryptEXECreateVolume(), zuluCryptEXEGetDevice(), zuluCryptEXEOpenVolume(), zuluCryptEXERemoveKey(), zuluCryptEXEVolumeInfo(), zuluCryptEXEWriteDeviceWithJunk(), zuluCryptGetPartitionFromConfigFile(), zuluCryptGetVolumeSize(), zuluCryptHeaderMatchBackUpHeader(), zuluCryptPartitions(), zuluCryptPrintPartitionProperties(), zuluCryptUUIDFromPath(), zuluExit_1(), zuluMountMount(), zuluMountPartitionProperties(), zuluMountPrintDeviceProperties(), zuluMountUMount(), and zuluMountUnEncryptedVolumeStatus().

◆ zuluCryptSecurityLockMemory()

void zuluCryptSecurityLockMemory ( stringList_t  stl)

Definition at line 210 of file security.c.

References StringContent(), StringLength(), and StringListGetIterators().

Referenced by main(), and zuluCryptEXEAddKey().

◆ zuluCryptSecurityLockMemory_1()

void zuluCryptSecurityLockMemory_1 ( string_t  st)

Definition at line 185 of file security.c.

References StringContent(), StringLength(), and StringVoid.

Referenced by zuluCryptEXEOpenVolume(), and zuluCryptEXERemoveKey().

◆ zuluCryptSecurityPrintPermissions()

void zuluCryptSecurityPrintPermissions ( void  )

Definition at line 260 of file security.c.

◆ zuluCryptSecuritySanitizeTheEnvironment()

void zuluCryptSecuritySanitizeTheEnvironment ( uid_t  uid,
stringList_t stx 
)

◆ zuluCryptSecuritySetPrivilegeElevationErrorFunction()

void zuluCryptSecuritySetPrivilegeElevationErrorFunction ( void(*)(const char *)  f)

Definition at line 104 of file security.c.

References zuluCryptSecurityPrivilegeElevationError.

Referenced by main().

◆ zuluCryptSecurityUnlockMemory()

void zuluCryptSecurityUnlockMemory ( stringList_t  stl)

Definition at line 229 of file security.c.

References e, StringContent(), StringLength(), StringListGetIterators(), and StringVoid.

Referenced by _zuluExit_1(), _zuluExit_2(), and zuluExit().

◆ zuluCryptSecurityUnlockMemory_1()

void zuluCryptSecurityUnlockMemory_1 ( string_t  st)

Definition at line 193 of file security.c.

References e, StringContent(), StringLength(), and StringVoid.

◆ zuluCryptSecurityUserOwnTheFile()

int zuluCryptSecurityUserOwnTheFile ( const char *  device,
uid_t  uid 
)

Definition at line 179 of file security.c.

◆ zuluCryptSetUserUIDForPrivilegeManagement()

void zuluCryptSetUserUIDForPrivilegeManagement ( uid_t  uid)

Definition at line 97 of file security.c.

References global_variable_user_uid.

Referenced by main().

Variable Documentation

◆ _original_UID

uid_t _original_UID
static

Definition at line 46 of file security.c.

Referenced by zuluCryptExeOriginalUserIsNotRoot(), and zuluCryptExeSetOriginalUID().

◆ _run_time_path

const char* _run_time_path
static

Definition at line 47 of file security.c.

Referenced by zuluCryptRunTimePath(), and zuluCryptSecuritySanitizeTheEnvironment().

◆ global_variable_user_uid

uid_t global_variable_user_uid

◆ zuluCryptSecurityPrivilegeElevationError

void( * zuluCryptSecurityPrivilegeElevationError) (const char *) = NULL