-
When now a days all passwords in databases are encrypted, did anybody here or maybe the owner made it possible to make the database password in the tenant_db_config table encrypted? I hope someone could help me with that, thank you in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I actually did something like that by creating new properties in my DbConfig entity (the one extending TenantDbConfigurationInterface and using the TenantDbConfigTrait Trait) called dbNameSecure dbPortSecure etc and using https://github.com/mediamonks //create a new column
#[ORM\Column(type: Types::BLOB, nullable: true, options: ["default" => null])]
#[Transformable(name: 'defuse_encrypt_key')]
protected $dbPasswordSecure = null;
//REST OF THE ENTITY
//Override original getters/setters to use the encrypted column
/**
* @return string|null
*/
public function getDbPassword(): ?string
{
return (string)$this->dbPasswordSecure;
}
/**
* @param string|null $dbPassword
* @return self
*/
public function setDbPassword(?string $dbPassword): self
{
$this->dbPasswordSecure = $dbPassword;
return $this;
} Only thing you have to look out for is the dbName property, it can't be nullable so if you plan to encrypt it as well, with like a dbNameSecure like above, you have to override it to make it nullable |
Beta Was this translation helpful? Give feedback.
I actually did something like that by creating new properties in my DbConfig entity (the one extending TenantDbConfigurationInterface and using the TenantDbConfigTrait Trait) called dbNameSecure dbPortSecure etc and using https://github.com/mediamonks
doctrine-extensions transformable for encryption I used defuse encryption
and then overwritting the getters and setters for the normal properties to retreive/set the encrypted ones
For example with the password field :