Ir al contenido

Artículos recientes

5
Mar

Como hacer Fabada Asturiana, Receta de la abuela Tradicional

Como hacer Fabada Asturiana, Receta de la abuela Tradicional

La fabada asturiana es uno de los platos por excelencia de la gastronomía asturiana junto con el pote asturiano de berzas. Los componentes de una buena fabada es la mezcla todos los ingredientes de la región, unas fabes de la granja (fabes típicas de Asturias para la preparación de pote y fabada) junto con el compango (morcilla, chorizo, panceta,.., productos derivados de la “matanza”).

En la región Asturiana es uno de los platos de cuchara por excelencia cuando empieza a apretar el frío ya por el Otoño e Invierno. La fabada y el pote asturiano, aunque compartan las fabes y el compango como ingredientes estrella, son diferentes comidas por completo.

La gastronomía asturiana es muy variada, a parte de éstos platos de cuchara podemos encontrar otros como las Fabes con Almejas, Escalopines de Ternera en Salsa de Queso Afuega’l pitu, Cachopo de Ternera, Picadillo de Chorizo,…

Además de la fabada asturiana, en ésta temporada de frío disponemos de otras recetas de cuchara tan apetecibles como el Alubias Blancas Estofadas, Cocido Madrileño, Ropa Vieja del Cocido, Alubias Pintas Estofadas con Verduras, Habas a la Catalana con Chorizo, Lentejas con Chorizo,…

Tiempo de preparación 5 min
Tiempo de cocción 3 h 10 min
Tiempo total 3 h 15 min
Raciones 4 personas

Equipamiento

  • 1 Cazuela grande
  • Espumadera

Ingredientes

  • 500 Gramos Fabas de la Granja
  • 2 Chorizos
  • 1 Morcilla
  • 1 Hueso de Jamón
  • 1 Trozo de Panceta
  • 1 Cebolla
  • 2 Dientes Ajo
  • 1 Hoja Laurel
  • 3-4 Hebras Azafrán
  • Sal (Si hiciera falta)

