Día 5: SELinux en 100 Días de DevOps

Descubre cómo SELinux refuerza la seguridad en Linux con políticas de control de acceso, modos Enforcing y Permissive, instalación y buenas prácticas. Soluciones de ciberseguridad e IA de Q2BSTUDIO.

28 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

En servidores Linux la seguridad es crucial. Los permisos normales de archivos lectura, escritura y ejecución son útiles pero no bastan cuando aplicaciones y servicios se comunican de muchas maneras. Aquí entra SELinux, Security-Enhanced Linux, una capa de control integrada en el kernel que define reglas estrictas sobre lo que aplicaciones, usuarios y procesos pueden hacer. SELinux no se fía solo de los permisos tradicionales: aplica políticas que actúan como un guardia de seguridad que puede bloquear accesos aunque alguien tenga la llave del archivo.

¿Por qué usar SELinux? Porque aporta protección adicional frente a vulnerabilidades o aplicaciones comprometidas. Si un servicio es explotado, SELinux puede impedir que acceda a archivos sensibles y además registra intentos de violación de políticas. Limitar lo que cada proceso puede hacer reduce el impacto de fallos o ataques.

Modos de SELinux: Enforcing las reglas están activas y se bloquea lo no permitido. Permissive se registran las violaciones pero no se bloquean, ideal para pruebas. Disabled SELinux está apagado. Comprueba el modo actual con getenforce o para más detalles usa sestatus.

Instalación y configuración rápida: En RHEL CentOS Fedora usa sudo yum install -y selinux-policy selinux-policy-targeted policycoreutils. En Debian Ubuntu sudo apt update sudo apt install selinux-basics selinux-policy-default auditd y luego sudo selinux-activate. El archivo principal de configuración es /etc/selinux/config donde verás SELINUX = enforcing SELINUXTYPE = targeted. Puedes cambiar el modo sin reiniciar con sudo setenforce 0 para pasar a permissive y sudo setenforce 1 para volver a enforcing. Para cambiarlo permanentemente edita /etc/selinux/config y reinicia.

Comandos útiles: para revisar denegados consulta cat /var/log/audit/audit.log | grep denied. Para gestionar booleanos que activan opciones concretas usa getsebool -a y cambia con sudo setsebool -P nombre_booleano on por ejemplo sudo setsebool -P httpd_can_network_connect_db on para permitir que Apache acceda a bases de datos remotas.

Desactivar SELinux no es recomendable pero si es imprescindible edita /etc/selinux/config y pon SELINUX = disabled y reinicia. Ten en cuenta que perderás una capa importante de defensa si lo apagas.

En Q2BSTUDIO aprovechamos buenas prácticas como SELinux en proyectos de desarrollo de software y en servicios de ciberseguridad para reforzar entornos productivos. Somos especialistas en aplicaciones a medida y software a medida, y combinamos protección con despliegues en la nube y soluciones de inteligencia artificial. Para auditorías y protección avanzada consulta nuestros servicios de ciberseguridad y pentesting en Servicios de ciberseguridad y pentesting. También diseñamos soluciones de ia para empresas y agentes IA a medida; descubre nuestras propuestas de inteligencia artificial en Soluciones de inteligencia artificial.

Consejo práctico: empieza con SELinux en modo permissive para ver qué bloquearía sin interrumpir servicios, ajusta políticas y booleanos y cuando estés seguro pasa a enforcing. Combinado con buenas prácticas de ciberseguridad, despliegues seguros en servicios cloud aws y azure, análisis con power bi y estrategias de servicios inteligencia de negocio, SELinux es una pieza clave para reducir riesgos en entornos donde aplicaciones a medida e integraciones complejas conviven.

En Q2BSTUDIO unimos desarrollo de aplicaciones y software a medida con seguridad, servicios cloud y business intelligence para ofrecer soluciones completas y seguras. Si buscas arquitecturas robustas que incluyan ciberseguridad, automatización, agentes IA y análisis con power bi estamos listos para colaborar.

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.

Live Chat