www.ProFTPD.de
13. März 2007, 20:16:25 *
Willkommen Gast. Bitte einloggen oder registrieren.
Haben Sie Ihre Aktivierungs E-Mail übersehen?

Einloggen mit Benutzername, Passwort und Sitzungslänge
News: SMF - Neu installiert!
 
   Übersicht   Hilfe Suche Login Registrieren  
Seiten: [1]   Nach unten
  Drucken  
Autor Thema: proftpd 1.2.10 + sql + quota + md5  (Gelesen 585 mal)
0 Mitglieder und 1 Gast betrachten dieses Thema.
streetrulez
ProFTPD
*
Offline Offline

Beiträge: 11


Profil anzeigen
« am: 15. Juli 2005, 08:25:16 »

Hi,

habe derzeit proftpd 1.2.10 mit SQL-Authentification und SQL-Quota am laufen. Jetzt möchte ich aber, dass die Passwörter, als MD5 und nicht als Plaintext von dem SQL-Table gelesen werden können.
Hab deshalb versucht über SQLAuthTypes, MD5-support zu aktivieren, doch sind nur folgende Unterstützungen implementiert:

Plaintext
OpenSSL  
Crypt
Backend
Empty

Weiß jemand Rat?

THX

mfg street
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #1 am: 15. Juli 2005, 11:18:10 »

/bin/ec ho "{md5}"`/bin/ec ho -n "password" | openssl dgst -binary -md5 | openssl enc -base64`

The "{md5}" prefix is necessary, so that mod_sql knows what digest algorithm was used.

Here's a quick and dirty example of generating database-ready strings using every digest algorithm supported by the installed OpenSSL:

  for c in `openssl list-message-digest-commands`; do
    /bin/ec ho "{$c}"`/bin/ec ho -n "password" | openssl dgst -binary -$c | openssl enc -base64`
  done

which generates:

  {md2}8DiBqIxuORNfDsxg79YJuQ==
  {md4}ip0JPxT4cB3xdzKyuxgsdA==
  {md5}X03MO1qnZdYdgyfeuILPmQ==
  {mdc2}HA0SCu32vhW+exItsGK4lQ==
  {rmd160}LAjo9YhHUKe5n28vNC/GONsl/zE=
  {sha}gAclaL6zshAjJesgP20P+S9c744=
  {sha1}W6ph5Mm5Pz8GgiULbPgzG37mj9g=

There are a lot of PHP applications which might want to generate passwords suitable for use with mod_sql. For example, to generate a base64-encoded MD5 password with PHP, which can then be read by mod_sql, use the following PHP code:

  // $password contains the cleartext password before
  $password = "{md5}".base64_encode(pack("H*", md5($password)));

  // $password now contains the encrypted, encoded password


SIEHE: http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-SQL.html
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
Anonymous
Gast
« Antwort #2 am: 15. Juli 2005, 14:16:49 »

danke erstmal!

jedoch hab ich das problem, dass ich die Passwörter der Kunden (>1000) bereits (und nur) im MD5-format habe. Ich habe vorher einen Sun Cobalt Server eingesetzt, nur ist der jetzt EOL und kurz vorm Geist aufgeben.

Wie kann ich die bereits bestehenden md5-Hashes (per Script von shadow importiert) nun nutzen?
Und wenn möglich ohne SSL?

Bitte um Hilfe

THX Smiley

mfg street
Gespeichert
streetrulez
ProFTPD
*
Offline Offline

Beiträge: 11


Profil anzeigen
« Antwort #3 am: 15. Juli 2005, 14:18:12 »

danke erstmal!

jedoch hab ich das problem, dass ich die Passwörter der Kunden (>1000) bereits (und nur) im MD5-format habe. Ich habe vorher einen Sun Cobalt Server eingesetzt, nur ist der jetzt EOL und kurz vorm Geist aufgeben.

Wie kann ich die bereits bestehenden md5-Hashes (per Script von shadow importiert) nun nutzen?
Und wenn möglich ohne SSL?

Kann ich einfach meine bestehenden md5-hasches einsetzen wenn ich {md5} davor schreibe?

z.B. {md5}X03MO1qnZdYdgyfeuILPmQ==
?
Und wenn ja, welchen SQLAuthTypes dann?

Bitte um Hilfe

THX Smiley

mfg street (sry, session war bereits abgelaufen)
Gespeichert
stonki
Administrator
ProFTPD
*****
Offline Offline

Beiträge: 1853


15318939
Profil anzeigen WWW E-Mail
« Antwort #4 am: 15. Juli 2005, 15:39:32 »

Zitat von: "streetrulez"
danke erstmal!

