Current time: 05-17-2024, 12:14 PM Hello There, Guest! (LoginRegister)


Post Reply 
Umsetzung Fremd auf ISPCP
Author Message
tango Offline
Member
***

Posts: 461
Joined: Jun 2007
Reputation: 0
Post: #11
RE: Umsetzung Fremd auf ISPCP
nein eben nicht, zurzeit wird $ werden nicht unterstützt. Daher glaube ich nicht das es mit dem Blowfish klappt Sad
02-27-2009 06:10 AM
Find all posts by this user Quote this message in a reply
Lucan Offline
Member
*
Beta Team

Posts: 982
Joined: Jul 2008
Reputation: 12
Post: #12
RE: Umsetzung Fremd auf ISPCP
Aber es ist doch auch so, das die ganzen passwörter, welche beim update von RC6 zu RC7 erst beim ersten Adminlogin in Ispcp verschlüsselt werden.

Sprich evtl. gibt es eine Datei, welche im RC7 liegt, welche automatisch, sobald man sie ausführt die passwörter verschlüsselt?


Aber wie gesagt, bei mir ist das alles mehr Raten als Wissen - leider, versuche aber trotzdem zu helfen wo es geht ;P
02-27-2009 06:11 AM
Find all posts by this user Quote this message in a reply
Uwe Driessen Offline
Junior Member
*

Posts: 21
Joined: Feb 2009
Reputation: 0
Post: #13
Rolleyes RE: Umsetzung Fremd auf ISPCP
mal eine freche Frage zwischendurch:

Warum sind die Entwickler denn auf crypt und dann auf Blowfish PW gegangen?

sowohl Christian als auch ich sind schon einige Zeit in der Postfixliste von Peer Heinlein als auch auf der de.postfix.org.

Dort lernt man gerade eben das das verschlüsseln der PW in den Datenbanken keinen Sicherheitsgewinn bringt.

Systeme müssen von Ihrer Struktur her sicher aufgebaut werden und durch die richtige Benutzung von zusätzlichen Tool's der Einbruch erschwert werden. Wirklich Sichere Systeme gibt es nicht, nur Systeme in die es länger braucht einzubrechen.
02-27-2009 06:15 AM
Find all posts by this user Quote this message in a reply
tango Offline
Member
***

Posts: 461
Joined: Jun 2007
Reputation: 0
Post: #14
RE: Umsetzung Fremd auf ISPCP
Passwörter werden asymmetrisch Verschlüsselt also checksum über das Passwort gebildet.Soweit ich weis ist Blowfish symmetrisch verschlüsselt.
02-27-2009 06:19 AM
Find all posts by this user Quote this message in a reply
chrroessner Offline
Junior Member
*

Posts: 10
Joined: Feb 2009
Reputation: 0
Post: #15
RE: Umsetzung Fremd auf ISPCP
Wie kompliziert wäre das evtl., ein Revert-Diff für die Bestandteile der RC7 im Wiki anzubieten, die das RC6-Verhalten (Cleartext) wiederherstellen?

Ich könnte mir nämlich vorstellen, dass wir nicht ganz die Einzigen sein werden, die hier Probleme sehen und straucheln geraten *g*
Wenn mir jemand sagt, welche Dateien für Blowfish geändert wurden, kann ich natürlich auch selbst ein Diff von 1.00 auf 1.00RC6 erstellen.

Ich klinke mich aber für heute schon mal aus, muss leider weg. Und schon mal Danke, die Antworten kommen hier ja echt ratz fatz ;-)
(This post was last modified: 02-27-2009 06:24 AM by chrroessner.)
02-27-2009 06:20 AM
Find all posts by this user Quote this message in a reply
tango Offline
Member
***

Posts: 461
Joined: Jun 2007
Reputation: 0
Post: #16
RE: Umsetzung Fremd auf ISPCP
du kannst ja rc6 mit rc7 vergleichen, und dann kann man schon mehr sagen welche Dateien sich geändert haben.
02-27-2009 06:26 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #17
RE: Umsetzung Fremd auf ISPCP
Google translator is not quite good, but I understand that you need to know how passwords are encrypted / decrypted.

