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

关于mod_security

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

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

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

x
前一段发生403在保存前台,DIY时候,都是mod_security
+ G6 P( k8 }3 O1 Q! F( m5 {$ x
  L% p* S3 W: R, ^* W8 n后台保存站点广告,如果含有一定词汇,也会出现。) C4 C# d( C+ u' d

( x- }2 Q* r$ D看到这里有,黏贴学习:+ P7 P; p) C/ R9 j1 X  w
8 e, f! R* y. v  i, ]
https://www.tipsandtricks-hq.com/apache-mod-security-update-how-to-fix-error-406-or-not-acceptable-issue-259( J. A+ P8 f0 n4 I

: }0 |: ?8 A8 q7 S# \
  1. Apache Mod Security update, How to Fix ‘Error 406’ or ‘Not Acceptable’ issue& x3 }6 T8 k/ n; i6 z6 Q$ q9 w6 Z
  2. last updated: october 28, 2016
    - p$ n, x( x; l1 |- T  P, B
  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.7 G5 `- D5 }7 w2 E

  4. 4 t1 B* ?3 k/ E3 [
  5. Not Acceptable
    + ^% a. \& Q. L
  6. An appropriate representation of the requested resource /wp-admin/post.php could not be found on this server
    - i( _5 Q# C+ \% [& U) [  _

  7. + G/ s$ y5 h+ A& n
  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./ D- M1 D2 G! u* G* ?& L$ t" P: e* g

  9. . E7 e$ E6 [+ b: E( ]1 ^
  10. Solution 1 for Fixing 406 Error
    / r: W, i8 t7 c6 h3 h# W
  11. % S; h0 J+ f3 j& ]+ M
  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.
    9 R' H' d5 F) `, w  e8 J& `

  13. & R, ~/ I' d) X0 ~* h
  14. <IfModule mod_security.c>- G' Q1 b: }9 f1 j& N8 `
  15. SecFilterEngine Off/ d1 ^3 b1 C; V
  16. SecFilterScanPOST Off) k3 Z2 T; n4 q# U# h# {0 v( @
  17. </IfModule>9 Y( |8 R: F, `! Z& i, x. Q/ O
  18. You can use any text editor such as Notepad to create this file./ g1 U8 \7 t, k5 }9 f1 {+ I

  19.   _( W5 W  ]7 U1 x* @' ?
  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., @- j5 B, `2 f
  21. 7 v- ]  E. I# g2 T) ^' V( H
  22. Solution 2 for Fixing 406 Error
    9 p1 b; ?+ E4 x' o

  23. 5 S' D/ v5 |& s7 F4 ~* c
  24. This is the solution that worked for me for my WordPress site.' p* ?9 v1 l7 g9 t! \" q

  25. / d: r) [6 _% }; r  b
  26. Backup your .htaccess file if you have one in the public_html directory.+ y- [8 l  m4 X! ~0 l1 ]3 m% F

  27. ( u" B1 `/ K+ B% m- b
  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.6 i6 |& p2 |% D5 o% s$ k9 M
  29. 5 B/ s4 m$ z( ~" |6 l: S9 Q. l; w( g
  30. # BEGIN WordPress
    * Z+ E' A7 v$ H* ~
  31. <IfModule mod_rewrite.c>5 |6 S: o, E. f5 R/ _; q/ Y0 t
  32. RewriteEngine On9 o8 x$ k$ n$ t% y- |
  33. RewriteBase /" J8 H: @. ~; c6 ~; r6 f8 t0 A+ C
  34. RewriteCond %{REQUEST_FILENAME} !-f
    , W6 ]0 y/ \, \0 e. S
  35. RewriteCond %{REQUEST_FILENAME} !-d/ t8 G+ j1 `. }6 O
  36. RewriteRule . /index.php [L]
    * U( J$ [7 `. f; h. j& `
  37. </IfModule>
    7 ]' W6 m. b/ O  P9 Z3 e+ V
  38. # END WordPress
    ; d0 I+ x' y0 k+ V  K6 k& v+ [
  39. Hopefully one of these solutions help fix your “Not Acceptable” error.
    4 V/ a" |' L9 I2 S: R

  40. ; O& I. W+ e3 P9 d9 W
  41. Good luck!
复制代码

: W: |$ o% V: R2 Y4 T0 O& H2 ]) [/ ~& \


转载请保留当前帖子的链接:https://www.beimeilife.com/thread-41419-1-1.html 谢谢
沙发
发表于 2017-1-21 21:33 | 只看该作者
http://www.bkjia.com/dedecms/362281.html
3 B( ~, n& O: s$ P# S0 X  n& S$ o) Z( S+ N9 t
最近论坛里很多朋友求救,说出现了这个问题,最近我也被这个问题困扰着。多谢Funkey朋友的办法,问题终于解决。
9 o2 {, q+ U9 _6 G7 c
, L9 E; @( G7 J; Z, ]问题说明: , V$ N; u- n3 L& r- W  @

0 f( V# E% @# a) o; ~8 {$ w后台设置页面无法保存,出现如下500错误页面: 3 }* ^% t* `; I% ~( m' u
+ h# B. {% Y  m" l" Z
forbidden
& C1 N; w3 _- g) eYou don't have permission to access /dede/sys_info.php on this server.   ?, }( G2 ^# \- W

4 `: B, D' [- Q# M' H+ M/ @Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. ; O$ C, |8 M- j$ ?* G: C% n
; \( P6 {, Y* y5 S% a
Apache Server at www.******.com Port 80 4 [7 v  v$ T9 r& n

" {) \. y! m. L0 m! a6 s2 r. U问题一般出现在国外主机空间上【目前发现此问题的空间商有:Host1Plus,BlueHost,JustHost,Backy LLC】,dedecms 5.5 和 5.6 都会出现错误,可见是空间的问题,不是织梦的问题。 0 V& r  a: Y. a2 u
; k- u" B' I0 b# e
原因: & F4 K5 [: T# e
经过多方核实,可以确定,大多数的国外主机在配置 Apache 的时候启用了 mod_security ,也就是开启了安全检查,如果提交的信息中包含 select , % , bin 等关键字,Apache 就会禁止,并给出 403,404,500 等错误。
# ]+ t4 k( N/ G3 q* ~  k( z: L4 [# S3 H( G: L, s& F
解决方法:
; _/ g  S6 v/ ^8 a1 g0 P  F由于这个设置属于服务器级别的配置,如果是VPS用户,需要关闭 mod_security2 的检查(mod_security2.c);而如果是虚拟空间用户的话需要联系客服协助修改。 ! o) o( V& N+ S/ k5 O" E! t
5 \! f. [- ^" i8 P
操作办法:
# M% A. Z4 q2 ]$ A" ^(虚拟空间用户)如果是CP面板,选择 Submit ticket——Paid hosting support,告诉客服自己使用 DEDE_CMS,请求将 mod_security 设置为 disabled 即可正常使用。
8 A" k! E3 `! ?) ?* N3 k3 ?2 @2 a, j英语不好的朋友,可以直接复制以下语句: 8 K7 a7 x# Y/ \2 l+ ^8 u
引用
' v& `' j5 r  e' s6 |( vI wanna use DEDE_CMS,So please change mod_security2.c settings to disable.
# @8 N0 N. c/ D# m7 k
& |" m$ T( ^# h8 ?
原文地址:http://www.bkjia.com/dedecms/362281.html
; }! r/ D& l' T
板凳
发表于 2017-1-22 11:46 | 只看该作者
XSS 防御设置 $_config['security']['urlxssdefend'] = true;        // 自身 URL XSS 防御                                
' y2 R+ U9 t- f" ^8 S+ M6 l5 o+ k; W  {6 E) _
CC 攻击防御
当你的站点发现被CC攻击时,你也可以在config中打开CC攻击防御,该防御有1/2/4/8四种防御方式,你除了可以配这四种外,还允许组合防御。例如:可以配成24,当配成24代表同时使用2跟4的两种防御攻击
$_config['security']['attackevasive'] = 0;                // CC 攻击防御 1|2|4|8                                " S+ S% o, `* `! O

