52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |摨閬 |梯璅∪
vi /etc/ssh/sshd_config
2 c& q4 [8 S1 g1 y& Z) J8 v( o( Q" K4 E4 y# B! A
1.靽格寥閮 port (舐典銵憭 port)
1 x9 a( x/ T# K* b% \+ i" `Port <port>8 T# [: F0 v4 j+ ~1 G
$ Y0 @# Z* a( m0 n! s) \4 I8 W- ~- q
2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)- j/ h$ K6 U" S* g& _, B3 r
ListenAddress 192.168.1.10
- Z$ g! t8 I; H" I
& ]' i7 A5 s0 K! Q  M) {3.蝳甇 root 餃
- A" T' W# C  G. e" g8 cPermitRootLogin no
7 ^: `$ g* `8 b, w1 {& u( o蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩
9 G, d5 ?! P$ `! |' ?
/ |7 v6 P  {" Z) [4.蝳甇V蝙函征撖蝣潛餃
5 E7 V( T" r$ E$ UPermitEmptyPasswords no- M* e, N( _1 l" @" ]9 N3 v6 q

8 e7 \/ Q" X0 y1 c& B$ |* G9 j5.閮望蝯孵撣唾蝢斤餃) E3 E; E# P1 L" F6 T- S% G
AllowUsers <user1> <user2> <user3>7 n2 d7 L+ q5 E$ {# Q$ D, ^: p3 `& @
AllowGroups <group>
/ `  y7 ~* k& x6 z2 |7 r. NDenyUsers *
( N* b$ H+ Q* _" y3 X2 Z+ D' q2 xDenyGroups no-ssh4 j- ^9 {: W6 u4 d; I3 o
寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny
2 F& t' e0 r% P8 e+ S6 E
& N* y8 E, _! |; W: l* X6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅) l6 B' g3 T8 V' |8 F
RSAAuthentication yes/ A6 h$ _0 t- [$ o+ W3 C4 W4 A' I
PubkeyAuthentication yes
  @+ h- R1 H4 g5 Z. @/ R" G: m5 M9 ~6 QAuthorizedKeysFile %h/.ssh/authorized_keys1 s; N/ u3 W7 m6 f* g
PasswordAuthentication no' u) b: G# J* w; P$ g
銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen
! E, O& Y: A/ x- p5 p' l+ Y2 i  B/ V' `& Q1 W0 H
7.閮 SSHv2
3 `+ \0 Z) _$ Y! bProtocol 2( Q3 k5 [8 F6 s3 G' y, }

  R4 V: J1 Q% h4 n3 y2 Y9 \  [) N8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔
7 G, U! A  Q' SMatch User somebody,handsomebody
! V% ?0 Q; t- X# d% X: \PasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP
# R4 k* f& Y& ?) X# vim /etc/hosts.deny' @0 S7 s7 S* Q8 u# M
sshd: ALL
: z& s+ H- P$ {& R# vim /etc/hosts.allow% h9 j) I; l9 {7 B( X# U
sshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺' N) ]- g# r' X. m- a) N2 m3 u

2 Z" Y, B; [! h$ y! t+ S! Z# l% c' Q9.雿輻 iptables 嗡皞 IP
: h0 n' f7 v4 o' u# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT
; H( w! ^' T' h$ a$ Y% l9 p; D# iptables -A INPUT -p tcp --dport 22 -j DROP
: i5 I- \: Y. P. H  H6 `閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖& |* \$ O( r5 V8 M7 I3 e

9 o7 t* y3 i4 I! m) c10.摰
+ D+ \7 ]* H/ A! T; @2 L# E5 T雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day 9 @$ E/ |" x2 ~  F. r, j
蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁7 x' b* @8 _( }8 ]  G0 f- \8 a
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT
* G$ R. X6 @* r  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP
0 ^/ R$ S2 j+ v/ b蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁. T2 Y1 J8 r, e: j# m
  # 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
) X8 X' Z& a! e; s# O6 [$ y  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP
$ I8 y; ?- C4 u+ W- W, q* ^: H' ?( l' _. r" o' u7 T& k: g# L
11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃- Z1 B! A' E0 ?9 O9 k- O8 D
StrictModes yes
1 v) Q, m4 ]. P; k+ z$ D% Z- k鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董
# x& L" E* ?1 F9 f* K4 K8 q$ A
: Q9 Y# I6 Y* P! J1 K9 y( M12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a); T, a/ U) `, C' ?5 w$ K9 f1 u5 v
Banner /etc/ssh/banner # 隞餅摮瑼
: o7 X" h; _) c/ v
: `0 K2 G8 b) _& J13. su/sudo   k' {: H# M* F7 M
# vi /etc/pam.d/su( c# Q4 S+ O+ a. _8 y/ M
    auth       required     /lib/security/$ISA/pam_wheel.so use_uid
, `4 c' [3 |' e, e4 y# visudo
( p. j( Y) O% |2 M) n    %wheel  ALL = (ALL) ALL
$ J5 X- ]7 G4 ^6 f1 r# gpasswd -a user1 wheel+ \$ w# s9 g  ^1 o, ?

7 t! z0 }/ Z* q3 B1 n% F3 P14. ssh 雿輻刻
% }! F. ^- S7 v4 h$ M# vi /etc/pam.d/sshd6 O8 X- \! M/ x% _2 R8 D
    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail
) {# l$ m+ c6 x# echo <username> >> /etc/ssh_users$ s& N8 S& l. `4 M/ C- L. g. E6 R6 ~
15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺
5 J" j: q8 T: ]0 o3 Y! U    靽格/etc/ssh/sshd_config
, u7 s4 e' t7 b#TCPKeepAlive yes7 c+ v) n. e9 f
#ClientAliveInterval 0
1 }/ R( f" {  Q( s; {4 [- h' \! U#ClientAliveCountMax 3
/ K- i. @6 {/ @7 v
     撠#踵==>摮瑼
# d. C/ U7 \, E6 E5 Y#service ssd restart ==>sshd
3 ?- j: K* N/ V8 L) P7 ^; v4 X, G    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:
9 B! U) }( ]- w. ~, H, ^    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

0 m( p2 n% k* m( [$ H0 o
6 B1 T' l# p. m( S3 V+ Z

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-28 08:16 , Processed in 0.062333 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