52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |摨閬 |梯璅∪
vi /etc/ssh/sshd_config
8 F) I6 N' ]8 G8 l; |/ h7 J/ W6 X$ r6 C* v% u3 Q
1.靽格寥閮 port (舐典銵憭 port)
! u) d- A1 J% ]; @0 M! X$ a' PPort <port>$ p- F+ O% B3 I( n* }  b
1 ?; o- |% B5 F' u) j7 A
2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)
6 ~7 U% J3 b6 K; y; h/ hListenAddress 192.168.1.10
4 b. k5 E# v( g
- i2 Z0 i1 X5 B/ Q- H& l  d3.蝳甇 root 餃
/ h( L- o# {* o1 O" s6 [PermitRootLogin no
+ e9 i9 K( R( A; \  x蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩
) v& E! ?4 c# f' \  I" A
6 ^5 [2 k  n$ K! B0 D& s6 G: E6 U. \' Q8 d4.蝳甇V蝙函征撖蝣潛餃
" `7 {) B$ Q4 C# a: v0 N  ?PermitEmptyPasswords no# [$ O4 X! G. P3 y8 ^, ^% G7 E
* X3 B1 t9 ?% u. U- Y) K
5.閮望蝯孵撣唾蝢斤餃
$ P0 y" d# M( u$ M- O! l9 eAllowUsers <user1> <user2> <user3>/ \3 Q) O% w, v, F
AllowGroups <group>
, S, t. e- z$ Z. sDenyUsers *3 [# R5 ~9 p( |8 g
DenyGroups no-ssh
, {7 `+ Q" ?% |6 h" w2 m; Y寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny
# ]. j% ?) K$ f  D# Z3 Y* ]! w! \$ h, _! ^
6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅  C7 O$ w% k! S. M+ c0 C. |2 m
RSAAuthentication yes
5 T7 j* k; m& R0 d( NPubkeyAuthentication yes0 G' ]! ?1 j3 Z$ |' c% K
AuthorizedKeysFile %h/.ssh/authorized_keys
" _% c4 q4 [# h1 i/ w4 aPasswordAuthentication no" L* T1 ~, D7 S; s
銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen
% @1 D; v8 z! i7 r/ ?$ ?. t  W8 P  p9 u% X& J+ j) X; L; u
7.閮 SSHv2
2 o- N& @3 t+ k! F+ ]. K; gProtocol 28 O2 r! b( d  W9 D. C9 s

1 i, x- I( d* L( V* e# q7 v- U/ r$ u8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔/ ~& x! i1 J" N
Match User somebody,handsomebody4 I( i3 b# N2 I+ I3 h5 F8 G
PasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP3 a0 p; [/ }( |# ^
# vim /etc/hosts.deny: r( Z. E; s3 l
sshd: ALL& q9 C5 U* R5 _2 C& L
# vim /etc/hosts.allow0 A0 j9 E0 t5 s0 C
sshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺3 U5 }) W+ q9 _4 f" b4 m( ^

: i" T* j- c4 d9.雿輻 iptables 嗡皞 IP, w. {, Z. d. H! G# x
# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT% ^2 Y* h6 H6 I+ X7 g: m* b% @
# iptables -A INPUT -p tcp --dport 22 -j DROP, f9 O) Q0 w) \! r. w4 G
閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖9 Y/ R% S8 k4 n/ j" p4 I& |0 j  F
! C% A. |6 J' j4 x% \
10.摰& ?7 T& X  x+ ~7 i: @" p
雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day 0 S7 o0 j$ R% ~5 a5 f# F
蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁
& C7 i- Q8 n' x" `7 h. N  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT
4 V" L+ `/ n# ?0 @, b$ t9 n2 f  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP/ L2 X5 \1 R0 q& h3 W" j: n( f8 f
蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁
0 p% p3 y5 b4 L: v  # 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 ACCEPT4 Q7 I0 R# U- _8 f. ^* I  P
  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP- F# [% K7 ?/ n% Q
3 c! L# t2 |2 k
11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃
% S: A/ L/ m( b! Z$ iStrictModes yes* N( R/ ~) g, B, W% V
鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董% a, q: @7 d. l6 A

5 D, U  L5 }0 ?; ^7 C12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a)9 m2 E; Q3 b3 i  V% W) k
Banner /etc/ssh/banner # 隞餅摮瑼
, v* A* }, Q3 R1 g
* m1 T' ?# ~( Q8 P13. su/sudo
, L& \+ Q: L* L. j2 X, O' R5 z# vi /etc/pam.d/su
/ {' h% [3 L5 E    auth       required     /lib/security/$ISA/pam_wheel.so use_uid- \# \1 \' y& K0 h: h8 g
# visudo8 S; x2 s) `4 H; f1 l
    %wheel  ALL = (ALL) ALL& O: @0 c1 `1 d# I( |
# gpasswd -a user1 wheel) F  S/ d' [. y' V
6 H: w# X( E' ^/ U6 n8 B2 ^+ r
14. ssh 雿輻刻
2 q7 l% S: A: }% ^! {# vi /etc/pam.d/sshd5 ^; K1 d9 |7 {/ p" C
    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail) y: ~# h5 k4 o0 p% E* C! \  W1 @
# echo <username> >> /etc/ssh_users
) }- x( F: Z" I3 \& g5 A, Y* H15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺
5 B( M6 t# k$ t/ ~0 t4 K$ k    靽格/etc/ssh/sshd_config- R4 r2 t0 ]( y! P- k
#TCPKeepAlive yes
% ~/ v* k3 l6 J: |9 |3 b! \#ClientAliveInterval 0; i6 \7 |8 F1 `9 m0 n4 L2 M* G  [0 J
#ClientAliveCountMax 3

1 F& m! S, p4 h6 \5 m
     撠#踵==>摮瑼
& D9 e* T) O2 B5 ~* d7 ?2 U* Z& C#service ssd restart ==>sshd
5 D! i; M! \3 D4 C0 N8 f    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:5 q( ?' M$ l; r
    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

  a' q6 {; l% c& v% l4 u; m2 n# {( S& L+ K

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-12-22 22:31 , Processed in 0.067081 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