52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |摨閬 |梯璅∪
vi /etc/ssh/sshd_config ( P% J3 |! X$ \* j. o4 m
0 m% `7 Y) N9 Q: M1 V( Z
1.靽格寥閮 port (舐典銵憭 port)7 O5 R$ {% n8 h+ A$ `5 u
Port <port>9 R  s$ }. G  G: w4 f6 o2 U

: I% M( u" S$ E4 H7 p  w2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)
( N7 Q$ }5 D- b3 {: n2 p0 n* S& t0 xListenAddress 192.168.1.10
' Q' l8 i1 s7 t; A5 ?+ x# g: F% Y9 h
3.蝳甇 root 餃2 f* a; o5 k) `9 x
PermitRootLogin no
  H) c+ C# J- z6 I蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩
4 l4 A. Z. A8 v5 A, }0 R
* R( w) S2 w5 e: h- M# g4.蝳甇V蝙函征撖蝣潛餃
+ V5 u# |3 F% ~$ j9 x2 y/ uPermitEmptyPasswords no8 K0 w- m5 G' P: i
/ b3 ~) p, e5 X  P
5.閮望蝯孵撣唾蝢斤餃& n4 }! Z- Z, t. M; d! b! D# P
AllowUsers <user1> <user2> <user3>- P6 ]. ^7 L: E  O& }$ `& I
AllowGroups <group>
) G( L' U% D6 kDenyUsers *9 }& V  P8 G, T1 z5 u% P
DenyGroups no-ssh
$ X- j) n' `. f" R, r. ~寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny
& q- m( w+ C3 p, o- G9 a3 V
1 y( r1 R! `! d6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅
0 _% O' u# R" R$ Q8 q2 hRSAAuthentication yes1 _7 R2 d# w; n+ Y' a. K+ p: n5 c8 W
PubkeyAuthentication yes4 }% T' D% w+ D" b4 e
AuthorizedKeysFile %h/.ssh/authorized_keys
6 \, x, A% R: PPasswordAuthentication no
9 M; H6 X; Z. d5 P9 n/ R9 Z; w) Q銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen4 [: R2 N8 b( v8 ^; D, `

! f2 d0 N8 w8 T7 t2 t: S7.閮 SSHv2" a+ w" `  n, s; i4 [1 h
Protocol 2
& U" Y9 e; Q  u' G2 U- ?
' W6 f5 }( S7 W( x: f8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔! \4 g5 q& z( S
Match User somebody,handsomebody
  c- e& G& _0 X; }$ j  ~$ zPasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP
8 |/ z3 S2 e' ]8 G8 R, X  h2 w# vim /etc/hosts.deny
* [0 l% A' N+ Jsshd: ALL# U7 ?* p' ?& i
# vim /etc/hosts.allow
8 M9 O8 o" C. n5 |1 G1 osshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺; ]; n* ~- s( }$ F8 f0 ^
$ A9 ~7 u6 y7 k0 J) ^4 T
9.雿輻 iptables 嗡皞 IP; s4 b" ^2 V- V2 h" q! L3 \
# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT" X0 @' c4 ]( I! r6 P
# iptables -A INPUT -p tcp --dport 22 -j DROP- _  O# w) b2 J0 ]& s% Q
閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖
5 j5 z# a2 \$ h% c* X& Y8 m# k2 r" n$ ]  g4 e6 S
10.摰/ L$ R2 ~1 M% u! Y' t" |) n) k
雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day
  ]: u  w" I" \蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁4 k7 k, Z, j: C) D2 A: y
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT) v  I7 A% @( [$ L7 e: ?: `
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP
6 @3 `+ @" y( A* g) X4 E  Q蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁8 x, W) c' K' y! H. _' M& p+ L: {
  # 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 ACCEPT3 R( }& m5 d) j; {* N
  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP
* c1 ?) q; i2 z& @
8 @# k# L9 o& Z4 k  H) Y11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃5 R# W6 O  {$ c# L6 m: f( |0 n9 \
StrictModes yes1 D3 W, \! c* i5 K9 f- H
鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董
; B, D2 i4 w% T$ g* T# C. C8 s& H7 G; T  J1 k$ F! l, C
12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a)
6 w1 S8 V9 c6 w) ^& `) mBanner /etc/ssh/banner # 隞餅摮瑼2 `* `% n  W# ^, ~

  t, F6 O0 ]5 k13. su/sudo
4 ~4 ?. W- s0 M& }5 v# vi /etc/pam.d/su& u' J6 y2 U! W7 e7 Q/ c
    auth       required     /lib/security/$ISA/pam_wheel.so use_uid4 a# S: W" P. K+ v
# visudo; }: p2 i. `- D
    %wheel  ALL = (ALL) ALL
. x' W' }+ b: ~# b' t# gpasswd -a user1 wheel4 ]; o2 @! i6 h+ ~0 V# F& c- n
6 d+ K$ c' W4 a# [
14. ssh 雿輻刻! W8 f9 f: z: _" u! X
# vi /etc/pam.d/sshd
4 u9 `# O# k. C7 c$ v% D1 r    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail% C* l% n: S* S  ]
# echo <username> >> /etc/ssh_users
. P3 z! u! ~: Y. O+ S- W5 H15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺) P/ E6 m0 b2 a8 N. u4 g3 E
    靽格/etc/ssh/sshd_config
4 y& I& x. O, {5 ~. k#TCPKeepAlive yes) J% E9 q* d% _  J
#ClientAliveInterval 0' l! u, [  a" e3 c
#ClientAliveCountMax 3
0 {7 e0 J) Y; W+ s- f
     撠#踵==>摮瑼( N0 [$ y$ T# ]0 [7 ?
#service ssd restart ==>sshd
" a% X  {% V# Z- ]    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:
; g- \) o/ ]/ T    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

0 Z$ z0 N7 |9 ~
/ @$ c+ S, c( W: H; k3 P5 V3 o

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-21 21:19 , Processed in 0.070623 second(s), 19 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