feat(exhook): add ssl cert info to ClientInfo
This commit is contained in:
parent
18ea764628
commit
07d5c0f9df
|
@ -335,6 +335,12 @@ message ClientInfo {
|
||||||
bool is_superuser = 9;
|
bool is_superuser = 9;
|
||||||
|
|
||||||
bool anonymous = 10;
|
bool anonymous = 10;
|
||||||
|
|
||||||
|
// common name of client TLS cert
|
||||||
|
string cn = 11;
|
||||||
|
|
||||||
|
// subject of client TLS cert
|
||||||
|
string dn = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Message {
|
message Message {
|
||||||
|
|
|
@ -254,7 +254,9 @@ clientinfo(ClientInfo =
|
||||||
protocol => stringfy(Protocol),
|
protocol => stringfy(Protocol),
|
||||||
mountpoint => maybe(Mountpoiont),
|
mountpoint => maybe(Mountpoiont),
|
||||||
is_superuser => maps:get(is_superuser, ClientInfo, false),
|
is_superuser => maps:get(is_superuser, ClientInfo, false),
|
||||||
anonymous => maps:get(anonymous, ClientInfo, true)}.
|
anonymous => maps:get(anonymous, ClientInfo, true),
|
||||||
|
cn => maybe(maps:get(cn, ClientInfo, undefined)),
|
||||||
|
dn => maybe(maps:get(dn, ClientInfo, undefined))}.
|
||||||
|
|
||||||
message(#message{id = Id, qos = Qos, from = From, topic = Topic, payload = Payload, timestamp = Ts}) ->
|
message(#message{id = Id, qos = Qos, from = From, topic = Topic, payload = Payload, timestamp = Ts}) ->
|
||||||
#{node => stringfy(node()),
|
#{node => stringfy(node()),
|
||||||
|
|
|
@ -452,7 +452,9 @@ from_clientinfo(ClientInfo) ->
|
||||||
protocol => stringfy(maps:get(protocol, ClientInfo)),
|
protocol => stringfy(maps:get(protocol, ClientInfo)),
|
||||||
mountpoint => maybe(maps:get(mountpoint, ClientInfo, <<>>)),
|
mountpoint => maybe(maps:get(mountpoint, ClientInfo, <<>>)),
|
||||||
is_superuser => maps:get(is_superuser, ClientInfo, false),
|
is_superuser => maps:get(is_superuser, ClientInfo, false),
|
||||||
anonymous => maps:get(anonymous, ClientInfo, true)
|
anonymous => maps:get(anonymous, ClientInfo, true),
|
||||||
|
cn => maybe(maps:get(cn, ClientInfo, <<>>)),
|
||||||
|
dn => maybe(maps:get(dn, ClientInfo, <<>>))
|
||||||
}.
|
}.
|
||||||
|
|
||||||
from_message(Msg) ->
|
from_message(Msg) ->
|
||||||
|
|
Loading…
Reference in New Issue