Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
l y
Jumpserver
Commits
8ad87637
Commit
8ad87637
authored
3 years ago
by
jiangweidong
Browse files
Options
Download
Email Patches
Plain Diff
改密计划支持数据库(mysql、oracle、postgre)改密
parent
ee5894c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Dockerfile
+6
-0
Dockerfile
apps/assets/migrations/0077_auto_20210802_1415.py
+30
-0
apps/assets/migrations/0077_auto_20210802_1415.py
apps/assets/models/authbook.py
+2
-1
apps/assets/models/authbook.py
apps/assets/signals_handler/authbook.py
+4
-1
apps/assets/signals_handler/authbook.py
requirements/requirements.txt
+4
-1
requirements/requirements.txt
with
46 additions
and
3 deletions
+46
-3
Dockerfile
+
6
-
0
View file @
8ad87637
...
...
@@ -37,6 +37,12 @@ COPY --from=stage-build /opt/jumpserver/release/jumpserver /opt/jumpserver
RUN
mkdir
-p
/root/.ssh/
\
&&
echo
"Host *
\n\t
StrictHostKeyChecking no
\n\t
UserKnownHostsFile /dev/null"
>
/root/.ssh/config
RUN
mkdir
-p
/opt/jumpserver/oracle/
ADD
https://f2c-north-rel.oss-cn-qingdao.aliyuncs.com/2.0/north/jumpserver/instantclient-basiclite-linux.x64-21.1.0.0.0.tar /opt/jumpserver/oracle/
RUN
tar
-xvf
/opt/jumpserver/oracle/instantclient-basiclite-linux.x64-21.1.0.0.0.tar
RUN
sh
-c
"echo /opt/jumpserver/oracle/instantclient_21_1 > /etc/ld.so.conf.d/oracle-instantclient.conf"
RUN
ldconfig
RUN
echo
>
config.yml
VOLUME
/opt/jumpserver/data
VOLUME
/opt/jumpserver/logs
...
...
This diff is collapsed.
Click to expand it.
apps/assets/migrations/0077_auto_20210802_1415.py
0 → 100644
+
30
-
0
View file @
8ad87637
# Generated by Django 3.1.6 on 2021-08-02 06:15
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'applications'
,
'0009_applicationuser'
),
(
'assets'
,
'0076_delete_assetuser'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'authbook'
,
name
=
'database'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'applications.application'
,
verbose_name
=
'Database'
),
),
migrations
.
AddField
(
model_name
=
'historicalauthbook'
,
name
=
'database'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
db_constraint
=
False
,
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
DO_NOTHING
,
related_name
=
'+'
,
to
=
'applications.application'
,
verbose_name
=
'Database'
),
),
migrations
.
AlterField
(
model_name
=
'authbook'
,
name
=
'asset'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assets.asset'
,
verbose_name
=
'Asset'
),
),
]
This diff is collapsed.
Click to expand it.
apps/assets/models/authbook.py
+
2
-
1
View file @
8ad87637
...
...
@@ -12,7 +12,8 @@ __all__ = ['AuthBook']
class
AuthBook
(
BaseUser
,
AbsConnectivity
):
asset
=
models
.
ForeignKey
(
'assets.Asset'
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
_
(
'Asset'
))
asset
=
models
.
ForeignKey
(
'assets.Asset'
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
_
(
'Asset'
),
null
=
True
)
database
=
models
.
ForeignKey
(
'applications.Application'
,
on_delete
=
models
.
CASCADE
,
null
=
True
,
verbose_name
=
_
(
'Database'
))
systemuser
=
models
.
ForeignKey
(
'assets.SystemUser'
,
on_delete
=
models
.
CASCADE
,
null
=
True
,
verbose_name
=
_
(
"System user"
))
version
=
models
.
IntegerField
(
default
=
1
,
verbose_name
=
_
(
'Version'
))
history
=
HistoricalRecords
()
...
...
This diff is collapsed.
Click to expand it.
apps/assets/signals_handler/authbook.py
+
4
-
1
View file @
8ad87637
...
...
@@ -39,4 +39,7 @@ def on_authbook_pre_create(sender, instance, **kwargs):
# 升级版本号
instance
.
version
=
instance
.
history
.
all
().
count
()
+
1
# 即使在 root 组织也不怕
instance
.
org_id
=
instance
.
asset
.
org_id
if
instance
.
database
:
instance
.
org_id
=
instance
.
database
.
org_id
else
:
instance
.
org_id
=
instance
.
asset
.
org_id
This diff is collapsed.
Click to expand it.
requirements/requirements.txt
+
4
-
1
View file @
8ad87637
...
...
@@ -113,4 +113,7 @@ termcolor==1.1.0
azure-identity==1.5.0
azure-mgmt-subscription==1.0.0
qingcloud-sdk==1.2.12
django-simple-history==3.0.0
\ No newline at end of file
django-simple-history==3.0.0
PyMySQL==1.0.2
cx-Oracle==8.2.1
psycopg2-binary==2.9.1
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help