How change limit file size of Clamd service for nclam - clamav

Default Limits: File size limit set to 26214400 bytes.
If i scan file size > 25mb, it will occur error.
The maximum stream size of 26214400 bytes has been exceeded.
I try change:
public ClamClient(string server, int port)
{
MaxChunkSize = 131072; //128k
MaxStreamSize = 209715200; //200mb ,- 26214400; //25mb
Server = server;
Port = port;
}
But it occur error when scan file:
Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.
How change limit file size of Clamd service in Window?
Thanks all.

You need to change nclam config ("clamd.conf"):
StreamMaxLength 50M
You also have to change the ClamClient instance with a higher MaxStreamSize:
var client = new ClamClient("localhost", 3310)
{
MaxStreamSize = 52428800
};

Related

Bacula multiple storage device

It seems to be relatively a simple question. I have two mount points on bacula-sd (storage) server- one for local drive and one for s3 bucket (off side backup) and what I need is start two concurrent job at the same time on both drives. So far I have something like that in bacula devices.conf
Device {
Name = "example.prod.com"
Device Type = File
Media Type = File
Archive Device = "/data/bacula/example.prod.com"
LabelMedia = yes
Random Access = yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Network Buffer Size = 65536
}
Device {
Name = example.prod.com-s3
Device Type = File
Media Type = File
Archive Device = "/mnt/bacula-backup-storage/example.prod.com-s3"
LabelMedia = yes
Random Access = Yes
AutomaticMount = yes
RemovableMedia = no
AlwaysOpen = no
Maximum Network Buffer Size = 65536
}
but it's probably not enough because the job started only on the first device. Do I need disk autochanger or something?
You have to change Media Type = ... parameter to be different for both Devices, i.e.
Device {
Name = "example.prod.com"
Device Type = File
Media Type = File
...
}
Device {
Name = example.prod.com-s3
Device Type = File
Media Type = S3
...
}
It won't work otherwise.

Cro WebSocket client doesn't see when the server goes out

