ED-226/feat: Add the rest of monitoring tools (#34)

* ED-226/feat: Add the rest of monitoring tools

- how_are_you for metrics
- also fix formatting on configs and app.src

* ED-226/refactor: Fix formatting
This commit is contained in:
Yaroslav Rogov 2021-08-23 19:03:16 +07:00 committed by GitHub
parent c4a94f72e2
commit 4452606bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 60 deletions

View File

@ -2,15 +2,16 @@
{description, "A service that does cds keyring management"},
{vsn, "1"},
{registered, []},
{mod, { kds, []}},
{mod, {kds, []}},
{applications, [
kernel,
stdlib,
crypto,
woody,
erl_health,
how_are_you,
shamir,
scoper,
erl_health,
msgpack,
lib_combin,
jose,

View File

@ -25,10 +25,11 @@
-type keyring_meta_diff() :: #{
current_key_id => non_neg_integer() | undefined,
keys => #{
key_id() => key_meta_diff()
}
| undefined
keys =>
#{
key_id() => key_meta_diff()
}
| undefined
}.
-type key_meta() :: #{

View File

@ -101,7 +101,8 @@ start_clear(Config) ->
owner => <<"ndiezel">>,
public_keys => #{
enc =>
<<"{\n"
<<
"{\n"
"\"use\": \"enc\",\n"
"\"kty\": \"RSA\",\n"
"\"kid\": \"KUb1fNMc5j9Ei_IV3DguhJh5UOH30uvO7qXq13uevnk\",\n"
@ -119,21 +120,25 @@ start_clear(Config) ->
"DJKC0U2yufePcA3nUJEhtR3UO_tIlHxZvlDSX5eTx4vs5VkFfujNSiPsgH0P"
"EeXABGBFbal7QxU1u0XHXIFwhW5cM8Fs\",\n"
"\"e\": \"AQAB\"\n"
"}">>,
"}"
>>,
sig =>
<<"{\n"
<<
"{\n"
"\"crv\":\"Ed25519\",\n"
"\"kid\":\"K3ZpHNJw3IZYu4fefhImUtB47eSBD4nRmpjWIoGukyg\",\n"
"\"kty\":\"OKP\",\n"
"\"x\":\"hqoiLZvfBzgtFQop3mBzUACee1ycgaT3tJIcKQ2Ndjc\"\n"
"}">>
"}"
>>
}
},
<<"2">> => #{
owner => <<"ndiezel2">>,
public_keys => #{
enc =>
<<"{\n"
<<
"{\n"
"\"use\": \"enc\",\n"
"\"kty\": \"RSA\",\n"
"\"kid\": \"JHKqPDhPO8ZnZsloKTHt44UbzYFnKnf_zowfL_zNFRE\",\n"
@ -151,21 +156,25 @@ start_clear(Config) ->
"QXg7JhJUY-gXdMgbdLyY5zrawkwsJhq_Lpsk6dHQsxV35imi7kNkOTnoiI-S"
"pswrACIlThnT56xC5ROuFRxAlrpZef-c\",\n"
"\"e\": \"AQAB\"\n"
"}">>,
"}"
>>,
sig =>
<<"{\n"
<<
"{\n"
"\"crv\":\"Ed25519\",\n"
"\"kid\":\"Q_85NCYwrmJr1vcbPOzO8g31_ohqFLpVoaGysWPwCbc\",\n"
"\"kty\":\"OKP\",\n"
"\"x\":\"JhVaGPlRm67u0oGbgxAgqnfLfXeW0aGjhCrBf_C1Fiw\"\n"
"}">>
"}"
>>
}
},
<<"3">> => #{
owner => <<"ndiezel3">>,
public_keys => #{
enc =>
<<"{\n"
<<
"{\n"
"\"use\": \"enc\",\n"
"\"kty\": \"RSA\",\n"
"\"kid\": \"xBET5c4u0yT6pDb_Cok0exHe_wQVetVpkGKn_1mmn7A\",\n"
@ -183,14 +192,17 @@ start_clear(Config) ->
"yVyAzIvDyOVdSmUPPeGxnI1YWKX-5t5SnlnpWO1Rqqh6RBtxu_1JGfq77d2k"
"hskTaPXxc1E5iyCYLFI0UgreCXpBzSGU\",\n"
"\"e\": \"AQAB\"\n"
"}">>,
"}"
>>,
sig =>
<<"{\n"
<<
"{\n"
"\"crv\":\"Ed25519\",\n"
"\"kid\":\"nwy3plcwQj_b70JJ3maZkN-VFQpjGCVRyIFYNeC0vvs\",\n"
"\"kty\":\"OKP\",\n"
"\"x\":\"af4UVYqUB4g711yGxzKjWvd27c9WY1EQ1a1-fwk0A6w\"\n"
"}">>
"}"
>>
}
}
}}

