Create Database SSH Tunnel for Azerothcore World of Warcraft MySQL Database
Project description
Welcome to acore_db_ssh_tunnel Documentation
出于安全考虑, 通常数据库都会被部署到私网中, 是不允许直接从公网访问的. 为了能让开发者从工具配置齐全的开发电脑连接到数据库, 通常采用跳板机 + SSH Tunnel 技术实现. 具体方法是用 SSH 和 EC2 的秘钥在本地机器上建立一个 tunnel, 所有本来要发送到 Database domain 的流量都发送到 127.0.0.1, 然后 SSH 会自动将流量发送到跳板机, 然后堡垒机再发送到 Database.
本项目将创建, 关闭, 查看, 以及测试 SSH Tunnel 的方法封装成了一个 Python package, 以便于在 Python 代码中使用.
用例
from acore_db_ssh_tunnel import api
def create_ssh_tunnel():
api.create_ssh_tunnel(
path_pem_file=path_pem_file,
db_host=db_host,
db_port=db_port,
jump_host_username=jump_host_username,
jump_host_public_ip=jump_host_public_ip,
)
def list_ssh_tunnel():
api.list_ssh_tunnel(path_pem_file)
def test_ssh_tunnel():
api.test_ssh_tunnel(
db_port=db_port,
db_username=db_username,
db_password=db_password,
db_name=db_name,
)
def kill_ssh_tunnel():
api.kill_ssh_tunnel(path_pem_file)
# edit the following variables to your own
db_host = "my-server.1a2b3c4d5e6f.us-east-1.rds.amazonaws.com"
db_port = 3306
db_username = "admin"
db_password = "admin"
db_name = "my_database"
jump_host_username = "ubuntu"
jump_host_public_ip = "111.111.111.111"
path_pem_file = "/Users/myusername/ec2-key.pem"
# create_ssh_tunnel() # run this first
# list_ssh_tunnel() # then this
# test_ssh_tunnel() # then this
# kill_ssh_tunnel() # then clean up
Install
acore_db_ssh_tunnel is released on PyPI, so all you need is to:
$ pip install acore-db-ssh-tunnel
To upgrade to latest version:
$ pip install --upgrade acore-db-ssh-tunnel
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file acore_db_ssh_tunnel-0.1.4.tar.gz.
File metadata
- Download URL: acore_db_ssh_tunnel-0.1.4.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a096e6b90b24520a978d0fc75a0641a1ea6f432e939f93ecf8792c821708abf5
|
|
| MD5 |
b618ab64b55ebdab56b2e9f4f332eadb
|
|
| BLAKE2b-256 |
2f82ac49332f8efd3605502db593486ece0defffe11aba302f7ad34a38bb831d
|
File details
Details for the file acore_db_ssh_tunnel-0.1.4-py3-none-any.whl.
File metadata
- Download URL: acore_db_ssh_tunnel-0.1.4-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1dc396ff2809b792edd2bb92bc0e35eb2b96ce75b68b84ed12e11f60324f52b
|
|
| MD5 |
26d18100e40263cf865c9ad6d1e73d78
|
|
| BLAKE2b-256 |
8a91a7f3a45f0800fad701e3e7a98d7637db748449013d4b8319552981d473cf
|