[squid-users] Squid + Mysql
adricustodio
adricustodio at uol.com.br
Wed Aug 19 12:17:38 UTC 2015
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
mysql_auth is this
#!/usr/bin/php
<?
$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] )
printf("OK\n");
else printf("ERR\n");
}
if ($erro) printf("ERR\n");
}
?>
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.
--
View this message in context: http://squid-web-proxy-cache.1019090.n4.nabble.com/Squid-Mysql-tp4672769.html
Sent from the Squid - Users mailing list archive at Nabble.com.
More information about the squid-users
mailing list