www.ProFTPD.de

ProFTPD => ProFTPD - Deutsch => Thema gestartet von: bis11 am 01. April 2005, 13:28:51



Titel: Probleme mit ProFTP und MySQL
Beitrag von: bis11 am 01. April 2005, 13:28:51
Hallo Leute,

ich habe bei mir ProFTP mit MySQL installiert. Nur wenn ich mich connecten will über SQL, dann bekomme ich keine Verbindung zum MySQL-Server. Im LogFile von der SQL - Anfrage steht :
Code:

Apr 01 13:17:14 mod_sql/4.11[11760]: backend module 'mod_sql_mysql/4.04'
Apr 01 13:17:14 mod_sql/4.11[11760]: backend api    'mod_sql_api_v1'
Apr 01 13:17:14 mod_sql/4.11[11760]: >>> sql_getconf
Apr 01 13:17:14 mod_sql/4.11[11760]: entering   mysql cmd_defineconnection
Apr 01 13:17:14 mod_sql/4.11[11760]:  name: 'default'
Apr 01 13:17:14 mod_sql/4.11[11760]:  user: 'root'
Apr 01 13:17:14 mod_sql/4.11[11760]:  host: 'localhost'
Apr 01 13:17:14 mod_sql/4.11[11760]:    db: 'proftpd'
Apr 01 13:17:14 mod_sql/4.11[11760]:  port: '3306'
Apr 01 13:17:14 mod_sql/4.11[11760]:   ttl: '0'
Apr 01 13:17:14 mod_sql/4.11[11760]: exiting    mysql cmd_defineconnection
Apr 01 13:17:14 mod_sql/4.11[11760]: entering   mysql cmd_open
Apr 01 13:17:14 mod_sql/4.11[11760]: exiting    mysql cmd_open
Apr 01 13:17:14 mod_sql/4.11[11760]: unrecoverable backend error
Apr 01 13:17:14 mod_sql/4.11[11760]: error: '2002'
Apr 01 13:17:14 mod_sql/4.11[11760]: message: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'


Und meine proftpd sieht so aus :

Code:

