Skip to content

Commit

Permalink
feat: [CO-825] add attribute to manage ClamAv ReadTimeout (#355)
Browse files Browse the repository at this point in the history
* feat: add new attribute to manage clamAv Read Timeout

- carbonioClamAVReadTimeout

* feat: generate getters for carbonioClamAVReadTimeout

Signed-off-by: Keshav Bhatt <keshavnrj@gmail.com>

* feat: provide deafult value for carbonioClamAVReadTimeout

---------

Signed-off-by: Keshav Bhatt <keshavnrj@gmail.com>
  • Loading branch information
keshavbhatt authored Oct 19, 2023
1 parent f8cbb88 commit 157600a
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 0 deletions.
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

0 comments on commit 157600a

Please sign in to comment.