0x00 Preface
---
This article will introduce multiple methods for detecting Zimbra versions, implement automation through Python, document development details, and provide open-source code.
0x01 Introduction
---
This article will cover the following:
- Implementation Approach
- Implementation Details
- Open-Source Code
0x02 Implementation Approach
---
There are many methods to check the Zimbra version, each with its own advantages and disadvantages. The specific methods are as follows:
1. Via the Web Management Page
Access the 7071 management page through a browser, where the current Zimbra version is displayed on the main page.
For example, my test environment displays as:
Zimbra Version: 9.0.0_GA_4273.NETWORK
The version obtained through this method is the accurate version
2. By executing the commands
su zimbra |
For example, my test environment displays as:
Release 9.0.0.GA.3924.UBUNTU16.64 UBUNTU16_64 NETWORK edition, Patch 9.0.0_P24.1.
For the output results, note the following issues:
- Release 9.0.0.GA.3924 corresponds to the initial installation package version and does not change with patch updates
- Patch 9.0.0_P24.1 is the patch version, which changes when upgrading
Note:
For Zimbra patch updates, refer to:
https://wiki.zimbra.com/wiki/Zimbra_Releases/9.0.0/patch_installation
3. Via Zimbra SOAP API
Under default configuration, the zimbraSoapExposeVersion attribute is set to FALSE. Query command:
zmprov gs `hostname` | grep ExposeVersion |
Return result:
zimbraImapExposeVersionOnBanner: FALSE |
After setting the zimbraSoapExposeVersion attribute to TRUE, the version can be obtained via Zimbra SOAP API. Command to modify the attribute:
su zimbra |
Example SOAP request format:
|
Return result under default configuration:
soap:Senderpermission denied: Version info is not available. |
Return result after enabling zimbraSoapExposeVersion:
The version obtained through this method is the accurate version
4. Via IMAP protocol
Require Zimbra to open port 143
Command execution example:
nc 192.168.1.1 143 |
Return result:
* ID ("NAME" "Zimbra" "VERSION" "9.0.0_GA_4273" "RELEASE" "20220506180442") |
The version obtained through this method is the accurate version
5. Via IMAP over SSL protocol
Require Zimbra to open port 993
Command execution example:
openssl s_client -connect 192.168.1.1:993 |
Return result:
* ID ("NAME" "Zimbra" "VERSION" "9.0.0_GA_4273" "RELEASE" "20220506180442") |
The version obtained through this method is the accurate version
6. Via specific URL
The specific URL contains installation information
Note:
This URL is not unique
Example access location: https://192.168.1.1/js/zimbraMail/share/model/ZmSettings.js
Example return result:
this.registerSetting("CLIENT_DATETIME", {type:ZmSetting.T_CONFIG, defaultValue:"20220324-0623"}); |
CLIENT_DATETIME and CLIENT_RELEASE are consistent with the creation time of this file. The version obtained through this method is for reference only and cannot be used as an accurate basis for version detection
0x03 Implementation Details
---
Integrating the above detection methods, to adapt to various environments, the program implementation selects three methods: via IMAP protocol, via IMAP over SSL protocol, and via specific URL
1. Via IMAP protocol
Complete example code:
def getversionimap(ip): |
2. Via IMAP over SSL protocol
Need to convert IP to hostname as parameter, example code:
hostname = socket.gethostbyaddr(ip) |
Complete example code:
def getversionimapoverssl(ip): |
Some environments cannot resolve IP to hostname, causing error: [Errno 11004] host not found. Therefore, the program logic prioritizes using the IMAP protocol.
3. Via specific URL
Complete example code:
def getversionweb(ip): |
0x04 Open Source Code
---
The complete implementation code has been uploaded to GitHub at the following address:
An open source project
The code first attempts to obtain version information through a specific URL, then reads version information via the IMAP protocol. If that fails, it finally reads version information via IMAP over SSL protocol.
0x05 Summary
---
This article introduces multiple methods for Zimbra version detection, compares their advantages and disadvantages, selects effective methods and implements automation through Python, records development details, and open-sources the code as an excellent learning example.