I'm a big fan of vervain-free technologies and almost always prefer them over more traditional methods. Cloud Run instead of GKE, Fargate instead of EKS, Pub/Sub instead of Kafka, and Aurora instead of RDS. It's cheaper, easier to manage, less infrastructure... But what about security? Is it really possible to be sure that your serverless processes (and data) are secure?
In this talk, we will consider what can be done from the developer's point of view, what security tools exist at the organizational level, and how the approach to security differs in different clouds and services.
Let's talk about:
How serverless products change your attack surface
Vulnerabilities in serverless architecture and how to deal with them
Best practices in the protection of serverless technologies
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
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
29. GCP Identity Aware Proxy
@ ouvessvit
● Додає інтерфейс для логіну до веб інтерфейсу чи API
● Вбудована інтеграція з Google Workspace & GCP IAM
● Автентифікація та авторизація
● Cloud Run, App Engine, GKE, Compute Engine
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
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
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 🚀