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

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.

主站蜘蛛池模板: 泗水县| 五常市| 三台县| 泸定县| 广昌县| 潮州市| 永平县| 永清县| 新巴尔虎右旗| 安康市| 新民市| 五河县| 惠东县| 宣汉县| 怀集县| 丹江口市| 禹城市| 电白县| 安福县| 灵宝市| 永福县| 社会| 嘉峪关市| 新晃| 岚皋县| 阳朔县| 百色市| 句容市| 沙雅县| 舞钢市| 乌拉特中旗| 威宁| 康马县| 漳平市| 潞城市| 红河县| 高雄市| 永城市| 深水埗区| 阳山县| 普兰店市|