The client program below receives messages from a WebSocket server.
It doesn't send any messages.
CLIENT
use v6;
use Cro::WebSocket::Client;
constant WS-URL = 'ws://localhost:20000/status';
constant TIMEOUT-TO-CONNECT = 5; # seconds
my $timeout;
my $connection-attempt;
await Promise.anyof(
$connection-attempt = Cro::WebSocket::Client.connect(WS-URL),
$timeout = Promise.in(TIMEOUT-TO-CONNECT));
if $timeout.status == Kept
{
say "* could not connect to server in ', TIMEOUT-TO-CONNECT, ' seconds";
exit 1;
}
if $connection-attempt.status != Kept
{
my $cause = $connection-attempt.cause;
say '"* error when trying to connect to server';
say '"* --------------------------------------';
# $cause is a long string, how do we get a simple numeric code ?
say $cause;
say '"* ======================================';
exit 1;
}
my $connection = $connection-attempt.result;
my $peer = 'localhost:20000';
say '* connected with ', $peer;
react
{
whenever $connection.messages -> $message
{
my $body = await $message.body;
say '* received message=[' ~ $body ~ '] from server';
LAST { say '* LAST'; done; }
QUIT { default { say '* QUIT'; done; }}
}
CLOSE { say '* CLOSE: leaving react block';}
} # react
SERVER
use Cro::HTTP::Router;
use Cro::HTTP::Server;
use Cro::HTTP::Router::WebSocket;
my $application =
route
{
get -> 'status'
{
web-socket -> $incoming
{
my $counter = 0;
my $timer = Supply.interval(1);
supply
{
whenever $incoming -> $thing
{
LAST { note '* LAST: client connection was closed'; done; }
QUIT { default { note '* QUIT: error in client connection'; done; } }
}
whenever $timer
{
$counter++;
say '* sending message ', $counter;
emit $counter.Str;
}
CLOSE { say '* CLOSE: leaving supply block'; }
} # supply
} #incoming
} # get -> status
}
my $server = Cro::HTTP::Server.new: :port(20000), :$application;
$server.start;
say '* serving on port 20000';
react whenever signal(SIGINT)
{
$server.stop;
exit;
}
Now, when the server goes out (say, by Ctrl+C) the client sees nothing.
Setting CRO_TRACE=1 in the client gives this:
TRACE(anon 2)] Cro::WebSocket::MessageParser EMIT WebSocket Message - Text
* received message=[4] from server
[TRACE(anon 1)] Cro::TCP::Connector DONE
[TRACE(anon 2)] Cro::WebSocket::FrameParser DONE
[TRACE(anon 2)] Cro::WebSocket::MessageParser DONE
[TRACE(anon 1)] Cro::HTTP::ResponseParser DONE
^C
The client showed nothing more (and then I cancelled it).
So, the question is: how should the client deal with this scenario ?
UPDATE
Edited the question, now showing the server code
Also, I'm in Fedora 28.
When I first cancel the server, netstat shows
$ netstat -ant | grep 20000
tcp6 0 0 ::1:20000 ::1:56652 TIME_WAIT
$
Tcpdump shows
IP6 ::1.20000 > ::1.56652: Flags [F.], seq 145, ack 194, win 350, options [nop,nop,TS val 1476681452 ecr 1476680552], length 0
IP6 ::1.56652 > ::1.20000: Flags [F.], seq 194, ack 146, win 350, options [nop,nop,TS val 1476681453 ecr 1476681452], length 0
IP6 ::1.20000 > ::1.56652: Flags [.], ack 195, win 350, options [nop,nop,TS val 1476681453 ecr 1476681453], length 0
It seems the last ACK from the client to the server is missing, I guess the client didn't close the connection.
Also, I'm curious as to why Cro chooses to work with IPv6 by default.
This is a bug that has been fixed since this question was posted, but I'm leaving an answer because of this part of the question that may confuse people when dealing with networking in Raku:
Also, I'm curious as to why Cro chooses to work with IPv6 by default.
localhost will resolve to an IPv6 address first if that's what the first address for localhost in your hosts file is. As of writing, IO::Socket::Async (which Cro uses internally) only allows PF_UNSPEC to be specified as a family, and the only address that will ever used from the results of hostname resolution is the first one in the list of addresses received. This will be changed at some point in the future as part of the work for my IP6NS grant and a problem solving issue to improve how DNS is handled, but for now, if you want to use IPv4/IPv6 only, you should specify 127.0.0.1/::1 instead of using localhost (or whichever addresses your machine resolves it to if they're different).

"max allowed size 128000 bytes, actual size of encoded class scala" error in akka remoting

I want to use Akka Remoting to exchange message over network between actors, but for large String message i got the following error:
akka.remote.OversizedPayloadException: Discarding oversized payload
sent to Actor :: max allowed size 128000 bytes
, actual size of encoded class scala.
How can i fix this limitation?
I add the following configuration and now everything is ok:
akka {
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
maximum-payload-bytes = 30000000 bytes
netty.tcp {
hostname = "127.0.0.1"
port = 2552
message-frame-size = 30000000b
send-buffer-size = 30000000b
receive-buffer-size = 30000000b
maximum-frame-size = 30000000b
}
}
}

Does AppFabric Cache compression cause data to be stored compressed on the server?

