Skip to content

Commit

Permalink
Clamav now use tcp to send file instead of shared filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Nov 20, 2024
1 parent 2dc631e commit 7e83a3b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ public/vite-test

app/graphql/schema.json
public/graphql/schema
/docker/
2 changes: 1 addition & 1 deletion app/services/clamav_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.safe_file?(file_path)
FileUtils.chmod(0666, file_path)

client = ClamAV::Client.new
response = client.execute(ClamAV::Commands::ScanCommand.new(file_path)).first
response = client.execute(ClamAV::Commands::InstreamCommand.new(File.open(file_path, 'rb')))

case response
when ClamAV::SuccessResponse
Expand Down
Empty file added app/test.rb
Empty file.
28 changes: 4 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ services:
- AR_ENCRYPTION_PRIMARY_KEY
- BANNER_MESSAGE
- CERTIGNA_USERPWD
- CLAMD_TCP_HOST=clamav-${ENV:-dev}
- CLAMAV_ENABLED=enabled
- CLAMD_TCP_HOST=clamav
- CLAMD_TCP_PORT=3310
- COJO_JWT_RSA_PRIVATE_KEY
- CRISP_CLIENT_KEY
Expand Down Expand Up @@ -160,8 +161,6 @@ services:
volumes:
- md-data-files:/app/storage
- md-tmp:/app/tmp
- md-logo-uploads:/app/public/uploads
- md-logo-downloads:/app/public/downloads
networks:
- md-network
depends_on:
Expand Down Expand Up @@ -195,7 +194,8 @@ services:
- AR_ENCRYPTION_KEY_DERIVATION_SALT
- AR_ENCRYPTION_PRIMARY_KEY
- CERTIGNA_USERPWD
- CLAMD_TCP_HOST=clamav-${ENV:-dev}
- CLAMAV_ENABLED=enabled
- CLAMD_TCP_HOST=clamav
- CLAMD_TCP_PORT=3310
- COJO_JWT_RSA_PRIVATE_KEY
- DB_DATABASE
Expand Down Expand Up @@ -239,7 +239,6 @@ services:
- WATERMARK_FILE
volumes:
- md-data-files:/app/storage
- md-root-tmp:/tmp
- md-tmp:/app/tmp
networks:
- md-network
Expand All @@ -251,7 +250,6 @@ services:
volumes:
- clamav-db:/data
- clamav-logs:/var/log/clamav
- md-root-tmp:/tmp
networks:
- md-network

Expand Down Expand Up @@ -295,30 +293,12 @@ volumes:
type: none
device: $ROOT/redis
o: bind
md-logo-uploads:
driver: local
driver_opts:
type: none
device: $ROOT/logos/uploads
o: bind
md-logo-downloads:
driver: local
driver_opts:
type: none
device: $ROOT/logos/downloads
o: bind
md-tmp:
driver: local
driver_opts:
type: none
device: $ROOT/tmp
o: bind
#----- to share file between worker and clamav
md-root-tmp:
driver_opts:
type: none
device: $ROOT/systmp
o: bind
clamav-db:
driver: local
driver_opts:
Expand Down

0 comments on commit 7e83a3b

Please sign in to comment.