点标签看更多好帖
开启左侧

关于mod_security

[复制链接] 2
回复
2292
查看
打印 上一主题 下一主题
楼主
跳转到指定楼层
发表于 2017-1-21 21:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册

x
前一段发生403在保存前台,DIY时候,都是mod_security
* G/ Q7 r( L' u8 e# l& e% b! v5 C9 B7 i: g) M/ Q5 S8 _0 |7 g1 p4 b' A! Q, g
后台保存站点广告,如果含有一定词汇,也会出现。
2 L2 d3 B4 U4 D# I. ~
3 j) n, d+ h" I3 T5 L看到这里有,黏贴学习:
9 {* l% C6 ]  `0 L2 J- c4 O: Z, G# E. O1 }0 u
https://www.tipsandtricks-hq.com/apache-mod-security-update-how-to-fix-error-406-or-not-acceptable-issue-259
8 b) c7 W2 o" w* O1 i5 H  I, ?1 O; J* m- u
  1. Apache Mod Security update, How to Fix ‘Error 406’ or ‘Not Acceptable’ issue9 C% F5 a6 M! e! S& A
  2. last updated: october 28, 2016
    4 @3 X7 S9 N) z
  3. Few weeks ago I started having “Not Acceptable! Error 406” on one of my WordPress sites when trying to save a post or a page. I kept getting the following message when trying to save a post.
    % n) S! v% C  Q5 X' h0 y
  4. . w; ^6 c+ d. l" a! n9 h# f
  5. Not Acceptable. i- `: x, Z5 {
  6. An appropriate representation of the requested resource /wp-admin/post.php could not be found on this server
    - W3 U' r+ I3 ^$ r8 a0 H4 N

  7. 1 K5 p+ x4 Y% @+ P
  8. I tried many fixes and nothing seemed to have helped getting rid of the issue. So I decided to reinstall WordPress (How to Uninstall and Reinstall WordPress). Even the reinstall didn’t help! Later I found out that the “Not acceptable! Error 406” occurs due to Mod Security updates on the server. So if you are having a similar problem then you can try one of the following methods to fix it.
    8 e  o- L1 {) B/ l6 x
  9. # N8 B' [. r2 V6 \1 h4 J! F
  10. Solution 1 for Fixing 406 Error
    2 k7 b; {/ R0 c' g

  11. 5 v, ?7 `$ g; W" D& S/ k
  12. Backup your .htaccess file if you have one in the ‘wp-admin’ directory. Then make a ‘.htaccess’ file with the following content and upload it to ‘wp-admin’ directory.
    0 F% z7 g0 f6 Q! h# [: y# l% @

  13. 2 l1 D. j  K6 G( B: i# V6 Z0 _
  14. <IfModule mod_security.c>$ G& S# Q" N' }' n
  15. SecFilterEngine Off
      E- Z' L% i2 P/ M' u. d! `- T  Y
  16. SecFilterScanPOST Off4 `$ x8 ?2 ~5 [) P1 g- b2 P
  17. </IfModule>
    - K( m3 p+ ]2 m% v, F8 e
  18. You can use any text editor such as Notepad to create this file.6 Y6 x0 h( X+ |) J! L- @

  19. 2 D1 X, \+ |3 Y9 ]$ s2 M+ i
  20. You will need to upload this .htaccedss file to your server. So if you don’t know how to upload a file to your server then check this tutorial on FTP.2 A& d+ W* s( e* x' N
  21. - r6 E1 y; @6 |4 O5 N) w; H, d
  22. Solution 2 for Fixing 406 Error0 W1 j! I5 j4 h8 a" y5 N
  23. + H; g* ]9 y9 K$ R/ @# r
  24. This is the solution that worked for me for my WordPress site.
    1 h/ q# k' o2 Y6 a

  25. ! @& k5 ^! Q0 }4 p5 ]4 g) A- `5 R
  26. Backup your .htaccess file if you have one in the public_html directory.
    & [. [7 q$ C9 d- j1 i6 ?7 f
  27. & m6 A8 G8 U* A! ?3 w4 p% x. S
  28. Open the .htaccess file with any text editor and observe the lines between the “# BEGIN WordPress” and “# END WordPress” tags. Make sure the lines look somewhat like the following. If not then update the file with the following content and upload it to the ‘public_html’ directory.
    " W! e' D# [. W. K5 ]- s: [
  29. / |7 s9 i6 Q  `
  30. # BEGIN WordPress' g  [+ W/ Q5 c% h. u: T. k
  31. <IfModule mod_rewrite.c>& _* q2 Q8 g( Q$ F( G
  32. RewriteEngine On3 Q! ~1 m2 Z% \& a
  33. RewriteBase /5 X$ H3 L! V6 s) T' p) ?
  34. RewriteCond %{REQUEST_FILENAME} !-f
    % k; F- @# D, h# F# F* e
  35. RewriteCond %{REQUEST_FILENAME} !-d% u2 c% z5 I) o2 m
  36. RewriteRule . /index.php [L]
    2 r8 i6 T2 a" c2 B% f( \# M3 j
  37. </IfModule>
    1 p% Y& J$ R/ N* C$ B. H8 D" M8 Y
  38. # END WordPress
    8 v' Z. T" M2 s# u
  39. Hopefully one of these solutions help fix your “Not Acceptable” error.
    5 y% G! p$ d& P% \# n

  40. ) h* @( |1 c$ E  \$ M3 Z, r  s! X
  41. Good luck!
复制代码

2 k9 W: q* |4 b% {2 P9 t0 B( D$ `; ]9 {' w: U7 H* j6 @; _4 Y6 m


转载请保留当前帖子的链接:https://www.beimeilife.com/thread-41419-1-1.html 谢谢
沙发
发表于 2017-1-21 21:33 | 只看该作者
http://www.bkjia.com/dedecms/362281.html
( x; n. m$ \# N0 @1 m) I: ?! Q5 W( j$ d# F$ C2 k: Q: j7 w  }7 s2 K
最近论坛里很多朋友求救,说出现了这个问题,最近我也被这个问题困扰着。多谢Funkey朋友的办法,问题终于解决。 " c, P- z, J- T* V, Z  E
+ P& T9 B( a9 Y* ~( R+ v( G7 P
问题说明:
2 [$ j/ c# |  o. |! F" B) B
: R  `( S# J9 W后台设置页面无法保存,出现如下500错误页面:
# b8 @7 }+ F: J" L# N) \4 M# J# a# H& {
forbidden ) ]$ h! |* l. j4 e& I
You don't have permission to access /dede/sys_info.php on this server. ( k. A3 j: {1 I0 h% F3 G( h

* S( `8 a( ^% b% iAdditionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
/ x) G( X0 v- J$ N
0 q+ O  f# q4 H3 P$ I& N8 qApache Server at www.******.com Port 80
$ G% G) e) _$ o; K& n9 v
" h8 N. a% P: h1 p$ I问题一般出现在国外主机空间上【目前发现此问题的空间商有:Host1Plus,BlueHost,JustHost,Backy LLC】,dedecms 5.5 和 5.6 都会出现错误,可见是空间的问题,不是织梦的问题。
' j3 E2 G# b9 E
! a% l" O; ~9 B6 X原因: ! _$ O' I7 t/ A; Q1 O5 s6 {
经过多方核实,可以确定,大多数的国外主机在配置 Apache 的时候启用了 mod_security ,也就是开启了安全检查,如果提交的信息中包含 select , % , bin 等关键字,Apache 就会禁止,并给出 403,404,500 等错误。
% M) [" p+ R+ _3 w
9 w0 y) J" K+ {2 ]解决方法:
/ d& X$ z0 `$ _8 y. s! R: P# L) i由于这个设置属于服务器级别的配置,如果是VPS用户,需要关闭 mod_security2 的检查(mod_security2.c);而如果是虚拟空间用户的话需要联系客服协助修改。 % C- Q! B( q; ^! w
8 Z! K: D  Z# w
操作办法: ! m+ H; V% S* W( E/ }; K9 i
(虚拟空间用户)如果是CP面板,选择 Submit ticket——Paid hosting support,告诉客服自己使用 DEDE_CMS,请求将 mod_security 设置为 disabled 即可正常使用。
8 M" |  q  P4 X6 U+ ~4 W英语不好的朋友,可以直接复制以下语句: 3 b& b; i6 k% I
引用
2 J: \; r) R- e' O' WI wanna use DEDE_CMS,So please change mod_security2.c settings to disable.
8 N: S, U4 W/ t' A: U, @9 B: c

1 {0 R+ y7 S' G/ T
原文地址:http://www.bkjia.com/dedecms/362281.html
5 x" }% k8 W# o2 j% q
板凳
发表于 2017-1-22 11:46 | 只看该作者
XSS 防御设置 $_config['security']['urlxssdefend'] = true;        // 自身 URL XSS 防御                                
; y+ a3 B! g' }! s- g7 q! r
3 U5 M* L# _0 U% M9 f) jCC 攻击防御
当你的站点发现被CC攻击时,你也可以在config中打开CC攻击防御,该防御有1/2/4/8四种防御方式,你除了可以配这四种外,还允许组合防御。例如:可以配成24,当配成24代表同时使用2跟4的两种防御攻击
$_config['security']['attackevasive'] = 0;                // CC 攻击防御 1|2|4|8                                # r, p3 o2 b6 M+ B, Q$ i
2 m/ v8 D! C- G8 k# K0 R
SQL 安全性防御8 M3 G* i4 l% `5 B! m1 s. n
  1. $_config['security']['querysafe']['status'] = 1;        // 是否开启SQL安全检测,可自动预防SQL注入攻击
    + T% Y- d& ~8 ~0 y$ N# j$ H4 {
  2. $_config['security']['querysafe']['dfunction']['0'] = 'load_file';1 B4 W: `7 I' J& \0 j" E5 ?
  3. $_config['security']['querysafe']['dfunction']['1'] = 'hex';( q' c3 X  w& b6 F$ p5 k
  4. $_config['security']['querysafe']['dfunction']['2'] = 'substring';
    ! `7 `0 Z2 {( ~( M
  5. $_config['security']['querysafe']['dfunction']['3'] = 'if';4 b- @% x: ]) G: r1 A; R% N6 c
  6. $_config['security']['querysafe']['dfunction']['4'] = 'ord';3 |( j$ q) f' {
  7. $_config['security']['querysafe']['dfunction']['5'] = 'char';
    ' A# v7 ]3 ?" j6 y* ?9 p4 J
  8. $_config['security']['querysafe']['daction']['0'] = 'intooutfile';
    & N) F) T1 b- R" o( t9 W2 ~; G9 q
  9. $_config['security']['querysafe']['daction']['1'] = 'intodumpfile';
    # C$ N7 \% l" v9 z
  10. $_config['security']['querysafe']['daction']['2'] = 'unionselect';5 D0 }' f* `# c% ~& ]( E, [$ v
  11. $_config['security']['querysafe']['daction']['3'] = '(select';; O5 B: a; T. D+ t
  12. $_config['security']['querysafe']['daction']['4'] = 'unionall';
    $ f3 t! A" s* j5 o& I+ t  X
  13. $_config['security']['querysafe']['daction']['5'] = 'uniondistinct';+ q& N  c: _7 V; {4 T1 a
  14. $_config['security']['querysafe']['dnote']['0'] = '/*';5 H% u- S5 C2 ?9 ]' ]% q7 \, ^
  15. $_config['security']['querysafe']['dnote']['1'] = '*/';
    6 |' U6 h% [! b
  16. $_config['security']['querysafe']['dnote']['2'] = '#';) s7 [1 L: w! t
  17. $_config['security']['querysafe']['dnote']['3'] = '--';8 t. R% ], o, [0 e9 W8 a; U0 w
  18. $_config['security']['querysafe']['dnote']['4'] = '"';
    + q* f3 U' g' D8 U6 M, c
  19. $_config['security']['querysafe']['dlikehex'] = 1;
    ' n- z7 J! a, r9 o5 P+ o* C
  20. $_config['security']['querysafe']['afullnote'] = '0';
复制代码

' Z( [$ K# h6 I! r
* w$ L1 S! e6 M
3 }1 F( z6 E" S  P7 X
# d+ l/ i, u6 d. e: N

  a- x  t7 G8 U* I3 a
6 ?7 W3 j/ Y+ X5 Z# P
7 @! W. @1 R: C6 R, }" n8 o+ t
                      * U3 H+ x* ~6 o+ h- P
在上面内容是关于SQL的安全检查,在配置中只需要配置$_config['security']['querysafe']['status']        = 1;就可以,1代表开启/0代表关闭

7 h( j) v$ c5 c+ j9 ]创始人的设置
创始人的设置,当您的站点在线上运营时,建议至少设置一个创始人,创始人拥有站点管理后台的最高权限。
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人                                        // 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;                                
8 d5 F7 I1 t; k
9 u; C5 l6 ~4 B, ~- c安全问答
安全问答,可以在这里开启安全问答来限制管理员必须设置相应的安全问答,来增加该站点的管理帐号的安全性。建议开启
$_config['admincp']['forcesecques'] = 1;// 管理人员必须设置安全提问才能进入系统设置 0=否, 1=是[安全]                                $ X8 @+ x" a  a8 F1 n3 m

- M. \- m& _7 p. q/ D  h验证后台管理IP
验证后台管理IP,建议开启
$_config['admincp']['checkip'] = 1;        // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。                                        //仅在管理员无法登陆后台时设置 0。                                & R3 I5 K6 k) e; W# c$ r$ r
9 f/ P4 w( @% s$ \3 W8 x' j
后台是否允许执行相关的MySQL操作
后台是否允许执行相关的MySQL操作,建议关闭。关闭后将无法直接在后台执行相关的SQL语句
$_config['admincp']['runquery']        = 0;        // 是否允许后台运行 SQL 语句 1=是 0=否[安全]                                $ d$ O* X# x: e# ~( l

# S' }1 [8 Z2 a* d" O; K1 c后台恢复数据
后台恢复数据。定期备份是一个很好的习惯,在站点运营过程中,为了安全建议关闭后台恢复数据的功能,在你的站点确实需要进行数据恢复操作时再将此开关打开
$_config['admincp']['dbimport']        = 0;                // 是否允许后台恢复论坛数据  1=是 0=否[安全]              
- \# ~( f( l1 Y7 {7 U

( K) `: H, L, T3 l/ S( g/ b
; K2 q: P7 I) i' |6 O' S
6 Q8 a, ^' Z  |4 q8 G  n
1 {8 {' R  Y7 g' q

" m) G5 y/ M4 @) W- H5 A) H" n" {# Qhttp://bbs.zb7.com/discuz/dx25/safe/security/security_config.htm
0 J* C# ?+ O) o& U; e0 G                  . C2 A* s. B$ q* Q: Q

  t: U2 l9 L2 [) w2 S: U$ h' @  b
/ l, p# v" z% Q* z/ A' ^* @1 x: c$ r8 q6 e' x4 b( ~

  }' m* W" _! b! n, X2 e3 A

使用高级回帖 (可批量传图、插入视频等)快速回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则   Ctrl + Enter 快速发布  

发帖时请遵守我国法律,网站会将有关你发帖内容、时间以及发帖IP地址等记录保留,只要接到合法请求,即会将信息提供给有关政府机构。
快速回复 返回顶部 返回列表