Integración rápida de SafeLine WAF con Apache APISIX: guía paso a paso

Guía paso a paso para integrar SafeLine WAF con Apache APISIX y proteger tu gateway de APIs frente a inyección SQL y XSS, con configuración, pruebas y servicios de Q2BSTUDIO.

15 sept 2025 • 4 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Integración rápida de SafeLine WAF con Apache APISIX: guía paso a paso por Q2BSTUDIO

En este artículo explicamos cómo integrar SafeLine WAF con Apache APISIX para añadir una capa potente de protección a tu gateway de APIs y bloquear ataques comunes como SQL injection y XSS. Q2BSTUDIO es una empresa de desarrollo de software que ofrece aplicaciones a medida, software a medida, soluciones de inteligencia artificial, ciberseguridad y servicios cloud aws y azure, y te apoyamos en la implementación y puesta a punto de esta integración.

Qué son APISIX y SafeLine

Apache APISIX es un gateway de APIs cloud native con alto rendimiento, enrutado dinámico y balanceo de carga. SafeLine WAF de Chaitin Tech proporciona protección HTTP avanzada y un motor de detección integrado para asegurar aplicaciones web. A partir de APISIX v3.5.0 se puede usar el plugin chaitin-waf para redirigir tráfico hacia SafeLine y realizar inspecciones de seguridad.

Requisitos

APISIX version 3.5.0 o superior y SafeLine 5.6.0 o superior. También se asume entorno con Docker y acceso a la configuración de SafeLine.

Paso 1 Configurar SafeLine para tráfico TCP

Por defecto SafeLine usa sockets Unix. Para integrarlo con APISIX cambia a modo TCP editando detector.yml y añadiendo las siguientes líneas en el bloque de configuración del detector

bind_addr : 0.0.0.0 listen_port : 8000

Con esto SafeLine escuchará en el puerto 8000 para tráfico TCP.

Paso 2 Exponer el puerto 8000

En el fichero compose.yaml del despliegue de SafeLine añade en el servicio detect la sección ports con la línea 8000:8000 y reinicia los contenedores docker compose down y docker compose up -d para aplicar los cambios.

Paso 3 Instalar APISIX vía Docker

Clona el repositorio apisix-docker y arranca APISIX con la etiqueta adecuada. Por ejemplo

git clone https://github.com/apache/apisix-docker cd apisix-docker/composeecho APISIX_DOCKER_TAG=3.5.0-debian >> .envdocker compose -f docker-compose-release.yaml up -d

Endpoints habituales: endpoint de negocio en https://127.0.0.1:9080 y Admin API en https://127.0.0.1:9180

Paso 4 Conectar SafeLine con APISIX

Registra el motor detector de SafeLine en la metadata del plugin chaitin-waf del Admin API de APISIX. Puedes hacerlo desde el APISIX Dashboard o mediante peticiones al Admin API creando una entrada plugin_metadata para chaitin-waf que apunte al host y puerto de SafeLine, por ejemplo host 192.168.99.11 puerto 8000.

Paso 5 Crear una ruta en APISIX con WAF habilitado

Crea una ruta o servicio en APISIX que aplique el plugin chaitin-waf. Define la ruta para tu API y configura el upstream con los nodos de backend, por ejemplo 192.168.99.12:80. Desde el Dashboard de APISIX o usando la Admin API añade el plugin chaitin-waf en la sección plugins de la ruta.

Paso 6 Probar la protección

Prueba una petición normal contra el endpoint de negocio para verificar el flujo. Para simular un intento de inyección SQL realiza una petición con datos sospechosos. Si todo está bien la respuesta esperada será un bloqueo por parte del WAF con código HTTP 403, mensaje indicando bloqueo por SafeLine y un identificador de evento para auditoría.

Consejo final Rehabilitar protección de sitio local

Si cambiaste SafeLine a modo TCP recuerda actualizar la configuración de NGINX que antes usaba sockets Unix. Duplica el fichero de configuración de NGINX y habilita la variante HTTP, por ejemplo copia safeline_unix.conf a safeline_http.conf y ajusta nginx.conf para incluir safeline_http.conf. Reinicia el contenedor SafeLine con docker restart safeline.

Cómo puede ayudar Q2BSTUDIO

En Q2BSTUDIO implementamos integraciones como esta dentro de proyectos más amplios de ciberseguridad y desarrollo. Ofrecemos auditorías, hardening y automatización de despliegue, y desarrollamos soluciones a medida que combinan seguridad, servicios cloud aws y azure y análisis de datos. Si necesitas una solución de software y aplicaciones a medida podemos adaptar APISIX y SafeLine a tu arquitectura. Para proyectos centrados en protección y pruebas de intrusión te recomendamos nuestros servicios de servicios de ciberseguridad y pentesting.

Palabras clave y servicios

Este tutorial está orientado a equipos interesados en aplicaciones a medida, software a medida, inteligencia artificial, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio, ia para empresas, agentes IA y power bi. En Q2BSTUDIO combinamos experiencia en desarrollo, automatización y seguridad para ofrecer soluciones completas que incluyen despliegue de WAF, integración con pipelines y monitorización continua.

Conclusión

Siguiendo estos pasos puedes integrar SafeLine WAF con APISIX y proteger tu gateway de APIs frente a ataques comunes. Si quieres que realicemos la integración, auditoría o un proyecto personalizado, contacta con Q2BSTUDIO para una consultoría adaptada a tus necesidades.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.