SlideShare a Scribd company logo
Automating Security workflow
with
Ansible
By
DEVANSH DUBEY
$Whoami
• Devansh Dubey
• Final Year student from UIT RGPV
• Infosec enthusiast
• Volunteer at NULL Bhopal
• RHCSA
• https://github.com/devanshdubey
• https://twitter.com/devanshdubey97
Table of Content
• Introduction
• Architecture
• Playbooks
• Security with ansible
• Examples
• Luks with ansible
• Webserver with ansible
INTRODUCTION TO ANSIBLE
Ansible is an IT automation tool. It can configure systems, deploy
software, and orchestrate more advanced IT tasks such as continuous
deployments or zero downtime rolling updates.
Ansible is an open source automation platform. It is very, very simple
to setup and yet powerful. Ansible can help you with configuration
management, application deployment, task automation. It can also do
IT orchestration
SETTING UP ENVIRONMENT
1. Python 2.7,3.x
2. Ansible 2.8 (latest)
3. SSH
FEATURES :-
• Agentless
• Open Source
• Simple
• Powerfull
ARCHITECTURE
Security  workflow with ansible
Configuration
Management
Orchestration
Application Deployment
Infrastructure
Provisioning
Security Automation
Continuous
Integration/Delivery
Common Ansible Use Cases
IMPORTANT FILES
• /etc/ansible/ansible.cfg (conf file)
• ./inventory (list of managed hosts)
• /etc/sudoers.d/ansible
PLAYBOOKS
• A playbook is like a recipe or an instructions manual which tells
Ansible what to do when it connects to each machine.
• Playbooks are written in YAML, which simplistically could be viewed
as XML but human readable.
Example
Why ansible for Security Automation
• Agentless
• SSH/WinRM
• Desired State
• Extensible and modular
• Push-based architecture
• Easy targeting based on facts
Why Ansible
Developers Security Team
Operations
APPLICATION
Information security with Ansible
• Application Security
• Network Security
• Forensics
• Incident Response
• Penetration Testing
• Fraud Detection and Prevention
• Governance, Risk, Compliance
EXAMPLES
• Ensure that all system
components and software are
protected from known
vulnerabilities by installing
applicable vendorsupplied
security patches. Install
critical security patches
within one month of release.
- name: RHEL | Install updates
yum:
name: "*"
state: latest
exclude: "mysql* httpd* nginx*"
when: “ansible_os_family == ‘RedHat’”
- name: DEBIAN | Install updates
apt:
update_cache: yes
cache_valid_time: 7200
name: "*"
state: latest
when: “ansible_os_family == ‘Debian’”
REMEDIATION
- name: Protect against CVE-2016-5696
hosts: all
become: yes
become_user: root
tasks: -
name: CVE-2016-5696 | Limit TCP challenge ACK limit
sysctl:
name: net.ipv4.tcp_challenge_ack_limit
value: 999999999
sysctl_set: yes
INCIDENT RESPONSE LOGS
- name: Gather log files from remote systems
hosts: lab
become: yes
tasks:
- name: Find logs
find:
paths: /var/log/
patterns: '*.log’
recurse: yes
register: _logs
- name: Fetch logs
fetch:
src: "{{ item.path }}"
dest: logs
with_items: "{{ _logs.files }}"
Change root password every 60 days
- name: Change root password
hosts: all
become: yes
vars:
root_password: "{{ vault_root_password }}"
root_password_salt: "{{ vault_root_password_salt }}"
tasks:
- name: Change root password
user:
name: root
password: "{{ root_password |
password_hash(salt=root_password_salt) }}"
LUKS And NBDE
• Linux Unified Key Setup-on-disk-format (or LUKS) allows you to
encrypt partitions on your Linux computer. This is particularly
important when it comes to mobile computers and removable media.
LUKS allows multiple user keys to decrypt a master key, which is
used for the bulk encryption of the partition.
Ansible playbook : https://github.com/devanshdubey
• The Network-Bound Disk Encryption (NBDE) allows the user to
encrypt root volumes of hard drives on physical and virtual
machines without requiring to manually enter a password when
systems are restarted.
Security  workflow with ansible
REFERENCES
• https://docs.ansible.com
• https://github.com/samdoran/demo-playbooks
• https://www.ansible.com/hubfs/2018_Content/AA%20NYC%202018%20Slides/Security%20Automation%20with%20Ansible_MichellePerz-NYCAutomates.pdf
• https://www.ansible.com/overview/how-ansible-works
• https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Network-Bound_Disk_Encryption.html
• https://www.google.com/url?sa=i&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwjp0NmUrqblAhVLnY8KHTdBD4QQMwiaASgUMBQ&url=https%3A%2F%2Fwww.riskgro
upllc.com%2Finformation-security-risks%2F&psig=AOvVaw26pQCGJDKMyEoUa5l_MKhD&ust=1571507066500358&ictx=3&uact=3
• https://www.google.com/url?sa=i&source=images&cd=&ved=2ahUKEwjr17-IkajlAhULbo8KHX25BasQjRx6BAgBEAQ&url=https%3A%2F%2Fwww.edureka.co%2Fblog%2Fwhat-
is-ansible%2F&psig=AOvVaw2vlVuhe23b28xWk0tQwjem&ust=1571567951915575
• https://a.wattpad.com/cover/147035011-352-k202749.jpg
• https://media.licdn.com/dms/image/C560BAQHxkF3dudpvEQ/company-logo_200_200/0?e=2159024400&v=beta&t=cNaLAqnnv3gVvkUY3KIeKo5j_hXMSyYt7N4qg1HcJxg
• https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.riskgroupllc.com%2Fwp-content%2Fuploads%2Finformation-Security-
1.jpg&imgrefurl=https%3A%2F%2Fwww.riskgroupllc.com%2Finformation-security-
risks%2F&docid=K7PzfgbIaDq3PM&tbnid=opNfbkYnxph8QM%3A&vet=10ahUKEwjRle_9harlAhUJKo8KHaedDZEQMwiMASgRMBE..i&w=750&h=500&bih=657&biw=1396&q=
information%20security&ved=0ahUKEwjRle_9harlAhUJKo8KHaedDZEQMwiMASgRMBE&iact=mrc&uact=8
THANK YOU
Any Questions…?????

