SlideShare a Scribd company logo
1 of 47
Download to read offline
$ whoami
• Наталя Годек
• Харківʼянка в Лондоні
• Cloud Architect/Системщик/Девопс
• GDE in Cloud Platform
• Соцмережі: @ouvessvit
@ ouvessvit
Optus data breach
@ ouvessvit
Optus data breach
@ ouvessvit
Dear Name,
We recently wrote to you advising that the
Victorian Government is fast tracking
protections for licence holders whose
licence information was exposed in the
recent Optus data breach.
This commitment includes replacing driver
licences and learner permits for free, with
a redesigned card that now prominently
features a unique card number on the
back top right hand corner.
As one of our impacted customers you
should have now received either a new
card or a label.
Optus data breach
@ ouvessvit
https://twitter.com/Jeremy_Kirk/status/1573652991496048640
https://inf.ooo/g/YcmgHfcqLF
Optus data breach
@ ouvessvit
https://twitter.com/Jeremy_Kirk/status/1573652991496048640
https://inf.ooo/g/YcmgHfcqLF
Optus data breach
@ ouvessvit
https://twitter.com/Jeremy_Kirk/status/1573652991496048640
https://inf.ooo/g/YcmgHfcqLF
Optus data breach
@ ouvessvit
“Та я просто запущу
свій таск в хмарі”
Serverless - безсерверні технології
на прикладі AWS та GCP
@ ouvessvit
lambda/
functions
fargate/
cloud run
Serverless Compute:
Serverless - безсерверні технології
на прикладі AWS та GCP
@ ouvessvit
lambda/
functions
fargate/
cloud run
aurora/
alloydb
dynamodb/
bigtable
Serverless Compute: Serverless Databases:
Serverless - безсерверні технології
на прикладі AWS та GCP
@ ouvessvit
lambda/
functions
fargate/
cloud run
aurora/
alloydb
s3/
storage
sqs/
pub/sub
dynamodb/
bigtable
Serverless Compute: Serverless Databases: Serverless Data:
@ ouvessvit
Складові захисту безсерверних технологій
@ ouvessvit
Хто має доступ
до сервісу
Внутрішні
механізми
безпеки
До чого має
доступ сервіс
“Та то ми експериментували.
Воно ні до чого не приєднано”
IAM
Складові захисту безсерверних технологій
@ ouvessvit
Хто має доступ
до сервісу
Внутрішні
механізми
безпеки
До чого має
доступ сервіс
IAM best practices: до чого має доступ сервіс
@ ouvessvit
IAM best practices: до чого має доступ сервіс
@ ouvessvit
IAM best practices: GCP default service accounts
@ ouvessvit
● Існують за замовчанням, створені Гуглом
● Мають дуже широкий доступ (editor на рівні проекту)
● За замовчанням ваші сервіси використовують цей акаунт
IAM best practices: GCP default service accounts
@ ouvessvit
● Для кожного application створюйте спеціальний сервісний акаунт
● Дотримуйтесь принципів least privilege: надавайте лише ті ролі, і лише до
тих ресурсів, що необхідні
IAM best practices: AWS default IAM policies
@ ouvessvit
● AWS має 1000+ стандартних IAM policy
● Вони мають загальний широкий доступ, наприклад S3: [*]
● Рекомендується створювати власні policy, обмежуючи дії та ресурси, до
яких надається доступ
● Притримуйтесь принципу least privilege
@ ouvessvit
"Statement":[
{
"Principal":{
"AWS":"arn:aws:lambda:us-west-2:123456789012:function:my-function"
},
"Effect":"Allow",
"Action":[
"s3:GetObject",
"s3:GetObjectVersion",
"s3:PutObject"
],
"Resource":"arn:aws:s3:::EXAMPLE-BUCKET/*",
}
]
Надати функції my-function доступ до бакета EXAMPLE-BUCKET:
IAM best practices: AWS default IAM policies
Статичні токени, нічний жах всіх секопсів
@ ouvessvit
GCP: IAM service account keys
AWS: IAM users and secret keys
● Легко створити і почати використовувати
● Легко вкрасти.
“To bad actors, service account keys can be
even more valuable than a leaked password”
- Google
ЧОМУ ЦЕ ВАЖЛИВО?
(demo)
Складові захисту безсерверних технологій
@ ouvessvit
Хто має доступ
до сервісу
Внутрішні
механізми
безпеки
До чого має
доступ сервіс
IAM best practices: who can invoke
@ ouvessvit
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "lambda:InvokeFunctionUrl",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:my-function",
"Condition": {
"StringEquals": {
"lambda:FunctionUrlAuthType": "NONE"
}
}
}
]
Надати публічний доступ до сервісу в AWS Lambda:
IAM best practices: who can invoke
@ ouvessvit
Надати публічний доступ до сервісу в GCP Cloud Run:
$ cat policy.yaml
bindings:
- members:
- allUsers
role: roles/run.invoker
$ gcloud run services set-iam-policy <SERVICE> policy.yaml
IAM best practices: who can invoke
@ ouvessvit
GCP Identity Aware Proxy
@ ouvessvit
● Додає інтерфейс для логіну до веб інтерфейсу чи API
● Вбудована інтеграція з Google Workspace & GCP IAM
● Автентифікація та авторизація
● Cloud Run, App Engine, GKE, Compute Engine
“Мені треба швидко спробувати,
зроблю клікопс”
Інтернет
AWS Lambda Function URLs
@ ouvessvit
@ ouvessvit
$ aws lambda create-function-url-config --function-name
my_function --auth-type NONE
NONE – Lambda doesn't perform any authentication before invoking
your function. However, your function's resource-based policy is
always in effect and must grant public access before your
function URL can receive requests. Choose this option to allow
public, unauthenticated access to your function URL.
AWS Lambda Function URLs
@ ouvessvit
"lambda-invoke" resource policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "lambda:InvokeFunctionUrl",
"Resource": "arn:aws:lambda:us-east-1:123456789012:function:my-function",
"Condition": {
"StringEquals": {
"lambda:FunctionUrlAuthType": "NONE"
}
}
}
]
}
AWS Lambda Function URLs
GCP Cloud Run Ingress Policy
@ ouvessvit
Ingress контролює доступ до URL самого сервісу, що автоматично створений:
https://<serviceName>-<projectHash>-<region>.run.app
GCP Cloud Run Ingress Policy
@ ouvessvit
Ingress контролює доступ до URL самого сервісу, що автоматично створений:
https://<serviceName>-<projectHash>-<region>.run.app
GCP Cloud Run Ingress Policy
@ ouvessvit
3 варіанти ingress:
● INGRESS_TRAFFIC_ALL <- default
● INGRESS_TRAFFIC_INTERNAL_ONLY
● INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER
GCP Cloud Run Ingress Policy
@ ouvessvit
3 варіанти ingress:
● INGRESS_TRAFFIC_ALL <- default
● INGRESS_TRAFFIC_INTERNAL_ONLY
● INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER
“Все йде вже налаштованим,
наша справа - писати код”
Quickfire
security
AWS не шифрує за замовчанням
Serverless is not really serverless
Cloud services are public APIs
GCP: Serverless VPC Connectors
@ ouvessvit
Мій Проєкт
func-sa my-func1 my-dataset
Serverless VPC
connector
subnet
Cloud Functions, Cloud Run та інші
безсерверні продукти категорії compute
працюють в так званих тіньових проєктах;
для забезпечення комунікації з
приватними та restricted сервісами можна
використати Serverless VPC Connector.
A Cloud Run сам уміє в приватні комунікації
завдяки VPC Egress 🚀
@ ouvessvit
AWS: VPC Endpoints
AWS
Приватні
сервіси
VPC
Subnet
Інтернет
Вимкніть публічний доступ до storage
buckets
Вимкніть публічний доступ до storage buckets
ouvessvit
Дякую!
Приєднуйся до дискусії в discord
Socials: ouvessvit