Does Windows Server AppFabric Cache compression cause data to be stored compressed or just transmitted compressed?
Is it intended to just save network bandwidth or both bandwidth and server memory ?
Note this is a Windows Server AppFabric question.
Yes, because data is compressed on the client.
A really simple way to check this is to CmdLet Get-CacheStatistics.
DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[1];
servers[0] = new DataCacheServerEndpoint("fr-vmrd-web1", 22233);
DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
factoryConfig.Servers = servers;
factoryConfig.SecurityProperties = new DataCacheSecurity(DataCacheSecurityMode.None, DataCacheProtectionLevel.None);
factoryConfig.TransportProperties.MaxBufferSize = int.MaxValue;
factoryConfig.TransportProperties.MaxBufferPoolSize = int.MaxValue;
factoryConfig.IsCompressionEnabled = true;//or false
DataCacheFactory mycacheFactory = new DataCacheFactory(factoryConfig);
var data = File.ReadAllText(#"c:\test.log"); //40 MB
DataCache myDefaultCache = mycacheFactory.GetDefaultCache();
myDefaultCache.Put("test", data);
With Compression
...
Size : 2575360
ItemCount : 1
RegionCount : 1
...
Without Compression
...
Size : 41900032
ItemCount : 1
RegionCount : 1
...
Hope this will help you.

Mobile Emulator Connection Failure (Merge Replication)

I am attempting to replicate a SQL CE 3.5 SP1 database but upon syncrhonization, I am thrown the following error:
"Failure to connect to SQL Server with provided connection information. SQL Server does not exist, access is denied because the IIS user is not a valid user on the computer running SQL Server, or the password is incorrect."
I am using the Windows Mobile 6 Professional emulator and the machine I am attempting to connect to is a Windows Virtual Machine running Windows XP Professional SP3. I have configured the network adapter settings for the emulator (I can access web pages), verified user permissions, double checked IIS settings, and triple checked my connection string:
SqlCeReplication rpl = null;
try
{
// Creates the replication object.
rpl = new SqlCeReplication();
// Establishes the connection string.
rpl.SubscriberConnectionString = #"Data Source = \Program Files\ParkSurvey\ParkSurvey.sdf; Password = *; Temp File Max Size = 512;
Max Database Size = 512; Max Buffer Size = 512; Flush Interval = 20; Autoshrink Threshold = 10; Default Lock Escalation = 100";
// Sets the Publisher properties.
rpl.PublisherSecurityMode = SecurityType.NTAuthentication;
rpl.Publisher = "PUBLISHER";
rpl.PublisherLogin = "INDICOPUBLIC\\subuser";
rpl.PublisherPassword = "*";
rpl.PublisherDatabase = "PUBLISHER";
rpl.Publication = "ParkSurveyPublication";
// Sets the internet replication properties.
rpl.InternetUrl = "http://replication/sqlce/sqlcesa35.dll";
rpl.InternetLogin = "INDICOPUBLIC\\subuser";
rpl.InternetPassword = "*";
rpl.ConnectionManager = true;
// Sets the Distributor properties.
rpl.Distributor = "PUBLISHER";
rpl.DistributorLogin = "INDICOPUBLIC\\subuser";
rpl.DistributorPassword = "psrAdmin";
rpl.DistributorSecurityMode = SecurityType.NTAuthentication;
// Sets the timeout properties.
rpl.ConnectionRetryTimeout = 120;
rpl.ConnectTimeout = 6000;
rpl.ReceiveTimeout = 6000;
rpl.SendTimeout = 6000;
// Sets the Subscriber properties.
rpl.Subscriber = "ParkSurveySubscriber";
rpl.HostName = "Mobile1";
rpl.CompressionLevel = 6;
rpl.ExchangeType = ExchangeType.BiDirectional;
// Call the replication methods.
rpl.Synchronize();
}
catch (SqlCeException sqlEx)
{
MessageBox.Show(sqlEx.Message);
}
finally
{
// Disposing the replication object
if (rpl != null)
{
rpl.Dispose();
}
}
I have also attempted to open the host machine itself in File Explorer on the mobile emulator and am prompted that "The network path was not found.". This leads me to believe it is ActiveSync issue within the emulator itself. Does anyone have any advice?
Try with IP adresse instead of hostname, and test the agent URL from IE on the device. Make sure to use the latest build of 3.5 SP2 on all components if your DB server is SQL 2012