More Related Content

PPTX
Automated tools for penetration testing
PPTX
Lateral Movement with PowerShell
ODP
OWASP 2015 AppSec EU ZAP 2.4.0 and beyond..
PPTX
The OWASP Zed Attack Proxy
ODP
2014 ZAP Workshop 2: Contexts and Fuzzing
ODP
BSides Manchester 2014 ZAP Advanced Features
PDF
Security Testing using ZAP in SFDC
PDF
Automated tools for penetration testing
Lateral Movement with PowerShell
OWASP 2015 AppSec EU ZAP 2.4.0 and beyond..
The OWASP Zed Attack Proxy
2014 ZAP Workshop 2: Contexts and Fuzzing
BSides Manchester 2014 ZAP Advanced Features
Security Testing using ZAP in SFDC

What's hot (20)

PDF
Security Automation using ZAP
ODP
OWASP 2013 APPSEC USA Talk - OWASP ZAP
ODP
Automating OWASP ZAP - DevCSecCon talk
ODP
BlackHat 2014 OWASP ZAP Turbo Talk
ODP
2014 ZAP Workshop 1: Getting Started
ODP
JoinSEC 2013 London - ZAP Intro
PPTX
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
ODP
OWASP 2013 Limerick - ZAP: Whats even newer
PPTX
Splunk: Forward me the REST of those shells
PDF
OSMC 2021 | Thola – A tool for monitoring and provisioning network devices
PPTX
ZAP @FOSSASIA2015
ODP
OWASP 2014 AppSec EU ZAP Advanced Features
ODP
JavaOne 2014 Security Testing for Developers using OWASP ZAP
ODP
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
PDF
Fuzzing and You: Automating Whitebox Testing
PPTX
InSpec - June 2018 at Open28.be
PDF
Inspec: Turn your compliance, security, and other policy requirements into au...
PDF
CNIT 126: Ch 2 & 3
PDF
All You Need is One - A ClickOnce Love Story - Secure360 2015
PDF
Attack All the Layers - What's Working in Penetration Testing
Security Automation using ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAP
Automating OWASP ZAP - DevCSecCon talk
BlackHat 2014 OWASP ZAP Turbo Talk
2014 ZAP Workshop 1: Getting Started
JoinSEC 2013 London - ZAP Intro
Practical Malware Analysis: Ch 2 Malware Analysis in Virtual Machines & 3: Ba...
OWASP 2013 Limerick - ZAP: Whats even newer
Splunk: Forward me the REST of those shells
OSMC 2021 | Thola – A tool for monitoring and provisioning network devices
ZAP @FOSSASIA2015
OWASP 2014 AppSec EU ZAP Advanced Features
JavaOne 2014 Security Testing for Developers using OWASP ZAP
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
Fuzzing and You: Automating Whitebox Testing
InSpec - June 2018 at Open28.be
Inspec: Turn your compliance, security, and other policy requirements into au...
CNIT 126: Ch 2 & 3
All You Need is One - A ClickOnce Love Story - Secure360 2015
Attack All the Layers - What's Working in Penetration Testing
Ad

