52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |摨閬 |梯璅∪
vi /etc/ssh/sshd_config
' F' J; y% v8 ]$ c6 D* ?+ n( G  x& l
1.靽格寥閮 port (舐典銵憭 port)
/ V- O# _7 J0 m0 GPort <port># H8 J! [7 ]1 N) n! C

% V8 ?: b4 e; `2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)
3 t. S1 C  M3 q0 a0 bListenAddress 192.168.1.10
' P  s% u- H* M2 ~8 m" a7 f, ~
! J7 v6 P; {: `+ Q' X; V3.蝳甇 root 餃
: e) z( [" I* }% B  LPermitRootLogin no
% D9 y  Q. @( E( F! F! d* n( S/ M蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩. q7 N. [$ H4 t( h
' _0 K8 S0 M$ L; H4 S
4.蝳甇V蝙函征撖蝣潛餃) n" s) p7 |% K$ H4 T/ \
PermitEmptyPasswords no
: C" d/ U$ M4 s8 T/ [8 b7 d& o9 _) m* d) ?) C8 Q
5.閮望蝯孵撣唾蝢斤餃! B0 ]1 r$ h% V! x! q1 E
AllowUsers <user1> <user2> <user3>) D* {. t+ R5 M  F4 v, ?# L
AllowGroups <group>
" T! ^! N8 R! w9 r  u" ?5 xDenyUsers *! o' b% j0 _% S" K0 h  _
DenyGroups no-ssh
( \* u$ U$ C  s3 z寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny 5 J7 M. M+ h9 u9 @+ ?5 m. g; C6 w

0 O, v$ w9 H7 S' x6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅
& M) b( {& ~) k/ L: l/ {RSAAuthentication yes
  @% ~8 N/ E1 I& |9 D# aPubkeyAuthentication yes) g, L$ R1 I8 i, R7 j
AuthorizedKeysFile %h/.ssh/authorized_keys
& s+ a2 C' H4 P! `PasswordAuthentication no
# N( ~3 _; n0 x4 b- J8 J銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen! s* V( H( @9 `  I' L+ w

- u# D! T# h: s, O) e7.閮 SSHv2
4 ~3 w( w; R# J0 c" LProtocol 2
  r+ R0 P' Y$ {! U% q
9 T. Q* E- F+ p. r3 z8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔8 I0 r: A2 u1 v; ]- O, `
Match User somebody,handsomebody
: g8 _4 ?2 P' W: B+ BPasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP
; Y* ~* y6 v' n8 k4 W" c# vim /etc/hosts.deny3 Y) y5 U6 }) R
sshd: ALL3 }" J3 `1 Z  N: \  S
# vim /etc/hosts.allow+ l5 o( `- ~9 d! n, k+ r3 ^
sshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺& j. F2 G* w3 Y

. e7 T8 c! F2 L& l/ K9.雿輻 iptables 嗡皞 IP
5 c4 L9 }: W: v9 T/ q9 ^' [' ~3 [# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT$ z2 m. H9 y" L
# iptables -A INPUT -p tcp --dport 22 -j DROP' _* Q3 k; K) x
閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖! |* f. w/ r5 s1 @4 [$ [
* {+ q3 _% s8 U0 H: b. `
10.摰
1 m1 i0 `! p' Y$ u) h7 Z雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day   S+ p% k/ A$ z) r4 d2 v
蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁7 |+ X* y2 M2 m0 G
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT
6 {' O. }, J$ ]" }# [4 K& z  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP" d- L" p! t6 E: W/ y' r4 v, W
蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁% C; m/ [& R5 g; D' g
  # 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: O, ~; E3 h" o9 }  k
  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP" y" ]4 h% S7 [: h& V

' ]: k, n. t8 Y; j) s11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃2 M# c* v3 |1 V* q
StrictModes yes
% C0 q3 q& U5 p0 ^( a& N2 a! z鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董3 m' t6 X! ?. W  r) n

% K. C: M+ h' F) a8 v" y2 t) N12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a)) X$ s; A" G7 H. t
Banner /etc/ssh/banner # 隞餅摮瑼
+ K* r2 X7 S; }$ o+ e( U3 k+ V6 Q* E3 P0 l7 s' ?3 l
13. su/sudo ; n7 p/ ^8 C) [" o
# vi /etc/pam.d/su1 P8 {7 j) C) _
    auth       required     /lib/security/$ISA/pam_wheel.so use_uid8 ?: T% l( l5 }* Y$ k* }. d
# visudo
! l: Y$ x7 H: Y: m6 @, E    %wheel  ALL = (ALL) ALL' X3 ]" v  w) f+ i; S
# gpasswd -a user1 wheel
# `; i- f! v& j: W7 w3 f3 u3 N/ P- [# m1 r4 ~! ~* i0 e
14. ssh 雿輻刻: k1 V  p3 g5 g5 u% {: j+ R" `& Q
# vi /etc/pam.d/sshd
. [0 K  U  z- ^# |( g    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail
; p* K, E* }+ {( B# O- H' t: D# echo <username> >> /etc/ssh_users
: i( s& {& I3 B0 ?( V  O15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺! Y8 ?. X! t7 N3 T% q
    靽格/etc/ssh/sshd_config, F: M  S. ~( S- O# W2 ]+ Y  f( S
#TCPKeepAlive yes
" L' F$ x9 }  \$ g$ q" L#ClientAliveInterval 0: ?" A) b; [2 ]* h0 P7 @" W9 u
#ClientAliveCountMax 3

, h2 @' u1 K$ E; w: R& x9 z
     撠#踵==>摮瑼8 L4 ?+ w# w7 D" ?( u3 q
#service ssd restart ==>sshd
. Z2 f" o! G1 {" Z; j    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:, d, a4 B! Z+ U/ `, M6 p7 b4 `
    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

/ r0 {1 H/ W% D+ @5 d
3 m/ ~# }% t1 m& @

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-21 21:35 , Processed in 0.072285 second(s), 17 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