- Security Automation with Ansible 2
- Madhu Akula Akash Mahajan
- 110字
- 2021-07-02 21:59:59
Hardening a database service
We have seen setting up the database. The following code snippet shows how we can harden the MySQL service by binding it to localhost and the required interfaces for interacting with the application. It then removes the anonymous user and test databases:
- name: delete anonymous mysql user for localhost
mysql_user:
user: ""
state: absent
login_password: "{{ mysql_root_password }}"
login_user: root
- name: secure mysql root user
mysql_user:
user: "root"
password: "{{ mysql_root_password }}"
host: "{{ item }}"
login_password: "{{ mysql_root_password }}"
login_user: root
with_items:
- 127.0.0.1
- localhost
- ::1
- "{{ ansible_fqdn }}"
- name: removes mysql test database
mysql_db:
db: test
state: absent
login_password: "{{ mysql_root_password }}"
login_user: root
推薦閱讀
- Hands-On Internet of Things with MQTT
- Seven NoSQL Databases in a Week
- 3D Printing with RepRap Cookbook
- 數據產品經理:解決方案與案例分析
- PostgreSQL Administration Essentials
- 影視后期編輯與合成
- Red Hat Linux 9實務自學手冊
- 啊哈C!思考快你一步
- INSTANT VMware vCloud Starter
- SQL Server數據庫應用基礎(第2版)
- 工業機器人力覺視覺控制高級應用
- Building Google Cloud Platform Solutions
- 穿越計算機的迷霧
- Red Hat Enterprise Linux 5.0服務器構建與故障排除
- 智能小車機器人制作大全(第2版)