Similar to Security workflow with ansible (20)

PDF
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
PPTX
Introduction to Ansible
PPTX
Ansible Hands On
PPTX
Introduction to ansible
PDF
IT Automation with Ansible
PDF
Ansible at work
PPTX
Managing windows Nodes like Linux Nodes by Ansible
PDF
Automation with ansible
PDF
Ansible loves Python, Python Philadelphia meetup
PDF
System Hardening Using Ansible
PPTX
ansible : Infrastructure automation,idempotent and more
PDF
Automated Deployment and Configuration Engines. Ansible
PPTX
Ansible as configuration management tool for devops
PDF
Ansible Introduction
PPTX
SESSION Ansible how to deploy and push resources
PDF
Ansible is the simplest way to automate. SymfonyCafe, 2015
PPTX
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
PPTX
Ansible_Automation_tools that used in devops
PPTX
Automating with Ansible
PDF
ansible_rhel.pdf
DevOpsDaysCPT Ansible Infrastrucutre as Code 2017
Introduction to Ansible
Ansible Hands On
Introduction to ansible
IT Automation with Ansible
Ansible at work
Managing windows Nodes like Linux Nodes by Ansible
Automation with ansible
Ansible loves Python, Python Philadelphia meetup
System Hardening Using Ansible
ansible : Infrastructure automation,idempotent and more
Automated Deployment and Configuration Engines. Ansible
Ansible as configuration management tool for devops
Ansible Introduction
SESSION Ansible how to deploy and push resources
Ansible is the simplest way to automate. SymfonyCafe, 2015
Mastering_Ansible_PAnsible_Presentation our score increases as you pick a
Ansible_Automation_tools that used in devops
Automating with Ansible
ansible_rhel.pdf
Ad

Recently uploaded (20)

PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
KodekX | Application Modernization Development
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
KodekX | Application Modernization Development
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mobile App Security Testing_ A Comprehensive Guide.pdf

