← Back
Editing: allow_anon_write.cpython-312.opt-1.pyc
� �Z` � �x � d dl Z e j dd�� Zej Zd dl� d dlmZ G d� de� Zy) � Nzsetroubleshoot-pluginsT)�fallback)�*)�Pluginc �n � e Zd Z ed� Z ed� Z ed� Z ed� Z ed� Zd� Z d� Z d� Zy ) �pluginz^ SELinux policy is preventing an httpd script from writing to a public directory. z� SELinux policy is preventing an httpd script from writing to a public directory. If httpd is not setup to write to public directories, this could signal an intrusion attempt. a If httpd scripts should be allowed to write to public directories you need to turn on the $BOOLEAN boolean and change the file context of the public directory to public_content_rw_t. Read the httpd_selinux man page for further information: "setsebool -P $BOOLEAN=1; chcon -t public_content_rw_t <path>" You must also change the default file context labeling files on the system in order to preserve public directory labeling even on a full relabel. "semanage fcontext -a -t public_content_rw_t <path>" zNIf you want to allow $SOURCE_PATH to be able to write to shared public contentz�you need to change the label on $TARGET_PATH to public_content_rw_t, and potentially turn on the allow_httpd_sys_script_anon_write boolean.c � � d|z }|S )Nzo# semanage fcontext -a -t public_content_rw_t $TARGET_PATH # restorecon -R -v $TARGET_PATH # setsebool -P %s %s� )�self�avc�args�do_texts �5/usr/share/setroubleshoot/plugins/allow_anon_write.py�get_do_textzplugin.get_do_text/ s � ����� �� c �F � t j | t � d| _ y )N�green)r �__init__�__name__�level)r s r r zplugin.__init__5 s � �����h�'��� r c � � |j dg� r�|j |j � r�|j dg� r| j d� S |j dg� r| j d� S |j dg� r| j d� S |j dg� r| j d � S |j d g� r| j d� S |j dg� r| j d � S y )N�public_content_t�httpd_t)�allow_httpd_anon_write�1�httpd_sys_script_t)�!allow_httpd_sys_script_anon_writer �ftpd_t)�allow_ftpd_anon_writer �nfsd_t)�allow_nfsd_anon_writer �rsync_t)�allow_rsync_anon_writer �smbd_t)�allow_smbd_anon_writer )�matches_target_types�all_accesses_are_in�create_file_perms�matches_source_types�report)r r s r �analyzezplugin.analyze9 s� � ��$�$�&8�%9�:��'�'��(=�(=�>��'�'���4��{�{�#B�C�C��'�'�)=�(>�?��{�{�#M�N�N��'�'�� �3��{�{�#A�B�B��'�'�� �3��{�{�#A�B�B��'�'���4��{�{�#B�C�C��'�'�� �3��{�{�#A�B�B�r N)r � __module__�__qualname__�_�summary�problem_description�fix_description�if_text� then_textr r r* r r r r r sa � � � � �G� � � �� � � �O� �`�a�G�� `� a�I���r r )�gettext�translationr- �setroubleshoot.util�setroubleshoot.Pluginr r r r r �<module>r7 s<