[connection] id=yunti.pptp.tw1 uuid=063db9b5-5915-4f3e-8bb4-2fe58abf5be5 type=vpn permissions=user:greatghoul:; autoconnect=false [vpn] service-type=org.freedesktop.NetworkManager.pptp gateway=tw1.example.com require-mppe=yes user=greatghoul refuse-chap=yes refuse-eap=yes password-flags=1 refuse-pap=yes [ipv4] method=auto dns=8.8.8.8;8.8.4.4; ignore-auto-dns=true
VPN_SERVERS = [
{ 'id': 'yunti.pptp.a', 'gateway': 'a.example.com' },
{ 'id': 'yunti.pptp.b', 'gateway': 'b.example.com' },
{ 'id': 'yunti.pptp.c', 'gateway': 'c.example.com' },
]
>>> import uuid >>> str(uuid.uuid1()) '0621ba62-888a-11e3-805c-44334c786649'
tpl.cfg [connection] id=%(id)s uuid=%(uuid)s type=vpn permissions=user:greatghoul:; autoconnect=false [vpn] service-type=org.freedesktop.NetworkManager.pptp gateway=%(gateway)s require-mppe=yes user=greatghoul refuse-chap=yes refuse-eap=yes password-flags=1 refuse-pap=yes [ipv4] method=auto dns=8.8.8.8;8.8.4.4; ignore-auto-dns=true
def add_connection(tpl, conn_info):
filename = os.path.join(CFG_DIR, conn_info['id'])
print ' Creating file:', filename
out = open(filename, 'w')
out.write(tpl % conn_info)
out.close()
os.chmod(filename, 0600)
def create_all():
tpl = open(os.path.join(CURRENT_DIR, 'tpl.cfg'), 'r').read()
print 'Creating yunti connection files under', CFG_DIR
for conn_info in VPN_SERVERS:
conn_info.update(uuid=str(uuid.uuid1()))
add_connection(tpl, conn_info)
os.chmod(filename, 0600)
$ sudo python create_yunti_config.py Cleaning up yunti connection files... Removing file: /etc/NetworkManager/system-connections/yunti.pptp.a Removing file: /etc/NetworkManager/system-connections/yunti.pptp.b Removing file: /etc/NetworkManager/system-connections/yunti.pptp.c Creating yunti connection files under /etc/NetworkManager/system-connections Creating file: /etc/NetworkManager/system-connections/yunti.pptp.a Creating file: /etc/NetworkManager/system-connections/yunti.pptp.b Creating file: /etc/NetworkManager/system-connections/yunti.pptp.c
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有