Microservices Security: All The Questions I'm trying to answer - Part 1

引子

Refer: http://www.grahamlea.com/2015/07/microservices-security-questions/

这一篇关于微服务安全的 post 给了我很大的启发,我也在去年尝试的在很多地方分享过关于微服务安全的知识和经验。至于文章的内容我就不翻译了,但是针对作者 Graham Lea 提出的 Microservices Security: All the Questions,我想根据我这几年的浅薄经验,尝试解答。

Core Services

by which I mean services that make up your system which do not interface with the Internet or other external systems

我们可以浅显的理解为内部系统,或者部署在 private subnet 中的系统,往往这些系统使用 Web Service、RFC 或者 middleware 的方式与外部集成。

  • Are you just protecting your system at the Internet boundary? (Defence in Depth)

Internet boundary is necessary for most cases, but not enough. First we should apply defence in depth in our infrastructure level (or four-layer network), secondary, it will be great if the cloud platform could supply abilities on granularity control, eg: AWS IAM could set any policy statement, and the subnet we always use it to protect resources could be accessed from some specified CIDR.

  • What protections do you have in place if an intruder gets inside your core network? (Defence in Depth)

Endpoint protection could help us, for example Nessus is nice to have. But if intruder gets inside, we could have another hand, for me I prefer 80 is the only open port in VM (of course you could have a lot of tools to connect your alarm systems like PagerDuty, to tell you someone break the glass).

  • How easily could someone inside your network get access to the traffic between your services? (Secure Communications)

This is a really good question, cause most company they have plain HTTP for the internal network, if someone breaks in the boundary so everything goes wild. HTTPS is a solution but requires a CA and more ops work and you can't avoid it, but not enough, I think in future people must face the zero trust network. To consider this question a bit further, if someone breaks in, traffic is a part the hack could steal, but what about the others? The database snapshots, the log center, the reports and the code?

  • Do your services trust each other too much? Or… Do your services trust whoever is calling them too much? (Are you sure only your services can call into your services?) (Reluctance to Trust)

This a another great question, service trust could be resolve in different network layer, for example we could use certificate cert below the application layer or we could implement in application like api-key or some JWT tokens, it's nice to have if the platform have more security abilities, we often use AWS security group to control the client services to the other services, some resources like EC2 Lambda or ECS could only have the permissions to their resources.

  • When your service is called, does it require the calling software to authenticate itself, or does it let anything connect? (Service Authentication)

If you want to have a centralized authentication and verification service, you can't apply Microservice 100%. I'm a bit curious how to implement without OAuth & JWT. I worked for a project they have their own authentication service and issue some tokens in different structure, finally we refactor is to use new modern SSO impl.

  • Do your services let their callers access all the APIs that a service offers, or just the ones it needs to fulfil its function? (Service Authorisation)

People often confused with Authentication & Authorization, if you apply SSO with standard protocols, let the verification of authorization happens in resource side. Service is a kind of resource.

  • Does the identity of the person who originated each call at the client get passed into your internal services, or is that lost at the gateway? (Principal Propagation)

I think for identity we could get it from client side which includes in the short access token, but for user's profile like some PII data, we could have another service to handle it. For the id token, it should only have the information safe to expose, also please consider to hide the email or fullname, maybe use * to mask.

  • Can your services request any data from each other, or only the data of a user that has given their authority? (Principal Authorisation)

I don't think this question belong to Microservice Security, Micronservice is an application architecture, we decouple the monolithic app into micro parts to make them could scale\monitor\change fast, each service could be function or a module in old monolithic application, that's how we build product. I don't think for users they could know the inside of the application they are using, so they don't need to care to authorize the data inside the system or product.

  • If an attacker owned a service, could they pretty easily request anything from its downstream services? (Principal Authorisation)

This question is good, most cases is yes, the attacher could control the downstream. It's very complicates to deal, for the web service downstream services, forward the access token to request is a good try, but for the middleware, we often ignore the protections.

  • What guarantees do you have that a request received from an authenticated user hasn’t been tampered with? (Tamper-Proofing)

Signature, and always get the latest public keys.

  • How do you ensure that an authorised request, delivered a second time, is detected and rejected? (Replay Protection)

Most times you don't need to worry, SSL/TLS everything.

-- 未完待续 --

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 230,362评论 6 544
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 99,577评论 3 429
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 178,486评论 0 383
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 63,852评论 1 317
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 72,600评论 6 412
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 55,944评论 1 328
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 43,944评论 3 447
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 43,108评论 0 290
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 49,652评论 1 336
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 41,385评论 3 358
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 43,616评论 1 374
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 39,111评论 5 364
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 44,798评论 3 350
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 35,205评论 0 28
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 36,537评论 1 295
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 52,334评论 3 400
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 48,570评论 2 379

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,415评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 12,191评论 3 20
  • 最近,突然发现一个特别有意思的事。 身边好多好多朋友,都在拼了命的干一件事情:学习 学营销 学管理 学赚钱 学领导...
    果子日记阅读 1,519评论 1 3
  • 阳光刺目,绿色疯长 百花消色,只有杜鹃花还强撑着 残局。春就这样匆匆败走 新蝉和着鸟脆生生鸣叫 蚊卵蠢蠢欲动,就要...
    锦茱萸阅读 222评论 8 8
  • 你好!八月。 从现在起用美好的心情去迎接每一天! 从今天起,老公休息五天,所以,儿子的吃喝拉撒都由爸爸照顾,我总算...
    薇薇冰朵阅读 159评论 0 1