test_config.json 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. {
  2. "identities": [
  3. {
  4. "name": "testuser",
  5. "credentials": [
  6. {
  7. "accessKey": "test-access-key",
  8. "secretKey": "test-secret-key"
  9. }
  10. ],
  11. "actions": ["Admin"]
  12. },
  13. {
  14. "name": "readonlyuser",
  15. "credentials": [
  16. {
  17. "accessKey": "readonly-access-key",
  18. "secretKey": "readonly-secret-key"
  19. }
  20. ],
  21. "actions": ["Read"]
  22. },
  23. {
  24. "name": "writeonlyuser",
  25. "credentials": [
  26. {
  27. "accessKey": "writeonly-access-key",
  28. "secretKey": "writeonly-secret-key"
  29. }
  30. ],
  31. "actions": ["Write"]
  32. }
  33. ],
  34. "iam": {
  35. "enabled": true,
  36. "sts": {
  37. "tokenDuration": "15m",
  38. "issuer": "seaweedfs-sts",
  39. "signingKey": "test-sts-signing-key-for-integration-tests"
  40. },
  41. "policy": {
  42. "defaultEffect": "Deny"
  43. },
  44. "providers": {
  45. "oidc": {
  46. "test-oidc": {
  47. "issuer": "http://localhost:8080/.well-known/openid_configuration",
  48. "clientId": "test-client-id",
  49. "jwksUri": "http://localhost:8080/jwks",
  50. "userInfoUri": "http://localhost:8080/userinfo",
  51. "roleMapping": {
  52. "rules": [
  53. {
  54. "claim": "groups",
  55. "claimValue": "admins",
  56. "roleName": "S3AdminRole"
  57. },
  58. {
  59. "claim": "groups",
  60. "claimValue": "users",
  61. "roleName": "S3ReadOnlyRole"
  62. },
  63. {
  64. "claim": "groups",
  65. "claimValue": "writers",
  66. "roleName": "S3WriteOnlyRole"
  67. }
  68. ]
  69. },
  70. "claimsMapping": {
  71. "email": "email",
  72. "displayName": "name",
  73. "groups": "groups"
  74. }
  75. }
  76. },
  77. "ldap": {
  78. "test-ldap": {
  79. "server": "ldap://localhost:389",
  80. "baseDN": "dc=example,dc=com",
  81. "bindDN": "cn=admin,dc=example,dc=com",
  82. "bindPassword": "admin-password",
  83. "userFilter": "(uid=%s)",
  84. "groupFilter": "(memberUid=%s)",
  85. "attributes": {
  86. "email": "mail",
  87. "displayName": "cn",
  88. "groups": "memberOf"
  89. },
  90. "roleMapping": {
  91. "rules": [
  92. {
  93. "claim": "groups",
  94. "claimValue": "cn=admins,ou=groups,dc=example,dc=com",
  95. "roleName": "S3AdminRole"
  96. },
  97. {
  98. "claim": "groups",
  99. "claimValue": "cn=users,ou=groups,dc=example,dc=com",
  100. "roleName": "S3ReadOnlyRole"
  101. }
  102. ]
  103. }
  104. }
  105. }
  106. },
  107. "policyStore": {}
  108. },
  109. "roles": {
  110. "S3AdminRole": {
  111. "trustPolicy": {
  112. "Version": "2012-10-17",
  113. "Statement": [
  114. {
  115. "Effect": "Allow",
  116. "Principal": {
  117. "Federated": ["test-oidc", "test-ldap"]
  118. },
  119. "Action": "sts:AssumeRoleWithWebIdentity"
  120. }
  121. ]
  122. },
  123. "attachedPolicies": ["S3AdminPolicy"],
  124. "description": "Full administrative access to S3 resources"
  125. },
  126. "S3ReadOnlyRole": {
  127. "trustPolicy": {
  128. "Version": "2012-10-17",
  129. "Statement": [
  130. {
  131. "Effect": "Allow",
  132. "Principal": {
  133. "Federated": ["test-oidc", "test-ldap"]
  134. },
  135. "Action": "sts:AssumeRoleWithWebIdentity"
  136. }
  137. ]
  138. },
  139. "attachedPolicies": ["S3ReadOnlyPolicy"],
  140. "description": "Read-only access to S3 resources"
  141. },
  142. "S3WriteOnlyRole": {
  143. "trustPolicy": {
  144. "Version": "2012-10-17",
  145. "Statement": [
  146. {
  147. "Effect": "Allow",
  148. "Principal": {
  149. "Federated": ["test-oidc", "test-ldap"]
  150. },
  151. "Action": "sts:AssumeRoleWithWebIdentity"
  152. }
  153. ]
  154. },
  155. "attachedPolicies": ["S3WriteOnlyPolicy"],
  156. "description": "Write-only access to S3 resources"
  157. }
  158. },
  159. "policies": {
  160. "S3AdminPolicy": {
  161. "Version": "2012-10-17",
  162. "Statement": [
  163. {
  164. "Effect": "Allow",
  165. "Action": ["s3:*"],
  166. "Resource": [
  167. "arn:seaweed:s3:::*",
  168. "arn:seaweed:s3:::*/*"
  169. ]
  170. }
  171. ]
  172. },
  173. "S3ReadOnlyPolicy": {
  174. "Version": "2012-10-17",
  175. "Statement": [
  176. {
  177. "Effect": "Allow",
  178. "Action": [
  179. "s3:GetObject",
  180. "s3:GetObjectVersion",
  181. "s3:ListBucket",
  182. "s3:ListBucketVersions",
  183. "s3:GetBucketLocation",
  184. "s3:GetBucketVersioning"
  185. ],
  186. "Resource": [
  187. "arn:seaweed:s3:::*",
  188. "arn:seaweed:s3:::*/*"
  189. ]
  190. }
  191. ]
  192. },
  193. "S3WriteOnlyPolicy": {
  194. "Version": "2012-10-17",
  195. "Statement": [
  196. {
  197. "Effect": "Allow",
  198. "Action": [
  199. "s3:PutObject",
  200. "s3:PutObjectAcl",
  201. "s3:DeleteObject",
  202. "s3:DeleteObjectVersion",
  203. "s3:InitiateMultipartUpload",
  204. "s3:UploadPart",
  205. "s3:CompleteMultipartUpload",
  206. "s3:AbortMultipartUpload",
  207. "s3:ListMultipartUploadParts"
  208. ],
  209. "Resource": [
  210. "arn:seaweed:s3:::*/*"
  211. ]
  212. }
  213. ]
  214. },
  215. "S3BucketManagementPolicy": {
  216. "Version": "2012-10-17",
  217. "Statement": [
  218. {
  219. "Effect": "Allow",
  220. "Action": [
  221. "s3:CreateBucket",
  222. "s3:DeleteBucket",
  223. "s3:GetBucketPolicy",
  224. "s3:PutBucketPolicy",
  225. "s3:DeleteBucketPolicy",
  226. "s3:GetBucketVersioning",
  227. "s3:PutBucketVersioning"
  228. ],
  229. "Resource": [
  230. "arn:seaweed:s3:::*"
  231. ]
  232. }
  233. ]
  234. },
  235. "S3IPRestrictedPolicy": {
  236. "Version": "2012-10-17",
  237. "Statement": [
  238. {
  239. "Effect": "Allow",
  240. "Action": ["s3:*"],
  241. "Resource": [
  242. "arn:seaweed:s3:::*",
  243. "arn:seaweed:s3:::*/*"
  244. ],
  245. "Condition": {
  246. "IpAddress": {
  247. "aws:SourceIp": ["192.168.1.0/24", "10.0.0.0/8"]
  248. }
  249. }
  250. }
  251. ]
  252. },
  253. "S3TimeBasedPolicy": {
  254. "Version": "2012-10-17",
  255. "Statement": [
  256. {
  257. "Effect": "Allow",
  258. "Action": ["s3:GetObject", "s3:ListBucket"],
  259. "Resource": [
  260. "arn:seaweed:s3:::*",
  261. "arn:seaweed:s3:::*/*"
  262. ],
  263. "Condition": {
  264. "DateGreaterThan": {
  265. "aws:CurrentTime": "2023-01-01T00:00:00Z"
  266. },
  267. "DateLessThan": {
  268. "aws:CurrentTime": "2025-12-31T23:59:59Z"
  269. }
  270. }
  271. }
  272. ]
  273. }
  274. },
  275. "bucketPolicyExamples": {
  276. "PublicReadPolicy": {
  277. "Version": "2012-10-17",
  278. "Statement": [
  279. {
  280. "Sid": "PublicReadGetObject",
  281. "Effect": "Allow",
  282. "Principal": "*",
  283. "Action": "s3:GetObject",
  284. "Resource": "arn:seaweed:s3:::example-bucket/*"
  285. }
  286. ]
  287. },
  288. "DenyDeletePolicy": {
  289. "Version": "2012-10-17",
  290. "Statement": [
  291. {
  292. "Sid": "DenyDeleteOperations",
  293. "Effect": "Deny",
  294. "Principal": "*",
  295. "Action": ["s3:DeleteObject", "s3:DeleteBucket"],
  296. "Resource": [
  297. "arn:seaweed:s3:::example-bucket",
  298. "arn:seaweed:s3:::example-bucket/*"
  299. ]
  300. }
  301. ]
  302. },
  303. "IPRestrictedAccessPolicy": {
  304. "Version": "2012-10-17",
  305. "Statement": [
  306. {
  307. "Sid": "IPRestrictedAccess",
  308. "Effect": "Allow",
  309. "Principal": "*",
  310. "Action": ["s3:GetObject", "s3:PutObject"],
  311. "Resource": "arn:seaweed:s3:::example-bucket/*",
  312. "Condition": {
  313. "IpAddress": {
  314. "aws:SourceIp": ["203.0.113.0/24"]
  315. }
  316. }
  317. }
  318. ]
  319. }
  320. }
  321. }