Skip to content

Commit 2ba2704

Browse files
author
Ell Marquez
committed
Adding study group notes for Perm101
1 parent c58284f commit 2ba2704

File tree

2 files changed

+186
-0
lines changed

2 files changed

+186
-0
lines changed

permissions101/perm101.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Perms 101
2+
3+
Please remember this outline was created to assist you in taking notes during our study group.
4+
5+
## FS Permission Basics
6+
7+
`drwxrwxrwx.`
8+
9+
* `d` rwxrwxrwx.
10+
* d`rwx`rwxrwx.
11+
* drwx`rwx`rwx.
12+
* drwxrwx`rwx`.
13+
* drwxrwxrwx`.`
14+
15+
## Using chmod, chown
16+
17+
`chown root:root file`
18+
19+
`chown root: file`
20+
21+
`chown root file`
22+
23+
`chown :root file`
24+
25+
### chmod
26+
The chmod command changes the mode or the permission set of a file.
27+
28+
Mode can be represented in symbolic or octal notations
29+
Symbolic rwx, rw, r-x
30+
Octal 755, 644
31+
chmod - Examples
32+
33+
* The following are some examples of how we can use chmod
34+
35+
chmod 755 file
36+
chmod u+rwx
37+
chmod g-rwx
38+
chmod o=rw
39+
40+
41+
* The following are some examples of how we can use chmod
42+
43+
chmod 755 file # Change the permissions to 755
44+
chmod u+rwx
45+
chmod g-rwx
46+
chmod o=rw
47+
48+
* The set uid and set gid bits configure a command so that it is executed as said owner or group
49+
50+
* The sticky bit designates that only the owner can delete the file
51+
52+
* These permissions are set with the chmod command.
53+
54+
* Using chmod with a capital -X denotes to only set the execute bit if the execute bit is already set elsewhere in the permissions
55+
56+
57+
## umask & /etc/skel
58+
59+
The umask is what determines what permissions is a new file created with. They are specifying which bits are turned off by default.
60+
61+
umask
62+
umask -S
63+
umask -p
64+
65+
* The umask is set in /etc/profile but can also be set per user or in /etc/skel
66+
67+
## FACLs Introduction
68+
69+
* Defaults are set on a directory and they will carry through to each file under the directory.
70+
71+
* Defaults are set by adding the -d, --default flag indicating the operations are for the default
72+
73+
`setfacl -d -m u:rack:rwx ./testdir/`
74+
75+
### C.R.U.D on FACLs
76+
77+
* Create setfacl -m u:rack:rwx file
78+
* Read getfacl file
79+
* Update setfacl -x u:rack / setfacl -m u:rack:rw
80+
* Delete setfacl -x -k -b file
81+
82+
## Review and Expand

security/K8sStudy.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Don't be Famous Study Group
2+
3+
## Part 1: Introduction:
4+
Famous breaches
5+
Tesla Cloud Resources Are Hacked To Run Cryptocurrency Mining Malware
6+
https://arstechnica.com/information-technology/2018/02/tesla-cloud-resources-are-hacked-to-run-cryptocurrency-mining-malware/
7+
Shopify
8+
https://www.eweek.com/security/how-shopify-avoided-a-data-breach-thanks-to-a-bug-bounty
9+
Legacy Security
10+
Physical Access
11+
Network Perimeter
12+
Updated Machines
13+
Workload Isolation
14+
Could be Dev, Staging and production. Could also be separating production environments.
15+
16+
## Part 2: Security through Architecture
17+
https://kubernetes.io/blog/2018/07/18/11-ways-not-to-get-hacked/#1-tls-everything
18+
Everywhere that can be TLS should be TLS inside the cluster.
19+
Worker nodes should never have access to etcd for any reason.
20+
Even Better, Etcd should be completely separate from the controls and firewall-ed.
21+
Upgrades
22+
Upgrade in place
23+
Lower infrastructure cost
24+
More “dangerous”
25+
Configuration Drift
26+
External Access is Easier
27+
Stand up a new cluster
28+
Higher infrastructure cost
29+
Less “dangerous”
30+
Immutable Clusters
31+
External Access is harder.
32+
Command to know:
33+
https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/
34+
kubectl cordon
35+
kubectl drain
36+
37+
Projects to know:
38+
Velero (arc) – backups and restores for k8s objects
39+
40+
## Part 3: RBAC
41+
RBAC relies on a series of well defined and standard concepts that are commonly found in all implementations.
42+
43+
Subjects – A person, agent or group
44+
Roles- A role is made of a set of permissions (an approval of a mode of access to a resource)
45+
Assignments – Role assignment grants a subject right to execute a transaction by assigning to the subject an active role
46+
Kubernetes has Role and Cluster Roles
47+
Using RBAC Authorizaiton
48+
https://kubernetes.io/docs/reference/access-authn-authz/rbac/
49+
Authorization Overview
50+
https://kubernetes.io/docs/reference/access-authn-authz/authorization/
51+
Roles are defined at the Kubernetes namespace level.
52+
Batteries Included
53+
Cluster-Admin
54+
Admin
55+
Edit
56+
View
57+
Role Sprawl Insanity
58+
Use groups
59+
Tools that help :
60+
Dex
61+
https://github.com/dexidp/dex/blob/master/Documentation/kubernetes.md
62+
https://github.com/dexidp/dex
63+
Gangway
64+
https://github.com/heptiolabs/gangway
65+
66+
## Part 4: “Policies”
67+
Network Policy
68+
Default is ALLOW ALL ANYWHERE
69+
Remember network plugins
70+
http://github.com/ahmetb/kubernetes-network-policy-recipes
71+
Pod Security Policy
72+
Runs on the cluster as an admission controller.
73+
Linked to RBAC roles
74+
RBAC defines what policies users have access to.
75+
Permissive vs Restricted
76+
Default
77+
Kube-System
78+
Networking
79+
80+
81+
## Part 5: Audit Everything
82+
https://kubernetes.io/docs/tasks/debug-application-cluster/audit/
83+
API Server will log ALL REQUEST for auditing purpose
84+
Audit logs can be VERY NOISY, so you only log what you need.
85+
Stages of a Request to the API server
86+
RequestReceived
87+
ResponseStated
88+
ResponseComplete
89+
Panic
90+
Audit log levels
91+
None
92+
Metadata
93+
Requests
94+
RequestResponse
95+
96+
97+
## Closing:
98+
Previous Study groups
99+
[History of Linux](https://youtu.be/qJ1CrzLS7Ak)
100+
[Ansible](https://youtu.be/0WfYpWl01VQ)
101+
[Command Line Threat Hunting](https://youtu.be/jy9SAUHEWdU)
102+
[Feedback form](https://forms.gle/oXAa1VYjsJJBsZD78)
103+
[Free k8s courses](https://linuxacademy.com/blog/linux-academy/freemay2019/)
104+
[Hearts twitter](@hhover)

0 commit comments

Comments
 (0)