一个 ssh 公钥管理工具, 将 ssh 公钥存储到github仓库上, 并定时将这些公钥同步到对应的机器上。
需要注意指定uid/gid, 否则启动后, 对应的文件权限会被改写成root, 导致不必要的问题。
docker run -it --rm -v `pwd`/.vscode:/data --user 1000:1000 xxxsen/keymanager:latest -config /data/config.json运行后, 程序会定期从git/s3 拉取保存的文件更新到本地。
{
"log": {
"console": true,
"level": "debug"
},
"storage": {
"storage_type": "git",
"storage_data": {
"owner": "xxxsen",
"repo": "ssh-keymanager",
"token": "abcdefg"
}
},
"store_key": "authorized_keys",
"local_key": "/home/test/.ssh/authorized_keys",
"run_cron": "*/1 * * * *"
}| key | 类型 | 说明 |
|---|---|---|
| log.console | bool | 是否将日志刷到控制台 |
| log.level | string | 日志级别 |
| storage.storage_type | string | 指定存储类型 |
| storage.storage_data | interface{} | 存储的配置 |
| local_key | string | github数据将被存储到哪个文件中 |
| run_cron | string | cron表达式, 指定程序运行周期 |
目前支持2种配置, git, s3
git相关配置:
| key | 类型 | 说明 |
|---|---|---|
| owner | string | repo所有者 |
| repo | string | 用于存储的repo |
| token | string | personal access token |
s3相关配置
| key | 类型 | 说明 |
|---|---|---|
| access_key | string | access key |
| secret_key | string | secret key |
| end_point | string | 端点 |
| bucket | string | 存储桶 |
| region | string | 地区, 按实际填写 |
{
"remark": "测试",
"key_list": [
{
"name": "key说明",
"data": "key数据"
}
]
}NOTE: 存储的时候, 会将key_list中的data抽取出来, 组成一个新的文件, 多个data中间使用'\n'分隔