On Tue, Jan 21, 2003 at 04:17:02AM +0100, Julen Landa Alustiza wrote:
> No estoy muy puesto en el tema pero no t faltara alguno d los siguientes 
> paquetes?
> 
> 
> [EMAIL PROTECTED]:~$ apt-cache search postfix mysql
> postfix-mysql - MYSQL map support for Postfix
> postfix-snap-mysql - MYSQL map support for Postfix-snap


Gracias pero:


espai1:~# dpkg -s postfix-mysql
Package: postfix-mysql
Status: install ok installed
[...]


No me puse la versi�n "snapshot" porque para empezar quer�a un poco de
estabilidad y no encontrarme con m�s problemas aparte de los que ya
provoco yo mismo  :)


> 
> -- 
> Julen Landa Alustiza
> mundurat.net eko administraria
> [EMAIL PROTECTED]
> 


Por cierto. Antes, cuando he dicho que ten�a el usuario "postfix" dado
de alta me refer�a a la base de datos. "postfix" ([EMAIL PROTECTED])
existe en mysql.user y tiene permisos sobre mail.*, como he indicado
antes. Y es curioso, pero le di los permisos con 

grant all on mail.* to [EMAIL PROTECTED] identified by '<passwd en \
claro>';

y no me aparece nada en mysql.tables_priv:



mysql> select * from tables_priv;
Empty set (0.07 sec)

mysql> grant all on mail.* to [EMAIL PROTECTED] identified by \
'<password en claro>';
Query OK, 0 rows affected (0.26 sec)

mysql> select * from tables_priv;
Empty set (0.00 sec)

mysql> select database();
+------------+
| database() |
+------------+
| mysql      |
+------------+
1 row in set (0.01 sec)

mysql> 




Compruebo que efectivamente tiene permisos:



espai1:~# mysql -S /var/run/mysqld/mysqld.sock -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 153 to server version: 3.23.49-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mail
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+----------------+
| Tables_in_mail |
+----------------+
| alias          |
| relocated      |
| transport      |
| users          |
| virtual        |
+----------------+
5 rows in set (0.03 sec)

mysql> quit
Bye
espai1:~# mysql -S /var/run/mysqld/mysqld.sock -u postfix -p mail.alias    
Enter password: 
ERROR 1102: Incorrect database name 'mail.alias'
espai1:~# 





Vaya...  Parece que se identific� bien pero que finalmente no se le
concedi� permiso para acceder a mail.alias. Pero �c�mo puede ser eso, si
la instrucci�n GRANT no dio error? [Cuando se usa GRANT no es necesario
ejecutar "flush priovileges;".]


Bueno. Resignaci�n (pero no me gusta nada que me ocurra esto; �no me lo
explico!):


[Entro como root]
mysql> grant all on mail.alias to [EMAIL PROTECTED] identified by \
'<password en claro>';
Query OK, 0 rows affected (0.00 sec)

[Lo mismo para mail.relocated, mail.transport, mail.users y
mail.virtual]


* En el GRANT, �verdad que con "select" en lugar de "all" tendr�a
suficiente? El usuario postfix consultar� el contenido de las tablas;
no lo modificar� de ning�n modo.




Ahora ya sale en mysql.tables_priv:

mysql> select * from mysql.tables_priv;
[...]
| localhost | mail | postfix | transport  | [EMAIL PROTECTED] | \
20030121045534 | Select,Insert,... <- Todos los permisos que comprende
                                      "ALL"
[...]
mysql> quit

* Salgo si ejecutar "flush privileges;", porque en teor�a no hace falta.


Volvemos a comprobar:


espai1:~# mysql -S /var/run/mysqld/mysqld.sock -u postfix -p mail.alias
Enter password: 
ERROR 1102: Incorrect database name 'mail.alias'


Empiezo a pensar que soy el resultado de un experimento gen�tico
fallido, as� que:


espai1:~# man mysql
Dando formato a mysql(1), aguarde por favor...


Vaya hombre. No se pone el nombre de la base de datos al final. Un 10
para m�.


espai1:~# mysql -S /var/run/mysqld/mysqld.sock -u postfix -p           
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 157 to server version: 3.23.49-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database
'mysql'
mysql> use mail
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from alias
    -> ;