Elaboración paso a paso

  • Ponemos las fabas a remojo. Como casi todas las legumbres hay que ponerlas a remojo el día anterior para hidratar bien les fabes. Hay que tenerlas a remojo mínimo 12 horas, por eso es bueno ponerlas la noche anterior.

  • Preparamos los ingredientes. Antes de comenzar la receta preparamos los ingredientes en la encimera para disponer de ellos cuando los necesitemos.
  • Ponemos los ajos y la cebolla. Pelamos los ajos y la cebolla y los echamos en una Cacerola grande . Los echamos enteros porque al final de la receta hay que retirarlos. También el añadimos la hoja de laurel.
  • Añadimos les fabes. Una vez puestas a remojo les fabes, les quitamos todo el agua y miramos un poco por encima que les fabes estén bien (las que están estropeadas las retiramos). Escurridas les fabes las añadimos a la Cacerola grande  con la cebolla y los ajos y las cubrimos de agua dos dedos por encima de les fabes.
  • “Asustamos” les fabes. Ponemos a calentar les fabes a fuego máximo (Al 9 de 9 en mi Vitrocerámica ). Cuando empiece a hervir fuerte, le echamos un chorro de agua fría para romper la cocción (esto es lo que se conoce como “asustar les fabes“. Éste proceso lo hacemos durante 3 veces.** Cada cierto tiempo le añadiremos agua fría a la cocción para “asustar” las fabes para así romper momentáneamente la ebullición y evitar que se cristalice el almidón.
  • Echamos el compango. El compango es el acompañamiento cárnico ahumado empleado en la elaboración de la fabada y el pote asturiano. Le añadimos los chorizos, la morcilla (Podemos ponerle unos palillos en los extremos para evitar que se rompa), el hueso de jamón y el trozo de panceta.
  • Iniciamos la cocción. Una vez echados todos los ingredientes le añadimos las hebras de azafrán. Con la ayuda de una Espumadera  le vamos quitando toda la espuma que va apareciendo.
  • Las dejamos cocer durante 3 horasLas ponemos a cocer al fuego máximo hasta que comiencen a hervir. Cuando eso, bajamos el fuego a fuego suave (Al 6 de 9 en mi Vitrocerámica ) durante 3 horas.** El fuego lento depende mucho de cada cocina. Las fabes tienen que hervir todo el rato, si en vuestras cocinas hierven a fuego más bajo pues bajar el fuego.
  • Final de la fabada. Pasado el tiempo de cocción miramos si necesita sal (Generalmente no necesita pues el compango le aporta la sal que necesita) y si eso se la añadimos al final. También quitamos la cebolla y los ajos y los retiramos.
  • Lista para degustar. La fabada como mejor está es cuando la dejamos reposar unas cuantas horas, pues la salsa va espesando y deja un sabor buenísimo.
19
Sep

Carne guisada (guiso de carne con patatas)

En este guiso o estofado se cocina, la carne será cortada en trozos pequeños, por lo que es un plato de cuchara ideal para comer cualquier día del año.

Además añadiremos a la carne, patatas y zanahorias que harán de este plato un plato único muy completo, se puede preparar en la víspera por lo que esta carne guisada con patatas  es perfecta para llevar en táper si tenéis que comer fuera. Eso sí, no se puede congelar por las patatas, no todo iba a ser perfecto.

Ingredientes

  • 600 g de cabezada de cerdo
  • 3 dientes de ajo
  • 1 cebolla grande
  • 1 pimiento verde
  • 3 patatas
  • 4 zanahorias
  • 2 hojas de laurel
  • 1 vasito de vino blanco
  • Agua
  • Sal
  • Pimienta negra molida
  • Aceite de oliva virgen o virgen extra

Cómo hacer un guiso de carne con patatas

  • Ponemos en una cazuela un poco de aceite de oliva virgen o virgen extra y sofreímos el pimiento, los ajos y la cebolla que hemos picado previamente.
  • Una vez que comiencen a dorarse, añadimos la carne salpimentada que hemos pedido en la carnicería que nos corten y rehogamos.
  • Cuando la carne esté, añadimos las hojas de laurel y el vino, cocinamos un par de minutos y cubrimos con agua.
  • Tapamos y dejamos cocinar a fuego suave unos 40 minutos.
  • Pasado este tiempo, añadimos las zanahorias peladas y cortadas en rodajas y las patatas que pelamos y cortamos chascándolas. Volvemos a tapar y dejamos cocinar otros 30 o 40 minutos.

Cómo degustar la carne guisada

Al ser un plato de cuchara que lleva patatas y verduras se puede tomar como plato único, porque sin duda es muy completo desde el punto de vista nutricional. Podéis prepararlo con antelación y calentar en el momento de servir, algo que incluso mejorará y concentrará el sabor de nuestro guiso. Sin embargo no es aconsejable congelarlo, ya que al llevar patatas éstas perderían su consistencia en el descongelado.

Trucos para hacer un guiso de carne con patatas

  • Guiso de carne en olla express: Podéis preparar esta carne guisada con patatas en la olla rápida, de este forma acortaréis el tiempo de cocción.
  • Pimiento: Si no os gusta el pimiento verde, no lo pongáis o podéis sustituirlo en esta receta de carne guisada con patatas por pimiento rojo.
  • Cómo espesar el caldo del guiso de carne: Si el caldo os ha quedado muy líquido, sacad una o dos patatas, las chafáis con el tenedor y las incorporáis a la carne guisada con patatas, notaréis como se traba enseguida.
  • Cómo limpiar la carne: Aunque os limpien de grasa la carne en la carnicería, si al llegar a casa notáis que algún trozo tiene mucha grasa, podéis quitarla con un cuchillo o con unas tijeras.
  • Tipo de carne para el guiso: Podéis sustituir la carne de cerdo por carne de ternera o hacer un guiso de pollo, si la hacéis con ternera tened en cuenta que el tiempo de cocción será mucho mayor.

 

23
Mar

Microsoft Exchange Server Vulnerabilities Mitigations – updated March 15, 2021

Para comprobar si el servidor es vulnerable se puede utilizar el siguiente
script del fabricante:
 
 
 
Adicionalmente, si quieren realizar una revisión en su red, pueden utilizar
este comando:
 
nmap -Pn -n –script=http-vuln-exchange,http-vuln-cve2021-26855 -p 443
 
que hace uso de los siguientes scripts:
 
 
 
Se recomienda la actualización de los sistemas afectados lo antes posible o
al menos, de forma temporal hasta poder realizar la actualización, no
permitir el acceso desde internet y aplicar las medidas de mitigación
indicadas por Microsoft:
 
 
 
Se han detectado múltiples actores maliciosos buscando y explotando estas
vulnerabilidades, los equipos que no hayan sido todavía parcheados podrían
considerarse comprometidos, por lo que se recomienda como mínimo realizar
un análisis en busca de webshells y otros indicadores de compromiso.
 
Explotando estas vulnerabilidades un atacante podría:
– Suplantar el servidor.
– Cargar archivos maliciosos en el sistema.
– Ejecutar código sin necesidad previa de autenticación.
– Robar información del servidor.
– Comprometer incluso el directorio activo mediante la generación de
«Golden tickets».
 
Sería recomendable recoger las evidencias forenses del servidor Exchange,
ponerlo en cuarentena, y si es posible, instalar uno nuevo desde un backup
confiable. Si existiesen evidencias de uso de alguna webshell, convendría
asimismo reconstruir por completo el directorio activo, forzando cambios de
contraseña para todos los usuarios.
 
Microsoft ha actualizado su herramienta MSERT que permite realizar escaneos
de seguridad para detectar la existencia de posibles webshells de
ProxyLogon y posteriormente eliminarlas. En el siguiente enlace dispone de
más información sobre la instalación y ejecución de la herramienta MSERT:
 
 
 
 
Disponen de más información sobre las vulnerabilidades e identificación de
evidencias en los siguientes enlaces:
 
 
 
 
 
 
 
Las actualizaciones para estas vulnerabilidades se encuentran disponibles
en:
 
 
 
To check if the server is vulnerable you can use the following manufacturer
script:
 
 
 
Additionally, if you want to perform a check on your network, you can use
this command:
 
nmap -Pn -n –script=http-vuln-exchange,http-vuln-cve2021-26855 -p 443
 
which makes use of the following scripts:
 
 
 
Multiple malicious actors have been detected looking for and exploiting
these vulnerabilities, computers that have not yet been patched could be
considered compromised, so it is recommended as a minimum to perform an
analysis in search of webshells and other indicators of compromise.
 
By exploiting these vulnerabilities an attacker could:
– Impersonate the server.
– Upload malicious files to the system.
– Execute code without prior authentication.
– Steal information From the server.
– Compromise even the active directory by generating “Golden tickets”.
 
It would be advisable to collect forensic evidence From the Exchange
server, quarantine it, and if possible, install a new one From a reliable
backup. If there is evidence of the use of a webshell, it would also be
advisable to completely rebuild the active directory, forcing password
changes for all users.
 
Microsoft has updated its MSERT tool that allows security scans to be
carried out to detect the existence of possible ProxyLogon webshells and
subsequently eliminate them. In the following link you have more
information about the installation and execution of the MSERT tool:
 
 
 
You have more information about vulnerabilities and identification of
evidence in the following links:
 
 
 
 
 
 
 
Updates for these vulnerabilities are available at:
 
 
 
18
Dic

Recetas para la vuelta al cole: Las lentejas más sencillas

Ingredientes para 4 personas

  • 300 gr de lentejas pardinas, 1 chorizo, 1/2 cebolla, 1 patata, 1 hoja de laurel, 1 zanahoria grande, 1/2 puerro, 3 cucharadas de tomate frito, 1 punta de jamón, 1 diente de ajo

Cómo hacer lentejas sencillas

Las lentejas pardinas, las pequeñitas normalmente salen muy ricas y necesitan una breve cocción para estar en su punto. Además, no es necesario dejarlas en remojo por lo que si queremos, podemos decidir hacer unas lentejas y tenerlas listas en menos de una hora.

En una cacerola colocamos las lentejas, la cebolla, la patata pelada, el puerro y la zanahoria cortada en trozos pequeños. Añadimos el chorizo cortado en rodajas y el jamón o si queremos un trozo de panceta para enriquecer el sabor del plato.

Agregamos el laurel y agua para cubrir todos los ingredientes y lo ponemos a cocer. En cuanto empiece a hervir, bajamos el fuego, añadimos el tomate frito y dejamos que cueza despacio durante unos 20-25 minutos. Con un cazo retiramos la parte superior del caldo para quitarle la grasa que suelte el chorizo. De esa forma el caldo quedará de color marrón y no de color rojo.

En una sartén freímos el diente de ajo muy muy picado, un cuarto de cebolla y cuando está blandito, le añadimos una pizca de salsa de tomate. Trituramos este sofrito con una cucharada del caldo de las lentejas con la batidora y lo incorporamos a la cacerola de las lentejas, dejando que de un último hervor con ellas.

Retiramos el puerro, el laurel y la cebolla, que desecharemos, probamos de sal, –normalmente no hace falta añadir por el sabor que aportan el chorizo y el jamón–, y si las lentejas están ya tiernas, las dejamos reposar.

Tiempo de elaboración:  40 minutos Dificultad:  Fácil

18
Oct

Receta de guiso de patatas con sepia

Personas: 4 Tiempo: Dificultad: Fácil

Ingredientes

  • 1 kg de sepia limpia
  • 500 g de patatas
  • 150 g de tomate triturado (natural o en conserva)
  • 1 puñado de guisantes (opcional)
  • 1 cebolla
  • 2 o 3 dientes de ajo
  • 1 cucharadita de pimentón dulce
  • 1 o 2 hojas de laurel
  • 2 o 3 cucharadas de aceite de oliva virgen
  • 1 chorrito de vino blanco
  • 1 l de caldo de pescado
  • Perejil fresco
  • Sal y pimienta negra molida

    Elaboración

    1. Pelar la cebolla y picarla finamente.
    2. Pelar los dientes de ajo, quitarles el germen y picarlos también muy fino.
    3. Trocear la sepia. Salpimentar.
    4. En una olla, calentar el aceite de oliva y sofreír la cebolla unos 5 o 6 minutos, hasta que esté tierna y ligeramente transparente.
    5. Incorporar la sepia y rehogarla unos minutos. Removiendo un par de veces.
    6. Mojar con el chorrito de vino blanco, mezclar bien y dejar que se cocine un par de minutos a fuego medio-alto para que el alcohol se evapore.
    7. Apartar del fuego. Añadir el ajo y la cucharadita de pimentón y mezclar bien. Volver a calentar y sofreír un par de minutos más.
    8. Agregar el tomate triturado, mezclar bien y dejar que el tomate pierda la mayor parte del agua.
    9. Cubrir con el caldo de pescado, tapar y calentar.
    10. Mientras tanto, pelar las patatas y cortarlas en trozos del tamaño de un bocado. Lo mejor es terminar el corte rasgando la patata para que así suelte almidón y la salsa coja cuerpo.
    11. Incorporar las patatas a la olla junto con el laurel, salpimentar y cocer unos 20 minutos hasta que las patatas estén medio tiernas. Unos 7 u 8 minutos en olla exprés.
    12. Incorporar las patatas a la olla junto con el laurel, salpimentar y cocer unos 20 minutos hasta que las patatas estén medio tiernas. Unos 7 u 8 minutos en olla exprés.
    13. Probar y rectificar de sal si fuera necesario.
    14. Incorporar los guisantes y cocer unos 5 minutos más.
    15. Cuando los guisantes y las patatas estén tiernos, apagar el fuego y dejar reposar tapado unos 10 minutos.
    16. Y ya está. Para servir, se puede espolvorear con perejil picado. ¡Buen provecho!
10
May

Sopa de cebolla

A la hora de entrar en calor y poder así soportar las bajas temperaturas invernales, no hay nada mejor como una rica sopa caliente de cebolla. De seguro que alguna de Nosotras somos frioleras, es por ello que os enseñaremos a preparar este delicioso plato ideal para los días de lluvia y frío.

Leer más »

18
Mar

Solomillo de Cerdo en Salsa al Pedro Ximénez

Ingredientes para hacer Solomillo de Cerdo en Salsa Pedro Ximénez (para 4 personas):

  • 4 solomillos de cerdo (1 por persona). Si son muy grandes compra 2 (medio para cada uno)
  • 1 cebolla grande (250-300 gramos)
  • 250 ml (un cuarto de litro o un vaso de tubo) de caldo de pollo
  • 125 ml (medio vaso de tubo) de vino Pedro Ximénez
  • 5 cucharadas de pasas de moscatel (unos 80 gramos)
  • 1 cucharada de harina de trigo
  • aceite de oliva
  • sal y pimienta negra

Leer más »

1
Ene

Patatas con carne

Ingredientes para hacer Papas con Carne (para 4 personas):

  • 800 gramos de carne de cerdo (pídele al carnicero carne de cerdo para guisar)
  • 1 kilo de patatas
  • 2 zanahorias grandes
  • 1 cebolla bien grande (250-300 gramos)
  • 4 dientes de ajo
  • 4 vasos de agua (1 litro)
  • 1/2 vaso de vino blanco (yo usé Fino Montilla Moriles)
  • 8 cucharadas de aceite de oliva (unos 80 ml)
  • 1 hoja de laurel
  • sal y pimienta negra

Leer más »

10
Feb

HAProxy – IIS and X-Forward-For Header

IIS and X-Forwarded-For Header

So, you’re using IIS and you want to track your clients by IP address in your IIS logs. Unfortunately, out of the tin, this is not directly supported. The X-Forwarded-For (XFF) HTTP header is an industry standard method to find the IP address of a client machine that is connecting to your web server via an HTTP proxy, load balancer etc. Fortunately, depending on the version of IIS being used, there are a number of ways to enable this.

A – IIS 7 & later :

Microsoft do now have a solution – it’s called IIS Advanced Logging. This is an installable IIS feature and can be downloaded here. Once installed on the IIS server, you’ll see an extra option called ‘Advanced Logging’ for the sites in IIS.

Once installed, follow the steps below to add the X-Forwarded-For log field to IIS:

1. From your Windows Server 2008 or Windows Server 2008 R2 device, open IIS Manager

2. From the Connections navigation pane, click the appropriate server, web site, or directory on which you are configuring Advanced Logging. The Home page appears in the main panel

3. From the Home page, under IIS, double-click Advanced Logging

4. From the Actions pane on the right, click Edit Logging Fields

5. From the Edit Logging Fields dialog box, click the Add Field button, and then complete the following:

-in the Field ID box, type X-Forwarded-For

-from the Category list, select Default

-from the Source Type list, select Request Header

-in the Source Name box, type X-Forwarded-For

-click the OK button in the Add Logging Field box, and then click the OK button in the Edit Logging Fields box

6. Click a Log Definition to select it. By default, there is only one: %COMPUTERNAME%-Server. The log definition you select must have a status of Enabled

7. From the Actions pane on the right, click Edit Log Definition

8. Click the Select Fields button, and then check the box for the X-Forwarded-For logging field

9. Click the OK button

10. From the Actions pane, click Apply

11. Click Return To Advanced Logging

12. In the Actions pane, click Enable Advanced Logging

Now, when you look at the logs the client IP address is included.

B – IIS 6 :

Unfortunatey the Microsoft solution mentioned above is not available for IIS 6. luckily there are a number of solutions available to address this limitation – some that cost money and others that have been released as open source. One excellent example that we’ve tested with our products is F5′s X-Forwarded-For ISAPI filter. It’s avaialable in both in 32 & 64 bit versions.

1. Download the zipped archive from here and extract to an appropriate folder

2. Navigate to the relevant version (32 or 64 bit)

3. Copy F5XForwardedFor.dll to a suitable location on your server, e.g. C:ISAPIfilters

4. Make sure you have ISAPI Filters enabled on your IIS server

5. Open IIS Manager, right-click the site and select Properties

6. Select the ISAPI Filters tab

7. Click ‘add’, then in the popup enter a suitable name and select the DLL file stored in step 3

8. Restart your website

That’s it – you should now start seeing the IP address of the client PC’s in your IIS logs rather than the IP of the load balancer.

———————————————————————————————————————————–

IIS X-Forward-For ISAPI Filter

A recent customer issue came up where they were load balancing servers but we unable to get the true client address logged in their IIS logs. They had their servers fronted by a BIG-IP and when clients would make requests the address passed to the server was the internal address of the BIG-IP and not that of the client.

This is a common issue with proxies and fortunately there is a standard for forwarding client information. It is the HTTP X-Forwarded-For header which is handled by most proxies. So, I set out to find an existing ISAPI filter to replace the c-ip (client ip) log value in IIS with the contents of the X-Forwarded-For header (if it exists). I was amazed to find that I couldn’t find a single instance of any open source (or even commercial) filter that would do this.

So, I dug out Visual Studio and whipped up a filter that does just that. It’s very basic and contains no user configuration so all you need to do is plug it into your Web Applications list of ISAPI Filters within the IIS Administration and you’re set to go.

We’ve released the source under the iControl End User License Agreement (available in any iControl SDK download). You can download it in the CodeShare section of DevCentral. If you find a way to optimize this filter, please let me know and I’ll update the sources here.

After 24-hours of posting, a customer already returned some performance testing on the filter indicating that it only effected the traffic by less than 1 percent. I’m sure there are ways to optimize the memory allocation in the filter to speed this up a bit more, but I’ll leave that for the community to work on.

Oh, and it should be noted that the X-Forwarded-For header isn’t supported the same way across all proxy products so you’ll want to make sure you test this out before using it. It is expecting the header to only contain an IP Address as it does a straight substitution on the value in the c-ip section of the log entry.

Enjoy!

6
Feb

HAProxy – Instalación, configuración, actualización…..

Pruebas con HAProxy.  Muy buena experiencia general, estupendo balanceo con muuuchas opciones.

Para más información y detalles de HAProxy

Instalar la distribucion de linux deseada, en mi caso opté por Debian, Ubunto lo traé integrado en el repositorio.

Configurar las tarjetas de red con ip´s fijas y las que sean necesarias según el entorno, para ello editamos el fichero /etc/network/interfaces:

Como ejemplo:

nano /etc/network/interfaces

allow-hotplug eth0
auto eth0
iface eth0 inet static
address 10.0.0.1
netmask 255.255.254.0
gateway 10.0.1.254
dns-nameservers 10.0.0.21 10.0.0.22

auto eth0:0
iface eth0:0 inet static
address 10.0.1.1
netmask 255.255.254.0
gateway 10.0.1.254
dns-nameservers 10.0.0.21 10.0.0.22
——————————————————————–

Actualizar el sistema.

apt-get update

apt-get upgrade

apt-get dist-update

INSTALAMOS:

Aquí comienza la instación de los requisitos para HAProxy:

apt-get install build-essential make libpcre3 libpcre3-dev

apt-get install build-essential libssl-dev libpopt-dev git libpcre3-dev

apt-get install linux-kernel-headers  (opcional)

——————————————————————————————————————————————

Opcional para evitar estos avisos o errores con versiones de kernel 2.6.xx:

PCRE library supports JIT : no (USE_PCRE_JIT not set)

PCRE library supports JIT : no (libpcre build without JIT?)

——————————————————————————————————————————————

cd /usr/src/

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz

tar xzfv pcre-8.32.tar.gz

cd pcre-8.32

./configure –enable-jit –enable-utf && make

——————————————————————————————————————————————
Ahora descargamos el programa HAProxy:

cd /usr/src/

wget http://haproxy.1wt.eu/download/1.5/src/devel/haproxy-1.5-dev21.tar.gz

tar xzfv haproxy-1.5-dev21.tar.gz

cd haproxy-1.5-dev21

COMPILAMOS:

Tenemos varias opciones de compilación, yo utilizo la última (en negrita):

make TARGET=linux2628 CPU=native USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1

make TARGET=linux2628 CPU=native USE_STATIC_PCRE=1 USE_LINUX_TPROXY=1

make TARGET=linux2628 CPU=native USE_PCRE=1 USE_STATIC_PCRE=1 USE_LINUX_TPROXY=1 USE_POLL=default USE_OPENSSL=1 USE_ZLIB=1

make TARGET=custom CPU=native USE_PCRE=1 USE_LIBCRYPT=1 USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1

make TARGET=linux2628 CPU=native USE_LINUX_SPLICE=1 USE_LIBCRYPT=1 USE_POLL=default USE_PCRE=1

make TARGET=linux2628 CPU=native USE_PCRE=1 USE_LIBCRYPT=1 USE_LINUX_SPLICE=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_ZLIB=1

make TARGET=linux2628 CPU=native USE_LINUX_SPLICE=1 USE_LIBCRYPT=1 USE_POLL=default USE_PCRE=1 USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1

make TARGET=linux2628 CPU=native USE_ZLIB=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1 PCRE_INC=/usr/src/pcre-8.32/ \PCRE_LIB=/usr/src/pcre-8.32/.libs

make TARGET=linux2628 CPU=native USE_LINUX_SPLICE=1 USE_LIBCRYPT=1 USE_POLL=default USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1 PCRE_INC=/usr/src/pcre-8.32/ \PCRE_LIB=/usr/src/pcre-8.32/.libs

make TARGET=linux2628 CPU=native ARCH=x86_64 USE_LINUX_SPLICE=1 USE_LIBCRYPT=1 USE_POLL=default USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1 PCRE_INC=/usr/src/pcre-8.32/ \PCRE_LIB=/usr/src/pcre-8.32/.libs

make install

CREAMOS LINKS y CARPETAS:

ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy

mkdir /usr/share/haproxy

nano /etc/init.d/haproxy  (creamos script de inicio-parada del sevicio)

—————————————————————————

#!/bin/sh
### BEGIN INIT INFO
# Provides:          haproxy
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: fast and reliable load balancing reverse proxy
# Description:       This file should be used to start and stop haproxy.
### END INIT INFO

# Author: Arnaud Cornet <acornet@debian.org>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
PIDFILE=/var/run/haproxy.pid
CONFIG=/etc/haproxy/haproxy.cfg
HAPROXY=/usr/sbin/haproxy
EXTRAOPTS=
ENABLED=0

test -x $HAPROXY || exit 0
test -f “$CONFIG” || exit 0

if [ -e /etc/default/haproxy ]; then
. /etc/default/haproxy
fi

test “$ENABLED” != “0” || exit 0

[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions

haproxy_start()
{
start-stop-daemon –start –pidfile “$PIDFILE” \
–exec $HAPROXY — -f “$CONFIG” -D -p “$PIDFILE” \
$EXTRAOPTS || return 2
return 0
}

haproxy_stop()
{
if [ ! -f $PIDFILE ] ; then
# This is a success according to LSB
return 0
fi
for pid in $(cat $PIDFILE) ; do
/bin/kill $pid || return 4
done
rm -f $PIDFILE
return 0
}

haproxy_reload()
{
$HAPROXY -f “$CONFIG” -p $PIDFILE -D $EXTRAOPTS -sf $(cat $PIDFILE) \
|| return 2
return 0
}

haproxy_status()
{
if [ ! -f $PIDFILE ] ; then
# program not running
return 3
fi

for pid in $(cat $PIDFILE) ; do
if ! ps –no-headers p “$pid” | grep haproxy > /dev/null ; then
# program running, bogus pidfile
return 1
fi
done

return 0
}

case “$1” in
start)
log_daemon_msg “Starting haproxy” “haproxy”
haproxy_start
ret=$?
case “$ret” in
0)
log_end_msg 0
;;
1)
log_end_msg 1
echo “pid file ‘$PIDFILE’ found, haproxy not started.”
;;
2)
log_end_msg 1
;;
esac
exit $ret
;;
stop)
log_daemon_msg “Stopping haproxy” “haproxy”
haproxy_stop
ret=$?
case “$ret” in
0|1)
log_end_msg 0
;;
2)
log_end_msg 1
;;
esac
exit $ret
;;
reload|force-reload)
log_daemon_msg “Reloading haproxy” “haproxy”
haproxy_reload
case “$?” in
0|1)
log_end_msg 0
;;
2)
log_end_msg 1
;;
esac
;;
restart)
log_daemon_msg “Restarting haproxy” “haproxy”
haproxy_stop
haproxy_start
case “$?” in
0)
log_end_msg 0
;;
1)
log_end_msg 1
;;
2)
log_end_msg 1
;;
esac
;;
status)
haproxy_status
ret=$?
case “$ret” in
0)
echo “haproxy is running.”
;;
1)
echo “haproxy dead, but $PIDFILE exists.”
;;
*)
echo “haproxy not running.”
;;
esac
exit $ret
;;
*)
echo “Usage: /etc/init.d/haproxy {start|stop|reload|restart|status}”
exit 2
;;
esac