9 q2 e7 L0 S# [6 ?# X0 [) hSQL 安全性防御
. p8 i. @* Z$ T) j: o% u
  1. $_config['security']['querysafe']['status'] = 1;        // 是否开启SQL安全检测,可自动预防SQL注入攻击
    $ ]6 t6 ~" G# l% T& n
  2. $_config['security']['querysafe']['dfunction']['0'] = 'load_file';: L. R( L* W0 z' h
  3. $_config['security']['querysafe']['dfunction']['1'] = 'hex';" a5 _2 z6 p+ S7 a0 P
  4. $_config['security']['querysafe']['dfunction']['2'] = 'substring';5 Q2 @- B8 r9 k! @' q$ C, l* X
  5. $_config['security']['querysafe']['dfunction']['3'] = 'if';6 B; l/ O# a' h5 P# g3 s; A* L
  6. $_config['security']['querysafe']['dfunction']['4'] = 'ord';6 N) @' E( o' I6 V2 a# Y
  7. $_config['security']['querysafe']['dfunction']['5'] = 'char';
    7 h4 Z3 Y2 c# L; C8 l
  8. $_config['security']['querysafe']['daction']['0'] = 'intooutfile';& Z& z% e! }/ l4 _7 z
  9. $_config['security']['querysafe']['daction']['1'] = 'intodumpfile';
    + @" B  `5 G6 O/ W
  10. $_config['security']['querysafe']['daction']['2'] = 'unionselect';
    ) G' c& b! M3 `- ?7 J0 ?
  11. $_config['security']['querysafe']['daction']['3'] = '(select';
    ) r! d2 [5 u1 r6 U( n7 P8 I3 o8 F
  12. $_config['security']['querysafe']['daction']['4'] = 'unionall';
    2 a9 e" i* u$ I8 A0 H- y
  13. $_config['security']['querysafe']['daction']['5'] = 'uniondistinct';/ C9 c3 b6 N9 F
  14. $_config['security']['querysafe']['dnote']['0'] = '/*';3 H" ~* c* \* p4 s. f; v; n' ^
  15. $_config['security']['querysafe']['dnote']['1'] = '*/';
    7 C4 [1 z6 x. U
  16. $_config['security']['querysafe']['dnote']['2'] = '#';
    + p' A+ t1 E) ~* }9 D
  17. $_config['security']['querysafe']['dnote']['3'] = '--';0 n: K+ C" V3 {  N
  18. $_config['security']['querysafe']['dnote']['4'] = '"';
    " M. t+ l" n. B/ r3 g, h- \
  19. $_config['security']['querysafe']['dlikehex'] = 1;( F- U, A4 z+ j  c& `. I
  20. $_config['security']['querysafe']['afullnote'] = '0';
复制代码

% c) Z( o; f. g% r% [% l$ d& ]+ E, ~! n
3 O2 T9 I! V! X$ s* s2 D1 k

# m7 T! g$ a3 u# N+ p

! t6 G3 z- `0 W2 H( a: m5 S1 S* D; D, `) \& t

8 T) G! k0 b  K! Q4 q4 {" t                      ' i2 N; @' Z' }: A6 y! f; ]* d7 M
在上面内容是关于SQL的安全检查,在配置中只需要配置$_config['security']['querysafe']['status']        = 1;就可以,1代表开启/0代表关闭
5 L/ n0 t. M8 `* B' q6 @1 |; F3 z
创始人的设置
创始人的设置,当您的站点在线上运营时,建议至少设置一个创始人,创始人拥有站点管理后台的最高权限。
$_config['admincp']['founder'] = '1'; // 站点创始人:拥有站点管理后台的最高权限,每个站点可以设置 1名或多名创始人                                        // 可以使用uid,也可以使用用户名;多个创始人之间请使用逗号“,”分开;                                
+ G: i! B: _( w. `5 J6 _1 h; q0 S& U  N7 ?# C  Q
安全问答
安全问答,可以在这里开启安全问答来限制管理员必须设置相应的安全问答,来增加该站点的管理帐号的安全性。建议开启
$_config['admincp']['forcesecques'] = 1;// 管理人员必须设置安全提问才能进入系统设置 0=否, 1=是[安全]                                6 t, n4 F/ O4 {5 A% g

" }" u' ]% R: [) ]% {0 n* H; T  o验证后台管理IP
验证后台管理IP,建议开启
$_config['admincp']['checkip'] = 1;        // 后台管理操作是否验证管理员的 IP, 1=是[安全], 0=否。                                        //仅在管理员无法登陆后台时设置 0。                                
! x3 {+ S7 j/ e5 w( V/ ]+ e
( ~! |% Q+ f4 h7 O: W( t9 u后台是否允许执行相关的MySQL操作
后台是否允许执行相关的MySQL操作,建议关闭。关闭后将无法直接在后台执行相关的SQL语句
$_config['admincp']['runquery']        = 0;        // 是否允许后台运行 SQL 语句 1=是 0=否[安全]                                ) I! |4 t- ?4 {, I4 D

& f# Q& h0 e9 u0 e  S8 T+ w, f后台恢复数据
后台恢复数据。定期备份是一个很好的习惯,在站点运营过程中,为了安全建议关闭后台恢复数据的功能,在你的站点确实需要进行数据恢复操作时再将此开关打开
$_config['admincp']['dbimport']        = 0;                // 是否允许后台恢复论坛数据  1=是 0=否[安全]              & J5 c) V1 K) m% N8 X% o
, \6 ~: d* R' R- }: G
. M! b) [+ J' j

! X, c; o- \. ]& X/ H
! F; J. @8 U& z# l

) D. }/ N$ t8 O' C; g# n# ]http://bbs.zb7.com/discuz/dx25/safe/security/security_config.htm
5 D1 J4 U% O/ I$ \, C                  
: E: e  |5 x, u. `% `( p8 j- q7 b
& @- ]" b( r" R! z" j
3 y9 W5 i1 X& f7 n8 F7 S* b1 ^
( U2 L- f  N* [# k( i- I
  j1 n% G1 q$ _$ G2 @" j5 L

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

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

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

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