iam_config.json 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. {
  2. "sts": {
  3. "tokenDuration": "1h",
  4. "maxSessionLength": "12h",
  5. "issuer": "seaweedfs-sts",
  6. "signingKey": "dGVzdC1zaWduaW5nLWtleS0zMi1jaGFyYWN0ZXJzLWxvbmc="
  7. },
  8. "providers": [
  9. {
  10. "name": "test-oidc",
  11. "type": "mock",
  12. "config": {
  13. "issuer": "test-oidc-issuer",
  14. "clientId": "test-oidc-client"
  15. }
  16. },
  17. {
  18. "name": "keycloak",
  19. "type": "oidc",
  20. "enabled": true,
  21. "config": {
  22. "issuer": "http://localhost:8080/realms/seaweedfs-test",
  23. "clientId": "seaweedfs-s3",
  24. "clientSecret": "seaweedfs-s3-secret",
  25. "jwksUri": "http://localhost:8080/realms/seaweedfs-test/protocol/openid-connect/certs",
  26. "userInfoUri": "http://localhost:8080/realms/seaweedfs-test/protocol/openid-connect/userinfo",
  27. "scopes": ["openid", "profile", "email"],
  28. "claimsMapping": {
  29. "username": "preferred_username",
  30. "email": "email",
  31. "name": "name"
  32. },
  33. "roleMapping": {
  34. "rules": [
  35. {
  36. "claim": "roles",
  37. "value": "s3-admin",
  38. "role": "arn:seaweed:iam::role/KeycloakAdminRole"
  39. },
  40. {
  41. "claim": "roles",
  42. "value": "s3-read-only",
  43. "role": "arn:seaweed:iam::role/KeycloakReadOnlyRole"
  44. },
  45. {
  46. "claim": "roles",
  47. "value": "s3-write-only",
  48. "role": "arn:seaweed:iam::role/KeycloakWriteOnlyRole"
  49. },
  50. {
  51. "claim": "roles",
  52. "value": "s3-read-write",
  53. "role": "arn:seaweed:iam::role/KeycloakReadWriteRole"
  54. }
  55. ],
  56. "defaultRole": "arn:seaweed:iam::role/KeycloakReadOnlyRole"
  57. }
  58. }
  59. }
  60. ],
  61. "policy": {
  62. "defaultEffect": "Deny"
  63. },
  64. "roles": [
  65. {
  66. "roleName": "TestAdminRole",
  67. "roleArn": "arn:seaweed:iam::role/TestAdminRole",
  68. "trustPolicy": {
  69. "Version": "2012-10-17",
  70. "Statement": [
  71. {
  72. "Effect": "Allow",
  73. "Principal": {
  74. "Federated": "test-oidc"
  75. },
  76. "Action": ["sts:AssumeRoleWithWebIdentity"]
  77. }
  78. ]
  79. },
  80. "attachedPolicies": ["S3AdminPolicy"],
  81. "description": "Admin role for testing"
  82. },
  83. {
  84. "roleName": "TestReadOnlyRole",
  85. "roleArn": "arn:seaweed:iam::role/TestReadOnlyRole",
  86. "trustPolicy": {
  87. "Version": "2012-10-17",
  88. "Statement": [
  89. {
  90. "Effect": "Allow",
  91. "Principal": {
  92. "Federated": "test-oidc"
  93. },
  94. "Action": ["sts:AssumeRoleWithWebIdentity"]
  95. }
  96. ]
  97. },
  98. "attachedPolicies": ["S3ReadOnlyPolicy"],
  99. "description": "Read-only role for testing"
  100. },
  101. {
  102. "roleName": "TestWriteOnlyRole",
  103. "roleArn": "arn:seaweed:iam::role/TestWriteOnlyRole",
  104. "trustPolicy": {
  105. "Version": "2012-10-17",
  106. "Statement": [
  107. {
  108. "Effect": "Allow",
  109. "Principal": {
  110. "Federated": "test-oidc"
  111. },
  112. "Action": ["sts:AssumeRoleWithWebIdentity"]
  113. }
  114. ]
  115. },
  116. "attachedPolicies": ["S3WriteOnlyPolicy"],
  117. "description": "Write-only role for testing"
  118. },
  119. {
  120. "roleName": "KeycloakAdminRole",
  121. "roleArn": "arn:seaweed:iam::role/KeycloakAdminRole",
  122. "trustPolicy": {
  123. "Version": "2012-10-17",
  124. "Statement": [
  125. {
  126. "Effect": "Allow",
  127. "Principal": {
  128. "Federated": "keycloak"
  129. },
  130. "Action": ["sts:AssumeRoleWithWebIdentity"]
  131. }
  132. ]
  133. },
  134. "attachedPolicies": ["S3AdminPolicy"],
  135. "description": "Admin role for Keycloak users"
  136. },
  137. {
  138. "roleName": "KeycloakReadOnlyRole",
  139. "roleArn": "arn:seaweed:iam::role/KeycloakReadOnlyRole",
  140. "trustPolicy": {
  141. "Version": "2012-10-17",
  142. "Statement": [
  143. {
  144. "Effect": "Allow",
  145. "Principal": {
  146. "Federated": "keycloak"
  147. },
  148. "Action": ["sts:AssumeRoleWithWebIdentity"]
  149. }
  150. ]
  151. },
  152. "attachedPolicies": ["S3ReadOnlyPolicy"],
  153. "description": "Read-only role for Keycloak users"
  154. },
  155. {
  156. "roleName": "KeycloakWriteOnlyRole",
  157. "roleArn": "arn:seaweed:iam::role/KeycloakWriteOnlyRole",
  158. "trustPolicy": {
  159. "Version": "2012-10-17",
  160. "Statement": [
  161. {
  162. "Effect": "Allow",
  163. "Principal": {
  164. "Federated": "keycloak"
  165. },
  166. "Action": ["sts:AssumeRoleWithWebIdentity"]
  167. }
  168. ]
  169. },
  170. "attachedPolicies": ["S3WriteOnlyPolicy"],
  171. "description": "Write-only role for Keycloak users"
  172. },
  173. {
  174. "roleName": "KeycloakReadWriteRole",
  175. "roleArn": "arn:seaweed:iam::role/KeycloakReadWriteRole",
  176. "trustPolicy": {
  177. "Version": "2012-10-17",
  178. "Statement": [
  179. {
  180. "Effect": "Allow",
  181. "Principal": {
  182. "Federated": "keycloak"
  183. },
  184. "Action": ["sts:AssumeRoleWithWebIdentity"]
  185. }
  186. ]
  187. },
  188. "attachedPolicies": ["S3ReadWritePolicy"],
  189. "description": "Read-write role for Keycloak users"
  190. }
  191. ],
  192. "policies": [
  193. {
  194. "name": "S3AdminPolicy",
  195. "document": {
  196. "Version": "2012-10-17",
  197. "Statement": [
  198. {
  199. "Effect": "Allow",
  200. "Action": ["s3:*"],
  201. "Resource": ["*"]
  202. },
  203. {
  204. "Effect": "Allow",
  205. "Action": ["sts:ValidateSession"],
  206. "Resource": ["*"]
  207. }
  208. ]
  209. }
  210. },
  211. {
  212. "name": "S3ReadOnlyPolicy",
  213. "document": {
  214. "Version": "2012-10-17",
  215. "Statement": [
  216. {
  217. "Effect": "Allow",
  218. "Action": [
  219. "s3:GetObject",
  220. "s3:ListBucket"
  221. ],
  222. "Resource": [
  223. "arn:seaweed:s3:::*",
  224. "arn:seaweed:s3:::*/*"
  225. ]
  226. },
  227. {
  228. "Effect": "Allow",
  229. "Action": ["sts:ValidateSession"],
  230. "Resource": ["*"]
  231. }
  232. ]
  233. }
  234. },
  235. {
  236. "name": "S3WriteOnlyPolicy",
  237. "document": {
  238. "Version": "2012-10-17",
  239. "Statement": [
  240. {
  241. "Effect": "Allow",
  242. "Action": [
  243. "s3:*"
  244. ],
  245. "Resource": [
  246. "arn:seaweed:s3:::*",
  247. "arn:seaweed:s3:::*/*"
  248. ]
  249. },
  250. {
  251. "Effect": "Deny",
  252. "Action": [
  253. "s3:GetObject",
  254. "s3:ListBucket"
  255. ],
  256. "Resource": [
  257. "arn:seaweed:s3:::*",
  258. "arn:seaweed:s3:::*/*"
  259. ]
  260. },
  261. {
  262. "Effect": "Allow",
  263. "Action": ["sts:ValidateSession"],
  264. "Resource": ["*"]
  265. }
  266. ]
  267. }
  268. },
  269. {
  270. "name": "S3ReadWritePolicy",
  271. "document": {
  272. "Version": "2012-10-17",
  273. "Statement": [
  274. {
  275. "Effect": "Allow",
  276. "Action": [
  277. "s3:*"
  278. ],
  279. "Resource": [
  280. "arn:seaweed:s3:::*",
  281. "arn:seaweed:s3:::*/*"
  282. ]
  283. },
  284. {
  285. "Effect": "Allow",
  286. "Action": ["sts:ValidateSession"],
  287. "Resource": ["*"]
  288. }
  289. ]
  290. }
  291. }
  292. ]
  293. }