View File

@ -5,11 +5,11 @@
{storage_port, 8023},
{management_transport_opts, #{}},
{storage_transport_opts, #{
transport => ranch_ssl,
transport => ranch_ssl,
socket_opts => [
{cacertfile, "/var/lib/kds/ca.crt"},
{certfile, "/var/lib/kds/server.pem"},
{verify, verify_peer},
{cacertfile, "/var/lib/kds/ca.crt"},
{certfile, "/var/lib/kds/server.pem"},
{verify, verify_peer},
{fail_if_no_peer_cert, true}
]
}},
@ -29,9 +29,9 @@
keyring_path => "/var/lib/kds/keyring"
}},
{health_check, #{
disk => {erl_health, disk , ["/", 99] },
memory => {erl_health, cg_memory, [99] },
service => {erl_health, service , [<<"kds">>]}
disk => {erl_health, disk, ["/", 99]},
memory => {erl_health, cg_memory, [99]},
service => {erl_health, service, [<<"kds">>]}
}},
{keyring_rotation_lifetime, 60000},
{keyring_initialize_lifetime, 180000},
@ -41,20 +41,26 @@
<<"1">> => #{
owner => <<"ndiezel">>,
public_keys => #{
enc => <<"{
\"use\": \"enc\",
\"kty\": \"RSA\",
\"kid\": \"KUb1fNMc5j9Ei_IV3DguhJh5UOH30uvO7qXq13uevnk\",
\"alg\": \"RSA-OAEP-256\",
\"n\": \"2bxkamUQjD4CN8rcq5BfNLJmRmosb-zY7ajPBJqtiLUTcqym23OkUIA1brBg34clmU2ZQmtd3LWi5kVJk_wr4WsMG_78jHK3wQA-HRhY4WZDZrULTsi4XWpNSwL4dCml4fs536RKy_TyrnpiXg0ug4JVVaEeo7VIZ593mVhCxC8Ev6FK8tZ2HGGOerUXLpgQdhcp9UwaI_l7jgoWNp1f7SuBqv1mfiw4ziC1yvwyXHTKy-37LjLmVB9EVyjqpkwZgzapaOvHc1ABqJpdOrUh-PyOgq-SduqSkMrvqZEdUeR_KbFVxqbxqWJMrqkl2HOJxOla9cHRowg5ObUBjeMoaTJfqie3t6uRUsFEFMzhIyvo6QMYHooxIdOdwpZ4tpzML6jv9o5DPtN375bKzy-UsjeshYbvad1mbrcxc8tYeiQkDZEIM0KeOdHm5C6neEyY6oF4s1vSYBNCnhE5O-R9dmp8Sk5KEseEkOH5u4G2RsIXBA9z1OTDoy6qF21EvRCGzsGfExfkmPAtzbnS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nUJEhtR3UO_tIlHxZvlDSX5eTx4vs5VkFfujNSiPsgH0PEeXABGBFbal7QxU1u0XHXIFwhW5cM8Fs\",\n"
" \"e\": \"AQAB\"\n"
"}"
>>,
sig =>
<<
"{\n"
" \"crv\":\"Ed25519\",\n"
" \"kid\":\"0S3dDL16upIQpkt5sooMFXeZR4j1O7fZngAWgn_Bmbo\",\n"
" \"kty\":\"OKP\",\n"
" \"x\":\"tIUiRZkBczC152j1ItfvtITl222ZHLcz6wRqUDa0-Ls\"\n"
"}"
>>
}
}
}}
@ -72,14 +78,19 @@
config => #{
type => {file, "/var/log/kds/console.json"}
},
formatter => {logger_logstash_formatter, #{
message_redaction_regex_list => [
"[0-9]{12,19}", %% pan
"[0-9]{2}.[0-9]{2,4}", %% expiration date
"[0-9]{3,4}", %% cvv
"^ey[JI]([a-zA-Z0-9_-]*.?){1,6}" %% JWS and JWE compact representation
]
}}
formatter =>
{logger_logstash_formatter, #{
message_redaction_regex_list => [
%% pan
"[0-9]{12,19}",
%% expiration date
"[0-9]{2}.[0-9]{2,4}",
%% cvv
"[0-9]{3,4}",
%% JWS and JWE compact representation
"^ey[JI]([a-zA-Z0-9_-]*.?){1,6}"
]
}}
}}
]}
]},
@ -99,7 +110,8 @@
]},
{snowflake, [
{max_backward_clock_moving, 1000}, % 1 second
% 1 second
{max_backward_clock_moving, 1000},
{machine_id, hostname_hash}
]},