ServerName                      "BIS-Programmierung ProFTPd "
ServerType                      standalone
DefaultServer                   on
Port                            21
Umask                           022
MaxInstances                    30
User                            nobody
Group                           nogroup
DefaultRoot ~
TransferLog                     /var/spool/proftpd/xferlog.legacy
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"
ExtendedLog                     /var/spool/proftpd/acces.log    WRITE,READ write
ExtendedLog                     /var/spool/proftpd/auth.log     AUTH auth
<Directory /ftp/*>
  AllowOverwrite                on
</Directory>

SQLAuthTypes Plaintext
SQLAuthenticate users*
SQLConnectInfo proftpd@localhost root geheim
SQLDefaultGID 65534
SQLDefaultUID 65534
SQLMinUserGID  100
SQLMinUserUID            500
SQLUserInfo ftp username password uid gid homedir shell
SQLLogFile /var/spool/proftpd/sql.log

<Anonymous /ftp/anonymous>
  User                          ftp
  Group                         ftp

  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias                     anonymous ftp

  # Limit the maximum number of anonymous logins
  MaxClients                    20

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin                  welcome.msg
  DisplayFirstChdir             .message

  <Directory /ftp/anonymous/uploads>
    <LIMIT WRITE>
      DenyAll
    </LIMIT>

    <LIMIT STOR>
      AllowAll
    </LIMIT>
  </Directory>
</Anonymous>


Die MySQL-Datenbank und der Server ist verfügbar, da ich z.B. mit phpMyAdmin drauf zugreifen kann. Systemkonfiguration siehe Signatur.

Was habe ich verkehrt gemacht, da der FTP-Server funktioniert, wenn ich die SQL-Anweisungen rausnehme und den Benutzer lokal anlege und mein Anonymous login funktioniert dann auch wunderbar.


Titel: Re: Probleme mit ProFTP und MySQL
Beitrag von: stonki am 01. April 2005, 13:37:43
probier mal ob Du mit "mysql -h localhost -u USER -p" raufkommst. Wenn nicht dann probier mal statt localhost die aktuelle IP des Rechners.


Titel: Re: Probleme mit ProFTP und MySQL
Beitrag von: bis11 am 01. April 2005, 13:42:07
Zitat von: "stonki"
probier mal ob Du mit "mysql -h localhost -u USER -p" raufkommst. Wenn nicht dann probier mal statt localhost die aktuelle IP des Rechners.


Das funktioniert einwandfrei.

Wenn ich die IP-Adresse in die SQL-Anweisungen eintrage, dann steht folgendes im LOG :

Code:

Apr 01 13:57:35 mod_sql/4.11[12529]: backend module 'mod_sql_mysql/4.04'
Apr 01 13:57:35 mod_sql/4.11[12529]: backend api    'mod_sql_api_v1'
Apr 01 13:57:35 mod_sql/4.11[12529]: >>> sql_getconf
Apr 01 13:57:35 mod_sql/4.11[12529]: entering   mysql cmd_defineconnection
Apr 01 13:57:35 mod_sql/4.11[12529]:  name: 'default'
Apr 01 13:57:35 mod_sql/4.11[12529]:  user: 'root'
Apr 01 13:57:35 mod_sql/4.11[12529]:  host: '169.254.30.80'
Apr 01 13:57:35 mod_sql/4.11[12529]:    db: 'proftpd'
Apr 01 13:57:35 mod_sql/4.11[12529]:  port: '3306'
Apr 01 13:57:35 mod_sql/4.11[12529]:   ttl: '0'
Apr 01 13:57:35 mod_sql/4.11[12529]: exiting    mysql cmd_defineconnection
Apr 01 13:57:35 mod_sql/4.11[12529]: entering   mysql cmd_open
Apr 01 13:57:35 mod_sql/4.11[12529]: exiting    mysql cmd_open
Apr 01 13:57:35 mod_sql/4.11[12529]: unrecoverable backend error
Apr 01 13:57:35 mod_sql/4.11[12529]: error: '1130'
Apr 01 13:57:35 mod_sql/4.11[12529]: message: '#HY000Host 'bispf001.bis-programmierung.dyndns.org' is not allowed to connect to this MySQL server'


Titel: Re: Probleme mit ProFTP und MySQL
Beitrag von: stonki am 01. April 2005, 14:05:10
Mysql und ProFTPD laufen auf dem gleichen Rechner ?


Titel: Re: Probleme mit ProFTP und MySQL
Beitrag von: bis11 am 01. April 2005, 14:10:15
Zitat von: "stonki"
Mysql und ProFTPD laufen auf dem gleichen Rechner ?


Ja

Ich habe es mitlerweile geschafft, das mein Anonymous-ZUgang funktioniert. Nur meine MySQL-Authentification klappt noch nicht. Meine proftpd.conf sieht jetzt so aus :

Code:

ServerName                      "BIS-Programmierung ProFTPD-Server"
ServerType                      standalone
DefaultServer                   on

Port                            21
Umask                           022

MaxInstances                    30

User                            nobody
Group                           nogroup

DefaultRoot                     ~

TransferLog                     /var/log/proftpd/xferlog.legacy
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"
ExtendedLog                     /var/log/proftpd/access.log WRITE,READ write
ExtendedLog                     /var/log/proftpd/auth.log AUTH auth

UseReverseDNS off
IdentLookups off

<Directory /ftp/*>
  AllowOverwrite                on
</Directory>

<Limit LOGIN>
Order allow,deny
AllowGroup ftpd
</Limit>
<Global>
SQLConnectInfo        ftpdb@localhost ftp
SQLAuthenticate       users* groups*
SQLAuthTypes          Crypt Backend Plaintext Empty
SQLUserInfo           users userid passwd uid gid homedir shell
SQLGroupInfo          groups groupid gid members
SQLHomedirOnDemand    on

SQLLog                PASS logincount
SQLNamedQuery         logincount UPDATE "login_count=login_count+1 WHERE userid='%u'" users
SQLLog                PASS lastlogin
SQLNamedQuery         lastlogin UPDATE "last_login=now() WHERE userid='%u'" users
SQLLog RETR           dlbytescount
SQLNamedQuery         dlbytescount UPDATE "dl_bytes=dl_bytes+%b WHERE userid='%u'" users
SQLLog RETR                 dlcount
SQLNamedQuery         dlcount UPDATE "dl_count=dl_count+1 WHERE userid='%u'" users
SQLLog STOR           ulbytescount
SQLNamedQuery         ulbytescount UPDATE "ul_bytes=ul_bytes+%b WHERE userid='%u'" users
SQLLog STOR           ulcount
SQLNamedQuery         ulcount UPDATE "ul_count=ul_count+1 WHERE userid='%u'" users
SQLLogFile            /var/log/proftpd/sql.log
RequireValidShell     off

SQLUserWhereClause    "disabled!=1 and (NOW()<=expires or expires=-1)"

QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on

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,f$
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 ftpquota$
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}$
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2},%{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

DirFakeGroup on ~
DirFakeUser on ~
MaxClients 3 "There are too many connections"
MaxClientsPerHost 3 "There are too many connections from your host"
ServerIdent on "You have connected"
DefaultRoot ~
UseFtpUsers on
CreateHome on 755 skel /ftp dirmode 755
</Global>
TimeoutLogin 60
TimeoutStalled 30

<Anonymous /ftp/anonymous>
  User                          ftp
  Group                         ftp

  # We want clients to be able to login with "anonymous" as well as "ftp"
  UserAlias                     anonymous ftp

  # Limit the maximum number of anonymous logins
  MaxClients                    10

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
  DisplayLogin                  welcome.msg
  DisplayFirstChdir             .message

  <Directory /ftp/anonymous/uploads>
    <LIMIT STOR WRITE>
      AllowAll
    </LIMIT>
  </Directory>
</Anonymous>


Nur bleibt es jetzt noch ein Rätsel, warum ich mit einem User der in der Datenbank steht mich nicht anmelden kann ? Das Passwort des Users steht in der Datenbank im klartext drin.