jedoch hab ich das problem, dass ich die Passwörter der Kunden (>1000) bereits (und nur) im MD5-format habe. Ich habe vorher einen Sun Cobalt Server eingesetzt, nur ist der jetzt EOL und kurz vorm Geist aufgeben.

Wie kann ich die bereits bestehenden md5-Hashes (per Script von shadow importiert) nun nutzen?
Und wenn möglich ohne SSL?

Kann ich einfach meine bestehenden md5-hasches einsetzen wenn ich {md5} davor schreibe?

z.B. {md5}X03MO1qnZdYdgyfeuILPmQ==
?
Und wenn ja, welchen SQLAuthTypes dann?

Bitte um Hilfe

THX :)

mfg street (sry, session war bereits abgelaufen)


a) Ja
b) Crypt
Gespeichert

www.stonki.de:    the more I see, the more I know.......
www.proftpd.de:   Deutsche ProFTPD Dokumentation
www.krename.net:  Der Batch Renamer für KDE
www.kbarcode.net: Die Barcode Solution für KDE
streetrulez
ProFTPD
*
Offline Offline

Beiträge: 11


Profil anzeigen
« Antwort #5 am: 18. Juli 2005, 07:57:05 »

hi stonki!

hab aus der shadow ein Beispiel rausgefischt, so sieht das Pass eines Testusers aus: $1$IgLSqs00$1fw

Ich versuchte folgende MD5-Strings
{md5}$1$IgLSqs00$1fw ( {md5}+original shadow-String )
{md5}JDEkSWdMU3FzMDAkMWZ3 ( {md5}+base64_encode($pass) )
{md5}AQAAAAAAHwA= ( {md5}+base64_encode(@pack("H*", $pass)); )

Als SQLAuthTypes setzte ich Crypt ein, jedoch gelang mir der Login nicht.

Werde jetzt doch mal die OpenSSL library konfigurieren und SQL-Authentification auf OpenSSL umstellen.

Aber eigentlich bräucht ich es ohne SSL weil sonst die ganzen Kunden anrufen, weil ja dann sFTP verwendet werden muss?!

Oder können die Kunden weiterhin das normale FTP-Protkoll nützen ohne einen sFTP-Client?

Und bitte sag mir welcher der 3 Passwortstrings ich dann verwenden muss.

Danke!

mfg street
Gespeichert
streetrulez
ProFTPD
*
Offline Offline

Beiträge: 11


Profil anzeigen
« Antwort #6 am: 18. Juli 2005, 15:53:19 »

hier noch ein paar weitere hinweise zu meiner konfiguration:

konfiguriert wurde proftpd wiefolgt:

Zitat

CFLAGS=-DHAVE_OPENSSL LIBS=-lcrypto ./configure     --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql     --with-includes=/usr/include/mysql:/usr/local/openssl/include     --with-libraries=/usr/include/mysql:/usr/local/openssl/lib


proftpd.conf:

Zitat

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operbation and anon.
 
ServerName                      "pop.citynet-hall.at"
ServerType                      standalone
DeferWelcome                    off
 
# Login beschleunigen
UsereverseDNS off
IdentLookups off
 
ShowSymlinks                    on
MultilineRFC2228                on
DefaultServer                   on
ShowSymlinks                    on
AllowOverwrite                  on
 
TimeoutNoTransfer               600
TimeoutStalled                  600
TimeoutIdle                     1200
 
DisplayLogin                    welcome.msg
DisplayFirstChdir               .message
#LsDefaultOptions                "-l"
 
DenyFilter                      \*.*/
 
# Uncomment this if you are using NIS or LDAP to retrieve passwords:
#PersistentPasswd               off
 
# Port 21 is the standard FTP port.
Port                            21
 
# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances                    30
 
# Set the user and group that the server normally runs at.
 
User                            root
Group                           root
 
