iam_config.local.json 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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:8090/realms/seaweedfs-test",
  23. "clientId": "seaweedfs-s3",
  24. "clientSecret": "seaweedfs-s3-secret",
  25. "jwksUri": "http://localhost:8090/realms/seaweedfs-test/protocol/openid-connect/certs",
  26. "userInfoUri": "http://localhost:8090/realms/seaweedfs-test/protocol/openid-connect/userinfo",
  27. "scopes": [
  28. "openid",
  29. "profile",
  30. "email"
  31. ],
  32. "claimsMapping": {
  33. "username": "preferred_username",
  34. "email": "email",
  35. "name": "name"
  36. },
  37. "roleMapping": {
  38. "rules": [
  39. {
  40. "claim": "roles",
  41. "value": "s3-admin",
  42. "role": "arn:seaweed:iam::role/KeycloakAdminRole"
  43. },
  44. {
  45. "claim": "roles",
  46. "value": "s3-read-only",
  47. "role": "arn:seaweed:iam::role/KeycloakReadOnlyRole"
  48. },
  49. {
  50. "claim": "roles",
  51. "value": "s3-write-only",
  52. "role": "arn:seaweed:iam::role/KeycloakWriteOnlyRole"
  53. },
  54. {
  55. "claim": "roles",
  56. "value": "s3-read-write",
  57. "role": "arn:seaweed:iam::role/KeycloakReadWriteRole"
  58. }
  59. ],
  60. "defaultRole": "arn:seaweed:iam::role/KeycloakReadOnlyRole"
  61. }
  62. }
  63. }
  64. ],
  65. "policy": {
  66. "defaultEffect": "Deny"
  67. },
  68. "roles": [
  69. {
  70. "roleName": "TestAdminRole",
  71. "roleArn": "arn:seaweed:iam::role/TestAdminRole",
  72. "trustPolicy": {
  73. "Version": "2012-10-17",
  74. "Statement": [
  75. {
  76. "Effect": "Allow",
  77. "Principal": {
  78. "Federated": "test-oidc"
  79. },
  80. "Action": [
  81. "sts:AssumeRoleWithWebIdentity"
  82. ]
  83. }
  84. ]
  85. },
  86. "attachedPolicies": [
  87. "S3AdminPolicy"
  88. ],
  89. "description": "Admin role for testing"
  90. },
  91. {
  92. "roleName": "TestReadOnlyRole",
  93. "roleArn": "arn:seaweed:iam::role/TestReadOnlyRole",
  94. "trustPolicy": {
  95. "Version": "2012-10-17",
  96. "Statement": [
  97. {
  98. "Effect": "Allow",
  99. "Principal": {
  100. "Federated": "test-oidc"
  101. },
  102. "Action": [
  103. "sts:AssumeRoleWithWebIdentity"
  104. ]
  105. }
  106. ]
  107. },
  108. "attachedPolicies": [
  109. "S3ReadOnlyPolicy"
  110. ],
  111. "description": "Read-only role for testing"
  112. },
  113. {
  114. "roleName": "TestWriteOnlyRole",
  115. "roleArn": "arn:seaweed:iam::role/TestWriteOnlyRole",
  116. "trustPolicy": {
  117. "Version": "2012-10-17",
  118. "Statement": [
  119. {
  120. "Effect": "Allow",
  121. "Principal": {
  122. "Federated": "test-oidc"
  123. },
  124. "Action": [
  125. "sts:AssumeRoleWithWebIdentity"
  126. ]
  127. }
  128. ]
  129. },
  130. "attachedPolicies": [
  131. "S3WriteOnlyPolicy"
  132. ],
  133. "description": "Write-only role for testing"
  134. },
  135. {
  136. "roleName": "KeycloakAdminRole",
  137. "roleArn": "arn:seaweed:iam::role/KeycloakAdminRole",
  138. "trustPolicy": {
  139. "Version": "2012-10-17",
  140. "Statement": [
  141. {
  142. "Effect": "Allow",
  143. "Principal": {
  144. "Federated": "keycloak"
  145. },
  146. "Action": [
  147. "sts:AssumeRoleWithWebIdentity"
  148. ]
  149. }
  150. ]
  151. },
  152. "attachedPolicies": [
  153. "S3AdminPolicy"
  154. ],
  155. "description": "Admin role for Keycloak users"
  156. },
  157. {
  158. "roleName": "KeycloakReadOnlyRole",
  159. "roleArn": "arn:seaweed:iam::role/KeycloakReadOnlyRole",
  160. "trustPolicy": {
  161. "Version": "2012-10-17",
  162. "Statement": [
  163. {
  164. "Effect": "Allow",
  165. "Principal": {
  166. "Federated": "keycloak"
  167. },
  168. "Action": [
  169. "sts:AssumeRoleWithWebIdentity"
  170. ]
  171. }
  172. ]
  173. },
  174. "attachedPolicies": [
  175. "S3ReadOnlyPolicy"
  176. ],
  177. "description": "Read-only role for Keycloak users"
  178. },
  179. {
  180. "roleName": "KeycloakWriteOnlyRole",
  181. "roleArn": "arn:seaweed:iam::role/KeycloakWriteOnlyRole",
  182. "trustPolicy": {
  183. "Version": "2012-10-17",
  184. "Statement": [
  185. {
  186. "Effect": "Allow",
  187. "Principal": {
  188. "Federated": "keycloak"
  189. },
  190. "Action": [
  191. "sts:AssumeRoleWithWebIdentity"
  192. ]
  193. }
  194. ]
  195. },
  196. "attachedPolicies": [
  197. "S3WriteOnlyPolicy"
  198. ],
  199. "description": "Write-only role for Keycloak users"
  200. },
  201. {
  202. "roleName": "KeycloakReadWriteRole",
  203. "roleArn": "arn:seaweed:iam::role/KeycloakReadWriteRole",
  204. "trustPolicy": {
  205. "Version": "2012-10-17",
  206. "Statement": [
  207. {
  208. "Effect": "Allow",
  209. "Principal": {
  210. "Federated": "keycloak"
  211. },
  212. "Action": [
  213. "sts:AssumeRoleWithWebIdentity"
  214. ]
  215. }
  216. ]
  217. },
  218. "attachedPolicies": [
  219. "S3ReadWritePolicy"
  220. ],
  221. "description": "Read-write role for Keycloak users"
  222. }
  223. ],
  224. "policies": [
  225. {
  226. "name": "S3AdminPolicy",
  227. "document": {
  228. "Version": "2012-10-17",
  229. "Statement": [
  230. {
  231. "Effect": "Allow",
  232. "Action": [
  233. "s3:*"
  234. ],
  235. "Resource": [
  236. "*"
  237. ]
  238. },
  239. {
  240. "Effect": "Allow",
  241. "Action": [
  242. "sts:ValidateSession"
  243. ],
  244. "Resource": [
  245. "*"
  246. ]
  247. }
  248. ]
  249. }
  250. },
  251. {
  252. "name": "S3ReadOnlyPolicy",
  253. "document": {
  254. "Version": "2012-10-17",
  255. "Statement": [
  256. {
  257. "Effect": "Allow",
  258. "Action": [
  259. "s3:GetObject",
  260. "s3:ListBucket"
  261. ],
  262. "Resource": [
  263. "arn:seaweed:s3:::*",
  264. "arn:seaweed:s3:::*/*"
  265. ]
  266. },
  267. {
  268. "Effect": "Allow",
  269. "Action": [
  270. "sts:ValidateSession"
  271. ],
  272. "Resource": [
  273. "*"
  274. ]
  275. }
  276. ]
  277. }
  278. },
  279. {
  280. "name": "S3WriteOnlyPolicy",
  281. "document": {
  282. "Version": "2012-10-17",
  283. "Statement": [
  284. {
  285. "Effect": "Allow",
  286. "Action": [
  287. "s3:*"
  288. ],
  289. "Resource": [
  290. "arn:seaweed:s3:::*",
  291. "arn:seaweed:s3:::*/*"
  292. ]
  293. },
  294. {
  295. "Effect": "Deny",
  296. "Action": [
  297. "s3:GetObject",
  298. "s3:ListBucket"
  299. ],
  300. "Resource": [
  301. "arn:seaweed:s3:::*",
  302. "arn:seaweed:s3:::*/*"
  303. ]
  304. },
  305. {
  306. "Effect": "Allow",
  307. "Action": [
  308. "sts:ValidateSession"
  309. ],
  310. "Resource": [
  311. "*"
  312. ]
  313. }
  314. ]
  315. }
  316. },
  317. {
  318. "name": "S3ReadWritePolicy",
  319. "document": {
  320. "Version": "2012-10-17",
  321. "Statement": [
  322. {
  323. "Effect": "Allow",
  324. "Action": [
  325. "s3:*"
  326. ],
  327. "Resource": [
  328. "arn:seaweed:s3:::*",
  329. "arn:seaweed:s3:::*/*"
  330. ]
  331. },
  332. {
  333. "Effect": "Allow",
  334. "Action": [
  335. "sts:ValidateSession"
  336. ],
  337. "Resource": [
  338. "*"
  339. ]
  340. }
  341. ]
  342. }
  343. }
  344. ]
  345. }