52AV璈A|52AV.ONE

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

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

[銴鋆賡包
頝唾唳摰璅撅
璅銝
潸” 2015-12-28 10:28:36 | 芰閰脖 撣 |甇摨閬 |梯璅∪
vi /etc/ssh/sshd_config
9 F0 X3 u4 B: c4 `5 ?9 U; {+ j$ d8 O
1.靽格寥閮 port (舐典銵憭 port)/ \: z1 m2 N7 ~* p9 f! r
Port <port>( S% O; j! V& ?8 v
9 M6 M6 s  ^# N' j3 F7 H# _, B: ~
2.賜孵 ip (拍冽澆蝬脣/憭 IP 敶)5 D1 w1 G2 B$ i& t, c5 d/ Q
ListenAddress 192.168.1.105 w9 Y4 W3 Q7 m% i
, A& j6 x( S& S# X, m; p
3.蝳甇 root 餃( N& W, `6 ^2 J; T* h: E; E
PermitRootLogin no
+ C' E6 w5 v( g  x- y9 V蝞∠敹隞亙鈭箏董餃伐 su root嚗拍 sudo 撌乩4 n: p, u' a& ?, ~2 a) v
3 a# l9 y& p( @. O' @5 [- \+ {
4.蝳甇V蝙函征撖蝣潛餃, z$ U, N: J. F3 k
PermitEmptyPasswords no
/ y8 x0 c, q% Q9 t1 U/ ]9 C
+ P& n4 f, F& E1 |" P7 B5.閮望蝯孵撣唾蝢斤餃
8 T& b3 L! U" j4 J; SAllowUsers <user1> <user2> <user3>
, U8 o  \: O. RAllowGroups <group>2 T& H" s0 J( Z  a: `* {$ D
DenyUsers *% U2 _# b$ K; i4 F! r
DenyGroups no-ssh
3 t: S$ [" }: k$ k& y3 o" o寞撖阡嚗撠澆銝撣唾閮嚗憒 Allow 頝 Deny 閰梧蝯 Deny 8 R- Z7 H# f- }
" [; S% @% J6 |) L1 W) q% R
6.撱a文蝣潛駁嚗撘瑁翰雿輻 RSA/DSA 撽霅' X8 v2 n( L$ S: N8 T
RSAAuthentication yes
7 d" [, X  s* u2 ^& m1 U$ @PubkeyAuthentication yes' |6 @7 H: x/ b- L
AuthorizedKeysFile %h/.ssh/authorized_keys' t4 L2 {( }/ @% Z) @
PasswordAuthentication no; i' T: U* Q7 w  ]8 J/ K
銝衣Ⅱ靽 user ~/.ssh 甈 700嚗撠閰 user public key 亙 ~/.ssh/authorized_keys 銝准Public key Y孵舀撠 ssh-keygen& w' E. @$ r: t. g
0 G6 a8 ]! N" j* {6 y
7.閮 SSHv2  h9 B/ |/ x7 d, ?/ ~$ ~! K
Protocol 2$ |! J3 R! [. a; v; b

  b4 j- ?; D8 l# a8.嗥孵雿輻刻蝢斤銝餅雿餃亥綽鋆∩誑 somebody handsomebody 銝臭蝙典蝣潛餃亦箔
8 L" X3 L$ v2 H3 `Match User somebody,handsomebody3 ~: k5 C% _$ h1 q
PasswordAuthentication no雿輻 TCP wrappers 嗡皞 IP
; V# i/ {  v9 [. A# vim /etc/hosts.deny2 }& W4 c0 Q+ C; ~# e6 C
sshd: ALL
9 }& Z9 V7 N4 R, H$ \# vim /etc/hosts.allow
1 n9 w3 u3 X! F' q8 S6 F7 l3 Y- v4 csshd: 192.168.1 1.2.3.4 # 閮 192.168.1.* 1.2.3.4 蝺
! |# D4 d* v. N* _5 d% {! S( K# M. L) W3 z" n
9.雿輻 iptables 嗡皞 IP) o' z  J0 L0 g" n; I$ ~
# iptables -A INPUT -p tcp -m state --state NEW --source 1.2.3.4 --dport 22 -j ACCEPT
/ \- q8 J0 W* k  N( K: f5 H# iptables -A INPUT -p tcp --dport 22 -j DROP
6 q8 k& ^  n4 T) X6 c+ B閮剖蝡喟嚗亙璈敺賭摮嚗閬脣 iptables 閮剖
' R& `* @) _/ u5 J( D6 E5 s1 B; B/ y8 j* a7 C5 F+ |
10.摰( X. T: n& Q/ l) K1 r2 Z
雿臭誑雿輻其iptables訾嗅訕SH伐霈嗅其孵蝭批臭誑伐嗡銝賡乓雿臭誑其Y隞颱靘摮銝凋蝙 /second/minute/hour /day ( }: L4 d6 g/ t  `/ w
蝚砌靘摮嚗憒銝冽嗉撓乩航炊撖蝣潘摰銝找閮勗刻赤SSH嚗璅瘥冽嗅其批芾賢閰虫甈∠駁
$ Y+ @+ N4 j. K  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -m limit --limit 1/minute --limit-burst 1 -j ACCEPT% [) y% \/ U! q( x* ~
  # iptables -A INPUT -p tcp -m state --syn --state NEW --dport 22 -j DROP
2 c! `7 p, e; ^$ x1 P2 y9 D5 V蝚砌靘摮嚗閮剔蔭iptables芸閮曹蜓璈193.180.177.13亙訕SH嚗典閰虫甈∪仃駁詨嚗iptables閮梯府銝餅瘥閰虫甈∠駁
7 a. b; `& _0 g& O2 s0 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
( F; k/ N3 ^. A6 }% u) v3 A+ v  # iptables -A INPUT -p tcp -s 193.180.177.13 -m state --syn --state NEW --dport 22 -j DROP. _* g3 A. c5 P# {3 U( G$ R

4 r: A" p3 F- w$ A+ m1 L11.瑼X亦賊瑼獢甈嚗銝摰典銝閮梁餃# n0 @0 P6 d  z! \2 f* [
StrictModes yes
: I9 J! k; C; F( J) t% ]鈭賊瑼獢甈閮剖交航炊嚗航賡摰冽折◢芥憒雿輻刻 ~/.ssh/authorized_keys 甈亦 666嚗航賡嗡鈭箏臭誑典董% `, N" e% B" B4 P/ f8 L

