我在这里找到了与密钥和组策略相关的问题和答案ServerFault。
此外,链接中列出的代码是:编辑 Sudo 用户:
%AccessGroup ALL=(git-sync) NOPASSWD: /usr/bin/"Access"
并编辑钩子:
sudo -u git-sync /usr/bin/"AccessGroup" push origin
还有命令:
#!/usr/sbin/setkey -f
#
# SPD for gateway A (172.16.72.1)
#
spdadd 192.168.1.0/24 10.42.23.0/24 any -P out ipsec
esp/tunnel/172.16.72.1-172.16.72.254/require
ah/tunnel/172.16.72.1-172.16.72.254/require;
spdadd 10.42.23.0/24 192.168.1.0/24 any -P in ipsec
esp/tunnel/172.16.72.254-172.16.72.1/require
ah/tunnel/172.16.72.254-172.16.72.1/require;
# AH SAD entries with 160 bit keys
add 172.16.72.254 172.16.72.1 ah 0x200 -A hmac-sha1 0x46915c30ed7e2465b42861b6ab19f2772813020c;
add 172.16.72.1 172.16.72.254 ah 0x300 -A hmac-sha1 0xc4dac594f8228e0b94a54758f7fbf2fdf4e37f3e;
带有 192 位密钥的 ESP SAD 条目
add 172.16.72.254 172.16.72.1 esp 0x201 -E rijndael-cbc 0xa3993b3dfc41ef0a1aa8d168a8bf2c27e48249ac17b61e09;
add 172.16.72.1 172.16.72.254 esp 0x301 -E rijndael-cbc 0x8f6498928ba354bd45cfad147f54c67b3b742896b3bafc02;
当然,这需要修改(来源)
至于刷新键,以下脚本可能会有所帮助:
汽车
IPsec 启动时应自动执行哪些操作(如果有);当前接受的值为
add (signifying an ipsec auto --add),
route (signifying that plus an ipsec auto --route),
start (signifying that plus an ipsec auto --up),
manual (signifying an ipsec manual --up),
and ignore (also the default) (signifying no automatic startup operation).
仅在本地相关,另一端不需要对此达成一致(但通常,对于预期的永久连接,两端应使用 auto=start 以确保任何重新启动都会立即重新协商)。 来源
我编写了一个 python 脚本的开头来帮助分发和分组客户端密钥:尽管代码仍在处理中......
void key (str x)
def _init_(key, status):
class key:
key.status = status
#Getter function
@status
def status(key):
return key.status
#Setter Function
@status.setter
def status(key, value):
if not isinstance(value, str):
raise TypeError('Expected Key Not Found')
key.status = value
#Deleter function
@status.deleter
def status(key):
raise AttibuteError("Can't Delete Attribute")
from operator import itemgetter
from ittertools import groupby
rows.sort(key=itemgetter(key.status))
for key.status, items in groupby(rows, key=itemgetter(key.status)):
print(status)
for i in items:
print(' ', i)
#Asserting Keys to Subclasses
class key(group)
@key
def status(key):
print("Adding Key to Group")
return super().status
@status.setter
def name(status, value):
print('Distributing Keys', value)
super(Subclient, Subclient).status._set_(key, value)
@key.deleter
def status(key):
print('Revoking Key')
super(Subclient, Subclient).key._delete_(status)
这不是在终端输入的,而是作为脚本运行的!