Skip to content

Commit 48e9424

Browse files
committed
use flag for antispam size
# Conflicts: # deployment/modules/aws/tesseract/conformance/main.tf
1 parent b98391d commit 48e9424

File tree

6 files changed

+78
-3
lines changed

6 files changed

+78
-3
lines changed

cmd/aws/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var (
6161
dbPassword = flag.String("db_password", "", "AuroraDB password")
6262
dbMaxConns = flag.Int("db_max_conns", 0, "Maximum connections to the database, defaults to 0, i.e unlimited")
6363
dbMaxIdle = flag.Int("db_max_idle_conns", 2, "Maximum idle database connections in the connection pool, defaults to 2")
64-
dedupPath = flag.String("dedup_path", "", "Path to the deduplication database.")
64+
inMemoryAntispamCacheSize = flag.Uint("inmemory_antispam_cache_size", 2<<10, "Maximum number of entries to keep in the in-memory antispam cache.")
6565
rootsPemFile = flag.String("roots_pem_file", "", "Path to the file containing root certificates that are acceptable to the log. The certs are served through get-roots endpoint.")
6666
rejectExpired = flag.Bool("reject_expired", false, "If true then the certificate validity period will be checked against the current time during the validation of submissions. This will cause expired certificates to be rejected.")
6767
rejectUnexpired = flag.Bool("reject_unexpired", false, "If true then CTFE rejects certificates that are either currently valid or not yet valid.")
@@ -160,7 +160,7 @@ func newAWSStorage(ctx context.Context, signer note.Signer) (*storage.CTStorage,
160160
appender, _, _, err := tessera.NewAppender(ctx, driver, tessera.NewAppendOptions().
161161
WithCheckpointSigner(signer).
162162
WithCTLayout().
163-
WithAntispam(2<<18, antispam)) // TODO(phbnf): do the math to see what fits in memory
163+
WithAntispam(*inMemoryAntispamCacheSize, antispam))
164164
if err != nil {
165165
return nil, fmt.Errorf("failed to initialize AWS Tessera storage: %v", err)
166166
}

cmd/gcp/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ var (
5555
bucket = flag.String("bucket", "", "Name of the bucket to store the log in.")
5656
spannerDB = flag.String("spanner_db_path", "", "Spanner database path: projects/{projectId}/instances/{instanceId}/databases/{databaseId}.")
5757
spannerAntispamDB = flag.String("spanner_antispam_db_path", "", "EXPERIMENTAL: Spanner antispam deduplication database path projects/{projectId}/instances/{instanceId}/databases/{databaseId}.")
58+
inMemoryAntispamCacheSize = flag.Uint("inmemory_antispam_cache_size", 2<<10, "Maximum number of entries to keep in the in-memory antispam cache.")
5859
rootsPemFile = flag.String("roots_pem_file", "", "Path to the file containing root certificates that are acceptable to the log. The certs are served through get-roots endpoint.")
5960
rejectExpired = flag.Bool("reject_expired", false, "If true then the certificate validity period will be checked against the current time during the validation of submissions. This will cause expired certificates to be rejected.")
6061
rejectUnexpired = flag.Bool("reject_unexpired", false, "If true then CTFE rejects certificates that are either currently valid or not yet valid.")
@@ -170,7 +171,7 @@ func newGCPStorage(ctx context.Context, signer note.Signer) (*storage.CTStorage,
170171
opts := tessera.NewAppendOptions().
171172
WithCheckpointSigner(signer).
172173
WithCTLayout().
173-
WithAntispam(2<<18, antispam) // TODO(phbnf): do the math to see what fits in memory
174+
WithAntispam(*inMemoryAntispamCacheSize, antispam)
174175

175176
// TODO(phbnf): figure out the best way to thread the `shutdown` func NewAppends returns back out to main so we can cleanly close Tessera down
176177
// when it's time to exit.

deployment/live/aws/conformance/ci/.terraform.lock.hcl

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment/live/aws/test/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Store the Aurora RDS database and S3 bucket information into the environment var
7676
export TESSERACT_DB_HOST=$(terragrunt output -raw rds_aurora_cluster_endpoint)
7777
export TESSERACT_DB_PASSWORD=$(aws secretsmanager get-secret-value --secret-id $(terragrunt output -json rds_aurora_cluster_master_user_secret | jq --raw-output .[0].secret_arn) --query SecretString --output text | jq --raw-output .password)
7878
export TESSERACT_BUCKET_NAME=$(terragrunt output -raw s3_bucket_name)
79+
export SCTFE_SIGNER_ECDSA_P256_PUBLIC_KEY_ID=$(terragrunt output -raw ecdsa_p256_public_key_id)
80+
export SCTFE_SIGNER_ECDSA_P256_PRIVATE_KEY_ID=$(terragrunt output -raw ecdsa_p256_private_key_id)
7981
```
8082

8183
Connect the VM and Aurora database following [these instructions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/tutorial-ec2-rds-option1.html#option1-task3-connect-ec2-instance-to-rds-database), it takes a few clicks in the UI.
@@ -98,6 +100,8 @@ go run ./cmd/aws \
98100
--db_user=tesseract \
99101
--db_password=${TESSERACT_DB_PASSWORD} \
100102
--antispam_db_name=antispam_db
103+
--signer_public_key_secret_name=${SCTFE_SIGNER_ECDSA_P256_PUBLIC_KEY_ID} \
104+
--signer_private_key_secret_name=${SCTFE_SIGNER_ECDSA_P256_PRIVATE_KEY_ID}
101105
```
102106

103107
In a different terminal you can either mint and submit certificates manually, or
@@ -190,6 +194,8 @@ go run ./cmd/aws \
190194
--db_user=tesseract \
191195
--db_password=${TESSERACT_DB_PASSWORD} \
192196
--antispam_db_name=antispam_db
197+
--signer_public_key_secret_name=${SCTFE_SIGNER_ECDSA_P256_PUBLIC_KEY_ID} \
198+
--signer_private_key_secret_name=${SCTFE_SIGNER_ECDSA_P256_PRIVATE_KEY_ID}
193199
-v=3
194200
```
195201

deployment/modules/aws/tesseract/conformance/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ resource "aws_ecs_task_definition" "conformance" {
173173
"--signer_public_key_secret_name=${module.secretsmanager.ecdsa_p256_public_key_id}",
174174
"--signer_private_key_secret_name=${module.secretsmanager.ecdsa_p256_private_key_id}",
175175
"--antispam_db_name=${module.storage.antispam_database_name}",
176+
"--inmemory_antispam_cache_size=25000000", # About 1GB of memory.
176177
"-v=2"
177178
],
178179
"logConfiguration" : {

deployment/modules/gcp/cloudrun/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ resource "google_cloud_run_v2_service" "default" {
5151
"--origin=${var.base_name}${var.origin_suffix}",
5252
"--signer_public_key_secret_name=${var.signer_public_key_secret_name}",
5353
"--signer_private_key_secret_name=${var.signer_private_key_secret_name}",
54+
"--inmemory_antispam_cache_size=25000000", # About 1GB of memory.
5455
]
5556
ports {
5657
container_port = 6962

0 commit comments

Comments
 (0)