# Normally, we want files to be overwriteable.
<Directory /*>
  # Umask 022 is a good standard umask to prevent new files and dirs
  # (second parm) from being group and world writable.
  Umask                         022  022
 
  AllowOverwrite                on
</Directory>
 
 
DefaultRoot ~
RequireValidShell off
 
#
# Logging options
#
TransferLog /var/log/proftpd.xferlog
 
# Some logging formats
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LogFormat write "%h %l %u %t \"%r\" %s %b"
 
# Log file/dir access
-
ExtendedLog /var/log/proftpd.access_log WRITE,READ write
 
# Record all logins
ExtendedLog /var/log/proftpd.auth_log AUTH auth
 
# Paranoia logging level....
#ExtendedLog /var/log/proftpd.paranoid_log ALL default
 
SQLAuthTypes            OpenSSL Crypt
SQLAuthenticate         users* groups*
SQLConnectInfo          mgmt_mail@localhost mgmt_cnh xxxxxxxxxx
SQLUserInfo             proftpd_users username password uid gid homedir shell
SQLGroupInfo            proftpd_groups groupname gid members
SQLUserWhereClause      "login_enabled = 'y'"
 
SQLLog PASS login
SQLNamedQuery login UPDATE "last_login=now(), login_count=login_count+1 WHERE username='%u'" proftpd_users
 
SQLLog RETR download
SQLNamedQuery download UPDATE "down_count=down_count+1, down_bytes=down_bytes+%b WHERE username='%u'" proftpd_users
 
SQLLog STOR upload
 
#
# mod_quota tab
#
QuotaEngine on
QuotaShowQuotas on
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
 
SQLNamedQuery get-quota-limit SELECT "name, quota_type,per_session,limit_type, bytes_in_avail, bytes_out_avail,bytes_xfer_avail, files_in_avail, files_out_avail,files_xfer_avail FROM quotalimits WHERE name = '%{0}' AND quota_type ='%{1}'"
 
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used,bytes_out_used, bytes_xfer_used, files_in_used, files_out_used,files_xfer_used FROM quotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
 
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used= files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name= '%{6}' AND quota_type = '%{7}'" quotatallies
 
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4},%{5}, %{6}, %{7}" quotatallies


Ich versuchte mich mit dem Testuser anzumelden auf 3 verschiedene Arten das Passwort in der Datenbank einzugeben:

1.) {md5}$1$IgLSqs00$1fw
2.) {md5}JDEkSWdMU3FzMDAkMWZ3
3.) {md5}AQAAAAAAHwA=

zu 1.) Format wiefolgt: {md5}+original shadow-String
zu 2.) Format wiefolgt: {md5}+base64_encode($pass) (via phpscript)
zu 3.) Format wiefolgt: {md5}+base64_encode(@pack("H*", $pass)); (via phpscript)

Kann mich allerdings auf keine der 3 Arten einloggen (egal ob openSSL oder Crypt steht):

Zitat

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - no supplemental groups found for user 'tester'

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "getpwnam" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "gid_name" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "gid_name" to module mod_auth_file

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "gid_name" to module mod_auth_unix

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "auth" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "check" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "check" to module mod_auth_file

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "check" to module mod_auth_unix

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "auth" to module mod_auth_file

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "auth" to module mod_auth_unix

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - ROOT PRIVS at mod_auth_unix.c:421

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - RELINQUISH PRIVS at mod_auth_unix.c:482

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - USER tester (Login failed): No such user found.

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching POST_CMD_ERR command 'PASS (hidden)' to mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching LOG_CMD_ERR command 'PASS (hidden)' to mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching LOG_CMD_ERR command 'PASS (hidden)' to mod_log

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching LOG_CMD_ERR command 'PASS (hidden)' to mod_auth

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching PRE_CMD command 'QUIT' to mod_core

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching PRE_CMD command 'QUIT' to mod_core

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching PRE_CMD command 'QUIT' to mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching PRE_CMD command 'QUIT' to mod_log

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching CMD command 'QUIT' to mod_core

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endpwent" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endpwent" to module mod_auth_file

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endpwent" to module mod_auth_unix

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endgrent" to module mod_sql

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endgrent" to module mod_auth_file

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - dispatching auth request "endgrent" to module mod_auth_unix

pop.citynet-hall.at (cnh195149221200.surfer.cnh.at[195.149.221.200]) - FTP session closed.


-------------------------------------------------------------------------------------

Bitte dringend um Hilfe, muss das bis Ende dieser Woche schaffen!

BIGTHX!!!

mfg street[/quote]
Gespeichert
streetrulez
ProFTPD
*
Offline Offline

Beiträge: 11


Profil anzeigen
« Antwort #7 am: 18. Juli 2005, 19:41:06 »

okay leute habs zusammengebracht!

der parallelthread im proftpd.org forum + lösung:

http://forums.proftpd.org/phpBB2/viewtopic.php?p=1932#1932

Hatte 2 Fehler:

1.) mein Praktikant schrieb ein Importskript das von der Shadow die Hashes in das entsprechende Feld in der Datenbank importiert, allerdings beachtete er nicht, dass die Hashes weit mehr als 20 Zeichen benötigen, weswegen der Hash in der DB abgeschnitten war

2.) wenn man Hasches aus der Shadow wie z.B. $1$IgLSqs00$1fwmLHYUVLxupPd6AxprK/ verwenden möchte und als SQLAuthTypes Crpyt schreibt, muss man den Prefix {md5} weglassen!

BIGHTHX an stonki und castaglia

mfg street
Gespeichert
Seiten: [1]   Nach oben
  Drucken  
 
Gehe zu:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Prüfe XHTML 1.0 Prüfe CSS
Seite erstellt in 0.069 Sekunden mit 18 Zugriffen.