File: //usr/share/setroubleshoot/plugins/__pycache__/allow_anon_write.cpython-39.opt-1.pyc
a
�Z`
� @ sD d dl Z e jddd�Zej Zd dlT d dlmZ G dd� de�ZdS ) � Nzsetroubleshoot-pluginsT)Zfallback)�*)�Pluginc @ sL e Zd Zed�Zed�Zed�Zed�Zed�Zdd� Z dd � Z
d
d� ZdS )
�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 C s d| }|S )Nzo# semanage fcontext -a -t public_content_rw_t $TARGET_PATH
# restorecon -R -v $TARGET_PATH
# setsebool -P %s %s� )�self�avc�argsZdo_textr r �5/usr/share/setroubleshoot/plugins/allow_anon_write.py�get_do_text/ s �zplugin.get_do_textc C s t �| t� d| _d S )NZgreen)r �__init__�__name__�level)r r r r r 5 s zplugin.__init__c C s� |� dg�r�|�|j�r�|�dg�r.| �d�S |�dg�rD| �d�S |�dg�rZ| �d�S |�dg�rp| �d �S |�d
g�r�| �d�S |�dg�r�| �d
�S d S )NZpublic_content_tZhttpd_t)Zallow_httpd_anon_write�1Zhttpd_sys_script_t)Z!allow_httpd_sys_script_anon_writer Zftpd_t)Zallow_ftpd_anon_writer Znfsd_t)Zallow_nfsd_anon_writer Zrsync_t)Zallow_rsync_anon_writer Zsmbd_t)Zallow_smbd_anon_writer )Zmatches_target_typesZall_accesses_are_inZcreate_file_permsZmatches_source_typesZreport)r r r r r �analyze9 s
�
zplugin.analyzeN)r �
__module__�__qualname__�_ZsummaryZproblem_descriptionZfix_descriptionZif_textZ then_textr
r r r r r r r s r )�gettextZtranslationr Zsetroubleshoot.utilZsetroubleshoot.Pluginr r r r r r �<module> s