Results 1 to 4 of 4

Thread: encrypt password/string in MariaDB (mailserver purpose)

  1. #1
    Join Date
    Apr 2013
    Location
    Modra, Slovakia
    Posts
    265

    Default encrypt password/string in MariaDB (mailserver purpose)

    I set up a mail server and the users info is in the database. And here starts my question I wanna encrypt the paswords that are in the database I'm using MariaDB I've red this https://mariadb.com/kb/en/aes_encrypt/ so like I've a database users I do
    Code:
    INSERT INTO users (pass) VALUES (AES_ENCRYPT('text',SHA2('password',512)));
    but what about that value 'text does it matter somewhat? I mean when user logs in and types password would it matter?
    And another question I've binded myql with postfix this way
    Code:
    /etc/postfix/mysql_mailbox.cf
    lloks like that
    Code:
     user=mail 
    password=mailPASSWORD 
    dbname=maildb 
    table=users 
    select_field=maildir 
    where_field=id 
    hosts=127.0.0.1 
    additional_conditions = and enabled = 1
    but I want multiple users so there'd be different values for different users in table : users ->field : pass but in that file /mailbox.cf there's only one .
    I know I can use yast ->network services-> mail server but there's only option for one user i.e. I've set up the server manually and the changes will over yast will overwrite the files like /etc/postfix/main.cf I've virtual users...
    13.2 KDE 64bit tumbleweed
    Lenovo G500s, Thinkpad R500

  2. #2
    Join Date
    Oct 2011
    Location
    Germany (Ore Mountains)
    Posts
    457

    Default Re: encrypt password/string in MariaDB (mailserver purpose)

    Quote Originally Posted by roberto68 View Post
    I set up a mail server and the users info is in the database. And here starts my question I wanna encrypt the paswords that are in the database I'm using MariaDB I've red this https://mariadb.com/kb/en/aes_encrypt/ so like I've a database users I do
    Code:
    INSERT INTO users (pass) VALUES (AES_ENCRYPT('text',SHA2('password',512)));
    but what about that value 'text does it matter somewhat? I mean when user logs in and types password would it matter?
    'text' : the passwords of your users
    'password' : the key to encrypt/decrypt your users passwords

    More reading:
    http://dev.mysql.com/doc/refman/5.5/...on_aes-encrypt

    Hendrik

  3. #3
    Join Date
    Apr 2013
    Location
    Modra, Slovakia
    Posts
    265

    Default Re: encrypt password/string in MariaDB (mailserver purpose)

    thanks so the 'password' (the encryption key as you said ) in that command belongs to field : password = mailPASSWORD in table users right?
    13.2 KDE 64bit tumbleweed
    Lenovo G500s, Thinkpad R500

  4. #4
    Join Date
    Oct 2011
    Location
    Germany (Ore Mountains)
    Posts
    457

    Default Re: encrypt password/string in MariaDB (mailserver purpose)

    Quote Originally Posted by roberto68 View Post
    thanks so the 'password' (the encryption key as you said ) in that command belongs to field : password = mailPASSWORD in table users right?
    No. 'text' is the placeholder for whatever content you want to encrypt, here your "mailPASSWORD".

    In your example:

    Code:
    AES_ENCRYPT('mailPASSWORD',SHA2('crypt_key',512))
    The application, that want's to read/write your mailuser account's passwords, has to provide the "crypt_key".

    Hendrik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •