exchange-keyshare 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,221 @@
1
+ AWSTemplateFormatVersion: '2010-09-09'
2
+ Description: Exchange Keyshare credential storage infrastructure
3
+
4
+ Parameters:
5
+ BucketName:
6
+ Type: String
7
+ Description: Name of the S3 bucket for credential storage
8
+
9
+ ConsumerPrincipalArn:
10
+ Type: String
11
+ Description: ARN of the principal that will assume the role
12
+
13
+ ExternalId:
14
+ Type: String
15
+ Description: External ID for role assumption
16
+
17
+ Resources:
18
+ CredentialsBucket:
19
+ Type: AWS::S3::Bucket
20
+ DeletionPolicy: Retain
21
+ UpdateReplacePolicy: Retain
22
+ Properties:
23
+ BucketName: !Ref BucketName
24
+ Tags:
25
+ - Key: app
26
+ Value: exchange-keyshare
27
+ VersioningConfiguration:
28
+ Status: Enabled
29
+ BucketEncryption:
30
+ ServerSideEncryptionConfiguration:
31
+ - ServerSideEncryptionByDefault:
32
+ SSEAlgorithm: aws:kms
33
+ KMSMasterKeyID: !GetAtt CredentialsKey.Arn
34
+ PublicAccessBlockConfiguration:
35
+ BlockPublicAcls: true
36
+ BlockPublicPolicy: true
37
+ IgnorePublicAcls: true
38
+ RestrictPublicBuckets: true
39
+ LoggingConfiguration:
40
+ DestinationBucketName: !Ref AccessLogsBucket
41
+ LogFilePrefix: credentials-access/
42
+
43
+ AccessLogsBucket:
44
+ Type: AWS::S3::Bucket
45
+ DeletionPolicy: Retain
46
+ UpdateReplacePolicy: Retain
47
+ Properties:
48
+ BucketName: !Sub '${BucketName}-access-logs'
49
+ Tags:
50
+ - Key: app
51
+ Value: exchange-keyshare
52
+ PublicAccessBlockConfiguration:
53
+ BlockPublicAcls: true
54
+ BlockPublicPolicy: true
55
+ IgnorePublicAcls: true
56
+ RestrictPublicBuckets: true
57
+ BucketEncryption:
58
+ ServerSideEncryptionConfiguration:
59
+ - ServerSideEncryptionByDefault:
60
+ SSEAlgorithm: AES256
61
+ LifecycleConfiguration:
62
+ Rules:
63
+ - Id: ExpireOldLogs
64
+ Status: Enabled
65
+ ExpirationInDays: 90
66
+
67
+ AccessLogsBucketPolicy:
68
+ Type: AWS::S3::BucketPolicy
69
+ Properties:
70
+ Bucket: !Ref AccessLogsBucket
71
+ PolicyDocument:
72
+ Version: '2012-10-17'
73
+ Statement:
74
+ - Sid: S3ServerAccessLogsPolicy
75
+ Effect: Allow
76
+ Principal:
77
+ Service: logging.s3.amazonaws.com
78
+ Action: s3:PutObject
79
+ Resource: !Sub '${AccessLogsBucket.Arn}/*'
80
+ Condition:
81
+ ArnLike:
82
+ aws:SourceArn: !GetAtt CredentialsBucket.Arn
83
+ StringEquals:
84
+ aws:SourceAccount: !Ref AWS::AccountId
85
+
86
+ CredentialsBucketPolicy:
87
+ Type: AWS::S3::BucketPolicy
88
+ Properties:
89
+ Bucket: !Ref CredentialsBucket
90
+ PolicyDocument:
91
+ Version: '2012-10-17'
92
+ Statement:
93
+ - Sid: DenyUnencryptedUploads
94
+ Effect: Deny
95
+ Principal: '*'
96
+ Action: s3:PutObject
97
+ Resource: !Sub '${CredentialsBucket.Arn}/*'
98
+ Condition:
99
+ StringNotEquals:
100
+ s3:x-amz-server-side-encryption: aws:kms
101
+ - Sid: DenyWrongKmsKey
102
+ Effect: Deny
103
+ Principal: '*'
104
+ Action: s3:PutObject
105
+ Resource: !Sub '${CredentialsBucket.Arn}/*'
106
+ Condition:
107
+ StringNotEqualsIfExists:
108
+ s3:x-amz-server-side-encryption-aws-kms-key-id: !GetAtt CredentialsKey.Arn
109
+ - Sid: DenyInsecureTransport
110
+ Effect: Deny
111
+ Principal: '*'
112
+ Action: 's3:*'
113
+ Resource:
114
+ - !GetAtt CredentialsBucket.Arn
115
+ - !Sub '${CredentialsBucket.Arn}/*'
116
+ Condition:
117
+ Bool:
118
+ aws:SecureTransport: 'false'
119
+
120
+ CredentialsKey:
121
+ Type: AWS::KMS::Key
122
+ DeletionPolicy: Retain
123
+ UpdateReplacePolicy: Retain
124
+ Properties:
125
+ Description: KMS key for Exchange Keyshare credential encryption
126
+ EnableKeyRotation: true
127
+ PendingWindowInDays: 30
128
+ Tags:
129
+ - Key: app
130
+ Value: exchange-keyshare
131
+ KeyPolicy:
132
+ Version: '2012-10-17'
133
+ Statement:
134
+ - Sid: AllowAccountRoot
135
+ Effect: Allow
136
+ Principal:
137
+ AWS: !Sub 'arn:aws:iam::${AWS::AccountId}:root'
138
+ Action: 'kms:*'
139
+ Resource: '*'
140
+ - Sid: AllowConsumerDecrypt
141
+ Effect: Allow
142
+ Principal:
143
+ AWS: !Ref ConsumerPrincipalArn
144
+ Action:
145
+ - kms:Decrypt
146
+ - kms:DescribeKey
147
+ Resource: '*'
148
+
149
+ CredentialsKeyAlias:
150
+ Type: AWS::KMS::Alias
151
+ Properties:
152
+ AliasName: !Sub 'alias/${BucketName}'
153
+ TargetKeyId: !Ref CredentialsKey
154
+
155
+ ConsumerAccessRole:
156
+ Type: AWS::IAM::Role
157
+ Properties:
158
+ RoleName: !Ref BucketName
159
+ Tags:
160
+ - Key: app
161
+ Value: exchange-keyshare
162
+ AssumeRolePolicyDocument:
163
+ Version: '2012-10-17'
164
+ Statement:
165
+ - Effect: Allow
166
+ Principal:
167
+ AWS: !Ref ConsumerPrincipalArn
168
+ Action: sts:AssumeRole
169
+ Condition:
170
+ StringEquals:
171
+ sts:ExternalId: !Ref ExternalId
172
+ Policies:
173
+ - PolicyName: CredentialAccess
174
+ PolicyDocument:
175
+ Version: '2012-10-17'
176
+ Statement:
177
+ - Sid: ListBucket
178
+ Effect: Allow
179
+ Action:
180
+ - s3:ListBucket
181
+ Resource: !GetAtt CredentialsBucket.Arn
182
+ Condition:
183
+ StringLike:
184
+ s3:prefix:
185
+ - 'exchange-credentials/*'
186
+ - Sid: GetObjects
187
+ Effect: Allow
188
+ Action:
189
+ - s3:GetObject
190
+ Resource: !Sub '${CredentialsBucket.Arn}/exchange-credentials/*'
191
+ - Sid: DecryptKey
192
+ Effect: Allow
193
+ Action:
194
+ - kms:Decrypt
195
+ - kms:DescribeKey
196
+ Resource: !GetAtt CredentialsKey.Arn
197
+
198
+ Outputs:
199
+ BucketName:
200
+ Description: S3 bucket name
201
+ Value: !Ref CredentialsBucket
202
+
203
+ BucketArn:
204
+ Description: S3 bucket ARN
205
+ Value: !GetAtt CredentialsBucket.Arn
206
+
207
+ KmsKeyArn:
208
+ Description: KMS key ARN
209
+ Value: !GetAtt CredentialsKey.Arn
210
+
211
+ RoleArn:
212
+ Description: IAM role ARN for credential consumer to assume
213
+ Value: !GetAtt ConsumerAccessRole.Arn
214
+
215
+ ExternalId:
216
+ Description: External ID for role assumption
217
+ Value: !Ref ExternalId
218
+
219
+ AccessLogsBucketName:
220
+ Description: S3 bucket for access logs
221
+ Value: !Ref AccessLogsBucket
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: exchange-keyshare
3
+ Version: 0.1.0
4
+ Summary: CLI for market makers to securely share exchange API credentials
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: boto3>=1.34.0
7
+ Requires-Dist: click>=8.1.0
8
+ Requires-Dist: pyyaml>=6.0
9
+ Requires-Dist: questionary>=2.0.0
10
+ Requires-Dist: rich>=13.0.0
@@ -0,0 +1,15 @@
1
+ exchange_keyshare/__init__.py,sha256=r2L4CpACTGPQTgruORVSNLxpD1vQD6zbcigQqDzzpt8,111
2
+ exchange_keyshare/cfn.py,sha256=Jr8QjeRHS9AP44vx14N_023we0iWjIHAz5Np9dnATe4,364
3
+ exchange_keyshare/cli.py,sha256=ogQBvZmrbR18QPQ4RJW9nERac3JqO_DPnk4RgyVjORU,825
4
+ exchange_keyshare/config.py,sha256=QD2apmjj99J9j5svOVS209726pS7uK5rcaxTAgYYBj4,2668
5
+ exchange_keyshare/keys.py,sha256=Lyl7vgJ4Bo0XA4iBKJyRWGd1ZpHPmrAuY7T0-sUWpOM,3278
6
+ exchange_keyshare/schema.py,sha256=BRv22tV3TifkoADVlMPGPNbhc9DKHtPq56s1EDcy70w,3818
7
+ exchange_keyshare/setup.py,sha256=n0Rn-gl8tFautc34HnA5lm-R0iCx7SAQAc7LTL9Zyn8,8235
8
+ exchange_keyshare/commands/__init__.py,sha256=gQ6tnU0Rvm0-ESWFUBU-KDl5dpNOpUTG509hXOQQjwY,27
9
+ exchange_keyshare/commands/keys.py,sha256=NX_BDl2-iWoLso5ep9kQNCjx5r7SszUg2MY62qJ-eHc,14610
10
+ exchange_keyshare/commands/setup.py,sha256=GTfFP4H6JJtIah47ruSlETLy9mJm6XvZbUpEN-OUMo0,5727
11
+ exchange_keyshare/templates/stack.yaml,sha256=KdNEeTFHm24pxQbSKzWxi2VyyjkKBYB9mYlBvSA6gfQ,6456
12
+ exchange_keyshare-0.1.0.dist-info/METADATA,sha256=B4dXgTPHXQgLBWuUJN-h7mzUedSK72-RlT4pKoNAL-c,305
13
+ exchange_keyshare-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
14
+ exchange_keyshare-0.1.0.dist-info/entry_points.txt,sha256=4SeV5jhxW3C6plg8WefZdLhPBRqmYErdKfnGTUEWmmo,65
15
+ exchange_keyshare-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ exchange-keyshare = exchange_keyshare.cli:main