Empty set (0.05 sec)



En realidad mail.alias est� vac�a. Todo bien hasta ahora.



A ver c�mo se porta cuando recibe un correo:



Jan 21 05:05:48 espai1 postfix/smtpd[5041]: connect from
123.Red-80-39-5.pooles.rima-tde.net[80.39.5.123]
Jan 21 05:05:50 espai1 postfix/smtpd[5041]: 54A89D591:
client=123.Red-80-39-5.pooles.rima-tde.net[80.39.5.123]
Jan 21 05:05:51 espai1 postfix/smtpd[5041]: warning: connect to mysql
server unix:/var/run/mysqld/mysqld.sock: Can't connect to local MySQL
server through socket '/var/run/mysqld/mysqld.sock' (2)
Jan 21 05:05:51 espai1 postfix/smtpd[5041]: fatal:
mysql:/etc/postfix/mysql-transport.cf: table lookup problem
Jan 21 05:05:52 espai1 postfix/master[317]: warning: process
/usr/lib/postfix/smtpd pid 5041 exit status 1
Jan 21 05:05:52 espai1 postfix/master[317]: warning:
/usr/lib/postfix/smtpd: bad command startup -- throttling
Jan 21 05:05:52 espai1 postfix/cleanup[5042]: warning: premature
end-of-input from cleanup socket while reading input attribute name




Pues sigue sin funcionar. Para que no haya dudas:



# /etc/postfix/mysql-transport.cf

user         = postfix
password     = <password en claro>
dbname       = mail
table        = transport
select_field = destination
where_field  = domain
#hosts        = 127.0.0.1
#hosts        = localhost
hosts = unix:/var/run/mysqld/mysqld.sock




mysql> describe transport;
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      |      | PRI | NULL    | auto_increment |
| domain      | varchar(128) |      | UNI |         |                |
| destination | varchar(128) |      |     |         |                |
+-------------+--------------+------+-----+---------+----------------+
3 rows in set (0.03 sec)




Supongo que los errores posteriores son consecuencia de la no conexi�n a
la base de datos.




Pongo ahora como anexo el fichero /etc/mysql/my.cnf, aunque me parece
que es un poco in�til porque s�lo he tocado la l�nea "skip-networking"
(y sin resultado, por cierto, como he cometado en un mensaje anterior).



Venga, gracias a [EMAIL PROTECTED]



Pepe.

-- 
Jos� Marcos Chalm�s Garc�a - Public key ID: 0x6FDE933B
www.polinux.upv.es - www.debian.org - www.gnu.org - www.bsd.org - ...
I use free software | Utilitze programari lliure | Uso software libre
---------------------------------------------------------------------

# You can copy this to one of:
# /etc/mysql/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
# 
# One can use all long options that the program supports.
# Run the program with --help to get a list of available options

# This will be passed to all mysql clients
[client]
#password       = my_password
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[safe_mysqld]
err-log         = /var/log/mysql/mysql.err

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
#
# You can also put it into /var/log/mysql/mysql.log but I leave it in /var/log
# for backward compatibility. Both location gets rotated by the cronjob.
#log            = /var/log/mysql/mysql.log
log             = /var/log/mysql.log
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
#20030121
#language       = /usr/share/mysql/english
language        = /usr/share/mysql/spanish
skip-locking
#
# The skip-networkin option will no longer be set via debconf menu.
# You have to manually change it if you want networking i.e. the server
# listening on port 3306. The default is "disable" - for security reasons.
#20030120
skip-networking
#/20030120
set-variable    = key_buffer=16M
set-variable    = max_allowed_packet=1M
set-variable    = thread_stack=128K
#
# Here you can see queries with especially long duration
#log-slow-queries       = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication
#server-id              = 1
#log-bin                = /var/log/mysql/mysql-bin.log
#binlog-do-db           = include_database_name
#binlog-ignore-db       = include_database_name
#
# Read the manual if you want to enable InnoDB!
skip-innodb

[mysqldump]
quick
set-variable    = max_allowed_packet=1M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
set-variable    = key_buffer=16M

Responder a