labring / fist Goto Github PK
View Code? Open in Web Editor NEWon the way~
License: Apache License 2.0
on the way~
License: Apache License 2.0
Unable to authenticate the request due to an error: [invalid bearer token, [invalid bearer token, oidc: verify token: failed to verify signature: failed to verify id token signature]]
在cmd/auth.go 增加参数功能
目前想到就是
cmd/root.go 增加参数功能
还有什么好的想法可以这里再想一下。
curl -k https://fist.sealyun.svc.cluster.local:8080/token?user=fanux&group=dev&group=test
groups := request.Request.URL.Query()["group"]
新增rbac模块
主要功能负责用户相关的鉴权等功能
重构代码
在k8s环境下完善WithoutToken功能
做法:
支持如k8s原生pipeline的功能。具体实现不定。 大概是可以在定义一个按钮,按钮下是用户自定的一个pipeline,用于解决一些复杂的流程编排。
管理员具有namespace创建 Quota,把namespace绑定给具体用户等权限,也需要给角色绑定PSP防止用户进行越权操作如挂载宿主机目录,启用特权模式,等。
http://plugins.drone.io/vallard/drone-kube/
vallard/drone-kube插件支持以下几个参数:
template: deployment.yaml
namespace: mynamespace
server: https://10.93.234.28:6433
ca: k8scastring
token: xxx
然后可以用模板让部署镜像的tag与构建的关联,在deployment.yaml里用 {{ build.tag }}
把kubeconfig放在代码里非常不安全。
然后就可以用drone的secret放server地址和token,解决CD时部署安全性问题
加golint检查代码格式
不然每次重启后重新生成密钥对导致老的token不能用。
https://github.com/fanux/fist/blob/master/auth/jwt.go#L17
支持用户将mysql redis prometheus等等APP装到自己的namespace中。 可能需要依赖rook当作存储基础。
在fist/terminal下新建工具类
切一个bug fix分支,修复这个bug。
func (t *Terminal) Create() error {
t.TerminalID =
//create tty deployment and service
return CreateTTYcontainer(t)
}
这里 t.TerminalID = DefaultNamespace + newUUID()
就不用到处加前缀了. 直接用 t.TerminalID 当参数即可
filter使用参考:filter
cookie allow要设置成true
https://github.com/fanux/fist/blob/master/tools/cors.go#L12
POST /user
{
name
passwd
...
}
帮助用户渲染yaml文件,实现类似helm的核心功能,但是不需要tiller这个服务端。 通过UI上填一些参数生成 deployment service configmap等配置,并可以运行
type Admin struct {
Name string
Passwd string
}
type Adminer interface {
LoadSecret()
IsAdmin(user string)
}
这个功能会用于fist前端管理员登录时的校验,管理员登录后会调用创建token的接口为管理员创建token,并绑定最高权限。
前端渲染好的模板需要执行,这的实现方式有几种:
因为如这种中间带有---的yaml,其实是在kubectl这块做切分的
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: admin
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin
namespace: sealyun
labels:
kubernetes.io/cluster-service: "true"
这个切分虽然不难,但是需要考虑一些细节,比如有时confimap里也有---应该如何处理。 这块代码我之前已经复用过kubectl里的函数进行处理了。
但是切分完成后我们依然要根据kind判断去实例化一个object 然后调用client-go进行创建。 这里最好能复用kubectl的代码。
fist相比kubectl更复杂的地方在于fist是多租户系统,client-set也需要根据租户的token 或者特定的kubeconfig字符串进行创建,这块实现我也已经做过:
curl: (60) Peer's certificate has an invalid signature.
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
[root@iZj6cegflzze2l7fpcqoerZ deploy]# cat token.sh
curl https://fist.sealyun.svc.cluster.local:8080/token --cacert ssl/ca.pem
在auth中再起一个http服务(单独协程), 把token的handle直接放进去。
从文件中读取template文件到内存中,以文件名作为key,value为文件内容.
默认模板目录 /etc/fist/templates
map[string]string
type Authenticater interface {
Authenticat(user, passwd string) *UserInfo //失败返回nil 成功返回用户信息
}
auth目录下新建ldap.go 实现该接口,再来个NewLdap函数
/terminal/tty/{terminalID} 动态创建ingress,解决安全问题,防止tty端口号被扫到。 terminalID比较难猜到
每个terminal会起一个容器,多租户场景下用户连很多terminal就会创建很多容器,所以需要有一种机制去定时清理掉已经没有用户在用的terminal
新增用户时 name正则 防止新增screts时候报错
目前我感觉用于登录, 只允许英文字符即可。
用户信息增加 niceName,用于展示使用。
admin的niceName 固定为administrator
获取用户已打开存活状态的terminal列表。 否则前端用户切到别的页面再切回来就看不到之前已经打开的终端了
fist template需要有个接口返回所有的template元数据,元数据以特定格式存在磁盘上。
详情请见
程序启动时将元数据加载到内存中,请求时直接返回即可。
每10分钟执行一次清理任务
在.zshrc中加入
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
GET /keepalived?tid=xxxx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.