dbfdg 3 nma@sdddlZejdddZejZddlTddlmZddlZddlZddZd d Z Gd d d eZ dS) Nzsetroubleshoot-pluginsT)Zfallback)*)Pluginc CsD|ddkrdSytjdd|gddj}Wn dS|ddkS) Nr/F execstackz-qT)universal_newlinesX) subprocess check_outputsplit)pathxr 4/usr/share/setroubleshoot/plugins/allow_execstack.py is_execstacks rcCsg}ytjd|gddj}Wn |Sx&|D]}t|r0||kr0|j|q0WyPtd|d}x<|jD]0}x*|jD]}t|rz||krz|j|qzWqlWWntk rYnX|S)NZlddT)rz /proc/%s/mapsr)rr r rappendopen readlinesIOError)ZexepidZ execstacklistpathsr fdZrecr r rfind_execstack's" rc@sheZdZedZedZedZdZedZedZ edZ dd Z d d Z d d Z ddZddZdS)pluginzV SELinux is preventing $SOURCE_PATH from making the program stack executable. a# The $SOURCE application attempted to make its stack executable. This is a potential security problem. This should never ever be necessary. Stack memory is not executable on most OSes these days and this will not change. Executable stack memory is one of the biggest security problems. An execstack error might in fact be most likely raised by malicious code. Applications are sometimes coded incorrectly and request this permission. The SELinux Memory Protection Tests web page explains how to remove this requirement. If $SOURCE does not work and you need it to work, you can configure SELinux temporarily to allow this access until the application is fixed. Please file a bug report. a6 Sometimes a library is accidentally marked with the execstack flag, if you find a library with this flag you can clear it with the execstack -c LIBRARY_PATH. Then retry your application. If the app continues to not work, you can turn the flag back on with execstack -s LIBRARY_PATH. zfIf you do not think $SOURCE_PATH should need to map stack memory that is both writable and executable.zByou need to report a bug. This is a potentially dangerous access.z:Contact your security administrator and report this issue.c Cs0y|d}|s|jStd|S|jSdS)Nrz4If you believe that %s should not require execstack)if_text_)selfavcargsr r r r get_if_text]s zplugin.get_if_textc Cs0y|d}|s|jStd|S|jSdS)Nrzyou should clear the execstack flag and see if $SOURCE_PATH works correctly. Report this as a bug on %s. You can clear the exestack flag by executing:) then_textr)rrrr r r r get_then_textgs zplugin.get_then_textc Cs0y|d}|s|jStd|S|jSdS)Nrzexecstack -c %s)do_textr)rrrr r r r get_do_textps zplugin.get_do_textcCstj|tdS)N)r__init____name__)rr r rr%zszplugin.__init__cCsr|jdddddgrj|jdgrjg}x*t|j|jD]}|j|j||fq4Wt|dkr`|S|jdSdSdS) NZ unconfined_tZstaff_tZuser_tZguest_tZxguest_trr)NN)Zmatches_source_typesZhas_any_access_inrZspathrrZreportlen)rrZreportsir r ranalyze}s   zplugin.analyzeN)r& __module__ __qualname__rZsummaryZproblem_descriptionZfix_descriptionZfix_cmdrr!r#r r"r$r%r)r r r rr;s    r) gettextZ translationrZsetroubleshoot.utilZsetroubleshoot.Pluginrrsysrrrr r r rs