52AV璈A|52AV.ONE

 曉撖蝣
 蝡唾酉
敹急瑕
  • av隢憯BBS
  • 璈A
  • 芣瑟憭瘚
  • 鞎澆
  • 52av鋆貉摰
  • 銝剜-銝剖銝餅
Yahoo!憟拇撠
望: 璈A
Google憟拇撠
望: 璈A
     
亦: 3303|敺: 0
銝銝銝駁 銝銝銝駁

[ssh] 靽格 sshd 閮剖 ,閮剖瑼 /etc/ssh/sshd_config

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |摨閬 |梯璅∪
vi /etc/ssh/sshd_config
) X: {2 N; I8 w
( [5 R; L1 t4 v% @+ B1.靽格寥閮 port (舐典銵憭 port)( r5 J$ h3 t5 O: b
Port <port>. j5 g8 {6 D5 T& |

% N& c  z7 `$ _0 Z& K# j2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)
& u6 i2 J$ I1 V- g% B$ }9 pListenAddress 192.168.1.10& q: h3 c, m& [8 z# i$ H  J

3 W5 ^0 a) _% F& @! d+ E- l# L6 x3.蝳甇 root 餃- f; u' t5 p9 y! z0 u. r
PermitRootLogin no
; v9 h( r0 f9 r4 v4 B0 @蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩+ d" n- {, i/ d8 v% ^# }
- K: J7 ?5 s2 h) t& [7 h4 R3 R
4.蝳甇V蝙函征撖蝣潛餃2 i2 u) u% E4 T8 @% L! L
PermitEmptyPasswords no; d* D0 J- n# H! N/ P; o1 D
  t+ K, B  V! b, }, f: F
5.閮望蝯孵撣唾蝢斤餃& q  G- S. w# d+ d7 `  j/ B
AllowUsers <user1> <user2> <user3>
/ T- y- F; {+ c; cAllowGroups <group>
/ L- B* z+ H4 g5 t" }7 S: LDenyUsers *
  e6 N( P$ _* FDenyGroups no-ssh
9 z5 X% Z& E/ b寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny
+ f% v& H3 q+ J* \
" M! z) }; g* c8 I  x6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅/ S% h# x- j$ N. u- H
RSAAuthentication yes' O# H  A$ \# o' e6 l' }
PubkeyAuthentication yes% a1 G  y% J, H
AuthorizedKeysFile %h/.ssh/authorized_keys
) g+ `" U0 g5 L$ C0 J8 g/ {PasswordAuthentication no
( P8 r, o1 z3 p' j銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen
7 _$ K! S" f( Q% f
) X7 Q) p9 p% k9 }3 z7.閮 SSHv24 L$ W% g( S1 T% Q+ C
Protocol 2
* q3 z  h0 \" I& R+ c! s' B, E$ v. T" e; q' V+ \' O+ }
8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔
: w2 ]7 m' k- nMatch User somebody,handsomebody- {: O4 K& ^8 f- |8 {
PasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP, I- v  c: b/ ]. j! N) s3 s
# vim /etc/hosts.deny
5 P8 `3 o1 B' B( ?sshd: ALL$ @1 Q; @9 o* b0 b  E, `) N# y" ~- c1 w
# vim /etc/hosts.allow
- V; G3 E. @5 G. U# ~; H* ]/ usshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺# w, X. {" }* @; [* t1 b0 {

+ j9 l4 F# N7 x8 G9 h9.雿輻 iptables 嗡皞 IP
6 v) j" L5 j, D; u4 A1 k# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT; V% j0 K( Y" z$ g
# iptables -A INPUT -p tcp --dport 22 -j DROP
; w: S; [6 j7 y6 x) x5 y7 d' d( ?閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖
  W  Q7 U, N' ?
* s3 D& {8 R# H  s7 g9 Z$ }& K10.摰
5 \. `' }9 |; X5 M0 P9 h雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day ' s/ g3 L; a  K7 r
蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁& j8 @8 V: C" m8 B- `" @
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT
6 G! K* P4 C7 h7 M8 Q7 R  H  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP
) ~. g  I, I; X蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁
5 w: ^& v8 y; F5 d  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT. v* e" L6 b& E' }* C  S
  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP
  R( H" x6 E4 _; B1 _' G* [6 R' N, K9 M# \3 T3 Q, m
11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃
. @- n" o* Z  YStrictModes yes
6 e8 E2 z/ {  `鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董' O* w: a; l. S# O! G5 s3 S& U" k
& R0 l) H  W( g) J! W
12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a)0 k- a' |+ j" L3 A$ w( z3 c0 N0 v7 a
Banner /etc/ssh/banner # 隞餅摮瑼
+ s) q; {* J  v4 y5 A; Z3 W6 b5 b, C/ L. t
13. su/sudo + o+ C! ~' y7 O7 U: R: S0 A
# vi /etc/pam.d/su
# C$ u' e; n! ~, X6 B) q    auth       required     /lib/security/$ISA/pam_wheel.so use_uid$ c/ Y% L& @6 D* D7 W
# visudo
$ k  d( ^  P0 X& F, p1 W, \    %wheel  ALL = (ALL) ALL
0 M- H2 C9 M+ \2 ~# gpasswd -a user1 wheel
& S6 S1 t0 S2 I) O9 N2 q: j: {' ^
2 }# A( H/ \$ ?4 f; s$ `- D14. ssh 雿輻刻
+ f/ g5 j3 Y, [- y- @6 |# vi /etc/pam.d/sshd
; d) U, o0 R: V& l/ _8 I: y    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail. ^2 z! V3 D- |' z. r$ z
# echo <username> >> /etc/ssh_users* H7 a# [: i+ B* r/ s
15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺# d: `) U* l6 }
    靽格/etc/ssh/sshd_config! h/ G, B- B9 q" e8 r1 {$ h: O
#TCPKeepAlive yes8 g, z3 M' q* T9 t# }
#ClientAliveInterval 0; i: X" K2 |3 a: Z* Q0 M
#ClientAliveCountMax 3
5 o" ^6 z! V+ q5 {$ E6 t
     撠#踵==>摮瑼
) o& D. _3 ?# H2 F% {! l+ r, {#service ssd restart ==>sshd
- }" ?8 I, ?9 t8 V    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:: x0 w' b9 m$ F% B: A: j" C; r$ l
    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

4 P$ S/ B4 ?5 u) ^% M* A2 y8 v" E( I, C

雿輻券

祉蝛閬

BT蝳

砍憛批捆靘餉衣雯頝臬批捆蝝颲行粹嗥蝬脩嚗摰撟湔遛嚗嚗甇脖誑銝嗅啣摰嗆摰撟湧翩鈭箏ㄚ孵舫脣伐銝憿亙祉璇甈橘芣遛18甇 雓蝯脣亦閬賬粹脩芣遛18甇脖芣撟渡雯閬賜雯頝臭嗥批捆鞈閮嚗撱箄降典舫脰蝬脰楝批捆蝝蝯蝜ICRA蝝摰鋆閮剖 (粹蝯行霅 祉蝬脣銝蝝瘛函隢憯啣嚗祉閮剜蝞∠)

QQ|撠暺撅||52AV璈A

GMT+8, 2024-12-22 17:08 , Processed in 0.067154 second(s), 19 queries .

蝯∠.撱

52avtv@gmail.com | QQ:2405733034     since 2015-01

鋆貉憒 敹恍敺 餈銵