$ispcp_db_pass_key and $ispcp_db_pass_iv are generated on install and saved on ispcp/gui/include/ispcp-db-keys.php.

Code:
function decrypt_db_password ($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;

    if ($db_pass == '')
        return '';

    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $text = @base64_decode($db_pass . "\n");
        // Open the cipher
        $td = @mcrypt_module_open ('blowfish', '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        // Decrypt encrypted string
        $decrypted = @mdecrypt_generic ($td, $text);
        @mcrypt_module_close ($td);

        // Show string
        return trim($decrypted);
    } else {
        system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die();
    }
}

function encrypt_db_password($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;
    
    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $td = @mcrypt_module_open (MCRYPT_BLOWFISH, '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;
        
        //compatibility with used perl pads
        $block_size=@mcrypt_enc_get_block_size($td);
        $strlen=strlen($db_pass);

        $pads=$block_size-$strlen % $block_size;

        $db_pass .= str_repeat(' ', $pads);

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        //Encrypt string
        $encrypted = @mcrypt_generic ($td, $db_pass);
        @mcrypt_generic_deinit($td);
        @mcrypt_module_close($td);

        $text = @base64_encode("$encrypted");
        $text=trim($text);
        return $text;
    } else {
        //system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die("ERROR: The php-extension 'mcrypt' not loaded!");
    }
}
02-27-2009 06:31 AM
Visit this user's website Find all posts by this user Quote this message in a reply
chrroessner Offline
Junior Member
*

Posts: 10
Joined: Feb 2009
Reputation: 0
Post: #18
RE: Umsetzung Fremd auf ISPCP
(02-27-2009 06:31 AM)sci2tech Wrote:  Google translator is not quite good, but I understand that you need to know how passwords are encrypted / decrypted.

$ispcp_db_pass_key and $ispcp_db_pass_iv are generated on install and saved on ispcp/gui/include/ispcp-db-keys.php.

Code:
function decrypt_db_password ($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;

    if ($db_pass == '')
        return '';

    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $text = @base64_decode($db_pass . "\n");
        // Open the cipher
        $td = @mcrypt_module_open ('blowfish', '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        // Decrypt encrypted string
        $decrypted = @mdecrypt_generic ($td, $text);
        @mcrypt_module_close ($td);

        // Show string
        return trim($decrypted);
    } else {
        system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die();
    }
}

function encrypt_db_password($db_pass) {
    global $ispcp_db_pass_key, $ispcp_db_pass_iv;
    
    if (extension_loaded('mcrypt') || @dl('mcrypt.' . PHP_SHLIB_SUFFIX)) {
        $td = @mcrypt_module_open (MCRYPT_BLOWFISH, '', 'cbc', '');
        // Create key
        $key = $ispcp_db_pass_key;
        // Create the IV and determine the keysize length
        $iv = $ispcp_db_pass_iv;
        
        //compatibility with used perl pads
        $block_size=@mcrypt_enc_get_block_size($td);
        $strlen=strlen($db_pass);

        $pads=$block_size-$strlen % $block_size;

        $db_pass .= str_repeat(' ', $pads);

        // Initialize encryption
        @mcrypt_generic_init ($td, $key, $iv);
        //Encrypt string
        $encrypted = @mcrypt_generic ($td, $db_pass);
        @mcrypt_generic_deinit($td);
        @mcrypt_module_close($td);

        $text = @base64_encode("$encrypted");
        $text=trim($text);
        return $text;
    } else {
        //system_message("ERROR: The php-extension 'mcrypt' not loaded!");
        die("ERROR: The php-extension 'mcrypt' not loaded!");
    }
}

Thanks. At the moment I think about on how to revert the changes to ispcp concerning cleartext switch to blowfish. As of many peoples view it really is bad to store passwords encrypted in databases. It does not bring security, it costs security. The administrotor of a server does not need to know passwords of resellers or guests, because he is the root of the server and he can see all data directly without the need of fetching the passwords from the db. If he/she wants to see private data, he always could change into the directory and see, what he/she wants to see.

The database server itself needs to run safely. You never would let run mysql on 3306 on 0.0.0.0 without packat filtering, etc. In our case, the mysql server does have its own virtual server.

