Foro de elhacker.net

Comunicaciones => Redes => Mensaje iniciado por: weggi en 31 Diciembre 2011, 19:34 pm



Título: ayuda con proxy
Publicado por: weggi en 31 Diciembre 2011, 19:34 pm
hola , felices fiestas :P

Lo que tengo pensado hacer es basicamente que al haberse conectado el cliente al servidodr proxy redireccione a una web automaticamente.

estoy usando squid en linux y e trasteado con iptables pero aun no logro lo deseado.

alguna persona que me ilumine?


Título: Re: ayuda con proxy
Publicado por: madpitbull_99 en 1 Enero 2012, 19:51 pm
Prueba con la siguiente directiva:

Código:
always_direct dominio1 dominio2

Eso redirigía el dominio1 al dominio2. Más información. (http://www.visolve.com/squid/squid24s1/externals.php#redirect_program)

O sino, con un script en Perl:

Citar
Squid can be used a reverse proxy to load balance several web servers, instead of using a hardware load balancer. This is useful because Squid can cache a lot of the content coming from the source web servers, thereby reducing their load. However, it isn't clear how to do an Apache style direct where all hostnames other than www.hostname.com get redirected to www.hostname.com. But using a director program it can be straight-forward.

Edit Steps

1.) In Perl write a simple redirector program like this one:

Código
  1.    #!/usr/bin/env perl
  2.    $|=1;
  3.    while (<>) {
  4.      $url = m/^([^ ]*)/;
  5.      if ($url !~ /^http:\/\/www\.hostname\.com/) {
  6.        $url =~ s@^http://www\.hostname\.com/(.*)@http://www.hostname.com/\1@;
  7.        print "301:$url\n";
  8.      } else {
  9.        print "$url\n";
  10.      }
  11.    }

2.) In your squid.conf file change the redirect_program variable, it's probably commented out, and specify where your redirector_program is, ex: /usr/sbin/redirect.pl

3.)  Make sure that the variable httpd_accel_uses_host_header is set to on, otherwise nothing will be redirected.