More Related Content

More from Fwdays

More from Fwdays (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets"What is a RAG system and how to build it",Dmytro Spodarets
"What is a RAG system and how to build it",Dmytro Spodarets
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi"Distributed graphs and microservices in Prom.ua",  Maksym Kindritskyi
"Distributed graphs and microservices in Prom.ua", Maksym Kindritskyi
 
"Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl..."Rethinking the existing data loading and processing process as an ETL exampl...
"Rethinking the existing data loading and processing process as an ETL exampl...
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ..."The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
"The Strength of Being Vulnerable: the experience from CIA, Tesla and Uber", ...
 
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu..."[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
"[QUICK TALK] Radical candor: how to achieve results faster thanks to a cultu...
 
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care..."[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
"[QUICK TALK] PDP Plan, the only one door to raise your salary and boost care...
 
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"..."4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
"4 horsemen of the apocalypse of working relationships (+ antidotes to them)"...
 
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast..."Reconnecting with Purpose: Rediscovering Job Interest after Burnout",  Anast...
"Reconnecting with Purpose: Rediscovering Job Interest after Burnout", Anast...
 
"Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others..."Mentoring 101: How to effectively invest experience in the success of others...
"Mentoring 101: How to effectively invest experience in the success of others...
 
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova"Mission (im) possible: How to get an offer in 2024?",  Oleksandra Myronova
"Mission (im) possible: How to get an offer in 2024?", Oleksandra Myronova
 
"Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv..."Why have we learned how to package products, but not how to 'package ourselv...
"Why have we learned how to package products, but not how to 'package ourselv...
 
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin..."How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
"How to tame the dragon, or leadership with imposter syndrome", Oleksandr Zin...
 
"Leadership, Soft Skills, and Personality Types for IT teams", Sergiy Tytenko
"Leadership, Soft Skills, and Personality Types for IT teams",  Sergiy Tytenko"Leadership, Soft Skills, and Personality Types for IT teams",  Sergiy Tytenko
"Leadership, Soft Skills, and Personality Types for IT teams", Sergiy Tytenko
 
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T..."How Ukrainian IT specialist can go on vacation abroad without crossing the T...
"How Ukrainian IT specialist can go on vacation abroad without crossing the T...
 
"Mastering cross-cultural communication", Anna Gandrabura
"Mastering cross-cultural communication", Anna Gandrabura"Mastering cross-cultural communication", Anna Gandrabura
"Mastering cross-cultural communication", Anna Gandrabura
 

""I'll just run my task in the cloud" - Legends and myths of security in Serverless", Natalie Godec

  • 1.
  • 2. $ whoami • Наталя Годек • Харківʼянка в Лондоні • Cloud Architect/Системщик/Девопс • GDE in Cloud Platform • Соцмережі: @ouvessvit @ ouvessvit
  • 4. Optus data breach @ ouvessvit Dear Name, We recently wrote to you advising that the Victorian Government is fast tracking protections for licence holders whose licence information was exposed in the recent Optus data breach. This commitment includes replacing driver licences and learner permits for free, with a redesigned card that now prominently features a unique card number on the back top right hand corner. As one of our impacted customers you should have now received either a new card or a label.
  • 5. Optus data breach @ ouvessvit https://twitter.com/Jeremy_Kirk/status/1573652991496048640 https://inf.ooo/g/YcmgHfcqLF
  • 6. Optus data breach @ ouvessvit https://twitter.com/Jeremy_Kirk/status/1573652991496048640 https://inf.ooo/g/YcmgHfcqLF
  • 7. Optus data breach @ ouvessvit https://twitter.com/Jeremy_Kirk/status/1573652991496048640 https://inf.ooo/g/YcmgHfcqLF
  • 9. “Та я просто запущу свій таск в хмарі”
  • 10. Serverless - безсерверні технології на прикладі AWS та GCP @ ouvessvit lambda/ functions fargate/ cloud run Serverless Compute:
  • 11. Serverless - безсерверні технології на прикладі AWS та GCP @ ouvessvit lambda/ functions fargate/ cloud run aurora/ alloydb dynamodb/ bigtable Serverless Compute: Serverless Databases:
  • 12. Serverless - безсерверні технології на прикладі AWS та GCP @ ouvessvit lambda/ functions fargate/ cloud run aurora/ alloydb s3/ storage sqs/ pub/sub dynamodb/ bigtable Serverless Compute: Serverless Databases: Serverless Data:
  • 14. Складові захисту безсерверних технологій @ ouvessvit Хто має доступ до сервісу Внутрішні механізми безпеки До чого має доступ сервіс
  • 15. “Та то ми експериментували. Воно ні до чого не приєднано” IAM
  • 16. Складові захисту безсерверних технологій @ ouvessvit Хто має доступ до сервісу Внутрішні механізми безпеки До чого має доступ сервіс
  • 17. IAM best practices: до чого має доступ сервіс @ ouvessvit
  • 18. IAM best practices: до чого має доступ сервіс @ ouvessvit
  • 19. IAM best practices: GCP default service accounts @ ouvessvit ● Існують за замовчанням, створені Гуглом ● Мають дуже широкий доступ (editor на рівні проекту) ● За замовчанням ваші сервіси використовують цей акаунт
  • 20. IAM best practices: GCP default service accounts @ ouvessvit ● Для кожного application створюйте спеціальний сервісний акаунт ● Дотримуйтесь принципів least privilege: надавайте лише ті ролі, і лише до тих ресурсів, що необхідні
  • 21. IAM best practices: AWS default IAM policies @ ouvessvit ● AWS має 1000+ стандартних IAM policy ● Вони мають загальний широкий доступ, наприклад S3: [*] ● Рекомендується створювати власні policy, обмежуючи дії та ресурси, до яких надається доступ ● Притримуйтесь принципу least privilege
  • 23. Статичні токени, нічний жах всіх секопсів @ ouvessvit GCP: IAM service account keys AWS: IAM users and secret keys ● Легко створити і почати використовувати ● Легко вкрасти. “To bad actors, service account keys can be even more valuable than a leaked password” - Google
  • 25. Складові захисту безсерверних технологій @ ouvessvit Хто має доступ до сервісу Внутрішні механізми безпеки До чого має доступ сервіс
  • 26. IAM best practices: who can invoke @ ouvessvit "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "lambda:InvokeFunctionUrl", "Resource": "arn:aws:lambda:us-east-1:123456789012:function:my-function", "Condition": { "StringEquals": { "lambda:FunctionUrlAuthType": "NONE" } } } ] Надати публічний доступ до сервісу в AWS Lambda:
  • 27. IAM best practices: who can invoke @ ouvessvit Надати публічний доступ до сервісу в GCP Cloud Run: $ cat policy.yaml bindings: - members: - allUsers role: roles/run.invoker $ gcloud run services set-iam-policy <SERVICE> policy.yaml
  • 28. IAM best practices: who can invoke @ ouvessvit
  • 29. GCP Identity Aware Proxy @ ouvessvit ● Додає інтерфейс для логіну до веб інтерфейсу чи API ● Вбудована інтеграція з Google Workspace & GCP IAM ● Автентифікація та авторизація ● Cloud Run, App Engine, GKE, Compute Engine
  • 30. “Мені треба швидко спробувати, зроблю клікопс” Інтернет
  • 31. AWS Lambda Function URLs @ ouvessvit
  • 32. @ ouvessvit $ aws lambda create-function-url-config --function-name my_function --auth-type NONE NONE – Lambda doesn't perform any authentication before invoking your function. However, your function's resource-based policy is always in effect and must grant public access before your function URL can receive requests. Choose this option to allow public, unauthenticated access to your function URL. AWS Lambda Function URLs
  • 33. @ ouvessvit "lambda-invoke" resource policy: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "lambda:InvokeFunctionUrl", "Resource": "arn:aws:lambda:us-east-1:123456789012:function:my-function", "Condition": { "StringEquals": { "lambda:FunctionUrlAuthType": "NONE" } } } ] } AWS Lambda Function URLs
  • 34. GCP Cloud Run Ingress Policy @ ouvessvit Ingress контролює доступ до URL самого сервісу, що автоматично створений: https://<serviceName>-<projectHash>-<region>.run.app
  • 35. GCP Cloud Run Ingress Policy @ ouvessvit Ingress контролює доступ до URL самого сервісу, що автоматично створений: https://<serviceName>-<projectHash>-<region>.run.app
  • 36. GCP Cloud Run Ingress Policy @ ouvessvit 3 варіанти ingress: ● INGRESS_TRAFFIC_ALL <- default ● INGRESS_TRAFFIC_INTERNAL_ONLY ● INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER
  • 37. GCP Cloud Run Ingress Policy @ ouvessvit 3 варіанти ingress: ● INGRESS_TRAFFIC_ALL <- default ● INGRESS_TRAFFIC_INTERNAL_ONLY ● INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER
  • 38. “Все йде вже налаштованим, наша справа - писати код” Quickfire security
  • 39. AWS не шифрує за замовчанням
  • 40. Serverless is not really serverless
  • 41. Cloud services are public APIs
  • 42. GCP: Serverless VPC Connectors @ ouvessvit Мій Проєкт func-sa my-func1 my-dataset Serverless VPC connector subnet Cloud Functions, Cloud Run та інші безсерверні продукти категорії compute працюють в так званих тіньових проєктах; для забезпечення комунікації з приватними та restricted сервісами можна використати Serverless VPC Connector. A Cloud Run сам уміє в приватні комунікації завдяки VPC Egress 🚀
  • 43. @ ouvessvit AWS: VPC Endpoints AWS Приватні сервіси VPC Subnet Інтернет
  • 45.
  • 46. Вимкніть публічний доступ до storage buckets ouvessvit