On 20/08/2015 12:17 a.m., adricustodio wrote: > Hi guys, i got a question... again.... > > Im runing here Centos7 + squid 3.3.8 > Im trying to set up a squid with mysql auth, but im kinda lost here... > > For now squid is running fine on basic_ncsa_auth > I've created a mysql db called "squid" and a table called "users" with name, > pass (varchar) and status. > > My squid did not come with mysql_auth, so i tried to create a new one and > tried to use basic_db_auth basic_db_auth is what I use to authenticate my clients against a MySQL database. Whats the problem? > mysql_auth is this > > #!/usr/bin/php I seriously advise against PHP. Spent most of a year trying to get it interoperating well as a helper language, but had to give up. It has a history of bugs and weirdness with timeouts rooted in its primary use-case as a web CGI interface that has not yet gone away AFAICT. > <? > $link = mysqli_connect("localhost", "usuario_do_banco", "senha_do_banco"); > > if (!$link) { > printf("Erro ao Conectar com o Banco de Dados: %s\n", > mysqli_connect_error()); > die(); > } > > $selectdb = mysqli_select_db($link, "squid"); > > if (!$selectdb) { > printf("Erro ao Abrir o Banco de Dados: %s\n", mysqli_error($link)); > die(); > } > > while ( fscanf(STDIN, "%s %s", $nome, $senha) ) { > $select = "SELECT nome, senha FROM usuarios WHERE nome = '".$nome."' AND > status = 1"; > $Query = mysqli_query($link, $select); > $nrRegistros = mysqli_num_rows($Query); > $erro = true; > > while ( $Registro = mysqli_fetch_array($Query) ) { > $erro = false; > > if ( crypt($senha, $Registro[senha]) == $Registro[senha] ) Replace " [senha] " with " ['senha'] " (notice the single-quotes). > printf("OK\n"); > else printf("ERR\n"); > } > if ($erro) printf("ERR\n"); On helper errors output "BH" > } > ?> > > My squid asks for user and password but do not authenticate... > on the basic_db_auth i didnt change anything, i dont know how to configure > squid to authenticate on mysql. Same as the demo I gave for using it to authenticate directly to OracleDB but with "mysql" instead of "Oracle" and 3306 instead of 1234 in the --dsn value. With your described DB setup you also want --plaintext instead of --md5 and --salt. Amos _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users