{"id":100,"date":"2020-08-10T23:23:27","date_gmt":"2020-08-10T23:23:27","guid":{"rendered":"https:\/\/adrianotanaka.com.br\/?p=100"},"modified":"2020-08-10T23:29:59","modified_gmt":"2020-08-10T23:29:59","slug":"monitorando-logins-no-oci-com-notifications-e-events","status":"publish","type":"post","link":"https:\/\/adrianotanaka.com.br\/index.php\/2020\/08\/10\/monitorando-logins-no-oci-com-notifications-e-events\/","title":{"rendered":"Monitorando logins no OCI com Notifications e Events"},"content":{"rendered":"\n<p>Seguran\u00e7a \u00e9 sempre importante e com cada vez mais ambientes em Cloud sendo utilizados,  ter um monitoramento do que acontece em seu ambiente \u00e9 vital, nesse t\u00f3pico ensino como receber um alerta quando um usu\u00e1rio fizer login no seu ambiente, para isso vamos usar os recursos <strong>Notifications<\/strong> e <strong>Events<\/strong>, ambos os servi\u00e7os at\u00e9 o momento s\u00e3o gratuitos para poucos envios:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"191\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1024x191.png\" alt=\"\" class=\"wp-image-101\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1024x191.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-300x56.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-768x143.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1536x287.png 1536w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image.png 1558w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><a href=\"https:\/\/www.oracle.com\/br\/cloud\/systems-management\/notifications\/pricing.html\">https:\/\/www.oracle.com\/br\/cloud\/systems-management\/notifications\/pricing.html<\/a><br><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"352\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1-1024x352.png\" alt=\"\" class=\"wp-image-102\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1-1024x352.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1-300x103.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1-768x264.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1-1536x528.png 1536w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-1.png 1822w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption><a href=\"https:\/\/www.oracle.com\/cloud-native\/events-service\/#:~:text=There%20are%20no%20fees%20for,receive%20events%20from%20Events%20Service.\">https:\/\/www.oracle.com\/cloud-native\/events-service\/#:~:text=There%20are%20no%20fees%20for,receive%20events%20from%20Events%20Service.<\/a><\/figcaption><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Notifications<\/strong> <\/p>\n\n\n\n<p>Com um usu\u00e1rio que tenha permiss\u00f5es para utilizar o servi\u00e7o, basta ir no menu do lado esquerdo <strong>Application Integration -> Notifications -> Topic -> Create Topic<\/strong> e preencher as informa\u00e7\u00f5es que ele solicita, aqui criei um chamado <strong>UsuarioFezLogin<\/strong>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"515\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-3-1024x515.png\" alt=\"\" class=\"wp-image-104\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-3-1024x515.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-3-300x151.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-3-768x386.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-3.png 1186w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Agora precisamos criar um <strong>Subscription <\/strong>que \u00e9 quem vai receber essa mensagem, no meu caso criei um do tipo e-mail mas voc\u00ea possui algumas outras op\u00e7\u00f5es, ap\u00f3s mandar criar voc\u00ea precisa ir no e-mail cadastrado e confirmar que deseja receber os e-mails:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"297\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-4-1024x297.png\" alt=\"\" class=\"wp-image-105\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-4-1024x297.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-4-300x87.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-4-768x222.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-4.png 1402w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Aceite receber os e-mails de notifica\u00e7\u00e3o.<\/figcaption><\/figure>\n\n\n\n<p>Caso queira testar se a notifica\u00e7\u00e3o est\u00e1 funcionando basta clicar no bot\u00e3o <strong>Publish Message<\/strong> na tela do Topic e colocar uma mensagem de teste:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"331\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-5-1024x331.png\" alt=\"\" class=\"wp-image-106\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-5-1024x331.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-5-300x97.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-5-768x248.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-5.png 1402w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>E-mail de teste<\/figcaption><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Events<\/strong><\/p>\n\n\n\n<p>Agora que temos o nosso <strong>Notification <\/strong>criado, precisamos criar uma regra que vai disparar a notifica\u00e7\u00e3o indo em <strong>Application Integration -> Events Service<\/strong>, a dica aqui \u00e9 que durante meus testes o evento s\u00f3 foi disparado quando criado no <strong>compartimento root<\/strong>.<\/p>\n\n\n\n<p>Aqui criei um <strong>Event <\/strong>chamado <strong>UsuarioFezLogin<\/strong>, note que ao colocar o Event Type voc\u00ea precisa selecionar <strong>Identity SignOn<\/strong> e que no campo <strong>Event Type <\/strong>existem quatro op\u00e7\u00f5es com o nome <strong>Identity Sign-On UI Provider (SOUP)<\/strong> , cada uma para um tipo de login, no meu caso eu selecionei a que monitora &#8220;<strong>interactivelogin<\/strong>&#8221; conforme ele mostra no lado direito mas voc\u00ea pode colocar por exemplo um login que venha de um servi\u00e7o federado, no campo <strong>Actions <\/strong>selecione a a\u00e7\u00e3o que criamos no come\u00e7o desse post:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"386\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6-1024x386.png\" alt=\"\" class=\"wp-image-107\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6-1024x386.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6-300x113.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6-768x290.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6-1536x579.png 1536w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-6.png 1861w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>E-mail gerado<\/strong><\/p>\n\n\n\n<p>Ap\u00f3s a cria\u00e7\u00e3o quando algu\u00e9m fizer login no seu ambiente um e-mail como o abaixo vai ser gerado:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"340\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7-1024x340.png\" alt=\"\" class=\"wp-image-108\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7-1024x340.png 1024w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7-300x100.png 300w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7-768x255.png 768w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7-1536x510.png 1536w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-7.png 1688w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>E o peda\u00e7o onde mostra qual usu\u00e1rio fez o login:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"103\" src=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-8.png\" alt=\"\" class=\"wp-image-109\" srcset=\"https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-8.png 760w, https:\/\/adrianotanaka.com.br\/wp-content\/uploads\/2020\/08\/image-8-300x41.png 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Seguran\u00e7a \u00e9 sempre importante e com cada vez mais ambientes em Cloud sendo utilizados, ter um monitoramento do que acontece em seu ambiente \u00e9 vital, nesse t\u00f3pico ensino como receber um alerta quando um usu\u00e1rio fizer login no seu ambiente, para isso vamos usar os recursos Notifications e Events, ambos os servi\u00e7os at\u00e9 o momento [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":114,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"material-hide-sections":[],"footnotes":""},"categories":[8,6,14],"tags":[16,10,15],"class_list":["post-100","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oci","category-oracle","category-seguranca","tag-iam","tag-oci","tag-seguranca"],"_links":{"self":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":3,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":113,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/100\/revisions\/113"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/media\/114"}],"wp:attachment":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}