Security workflow with ansible

  • 2. $Whoami • Devansh Dubey • Final Year student from UIT RGPV • Infosec enthusiast • Volunteer at NULL Bhopal • RHCSA • https://github.com/devanshdubey • https://twitter.com/devanshdubey97
  • 3. Table of Content • Introduction • Architecture • Playbooks • Security with ansible • Examples • Luks with ansible • Webserver with ansible
  • 4. INTRODUCTION TO ANSIBLE Ansible is an IT automation tool. It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates. Ansible is an open source automation platform. It is very, very simple to setup and yet powerful. Ansible can help you with configuration management, application deployment, task automation. It can also do IT orchestration
  • 5. SETTING UP ENVIRONMENT 1. Python 2.7,3.x 2. Ansible 2.8 (latest) 3. SSH FEATURES :- • Agentless • Open Source • Simple • Powerfull
  • 9. IMPORTANT FILES • /etc/ansible/ansible.cfg (conf file) • ./inventory (list of managed hosts) • /etc/sudoers.d/ansible
  • 10. PLAYBOOKS • A playbook is like a recipe or an instructions manual which tells Ansible what to do when it connects to each machine. • Playbooks are written in YAML, which simplistically could be viewed as XML but human readable.
  • 12. Why ansible for Security Automation • Agentless • SSH/WinRM • Desired State • Extensible and modular • Push-based architecture • Easy targeting based on facts
  • 13. Why Ansible Developers Security Team Operations APPLICATION
  • 14. Information security with Ansible • Application Security • Network Security • Forensics • Incident Response • Penetration Testing • Fraud Detection and Prevention • Governance, Risk, Compliance
  • 15. EXAMPLES • Ensure that all system components and software are protected from known vulnerabilities by installing applicable vendorsupplied security patches. Install critical security patches within one month of release. - name: RHEL | Install updates yum: name: "*" state: latest exclude: "mysql* httpd* nginx*" when: “ansible_os_family == ‘RedHat’” - name: DEBIAN | Install updates apt: update_cache: yes cache_valid_time: 7200 name: "*" state: latest when: “ansible_os_family == ‘Debian’”
  • 16. REMEDIATION - name: Protect against CVE-2016-5696 hosts: all become: yes become_user: root tasks: - name: CVE-2016-5696 | Limit TCP challenge ACK limit sysctl: name: net.ipv4.tcp_challenge_ack_limit value: 999999999 sysctl_set: yes
  • 17. INCIDENT RESPONSE LOGS - name: Gather log files from remote systems hosts: lab become: yes tasks: - name: Find logs find: paths: /var/log/ patterns: '*.log’ recurse: yes register: _logs - name: Fetch logs fetch: src: "{{ item.path }}" dest: logs with_items: "{{ _logs.files }}"
  • 18. Change root password every 60 days - name: Change root password hosts: all become: yes vars: root_password: "{{ vault_root_password }}" root_password_salt: "{{ vault_root_password_salt }}" tasks: - name: Change root password user: name: root password: "{{ root_password | password_hash(salt=root_password_salt) }}"
  • 19. LUKS And NBDE • Linux Unified Key Setup-on-disk-format (or LUKS) allows you to encrypt partitions on your Linux computer. This is particularly important when it comes to mobile computers and removable media. LUKS allows multiple user keys to decrypt a master key, which is used for the bulk encryption of the partition. Ansible playbook : https://github.com/devanshdubey • The Network-Bound Disk Encryption (NBDE) allows the user to encrypt root volumes of hard drives on physical and virtual machines without requiring to manually enter a password when systems are restarted.
  • 21. REFERENCES • https://docs.ansible.com • https://github.com/samdoran/demo-playbooks • https://www.ansible.com/hubfs/2018_Content/AA%20NYC%202018%20Slides/Security%20Automation%20with%20Ansible_MichellePerz-NYCAutomates.pdf • https://www.ansible.com/overview/how-ansible-works • https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Network-Bound_Disk_Encryption.html • https://www.google.com/url?sa=i&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwjp0NmUrqblAhVLnY8KHTdBD4QQMwiaASgUMBQ&url=https%3A%2F%2Fwww.riskgro upllc.com%2Finformation-security-risks%2F&psig=AOvVaw26pQCGJDKMyEoUa5l_MKhD&ust=1571507066500358&ictx=3&uact=3 • https://www.google.com/url?sa=i&source=images&cd=&ved=2ahUKEwjr17-IkajlAhULbo8KHX25BasQjRx6BAgBEAQ&url=https%3A%2F%2Fwww.edureka.co%2Fblog%2Fwhat- is-ansible%2F&psig=AOvVaw2vlVuhe23b28xWk0tQwjem&ust=1571567951915575 • https://a.wattpad.com/cover/147035011-352-k202749.jpg • https://media.licdn.com/dms/image/C560BAQHxkF3dudpvEQ/company-logo_200_200/0?e=2159024400&v=beta&t=cNaLAqnnv3gVvkUY3KIeKo5j_hXMSyYt7N4qg1HcJxg • https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.riskgroupllc.com%2Fwp-content%2Fuploads%2Finformation-Security- 1.jpg&imgrefurl=https%3A%2F%2Fwww.riskgroupllc.com%2Finformation-security- risks%2F&docid=K7PzfgbIaDq3PM&tbnid=opNfbkYnxph8QM%3A&vet=10ahUKEwjRle_9harlAhUJKo8KHaedDZEQMwiMASgRMBE..i&w=750&h=500&bih=657&biw=1396&q= information%20security&ved=0ahUKEwjRle_9harlAhUJKo8KHaedDZEQMwiMASgRMBE&iact=mrc&uact=8