Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [CO-825] add attribute to manage ClamAv ReadTimeout #355

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,15 @@ public static TwoFactorAuthSecretEncoding fromString(String s) throws ServiceExc
@ZAttr(id=3120)
public static final String A_carbonioClamAVDatabaseCustomURL = "carbonioClamAVDatabaseCustomURL";

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public static final String A_carbonioClamAVReadTimeout = "carbonioClamAVReadTimeout";

/**
* Whether the Chat App usages enabled for account or COS
*
Expand Down
5 changes: 5 additions & 0 deletions store/conf/attrs/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10118,4 +10118,9 @@ TODO: delete them permanently from here
<attr id="3139" name="carbonioAdminUILogoutURL" type="string" max="256" cardinality="single" optionalIn="globalConfig,domain" flags="domainInfo,domainAdminModifiable" requiresRestart="nginxproxy" since="23.10.0">
<desc>Logout URL for Carbonio Admin web client to send the user to upon explicit logging out</desc>
</attr>

<attr id="3140" name="carbonioClamAVReadTimeout" type="integer" cardinality="single" optionalIn="globalConfig,server" flags="serverInherited" requiresRestart="mta,antivirus" since="23.11.0">
<globalConfigValue>900</globalConfigValue>
<desc>Waiting for data from a client socket connected to ClamAV will timeout after this time (seconds)</desc>
</attr>
</attrs>
5 changes: 5 additions & 0 deletions store/ldap/src/updates/attrs/1697206170.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"zimbra_globalconfig": [
"carbonioClamAVReadTimeout"
]
}
77 changes: 77 additions & 0 deletions store/src/main/java/com/zimbra/cs/account/ZAttrConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,83 @@ public Map<String,Object> unsetCarbonioClamAVDatabaseCustomURL(Map<String,Object
return attrs;
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @return carbonioClamAVReadTimeout, or 900 if unset
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public int getCarbonioClamAVReadTimeout() {
return getIntAttr(ZAttrProvisioning.A_carbonioClamAVReadTimeout, 900, true);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param carbonioClamAVReadTimeout new value
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public void setCarbonioClamAVReadTimeout(int carbonioClamAVReadTimeout) throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, Integer.toString(carbonioClamAVReadTimeout));
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param carbonioClamAVReadTimeout new value
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public Map<String,Object> setCarbonioClamAVReadTimeout(int carbonioClamAVReadTimeout, Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, Integer.toString(carbonioClamAVReadTimeout));
return attrs;
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public void unsetCarbonioClamAVReadTimeout() throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, "");
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public Map<String,Object> unsetCarbonioClamAVReadTimeout(Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, "");
return attrs;
}

/**
* Logo URL for domain
*
Expand Down
77 changes: 77 additions & 0 deletions store/src/main/java/com/zimbra/cs/account/ZAttrServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,83 @@ public Map<String,Object> unsetCarbonioAmavisDisableVirusCheck(Map<String,Object
return attrs;
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @return carbonioClamAVReadTimeout, or 900 if unset
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public int getCarbonioClamAVReadTimeout() {
return getIntAttr(ZAttrProvisioning.A_carbonioClamAVReadTimeout, 900, true);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param carbonioClamAVReadTimeout new value
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public void setCarbonioClamAVReadTimeout(int carbonioClamAVReadTimeout) throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, Integer.toString(carbonioClamAVReadTimeout));
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param carbonioClamAVReadTimeout new value
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public Map<String,Object> setCarbonioClamAVReadTimeout(int carbonioClamAVReadTimeout, Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, Integer.toString(carbonioClamAVReadTimeout));
return attrs;
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @throws com.zimbra.common.service.ServiceException if error during update
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public void unsetCarbonioClamAVReadTimeout() throws com.zimbra.common.service.ServiceException {
HashMap<String,Object> attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, "");
getProvisioning().modifyAttrs(this, attrs);
}

/**
* Waiting for data from a client socket connected to ClamAV will timeout
* after this time (seconds)
*
* @param attrs existing map to populate, or null to create a new map
* @return populated map to pass into Provisioning.modifyAttrs
*
* @since ZCS 23.11.0
*/
@ZAttr(id=3140)
public Map<String,Object> unsetCarbonioClamAVReadTimeout(Map<String,Object> attrs) {
if (attrs == null) attrs = new HashMap<>();
attrs.put(ZAttrProvisioning.A_carbonioClamAVReadTimeout, "");
return attrs;
}

/**
* RFC2256: common name(s) for which the entity is known by
*
Expand Down