Postfix and doveccot themselves could use challenge/response methos over unsecure connections. But with passwords encrypted in the database, only PLAIN and LOGIN are left over. So you have to force customers to use SSL, if you want to prevent them from using plaintext over unsecure connections! Does not really make sence.

Second, if providing ssl, and you do have about 1000 or more accounts on a server, you will recognize more cpu usage on the ssl encypted lines (although this should not really be a big factor). But normally you would not need to provide ssl (see Web.de, GMX.de).

So the decision to switch to blowfish-cbc was in fact a really bad decision. To summarize in short:

- Do not protect passwords against the admin (it does not make sence)
- Protect client/server connections with hashed/encrypted passwords.

So I hope, developers will realize that it cost security. Reading a pdf about hardened Linux must be challenged, before simply coding it 1:1. For more information on encrypted passwords you are welcome to subscribe any postfix mailing lists. You will meat people like Patrick Ben Koetter, Ralf Hildebrandt or Peer Heinlein and you shortly will understand, your decision was completley wrong.

Because English is not my mothers language, I please you not to understand it too hard. I hope, you could follow my opinion and maybe you will discuss this internally.
Kurze Anregung:

MySQL-Rechte für _alle_ Passwort-Felder der ispcp-DB setzen auf: UPDATE, DELETE und INSERT. Wenn Passwörter nicht sichtbar angezeigt werden, dann benötigt es auch kein SELECT. Damit kann dann auch ispcp potentiell Sicherheitslöcher haben, ohne dass man von außen auf die PWs zugreifen könnte. Für Courier und/oder/Dovecot bzw. Postfix empfehle ich dann einen extra User, der hier sogar _nur_ SELECT-Rechte hat. So haben wir das jetzt umgesetzt.

Beispiel:

GRANT SELECT ON ispcp.* to mailadmin@'somewhere' IDENTIFIED BY 'Bla';

Reicht hier aus.

Eine weitere Alternative wäre, dem Administrator in der Weboberfläche selbst die Entscheidung zu überlassen, ob er clear oder encrypted die Passwörter verwalten möchte.

Ich bin selbst Entwickler (Student in den allerletzten Zügen) und liebe es mich mit Security zu beschäftigen. Ich kann mir auch aus Erfahrung sehr gut vorstellen wie das ist, wenn man viel Zeit in Sourcecode hineingesteckt hat, um eine Funktionalität zu programmieren; plötzlich wird einem von außen gesagt, dass das nicht gut war; nun soll man diesen Code wieder verwerfen. Aber das ist eine Erfahrung, über der man glaube ich stehen muss :-) Manchmal programmiert man halt etwas für die Füße *g*

Aber weiter werde ich jetzt auch nicht meinen Senf dazu geben, dass müsst ihr jetzt selbst überlegen und entscheiden. Es ist letztlich nur Uwes und meine Meinung.
(This post was last modified: 02-27-2009 12:07 PM by chrroessner.)
02-27-2009 11:32 AM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #19
RE: Umsetzung Fremd auf ISPCP
Problems are only with Dovecot witch is not (yet) officially supported by ISPCP. Postfix can use any method, not just PLAIN or LOGIN. Postfix do not authenticate against mysql database. Having plain password here is a security issue (and protection is not agains administrator).
Since we need to keep passwords because we need to be able to recreate emails on upgrade/domain property change. Until we will find a better solution must remain like this. Again, Dovecot is not officially supported, but since number of users seems to like it, I did come with a solution to make it work with ISPCP. Is not the best, but is working Wink
02-28-2009 08:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
chrroessner Offline
Junior Member
*

Posts: 10
Joined: Feb 2009
Reputation: 0
Post: #20
RE: Umsetzung Fremd auf ISPCP
(02-28-2009 08:47 PM)sci2tech Wrote:  Problems are only with Dovecot witch is not (yet) officially supported by ISPCP. Postfix can use any method, not just PLAIN or LOGIN. Postfix do not authenticate against mysql database. Having plain password here is a security issue (and protection is not agains administrator).
Nice to here that it is not against admin :-) Could you give further information what kind of security issues you are seeing here? Wouldn't the mysql grant stuff not do anything, what is important?

By the way, I just look through your given php code and try to understand it *g*
02-28-2009 09:00 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)