Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/lib/fixperms
File: fixperms_wp3.py
"""Fixperms class for WP3"""
[0] Fix | Delete
from fixperms_base import PermMap
[1] Fix | Delete
from fixperms_ids import IDCache
[2] Fix | Delete
from fixperms_cli import Args
[3] Fix | Delete
[4] Fix | Delete
[5] Fix | Delete
class WP3PermMap(PermMap):
[6] Fix | Delete
"""Fixperms class for WP3"""
[7] Fix | Delete
[8] Fix | Delete
def __init__(self, ids: IDCache, args: Args):
[9] Fix | Delete
super().__init__(
[10] Fix | Delete
ids=ids,
[11] Fix | Delete
args=args,
[12] Fix | Delete
user='wordpress',
[13] Fix | Delete
all_docroots=['/home/wordpress/doc_root'],
[14] Fix | Delete
docroot_chmod=0o755,
[15] Fix | Delete
docroot_chown=('wordpress', 'wordpress'),
[16] Fix | Delete
)
[17] Fix | Delete
# pylint: disable=duplicate-code
[18] Fix | Delete
# Order these rules more specific to less specific regex.
[19] Fix | Delete
uid, gid = self.uid, self.gid
[20] Fix | Delete
# sensitive passwords: ~/.accesshash, ~/.pgpass, ~/.my.cnf
[21] Fix | Delete
self.add_rule(r"\/\.(?:pgpass|my\.cnf)$", (0o600, None), (uid, gid))
[22] Fix | Delete
# ~/.imh/nginx - ngxconf & cache manager files
[23] Fix | Delete
self.add_rule(r"\/\.imh\/nginx(?:$|\/)", (0o664, 0o775), (uid, gid))
[24] Fix | Delete
# ~/.imh directory and contents
[25] Fix | Delete
self.add_rule(r"\/\.imh(?:$|\/)", (0o644, 0o755), (0, 0))
[26] Fix | Delete
# ~/.ssh directory and contents
[27] Fix | Delete
self.add_rule(r"\/\.ssh(?:$|\/)", (0o600, 0o700), (uid, gid))
[28] Fix | Delete
# ~/.pki dir and subdirs
[29] Fix | Delete
self.add_rule(r"\/\.pki(?:$|\/)", (None, 0o740), (uid, gid))
[30] Fix | Delete
# ~/boldgrid_backup and contents
[31] Fix | Delete
self.add_rule(r"\/boldgrid_backup(?:$|\/)", (0o644, 0o700), (uid, gid))
[32] Fix | Delete
# .cgi and .pl files
[33] Fix | Delete
self.add_rule(r"\/.*\.(?:pl|cgi)$", (0o755, None), (uid, gid))
[34] Fix | Delete
# homedir folder itself
[35] Fix | Delete
self.add_rule("$", (None, 0o711), (uid, gid))
[36] Fix | Delete
# restrict access to wp-config.php
[37] Fix | Delete
self.add_rule(r"\/(?:.+\/)?wp-config\.php$", (0o640, None), (uid, gid))
[38] Fix | Delete
# ansible and its tmp
[39] Fix | Delete
self.add_rule(r"\/\.ansible(?:\/tmp)?$", (None, 0o700), (uid, gid))
[40] Fix | Delete
# contents of homedir which do not match a previous regex
[41] Fix | Delete
self.add_rule(r"\/", (0o644, 0o755), (uid, gid))
[42] Fix | Delete
[43] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function