summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2017-12-15 07:21:10 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-12-18 00:10:16 +0100
commit1d3ae2d92f40567910303205da090fc86c7351b8 (patch)
tree0f140e4c738800c2b25711f20baf97f3a9a95afa /librpc
parentb29ab3a0c16b2f1abed89b41c92c446e8fe59f9b (diff)
downloadsamba-1d3ae2d92f40567910303205da090fc86c7351b8.tar.gz
dsdb encrypted secrets module
Encrypt the samba secret attributes on disk. This is intended to mitigate the inadvertent disclosure of the sam.ldb file, and to mitigate memory read attacks. Currently the key file is stored in the same directory as sam.ldb but this could be changed at a later date to use an HSM or similar mechanism to protect the key. Data is encrypted with AES 128 GCM. The encryption uses gnutls where available and if it supports AES 128 GCM AEAD modes, otherwise nettle is used. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/drsblobs.idl30
1 files changed, 30 insertions, 0 deletions
diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl
index 9fca2cb8b1f..5fd11bbc880 100644
--- a/librpc/idl/drsblobs.idl
+++ b/librpc/idl/drsblobs.idl
@@ -721,4 +721,34 @@ interface drsblobs {
[nopython] void decode_ForestTrustInfo(
[in] ForestTrustInfo blob
);
+
+ typedef enum {
+ ENC_SECRET_AES_128_AEAD = 1
+ } EncryptedSecretAlgorithm;
+
+ const uint32 ENCRYPTED_SECRET_MAGIC_VALUE = 0xCA5CADED;
+
+ typedef [public] struct {
+ DATA_BLOB cleartext;
+ } PlaintextSecret;
+
+ /* The AEAD routines uses this as the additional authenticated data */
+ typedef [public] struct {
+ uint32 magic;
+ uint32 version;
+ uint32 algorithm;
+ uint32 flags;
+ } EncryptedSecretHeader;
+
+ typedef [public] struct {
+ /*
+ * The iv is before the header to ensure that the first bytes of
+ * the encrypted values are not predictable.
+ * We do this so that if the decryption gets disabled, we don't
+ * end up with predictable unicodePasswords.
+ */
+ DATA_BLOB iv;
+ EncryptedSecretHeader header;
+ [flag(NDR_REMAINING)] DATA_BLOB encrypted;
+ } EncryptedSecret;
}