:

—————————————————————————————

chmod +x /etc/init.d/haproxy

update-rc.d haproxy defaults

nano /etc/default/haproxy (creamos el fichero de configuración para habilitarlo)

————————————————————————————

# Set ENABLED to 1 if you want the init script to start haproxy.
ENABLED=1
# Add extra flags here.
#EXTRAOPTS=”-de -m 16″

—————————————————————————————

groupadd haproxy
useradd -g haproxy haproxy

mkdir /etc/haproxy

mkdir /etc/haproxy/errors

cp /usr/src/haproxy-1.5-dev21/examples/errorfiles/* /etc/haproxy/errors

nano /etc/haproxy/haproxy.cfg

service haproxy restart

Ya estaría funcionando.

——————————————————————————————————————————————

Lo siguiente es para organizar los logs y que se eliminen pasado un tiempo (28 días).

nano /etc/rsyslog.d/haproxy.conf

if ($programname == ‘haproxy’ and $syslogseverity-text == ‘info’) then -/var/log/haproxy/haproxy-info.log
& ~
if ($programname == ‘haproxy’ and $syslogseverity-text == ‘notice’) then -/var/log/haproxy/haproxy-notice.log
& ~

nano /etc/logrotate.d/haproxy

/var/log/haproxy/*.log {
daily
missingok
rotate 28
compress
delaycompress
notifempty
create 644 root adm
sharedscripts
postrotate
/etc/init.d/haproxy reload > /dev/null
endscript
}

——————————————————————————————————————————————

Para actualizar o cambiar de versión de HAProxy:

cd /usr/src/haproxy-xxxxxx
make clean
make TARGET=linux2628 CPU=native ARCH=x86_64 USE_LINUX_SPLICE=1 USE_LIBCRYPT=1 USE_POLL=default USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1 PCRE_INC=/usr/src/pcre-8.32/ \PCRE_LIB=/usr/src/pcre-8.32/.libs
sudo make install

Ya estaría cambiada la versión.

——————————————————————————————————————————————

Reiniciar el servicio sin apenas parada, aunque de por sí es muy rápido.

haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)

haproxy -f configfile -sf

——————————————————————————————————————————————

Si queremos tener varios HAProxy por si falla el principal que tome el control otro, podemos utilizar Keepalived.

Primero lo instalamos.

apt-get install -y keepalived

update-rc.d keepalived defaults

echo “net.ipv4.ip_nonlocal_bind = 1” >> /etc/sysctl.conf
sysctl -p

La configuración del principal o master sería (XXX.XXX.XXX.XXX = IP Virtual deseada):

Master

nano /etc/keepalived/keepalived.conf

———————————————————————————————–

vrrp_script chk_haproxy {
script “killall -0 haproxy”   # verify the pid existance
interval 2                    # check every 2 seconds
weight 2                      # add 2 points of prio if OK
}

vrrp_instance VI_1 {
interface eth0                # interface to monitor
state MASTER
virtual_router_id 51          # Assign one ID for this route
priority 101                  # 101 on master, 100 on backup
virtual_ipaddress {
XXX.XXX.XXX.XXX            # the virtual IP
}
track_script {
chk_haproxy
}
}

La configuración del backup o esclavo sería (XXX.XXX.XXX.XXX = IP Virtual deseada):

Esclavo

nano /etc/keepalived/keepalived.conf

vrrp_script chk_haproxy {
script “killall -0 haproxy”   # verify the pid existance
interval 2                    # check every 2 seconds
weight 2                      # add 2 points of prio if OK
}

vrrp_instance VI_1 {
interface eth0                # interface to monitor
state MASTER
virtual_router_id 51          # Assign one ID for this route
priority 100                  # 101 on master, 100 on backup
virtual_ipaddress {
XXX.XXX.XXX.XXX            # the virtual IP
}
track_script {
chk_haproxy
}
}

————————————————————————————————–

/etc/init.d/keepalived start

ip a | grep -e inet.*eth0

cat /var/log/messages | grep VRRP_Instance

——————————————————————————————————————————————

Para comprobar si la configuración del HAProxy es correcta antes de ponerla en producción:

haproxy -f /etc/haproxy/haproxy.cfg -c
——————————————————————————————————————————————

Saber versión instalada de HAProxy y compilación:

haproxy -vv

——————————————————————————————————————————————

Ejemplo de fichero de configuración haproxy.cfg para versión 1.4 (XXX.XXX.XXX.XXX = IP Virtual):

———————————————- Inicio fichero haproxy.cfg 1.4.xx ——————————————–

global
daemon
log /dev/log local0 info
log /dev/log local0 notice
maxconn 1000
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.stat mode 600 level admin

userlist stats-auth
group admin             users Admin
user  Admin  insecure-password password
group readonly          users user
user  user        insecure-password password

defaults
backlog 10000
default-server inter 3s rise 2 fall 3
log global
option  contstats
option  dontlognull
option  redispatch
retries 3
timeout client 300s
timeout connect 30s
timeout http-keep-alive 5s
timeout http-request 15s
timeout queue 30s
timeout tarpit 1m
timeout server 300s

frontend ft_ftp_tcp
bind *:21 name ftp
mode tcp
maxconn 2000
default_backend bk_ftp_server_pool

frontend ft_sftp_tcp
bind XXX.XXX.XXX.XXX:22 name sftp
mode tcp
maxconn 2000
default_backend bk_sftp_server_pool

frontend ft_smtpsrv_tcp
bind XXX.XXX.XXX.XXX:25 name smtp
mode tcp
maxconn 2000
default_backend bk_smtpsrv_server_pool

frontend ft_web_http
bind *:80 name http
mode http
maxconn 10000
default_backend bk_web_server_pool

frontend ft_pop_tcp
bind *:110 name imap
mode tcp
maxconn 2000
default_backend bk_pop_server_pool

frontend ft_imap_tcp
bind *:143 name imap
mode tcp
maxconn 2000
default_backend bk_imap_server_pool

frontend ft_exchange_tcp
bind *:443 name https
mode tcp
maxconn 10000
default_backend bk_exchange_server_pool

frontend ft_smtpcli_tcp
bind *:587 name smtpcli
bind *:5587 name smtpcli
mode tcp
maxconn 2000
default_backend bk_smtpcli_server_pool

frontend ft_ftps_tcp
bind *:990 name imaps
mode tcp
maxconn 2000
default_backend bk_imaps_server_pool

frontend ft_imaps_tcp
bind *:993 name imaps
mode tcp
maxconn 2000
default_backend bk_imaps_server_pool

frontend ft_pops_tcp
bind *:995 name pops
mode tcp
maxconn 2000
default_backend bk_pops_server_pool

frontend ft_eset_tcp
bind *:2221-2222 name esethttp
mode tcp
maxconn 2000
default_backend bk_eset_server_pool

frontend ft_antispam_tcp
bind *:8081 name antispam_http
bind *:8481 name antispam_https
mode tcp
maxconn 2000
default_backend bk_antispam_server_pool

frontend ft_weblog_tcp
bind *:9991 name weblog
mode tcp
maxconn 2000
default_backend bk_weblog_server_pool

backend bk_ftp_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server FTP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 21
server FTP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 21

backend bk_sftp_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server SFTP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 22
server SFTP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 22

backend bk_smtpsrv_server_pool
option tcplog
option abortonclose
option smtpchk HELO dominio.com
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server SMTP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 25
server SMTP_1.XX 10.0.1.1XXweight 1 maxconn 1000 check port 25 backup

backend bk_web_server_pool
mode http
option httpclose
option forwardfor
option httplog
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server WEB_1.XX 10.0.1.XX:80 weight 1 maxconn 5000 check port 82
server WEB_1.XX 10.0.1.XX:80 weight 1 maxconn 5000 check port 82

backend bk_pop_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server POP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 110
server POP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 110

backend bk_imap_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server IMAP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 143
server IMAP_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 143

backend bk_exchange_server_pool
option tcplog
option abortonclose
option ssl-hello-chk
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server HTTPS_1.XX 10.0.1.XX:443 weight 1 maxconn 5000 check port 443
server HTTPS_1.XX 10.0.1.XX:443 weight 1 maxconn 5000 check port 443

backend bk_smtpcli_server_pool
option tcplog
option abortonclose
option smtpchk HELO dominio.com
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server SMTPCLI_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 587
server SMTPCLI_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 587

backend bk_ftps_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server FTPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 990
server FTPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 990

backend bk_imaps_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server IMAPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 993
server IMAPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 993

backend bk_pops_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server POPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 995
server POPS_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 995

backend bk_eset_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server ESET_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 2221
server ESET_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 2221

backend bk_antispam_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server ANTISPAM_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 8481
server ANTISPAM_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 8481 backup

backend bk_weblog_server_pool
option tcplog
option abortonclose
stick-table type ip size 10240k expire 60m
stick on src
balance leastconn
server WEBLOG_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 9991
server WEBLOG_1.XX 10.0.1.XX weight 1 maxconn 1000 check port 9991

listen admin
bind *:8080
mode http
acl AUTH       http_auth(stats-auth)
acl AUTH_ADMIN http_auth_group(stats-auth) admin
http-check expect status 200
maxconn    10
option abortonclose
option forceclose
option httpclose
option http-server-close
stats admin if AUTH_ADMIN
stats enable
stats hide-version
stats http-request auth unless AUTH
stats refresh 30s
stats show-desc RBHAProxyD1
stats show-legends
stats uri /stats

———————————————-Final fichero haproxy.cfg 1.4.xx ———————————————-

Ejemplo de fichero de configuración haproxy.cfg para versión 1.5 (XXX.XXX.XXX.XXX = IP Virtual):

———————————————- Inicio fichero haproxy.cfg 1.5.xx ————————————–

global
daemon
log /dev/log local0 info
log /dev/log local0 notice
maxconn 1000
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.stat mode 600 level admin

userlist stats-auth
group admin             users Admin
user  Admin  insecure-password password
group readonly          users user
user  user        insecure-password password

defaults
backlog 10000
compression algo gzip
compression type text/html text/html;charset=utf-8 text/plain text/css text/javascript application/x-javascript application/javascript application/ecmascript application/rss+xml application/atomsvc+xml application/atom+xml application/atom+xml;type=entry application/atom+xml;type=feed application/cmisquery+xml application/cmisallowableactions+xml application/cmisatom+xml application/cmistree+xml application/cmisacl+xml application/msword application/vnd.ms-excel application/vnd.ms-powerpoint
default-server inter 3s rise 2 fall 3
log /dev/log local0 info
log /dev/log local0 notice
maxconn 100
option  contstats
option  dontlognull
option    log-health-checks
option  redispatch
option    tcp-smart-accept
option    tcp-smart-connect
retries 3
timeout client 300s
timeout connect 30s
timeout http-keep-alive 30s
timeout http-request 60s
timeout queue 300s
timeout server 600s
timeout tarpit 300s

frontend f-ftp-in
bind *:21 name ftp
mode tcp
maxconn 100
stick-table type ip size 200 expire 30s store conn_cnt
tcp-request content reject if { src_updt_conn_cnt gt 3 }
default_backend b-ftp

frontend f-sftp-in
bind XXX.XXX.XXX.XXX:22 name sftp
mode tcp
maxconn 100
stick-table type ip size 200 expire 30s store conn_cnt
tcp-request content reject if { src_updt_conn_cnt gt 3 }
default_backend b-sftp

frontend f-smtpsrv-in
bind XXX.XXX.XXX.XXX:25 name smtp
mode tcp
maxconn 100
default_backend b-smtpsrv

frontend f-http-in
bind *:80 name http
mode http
maxconn 200
option forceclose
option forwardfor
option httpclose
option httplog
option http-server-close
default_backend b-http

frontend f-pop-in
bind *:110 name pop3
bind *:995 name pop3s
mode tcp
maxconn 100
default_backend b-pop

frontend f-imap-in
bind *:143 name imap
bind *:993 name imaps
mode tcp
maxconn 100
default_backend b-imap

frontend f-https-in
bind *:443 name https
mode tcp
acl aplicaciones req_ssl_sni -i aplicaciones.dominio.com
acl aplicaciones2 req_ssl_sni -i aplicaciones2.dominio.com
acl aplicaciones3 req_ssl_sni -i aplicaciones3.dominio.com
maxconn 200
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend b-aplicaciones if aplicaciones
use_backend b-aplicaciones2 if aplicaciones2
use_backend b-aplicaciones3 if aplicaciones3
default_backend b-https

frontend f-smtpcli-in
bind *:587 name smtpcli
bind *:5587 name smtpcli
mode tcp
maxconn 100
default_backend b-smtpcli

frontend f-ftps-in
bind *:990 name imaps
mode tcp
maxconn 100
stick-table type ip size 200 expire 30s store conn_cnt
tcp-request content reject if { src_updt_conn_cnt gt 3 }
default_backend b-ftps

frontend f-eset-in
bind *:2221-2222 name esethttp
mode tcp
maxconn 100
default_backend b-eset

frontend f-mysql-in
bind *:3306 name mysql
mode tcp
maxconn 200
default_backend b-mysql

frontend f-ums-in
bind *:8015 name antispam_http
mode http
maxconn 100
option forceclose
option forwardfor
option httpclose
option httplog
option http-server-close
default_backend b-ums

frontend f-antispam-in
bind *:8081 name antispam_http
mode http
maxconn 100
option forceclose
option forwardfor
option httpclose
option httplog
option http-server-close
default_backend b-antispam

frontend f-weblog-in
bind *:9991 name weblog
mode http
maxconn 100
option forceclose
option forwardfor
option httpclose
option httplog
option http-server-close
default_backend b-weblog

backend b-ftp
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option tcp-check expect string 220
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server FTP_1.XX 10.0.1.XX:21 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server FTP_1.XX 10.0.1.XX:21 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-sftp
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option tcp-check
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server SFTP_1.XX 10.0.1.XX:22 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server SFTP_1.XX 10.0.1.XX:22 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-smtpsrv
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option smtpchk HELO dominio.com
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server SMTP_1.XX 10.0.1.XX:25 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server SMTP_1.XX 10.0.1.XX:25 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions backup

backend b-http
mode http
http-check expect status 200
balance roundrobin
option abortonclose
option forceclose
option forwardfor
option httpchk
option httpclose
option httplog
option http-server-close
stick-table type ip size 10240k expire 60m
stick on src
server HTTP_1.XX 10.0.1.XX:80 weight 1 maxconn 200 check port 82 inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server HTTP_1.XX 10.0.1.XX:80 weight 1 maxconn 200 check port 82 inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-pop
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option tcplog
option tcp-check expect string +OK
stick-table type ip size 10240k expire 60m
stick on src
server POP_1.XX 10.0.1.XX:110 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server POP_1.XX 10.0.1.XX:110 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-imap
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option tcplog
option tcp-check expect string * OK
stick-table type ip size 10240k expire 60m
stick on src
server IMAP_1.XX 10.0.1.XX:143 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server IMAP_1.XX 10.0.1.XX:143 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-https
mode tcp
balance leastconn
acl clienthello req_ssl_hello_type 1
acl serverhello rep_ssl_hello_type 2
option abortonclose
option  persist
option  redispatch
option ssl-hello-chk
option tcplog
stick-table type binary len 32 size 10240k expire 60m
stick on payload_lv(43,1) if clienthello
stick store-response payload_lv(43,1) if serverhello
tcp-request content accept if clienthello
tcp-request inspect-delay 5s
tcp-response content accept if serverhello
server HTTPS_1.XX 10.0.1.XX:443 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server HTTPS_1.XX 10.0.1.XX:443 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-aplicaciones
mode tcp
balance leastconn
acl clienthello req_ssl_hello_type 1
acl serverhello rep_ssl_hello_type 2
option abortonclose
option ssl-hello-chk
option tcplog
stick-table type binary len 32 size 10240k expire 60m
stick on payload_lv(43,1) if clienthello
stick store-response payload_lv(43,1) if serverhello
tcp-request content accept if clienthello
tcp-request inspect-delay 5s
tcp-response content accept if serverhello
server HTTPS_0.XX 10.0.0.XX:443 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-aplicaciones2
mode tcp
balance leastconn
acl clienthello req_ssl_hello_type 1
acl serverhello rep_ssl_hello_type 2
option abortonclose
option ssl-hello-chk
option tcplog
stick-table type binary len 32 size 10240k expire 60m
stick on payload_lv(43,1) if clienthello
stick store-response payload_lv(43,1) if serverhello
tcp-request content accept if clienthello
tcp-request inspect-delay 5s
tcp-response content accept if serverhello
server HTTPS_0.XX 10.0.0.XX:443 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-aplicaciones3
mode tcp
balance leastconn
acl clienthello req_ssl_hello_type 1
acl serverhello rep_ssl_hello_type 2
option abortonclose
option ssl-hello-chk
option tcplog
stick-table type binary len 32 size 10240k expire 60m
stick on payload_lv(43,1) if clienthello
stick store-response payload_lv(43,1) if serverhello
tcp-request content accept if clienthello
tcp-request inspect-delay 5s
tcp-response content accept if serverhello
server HTTPS_0.XX 10.0.0.XX:443 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-smtpcli
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option smtpchk HELO dominio.com
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server SMTPCLI_1.XX 10.0.1.XX:587 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server SMTPCLI_1.XX 10.0.1.XX:587 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-ftps
mode tcp
balance leastconn
option abortonclose
option  persist
option  redispatch
option tcp-check
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server FTPS_1.XX 10.0.1.XX:990 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server FTPS_1.XX 10.0.1.XX:990 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-eset
mode tcp
balance roundrobin
option abortonclose
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server ESET_1.XX 10.0.1.XX:2221 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server ESET_1.XX 10.0.1.XX:2221 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-mysql
mode tcp
balance roundrobin
option abortonclose
option mysql-check user haproxy
option  persist
option  redispatch
option tcplog
stick-table type ip size 10240k expire 60m
stick on src
server MYSQL_1.XX 10.0.1.XX:3306 weight 10 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server MYSQL_1.XX 10.0.1.XX:3306 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server MYSQL_3.XX 10.0.3.XX:3306 weight 1 maxconn 200 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions backup

backend b-ums
mode http
balance roundrobin
http-check expect status 200
option abortonclose
option forceclose
option forwardfor
option httpchk
option httpclose
option httplog
option http-server-close
stick-table type ip size 10240k expire 60m
stick on src
server UMS_1.XX 10.0.1.XX:8015 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

backend b-antispam
mode http
balance leastconn
http-check expect status 200
option abortonclose
option forceclose
option forwardfor
option httpchk
option httpclose
option httplog
option http-server-close
stick-table type ip size 10240k expire 60m
stick on src
server ANTISPAM_1.XX 10.0.1.XX:8081 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server ANTISPAM_1.XX 10.0.1.XX:8081 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions backup

backend b-weblog
mode http
balance roundrobin
option abortonclose
option forceclose
option forwardfor
option httpchk
option httpclose
option httplog
option http-server-close
stick-table type ip size 10240k expire 60m
stick on src
server WEBLOG_1.XX 10.0.1.XX:9991 weight 10 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server WEBLOG_1.XX 10.0.1.XX:9991 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions
server WEBLOG_1.XX 10.0.1.XX:9991 weight 1 maxconn 100 check inter 3s rise 2 fall 3 on-marked-down shutdown-sessions

listen admin
bind *:8080
mode http
acl AUTH       http_auth(stats-auth)
acl AUTH_ADMIN http_auth_group(stats-auth) admin
http-check expect status 200
maxconn    10
option abortonclose
option forceclose
option httpclose
option http-server-close
stats admin if AUTH_ADMIN
stats enable
stats hide-version
stats http-request auth unless AUTH
stats refresh 30s
stats show-desc RBHAProxyD1
stats show-legends
stats uri /stats

————————————– Final fichero haproxy.cfg 1.5.xx ———————————

Algunos enlaces con información de HAProxy:

Parte 1 : Instalacion y configuracion del servicio

Parte 2: Fichero de reglas de prueba

How to Compile HAProxy From Source and Setup a Basic Configuration

HAProxy Quickstart w/ full example config file

Configure HAProxy with TPROXY kernel for full transparent proxy

Setting up HAProxy with Transparent Mode on Centos 6.x

Setting up HAproxy with TProxy

Install HAProxy and Keepalived (Virtual IP)

HAProxy for Alfresco

Enhanced SSL load-balancing with Server Name Indication (SNI) TLS extension

Maintain affinity based on SSL session ID

Configure HAProxy to Load Balance Sites With SSL

Using HAProxy to Build a More Featureful Elastic Load Balancer

HAProxy add test-check-expect to test various http-check methods

HAProxy – route by domain name

High Availability Web Services Using HAProxy

 

 

 

 

 

Última actualización 05/03/2023 13:36