: N" W9 U% y: U' x1 t! Q12.芾雿輻刻餃交憿舐內 banner (閰梯牧頝摰冽扳隞暻潮靽...? 憭扳臭誑函冗鈭斗孵頝憯鈭箏...= =a). U5 q" D, N6 L# d+ \
Banner /etc/ssh/banner # 隞餅摮瑼1 A+ B/ {1 l, f8 D$ [; v
  Q- }* v! s6 v6 y1 R' `8 ~
13. su/sudo
+ J" M) L/ ]2 |$ c3 G# vi /etc/pam.d/su
. {  D, W/ L, |1 G2 f$ c9 A    auth       required     /lib/security/$ISA/pam_wheel.so use_uid' o3 s6 _8 G2 C+ T( c1 B/ {
# visudo
7 E2 n, Z0 R* A/ m! C2 Z  x3 n9 _    %wheel  ALL = (ALL) ALL
5 d' R8 }. f8 z4 W; ^; P# gpasswd -a user1 wheel1 b- n) L8 r. ~5 s. ^
5 e0 U/ ?7 N' ^+ l* A
14. ssh 雿輻刻
8 x7 B9 o: \8 }* o- c# vi /etc/pam.d/sshd
! C& E$ ]7 U  R9 s    auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users onerr=fail9 J/ `7 c" [! L' w
# echo <username> >> /etc/ssh_users' s7 X; a3 r' ]- j
15.脫迫SSH蝺暹(timeout),霈PuTTY SSH 銝港蝺
* q3 @! v# ~. U& R$ T  f. A    靽格/etc/ssh/sshd_config5 g) M0 @9 z/ z/ D9 M( f4 k  A
#TCPKeepAlive yes
% i9 G" {# \1 t4 D4 J#ClientAliveInterval 0
. {2 A( q3 k, X! x/ ~6 j6 \( u#ClientAliveCountMax 3

4 s; B! z, E! X) H4 n
     撠#踵==>摮瑼
8 e. g4 e3 F3 p2 X0 b3 v# `" d: @#service ssd restart ==>sshd
+ N# x) l3 H. O6 e    乩靘靽格 Pietty 賂脣PuTTY 蝺閮剖:
: l' S5 K8 \5 c+ f    豢Connection殷撠Seconds between keepalives [0 to turn off]喲甈雿頛詨交撟曄嚗喲銝null撠隞乩蝺

7 K) p( }& ]- I9 ~- Q
/ u2 C9 E8 n; t  x4 }. i. @2 w

雿輻券

祉蝛閬

BT蝳

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

QQ|撠暺撅||52AV璈A

GMT+8, 2024-11-24 12:16 , Processed in 0.054959 second(s), 18 queries .

蝯∠.撱

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

鋆貉憒 敹恍敺 餈銵