1 Star 0 Fork 8

ice / bind-pod

forked from xiaoxin / bind-pod 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Bind-pod

Python3 Django2 Bind DnsPython DnsPython GitHub

Bind9 web管理平台并提供API接口调用

使用方法

安装NPM、Python3、Nginx

yum -y install epel-release
yum -y install python3-devel python3 python3-pip python3-setuptools python3-libs npm nginx

获取源码

git clone https://github.com/xiaoxin1992/bind-pod.git
cd bind-pod

安装Python依赖

pip3 install -i http://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate

手动启动

python3 manage.py runserver 0.0.0.0:8080

uwsgi 配置

[uwsgi]
chdir=/srv/BindPod          #  根据自己的项目路径填写
home = /usr
pythonpath=/srv/BindPod     #  根据自己的项目路径填写
http=0.0.0.0:8080
master=true
processes=4
threads=2
uid=root
gid=root
thunder-lock=true
enable-threads=true
module=bind-pod.wsgi
socket=bind-pod.sock
pidfile=bind-pod.pid
chmod-socket = 666
vacuum = true
die-on-term = true

uwsgi 启动

uwsgi  --ini uwsgi.ini

前端页面编译

修改web页面访问地址

sed -i 's/192.168.117.128:8000/10.10.20.30:8080/g' web/bindpod/src/main.js
把10.10.20.30:8080 改成你自己要监听的IP地址和端口

手动编译前端文件

cd web/bindpod
npm install --registry https://registry.npm.taobao.org 
npm run build
cp -a web/bindpod/dist /usr/share/nginx/html

启动Nginx服务器

api接口文档地址: http://ipaddress:port/docs/#api

访问api需要先通过:http://ipaddress:port/login/接口获取Token 登陆接口返回参数如下

{
"display_name": "xiaoxin",
"username": "root",
"Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjAzMzQ0MzE2LCJqdGkiOiI1Zjg1MzI3Y2M4MjY0MjhkYmUyMGYxNWFhZDlkNDdjNSIsInVzZXJfaWQiOjF9.bE4ub_f-Nb1RGLzqsT-XqtgOD4oRXmeYwDpdqNbcbnk",
"UserType": "admin",
"active": "admin",
"is_superuser": true
}
display_name        表示用户中文名称
username            登陆用户名
Token               登陆Token
UserType            用户类型(admin表示管理员,user表示普通用户)
active              表示用户是否允许登陆
is_superuser        表示用户是否是超级管理员

拿到Token后在请求头添加Token

{
"Authorization": "Token eyJ0eXAiOiJKV1QiLCJh"
}

Bind9 配置

首先配置rndc

rndc-confgen  #  生成rndc配置

rndc 配置文件内容如下 "/etc/rndc.key"

key "rndc-key" {
	algorithm hmac-md5;
	secret "8XhahdtLNWhIfpDQjdhvOQ==";
};

rndc 配置文件的key配置放入到named.conf文件中

    key "rndc-key" {
        algorithm hmac-md5;
        secret "8XhahdtLNWhIfpDQjdhvOQ==";
    };

配置域名管理key

cd /var/named/
dnssec-keygen -a HMAC-MD5 -b 128 -n USER bindpod
chown named.named Kbindpod.*
cat  Kbindpod.+157+52547.key
bindpod. IN KEY 0 3 157 HykrxxHfxz2SuFHC7wfSFg==

配置 /etc/named.conf, 添加域名管理配置Key

key "bindpod" {
	algorithm hmac-md5;
	secret "HykrxxHfxz2SuFHC7wfSFg==";
};

/etc/named.conf 配置域名

zone "test.com" IN {
    type master;
    file "test.com.zone";
    allow-update { key bindpod; };   # key 必须等于域名管理的key名称
};

修改服务配置文件

cd  BindPod/BindPod
vim settings.py
DNS_BASE_CONFIG = {
    "server": "127.0.0.1",                服务地址,默认即可
    "port": 53,                           服务端口,默认即可
    "key": "bindpod",                      key
    "secret": "HykrxxHfxz2SuFHC7wfSFg=="  验证密钥
}

完成后重启BindPod服务

创建好域名后,在平台中添加域名后可以使用

MIT License Copyright (c) 2020 OB Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Bind9 web管理平台并提供API接口调用 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/ldsice/bind-pod.git
git@gitee.com:ldsice/bind-pod.git
ldsice
bind-pod
bind-pod
main

搜索帮助