大左同学 發表於 2023-8-5 00:00:00

dedecms安全设置集合整理

<p>
        <span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第一、安装的时候数据库的表前缀,最好改一下,不用dedecms默认的前缀dede_,可以改成ljs_,随便一个名称即可。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第二、后台登录开启验证码功能,将默认管理员admin删除,改成一个自己专用的,复杂点的账号。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第三、装好程序后务必删除install目录 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第四、将dedecms后台管理默认目录名dede改掉。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第五、用不到的功能一概关闭,比如会员、评论等,如果没有必要通通在后台关闭。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第六、以下一些是可以删除的目录: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>member会员功能 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>special专题功能 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>company企业模块 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>plus\guestbook留言板 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>以下是可以删除的文件: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>管理目录下的这些文件是后台文件管理器,属于多余功能,而且最影响安全 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>file_manage_control.php file_manage_main.php file_manage_view.php media_add.php media_edit.php media_main.php </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>再有: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>不需要SQL命令运行器的将dede/sys_sql_query.php 文件删除。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>不需要tag功能请将根目录下的tag.php删除。不需要顶客请将根目录下的digg.php与diggindex.php删除。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>友情链接地方也容易被挂马,可以将数据库中的 dede_flink,dede_mytag表改名之类。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第七、多关注dedecms官方发布的安全补丁,及时打上补丁。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第八、下载发布功能(管理目录下soft__xxx_xxx.php),不用的话可以删掉,这个也比较容易上传小马的. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第九、DedeCms官网出的万能安全防护代码,我发在文章后面,官网的要会员才能看. </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>为了让大家的CMS更安全,有需要的手工在config_base.php里加上</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>打开</span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        config_base.php <br>
        找到<br>
        //禁止用户提交某些特殊变量<br>
        $ckvs = Array('_GET','_POST','_COOKIE','_FILES');<br>
        foreach($ckvs as $ckv){<br>
        if(is_array($$ckv)){ <br>
        foreach($$ckv AS $key =&gt; $value) <br>
        if(eregi("^(cfg_|globals)",$key)) unset(${$ckv}[$key]);<br>
        }<br>
        }</p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>改为下面代码</span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <p class="right">
                <span><u>复制代码</u></span></p>
        <p>
                代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        //把get、post、cookie里的&lt;? 替换成 &lt;?<br>
        $ckvs = Array('_GET','_POST','_COOKIE');<br>
        foreach($ckvs as $ckv){<br>
        if(is_array($$ckv)){ <br>
        foreach($$ckv AS $key =&gt; $value) <br>
        if(!empty($value)){<br>
        ${$ckv}[$key] = str_replace('&lt;'.'?','&amp;'.'lt;'.'?',$value);<br>
        ${$ckv}[$key] = str_replace('?'.'&gt;','?'.'&amp;'.'gt;',${$ckv}[$key]);<br>
        }<br>
        if(eregi("^cfg_|globals",$key)) unset(${$ckv}[$key]);<br>
        }<br>
        }<br>
        //检测上传的文件中是否有PHP代码,有直接退出处理<br>
        if (is_array($_FILES)) {<br>
        foreach($_FILES AS $name =&gt; $value){<br>
        ${$name} = $value['tmp_name'];<br>
        $fp = @fopen(${$name},'r');<br>
        $fstr = @fread($fp,filesize(${$name}));<br>
        @fclose($fp);<br>
        if($fstr!='' &amp;&amp; ereg("&lt;\?",$fstr)){<br>
        echo "你上传的文件中含有危险内容,程序终止处理!";<br>
        exit();<br>
        }<br>
        }<br>
        }</p>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>第十、最安全的方式:本地发布html,然后上传到空间。不包含任何动态内容,理论上最安全,不过维护相对来说比较麻烦。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>十一,还是得经常检查自己的网站,被挂黑链是小事,被挂木马或删程序就很惨了,运气不好的话,排名也会跟着掉。所以还得记得时常备份数据.</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>十二、将一些目录禁止执行脚本,例如 uploads、静态生成目录等</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>十三、对于后台需要执行的php目录,设置禁止网站匿名用户,具有写入权限。</span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><strong style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>其它补充:</strong><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>Dedecms织梦是应用最广泛的开源建站系统,但是安全性一直是它最大的问题,如何解决呢? </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>方法 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>以下目录:data、templets、uploads、a设置可读写不可执行权限。其中a目录为文档HTML默认保存路径,可以在后台进行更改。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>以下目录:include、member、plus、dede设置为可读可执行不可写入权限。其中后台管理目录(默认dede),可自行修改。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果只是使用文章系统并没有使用会员功能,则强推推荐:关闭会员功能、关闭新会员注册、直接删除member目录或改名。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>删除install安装目录。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>管理员帐号密码尽量设置复杂,发布文章可以新建频道管理员,并且只给予相关权限。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>Mysql数据库链接,不使用root用户,单独建立新用户,并给予:SELECT、INSERT、UPDATE、DELETE、CREATE、DROP、INDEX、ALTER、CREATE TEMPORARY TABLES权限。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>定期进行备份网站目录和数据库,并在后台进行文件校验、病毒扫描、系统错误修复。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在dedecms的后台更新补丁,尽可能升级为最新版本。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>检查有无/data/cache/t.php 、/data/cache/x.php和/plus/index.php 这些木马文件,有的话则应立即删除。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>重点查看/plus/config_s.php 此为dedecms里面的流量攻击脚本。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>注意事项 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>也可以安装安全狗软件,但是有时候操作后台时可能会被拦截 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>更新补丁,尽可能升级为最新版本。</span></p>
頁: [1]
查看完整版本: dedecms安全设置集合整理