#security - February 2020

February 2020
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
lvh
lvhover 6 years ago
Thanks but that’s Thomas’ writing :)
Igor
Igorover 6 years ago
What lightweight process/tool do you guys use for Change Management, if any?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@UUB28NLDS can you keep tabs? 😃
Igor
Igorover 6 years ago
Does nobody use change management? Or did I ask in the wrong channel? 😉
Alex Siegman
Alex Siegmanover 6 years ago(edited)
I mean, I have "change management." All my infra which includes IAM policies, security groups, accounts, etc. is defined by code. That code can't be rolled out except after reviewed PRs. So, I guess PRs are my change management. But nothing specific for the task, though I'd call that pretty light weight. It's not all encompassing, and what you're managing change on matters quite a bit too. I know nothing of specific change management tools.
Igor
Igorover 6 years ago
Thanks. I knew someone would mention infra-as-code, but I have doubts whether it's sufficient
loren
lorenover 6 years ago
I do the same. Git and PRs and required status checks, with a build system managing the deploy to controlled environments. Can be as lightweight or as complex as you like
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@Igor I whipped up some thoughts on this here: (draft)

https://cloudposse.com/change-management/
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago(edited)
also welcome feedback from everyone. I'll update it with your recommendations.
Igor
Igorover 6 years ago(edited)
@Erik Osterman (Cloud Posse) Thanks for that! So I assume (from #security perspective), there are literally no exceptions in this case. (i.e. If you urgently need to add a route to the ALB, it has to be done via TF.) In this case, shouldn't all AWS IAM accounts for humans be strictly read-only?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
That's a good real-world practical example.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
@marcinw has an interesting solution for this in his product, basically a way to run audited ad-hoc commands.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
I don't know if there's a general-catch-all solution to address this.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
For example, recorded session logs in teleport is one way
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
or recorded RDP sessions is another
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
I think the key is to have traceability for changes in addition to the control. Obviously cloudtrails will give a precise log of what changed and by whom. But ideally, every change is traced back to source control and every change in source control is traced to some ticket/task.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 6 years ago
That way you can justify every change
marcinw
marcinwover 6 years ago
loren
lorenover 6 years ago(edited)
Also, if you implement IaC, you want drift detection of some kind, like with terraform plan. So even if you do allow someone to, say, manually add a route to the ALB in an emergency, it then starts causing your drift detection to fail until someone adds the route to the codebase also
marcinw
marcinwover 6 years ago
Technically speaking terraform plan doesn’t fail, it just shows outstanding changes.
loren
lorenover 6 years ago(edited)
terraform plan -detailed-exitcode with exit code 2
loren
lorenover 6 years ago
  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

marcinw
marcinwover 6 years ago
I’m aware of that.
marcinw
marcinwover 6 years ago
Haven’t thought of using it to detect drift. I guess one would run it recurrently in CI?
loren
lorenover 6 years ago
yep. on a schedule, or get fancy and run it in response to cloudtrail events
marcinw
marcinwover 6 years ago
Wouldn’t it keep throwing false positives all over the place?
marcinw
marcinwover 6 years ago
Like, you’re running your drift detection in the middle of a long apply?
loren
lorenover 6 years ago
the lock should prevent that
marcinw
marcinwover 6 years ago
But your CI job would fail if it doesn’t acquire the lock, no?
marcinw
marcinwover 6 years ago
So you still get a false positive, but a wee bit earlier.
loren
lorenover 6 years ago
you can test the exit code. if it's not 2 then it's not an error this CI job cares about
loren
lorenover 6 years ago
or you can attempt to check the lock first, but that will be subject to a race condition
marcinw
marcinwover 6 years ago
What about changes waiting for human review? Or do you automatically apply everything that’s merged to your tracked branch?
loren
lorenover 6 years ago
automatically apply on some condition, yes. it can be a merge to a tracked branch, or a tag, or... pick your condition
marcinw
marcinwover 6 years ago
OK, then that’s a bit unsafe, no? Because unless you actually apply from a saved and reviewed plan, there’s no guarantee that what you’re applying is what you saw?
loren
lorenover 6 years ago
depends on the size of the config and the state, and how quickly everything is moving
marcinw
marcinwover 6 years ago
Yup, and how many people are contributing.
loren
lorenover 6 years ago
you can generate a plan, store that as an artifact, and promote it through your pipeline
marcinw
marcinwover 6 years ago
Drift detection is something I’d probably want to have in Spacelift at some point.
loren
lorenover 6 years ago
on merge, have the ci retrieve the plan and apply that specifically
loren
lorenover 6 years ago
i don't mean to say that terraform plan is a perfect answer, nor the right answer for everyone, but i think it's a reasonable 80% answer that is low-drag and works for us