View File

@ -23,14 +23,14 @@
{jose, "1.11.1"},
{prometheus, "4.6.0"},
{prometheus_cowboy, "0.1.8"},
{shamir , {git, "git@github.com:rbkmoney/shamir.git" , {branch, master}}},
{woody , {git, "git@github.com:rbkmoney/woody_erlang.git" , {branch, master}}},
{genlib , {git, "git@github.com:rbkmoney/genlib.git" , {branch, master}}},
{how_are_you , {git, "https://github.com/rbkmoney/how_are_you.git" , {branch, master}}},
{erl_health , {git, "https://github.com/rbkmoney/erlang-health.git" , {branch, master}}},
{cds_proto , {git, "git@github.com:rbkmoney/cds-proto.git" , {branch, master}}},
{msgpack , {git, "https://github.com/rbkmoney/msgpack-erlang" , {branch, master}}},
{scoper , {git, "git@github.com:rbkmoney/scoper.git" , {branch, master}}},
{shamir, {git, "git@github.com:rbkmoney/shamir.git", {branch, master}}},
{woody, {git, "git@github.com:rbkmoney/woody_erlang.git", {branch, master}}},
{genlib, {git, "git@github.com:rbkmoney/genlib.git", {branch, master}}},
{how_are_you, {git, "https://github.com/rbkmoney/how_are_you.git", {branch, master}}},
{erl_health, {git, "https://github.com/rbkmoney/erlang-health.git", {branch, master}}},
{cds_proto, {git, "git@github.com:rbkmoney/cds-proto.git", {branch, master}}},
{msgpack, {git, "https://github.com/rbkmoney/msgpack-erlang", {branch, master}}},
{scoper, {git, "git@github.com:rbkmoney/scoper.git", {branch, master}}},
{logger_logstash_formatter, {git, "git@github.com:rbkmoney/logger_logstash_formatter.git", {branch, "master"}}}
]}.
@ -73,14 +73,18 @@
]}.
{plugins, [
{erlfmt, "0.8.0"},
{rebar3_thrift_compiler,
{git, "https://github.com/rbkmoney/rebar3_thrift_compiler.git", {tag, "0.3.1"}}}
{erlfmt, "1.0.0"},
{rebar3_thrift_compiler, {git, "https://github.com/rbkmoney/rebar3_thrift_compiler.git", {tag, "0.3.1"}}}
]}.
{erlfmt, [
{print_width, 120},
{files, "apps/*/{src,include,test}/*.{hrl,erl}"}
{files, [
"apps/*/{src,include,test}/*.{hrl,erl,app.src}",
"rebar.config",
"elvis.config",
"config/sys.config"
]}
]}.
{overrides, [