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

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.

主站蜘蛛池模板: 西华县| 宜君县| 云南省| 元氏县| 乌拉特后旗| 宾阳县| 本溪| 屯门区| 庆城县| 澄江县| 祁连县| 资兴市| 宿迁市| 舟山市| 新民市| 长白| 嘉禾县| 方正县| 忻州市| 北流市| 朔州市| 台东市| 六盘水市| 太仆寺旗| 胶州市| 乃东县| 社会| 南乐县| 堆龙德庆县| 滦南县| 东源县| 马山县| 江达县| 称多县| 佛学| 平阴县| 九龙县| 和田县| 奎屯市| 晋城| 龙口市|