|
|
jumpserver 3 f. K' E0 b0 q* q
jumpserver是一款使用python,Django开发的开源跳板机系统+ c) E) s" h4 ?1 x" r; x" Y. x
$ L4 T/ T2 A2 \- v9 {( E: }官方地址:JumpServer - 开源堡垒机 - 官网
R0 J8 j w1 I4 n! d3 m+ q1 f ^6 t . ]; V% r- m' R2 |" W( o: i4 t
部署环境+ ~( x7 j: e- ^- ]. L& f2 O
6 D! @5 e% ?- E$ Gpython = 3.6.x9 A9 l3 l: n$ p3 v1 k8 }
* C7 p' ]1 O+ T& P$ w, }Mysql server 最低5.6( k% x7 ?! [0 N
% c3 r* N! D4 @8 h/ n
Mariadb server 最低5.5.56
, H" x5 U0 k$ x$ T9 b - @# D0 D) }1 ~" q3 M9 g: ?
Redis* w/ F4 |* o* }/ B
/ @4 P- a, `% \% v0 |& L K
以下示例用docker创建1 i- f, O J. y6 i8 l0 Z
2 s- I! P6 U6 g* \1 ~' w
docker部署mysql
! r! f1 Q6 m0 L' ~2 i) p! a数据库编码要求utf8
9 N; [# N5 i$ j) N9 d( A ( c8 {- D# z- Y3 ~' ~ w
# mkdir /data/mysql/{conf,jumpserver}6 g$ r+ s3 \+ x
# docker pull mysql:5.6.48# y0 O. l% n4 u$ o' x( M- C3 G
# docker run -it --rm --name mysql mysql:5.6.48 bash
! y: F4 C# U% _4 C& h# y( j6 r8 C' b# docker cp mysql:/etc/mysql/mysql.conf.d/mysqld.cnf /data/mysql/conf/* r' ?2 G, b6 e F
# docker cp mysql:/etc/mysql/conf.d/mysql.cnf /data/mysql/conf/( c) i' \, E6 t8 w' n% A
# vim /data/mysql/conf/mysql.conf: I7 }* W2 M8 O$ J+ W& A S
default-character-set=utf8% j# Q( V, o" w# {( }
# vim /data/mysql/conf/mysqld.conf' z3 L! m1 z H% E& }) Y. i
[mysqld]
: s8 V- ] N i/ G( T% _/ j6 Ipid-file = /var/run/mysqld/mysqld.pid
9 ~6 ^/ U6 |! E( C: G) Usocket = /var/run/mysqld/mysqld.sock! r- d# d/ H" w+ L* G0 m
datadir = /var/lib/mysql
" M. J* M- A+ J% L4 }+ f& m9 j#log-error = /var/log/mysql/error.log
' G s/ i3 l) E( r8 r9 c! A# Disabling symbolic-links is recommended to prevent assorted security risks; \0 n2 I( j) a
symbolic-links=0
0 Y l! ?: W" p7 S& Q) w) ?/ ncharacter-set-server=utf8) S4 T8 F$ J4 n. i" L
# docker run -it -d -p 3306:3306 -v /data/mysql/conf/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -v /data/mysql/conf/mysql.cnf:/etc/mysql/conf.d/mysql.cnf -v /data/mysql/jumpserver:/var/lib/mysql -e MYSQL_ROOT_PASSWORD="ilinux.com" mysql:5.6.489 @! {/ H. x) S
; x- h6 Z! M8 L0 f# n1 z; ?
##验证数据库编码是否为utf-8+ D! P- m* C0 ?
# apt install mysql-client3 p9 u( V7 e& }# l5 A, i
# mysql -uroot -h127.0.0.1 -pmagedu.com
$ C+ k! t: G- f) x5 I3 T9 ]& V6 b% Omysql> show variables like "%character%";show variables like "%collation%";& P4 |. z# C9 v6 c' K0 {, G3 h( ~
mysql> create database jumpserver;
! L4 `4 {$ R3 X6 `mysql> grant all on jumpserver.* to jumpserver@'172.17.%.%' identified by 'ilinux.com';! G# g! d3 \8 M* N6 T! P
mysql> flush privileges; 7 K0 W7 W$ V. a! q& L% i& j
docker部署redis 2 V4 ~$ {$ k. ]6 c* u9 _
# docker run -d -p 6379:6379 redis:alpine3.12, l8 }( r2 \ [; C
# apt install -y redis
/ e0 _7 ?5 u7 v# redis-cli % N6 T) C# p2 g/ S$ G
127.0.0.1:6379> info ' Y: Z i. r: ?! b5 V& l3 e
docker部署jumpserver
, {# G4 V* @4 j* Y+ a##创建jumpserver容器
8 ^) L- K* i8 Z$ F8 H9 M1 F1 idocker run --name jms_all \
2 ^: ~3 I1 f' R& N0 X -v /opt/jumpserver:/opt/jumpserver/data/media \
6 k( {1 a: |& t6 C5 C4 l9 r -p 80:80 \
( P3 ?$ p7 `- x$ G -p 2222:2222 \
1 J3 f7 Q7 T5 {# b4 j4 S0 E3 U -e SECRET_KEY=nHQrsL0MbI8z2K1vKzcOQi9O2gouEZSqZj7gAdL2r5ikegSLXD \2 c1 x' J' t8 ]2 ^% B5 p
-e BOOTSTRAP_TOKEN=V5XICWYCBMebHCXC \
3 W' I$ `& q, Z" [ -e DB_HOST=172.20.22.25 \8 f! O1 c$ J1 O! |: V5 k: ]
-e DB_PORT=3306 \+ u9 |+ w# ]$ m5 A: X
-e DB_USER='jumpserver' \
$ n l. |& [& J/ L) |8 l0 Y -e DB_PASSWORD="magedu.com" \! h, z& c( o0 u
-e DB_NAME=jumpserver \8 e! t; C3 Z% J, H, j
-e REDIS_HOST=172.20.22.25 \
% n; e7 \, ]6 ]( z -e REDIS_PORT=6379 \$ N4 S) k7 O4 p. ?
-e REDIS_PASSWORD= \
. i& u2 b1 d; |8 @' R8 x% `! Z/ L* n jumpserver/jms_all:1.5.9
8 O3 q9 {( Y: h" |1 w2 J. Z
$ y& G! v# s1 l* o2 f; C6 M+ a3 |9 b###浏览器输入ip,默认用户名密码admin ( A$ g+ s* k! R: r
% {% A7 h# t+ z0 m6 H
! O! x1 Q1 ]7 h' m# S P
2 y$ B/ {3 ?$ b+ O* T配置用户和相应的服务器资源
* d: D% K! `& ~# s9 c7 P/ F( v[ol]jumpserver #登录jumpserver的账号。通常是开发或者测试同事的姓名(如果重名就加1、2区分,如user1、user2)管理用户 #是后端资产服务器的系统管理员账号(/etc/passwd),此账户用于资产信息收集以及推送系统账户系统账号 #是后端资产服务器的普通系统用用户(/etc/passwd),此账户用于启动web服务(nginx/apache/nobody)[/ol]/ Y+ I, l4 I% i
添加jumpserver账号并指定对应的用户组1 E1 A1 s- _1 K2 f. x
' t6 w+ j: H/ V( \+ a' M7 i
9 u/ { i) u, T
/ y2 P6 N& N. _2 [! W* J$ t
7 B8 }3 u: o& {3 N 添加管理用户
% u4 e0 m0 w, c) Y/ {, I
, i0 Q J- v) H0 ?" c1 Q! g* \2 }; @" G8 Q5 ~5 K. s+ F
; G3 @+ V( t: N# Q7 k
添加系统用户
: g& |) f" j5 C' p1 |
! }3 n- w0 i' s; ^/ U1 N% e, h" x2 w W" e* A, u7 A& i+ b
添加资产# V6 R4 e5 T9 e9 ~2 ~, C6 v& F
: f5 k9 e; D- L q' k% z
2 x E( S$ ]" T6 f& t" Y. e) w t; t* a
# g% U! S: B6 U; \) }0 h; ]6 ^; @4 \: a* u- A2 G
- V! y/ I1 u9 n! k8 I0 U2 v. ~8 i% n5 o. s, O
, Z) S6 \1 H- z. l- M5 w
; z% Q- N) F0 l9 E$ `2 F, K . p Y2 @: U% p5 V" Q
5 k K; F! R4 c% }8 W # n; u9 Q8 z, y$ R5 P/ H7 a( T, g
权限授权' N* c4 N9 A5 @8 _8 @3 }* j
5 R5 W' D' ?% l+ ^0 `* q f' }# D! w, X9 o: S: s
0 [/ G: H% s7 O' r+ ]- q A, Y( p
使用新建用户查看对应的资产
/ o0 R# n: o* [
3 w: X* v$ [4 ?5 ]5 ~+ U& c# R/ A7 G }8 A5 P
0 o6 G% {7 d1 w( j: U
通过web终端可直接登入服务器/ s3 ]: m, J1 ?. e1 G
2 L. z3 A& A) S
) B, Y" F P& Z* E
# l: @* {" `- H% [命令过滤器
* n' T! [0 e9 G* @使用命令过滤器可禁止用户在服务器上使用一些危险性高的命令,比如rm,reboot,shutdown等
. |3 j* i, p7 C, G# v8 c. l $ w; z; q! } x/ A
配置命令过滤器
0 W3 f# e2 o$ X# M5 N r
$ f: ]7 ]! F$ c9 b6 l6 X) j$ _, P% A8 B7 I( x) ^1 [
( C: i5 p0 |) `2 j1 W, R1 s
: r& B; s0 U7 R8 }
l4 ^+ H( N6 X& o1 w* S4 \
修改系统用户设置,引用定义的命令过滤器 ' v; f2 B2 [1 {1 L6 U, N4 P
, f$ J6 S: p8 l, r1 U) c- ]
m1 {4 @- J9 W6 _% [4 [1 L' R u
8 A; G7 Y# j6 \- }$ J& X+ J登入验证
* Y+ |1 ]! V0 V9 B: s 5 g. }4 a8 l4 N7 v, e
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|