Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
99f95af7
Commit
99f95af7
authored
Dec 22, 2014
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified settings.py set option
parent
6a2e6709
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
8 deletions
+53
-8
connect.py
connect.py
+5
-4
jumpserver.conf
jumpserver.conf
+8
-1
settings.py
jumpserver/settings.py
+40
-3
No files found.
connect.py
View file @
99f95af7
...
...
@@ -10,7 +10,6 @@ import struct
import
fcntl
import
signal
try
:
import
termios
import
tty
...
...
@@ -32,10 +31,11 @@ def red_print(string):
def
alert_print
(
string
):
red_print
(
string
)
red_print
(
'AlertError:
%
s'
%
string
)
time
.
sleep
(
2
)
sys
.
exit
()
def
get_win_size
():
"""This function use to get the size of the windows!"""
if
'TIOCGWINSZ'
in
dir
(
termios
):
...
...
@@ -110,6 +110,7 @@ def posix_shell(chan, user, host):
finally
:
termios
.
tcsetattr
(
sys
.
stdin
,
termios
.
TCSADRAIN
,
old_tty
)
log
.
close
()
def
connect
(
username
,
password
,
host
,
port
):
...
...
@@ -140,7 +141,7 @@ def connect(username, password, host, port):
except
:
pass
#
s
et PS1 and msg it
#
S
et PS1 and msg it
channel
.
send
(
ps1
)
channel
.
send
(
login_msg
)
print
channel
.
get_name
()
...
...
@@ -148,7 +149,7 @@ def connect(username, password, host, port):
# Make ssh interactive tunnel
posix_shell
(
channel
,
username
,
host
)
#
s
hutdown channel socket
#
S
hutdown channel socket
channel
.
close
()
ssh
.
close
()
...
...
jumpserver.conf
View file @
99f95af7
#coding: utf8
[
jumpserver
]
[
db
]
host
=
127
.
0
.
0
.
1
port
=
3306
user
=
jumpserver
password
=
mysql345
database
=
jumpserver
jumpserver/settings.py
View file @
99f95af7
...
...
@@ -10,8 +10,18 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import
os
import
ConfigParser
config
=
ConfigParser
.
ConfigParser
()
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
config
.
read
(
os
.
path
.
join
(
BASE_DIR
,
'jumpserver.conf'
))
DB_HOST
=
config
.
get
(
'db'
,
'host'
)
DB_PORT
=
config
.
getint
(
'db'
,
'port'
)
DB_USER
=
config
.
get
(
'db'
,
'user'
)
DB_PASSWORD
=
config
.
get
(
'db'
,
'password'
)
DB_DATABASE
=
config
.
get
(
'db'
,
'database'
)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
...
...
@@ -36,12 +46,14 @@ INSTALLED_APPS = (
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'juser'
,
'jasset'
,
)
MIDDLEWARE_CLASSES
=
(
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
#
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware'
,
'django.contrib.auth.middleware.SessionAuthenticationMiddleware'
,
'django.contrib.messages.middleware.MessageMiddleware'
,
...
...
@@ -58,11 +70,34 @@ WSGI_APPLICATION = 'jumpserver.wsgi.application'
DATABASES
=
{
'default'
:
{
'ENGINE'
:
'django.db.backends.sqlite3'
,
'NAME'
:
os
.
path
.
join
(
BASE_DIR
,
'db.sqlite3'
),
'ENGINE'
:
'django.db.backends.mysql'
,
'NAME'
:
DB_DATABASE
,
'USER'
:
DB_USER
,
'PASSWORD'
:
DB_PASSWORD
,
'HOST'
:
DB_HOST
,
'PORT'
:
DB_PORT
,
}
}
TEMPLATE_CONTEXT_PROCESSORS
=
(
'django.contrib.auth.context_processors.auth'
,
'django.core.context_processors.debug'
,
'django.core.context_processors.i18n'
,
'django.core.context_processors.media'
,
'django.core.context_processors.static'
,
'django.core.context_processors.tz'
,
'django.contrib.messages.context_processors.messages'
,
)
TEMPLATE_DIRS
=
(
os
.
path
.
join
(
BASE_DIR
,
'templates'
),
)
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS
=
(
os
.
path
.
join
(
BASE_DIR
,
"static"
),
)
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
...
...
@@ -81,3 +116,5 @@ USE_TZ = True
# https://docs.djangoproject.com/en/1.7/howto/static-files/
STATIC_URL
=
'/static/'
SESSION_COOKIE_AGE
=
3600
Write
Preview
Markdown
is supported
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