官术网_书友最值得收藏!

Hardening WordPress

This includes basic checks for WordPress security misconfigurations. Some of them include:

  • Directory and file permissions:
    - name: update the file permissions
file:
path: "{{ WordPress_install_directory }}"
recurse: yes
owner: "{{ new_user_name }}"
group: www-data

- name: updating file and directory permissions
shell: "{{ item }}"

with_items:
- "find {{ WordPress_install_directory }} -type d -exec chmod
755 {} \;"
- "find {{ WordPress_install_directory }} -type f -exec chmod
644 {} \;"
  • Username and attachment enumeration blocking. The following code snippet is part of nginx's configuration:
    # Username enumeration block
if ($args ~ "^/?author=([0-9]*)"){
return 403;
}

# Attachment enumeration block
if ($query_string ~ "attachment_id=([0-9]*)"){
return 403;
}
  • Disallowing file edits in the WordPress editor:
    - name: update the WordPress configuration
lineinfile:
path: /var/www/html/wp-config.php
line: "{{ item }}"

with_items:
- define('FS_METHOD', 'direct');
- define('DISALLOW_FILE_EDIT', true);

There are many other checks we can add as the configuration changes and updates.

主站蜘蛛池模板: 潜江市| 临夏县| 台南市| 洪湖市| 思茅市| 施甸县| 云阳县| 永康市| 宁远县| 静乐县| 临潭县| 瑞丽市| 黎平县| 湘潭县| 安徽省| 乌兰浩特市| 龙陵县| 海丰县| 嘉禾县| 龙海市| 沾化县| 建始县| 德惠市| 吴忠市| 东安县| 荥阳市| 普兰店市| 商南县| 浮梁县| 洛扎县| 香河县| 公安县| 漾濞| 韶关市| 沙田区| 惠东县| 庆阳市| 临海市| 镇康县| 永顺县| 定日县|