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(clamav): clamav arm64 support using debian based image #4483

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
40 changes: 34 additions & 6 deletions Containers/clamav/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
# syntax=docker/dockerfile:latest
# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.1/alpine/Dockerfile
FROM clamav/clamav:1.3.1-49

COPY clamav.conf /tmp/clamav.conf
# DL3029 warning: Do not use --platform flag with FROM
# hadolint global ignore=DL3029

# Step 1: Setup base image based on arch

# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.3/alpine/Dockerfile

FROM --platform=linux/amd64 clamav/clamav:1.3.0-49 AS build-amd64

# DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
# hadolint ignore=DL3018
RUN set -ex; \
apk add --no-cache tzdata;

# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.3/debian/Dockerfile
FROM --platform=linux/arm64 clamav/clamav-debian:1.3.0-24 AS build-arm64

# DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
# hadolint ignore=DL3008
RUN set -ex; \
apk upgrade --no-cache -a; \
apk add --no-cache tzdata; \
cat /tmp/clamav.conf >> /etc/clamav/clamd.conf; \
apt-get update; \
apt-get install --no-install-recommends -y \
tzdata \
; \
rm -vrf /var/lib/apt/lists/*;

# Step 2: Configure clamav

# DL3006 warning: Always tag the version of an image explicitly
# hadolint ignore=DL3006
FROM build-${TARGETARCH}

COPY clamav.conf /tmp/clamav.conf

RUN cat /tmp/clamav.conf >> /etc/clamav/clamd.conf; \
rm /tmp/clamav.conf; \
mkdir -p /var/run/clamav /run/lock; \
chown -R clamav:clamav /var/run/clamav /run/clamav /var/log/clamav /var/lock /run/lock; \
chmod 777 -R /var/run/clamav /run/clamav /var/log/clamav /var/lock /run/lock /tmp


VOLUME /var/lib/clamav

USER clamav
Expand Down
6 changes: 3 additions & 3 deletions manual-install/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ First, install docker and docker-compose (v2) if not already done. Then simply r
git clone https://github.com/nextcloud/all-in-one.git
cd all-in-one/manual-install
```
Then copy the sample.conf to default environment file, e.g. `cp sample.conf .env`, open the new conf file, e.g. with `nano .env`, edit all values that are marked with `# TODO!`, close and save the file. (Note: there is no clamav image for arm64).
Then copy the sample.conf to default environment file, e.g. `cp sample.conf .env`, open the new conf file, e.g. with `nano .env`, edit all values that are marked with `# TODO!`, close and save the file.

Now copy the provided yaml file to a compose.yaml file by running `cp latest.yml compose.yaml`.

Now you should be ready to go with `sudo docker-compose up`.

## Docker profiles
The default profile of `latest.yml` only provide the minimum necessary services: nextcloud, database, redis and apache. To get optional services collabora, talk, talk-recording, clamav, imaginary or fulltextsearch use additional arguments for each of them, for example `--profile collabora`. (Note: there is no clamav image for arm64).
The default profile of `latest.yml` only provide the minimum necessary services: nextcloud, database, redis and apache. To get optional services collabora, talk, talk-recording, clamav, imaginary or fulltextsearch use additional arguments for each of them, for example `--profile collabora`.

For a complete all-in-one with collabora use `sudo docker-compose --profile collabora --profile talk --profile talk-recording --profile clamav --profile imaginary --profile fulltextsearch up`. (Note: there is no clamav image for arm64).
For a complete all-in-one with collabora use `sudo docker-compose --profile collabora --profile talk --profile talk-recording --profile clamav --profile imaginary --profile fulltextsearch up`.

## How to update?
Since the AIO containers may change in the future, it is highly recommended to strictly follow the following procedure whenever you want to upgrade your containers.
Expand Down
2 changes: 1 addition & 1 deletion manual-install/update-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ do
done

sed -i 's|_ENABLED=|_ENABLED="no" # Setting this to "yes" (with quotes) enables the option in Nextcloud automatically.|' sample.conf
sed -i 's|CLAMAV_ENABLED=no.*|CLAMAV_ENABLED="no" # Setting this to "yes" (with quotes) enables the option in Nextcloud automatically. Note: arm64 has no clamav support|' sample.conf
sed -i 's|CLAMAV_ENABLED=no.*|CLAMAV_ENABLED="no" # Setting this to "yes" (with quotes) enables the option in Nextcloud automatically.|' sample.conf
sed -i 's|TALK_ENABLED=no|TALK_ENABLED="yes"|' sample.conf
sed -i 's|COLLABORA_ENABLED=no|COLLABORA_ENABLED="yes"|' sample.conf
sed -i 's|COLLABORA_DICTIONARIES=|COLLABORA_DICTIONARIES="de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru" # You can change this in order to enable other dictionaries for collabora|' sample.conf
Expand Down
1 change: 0 additions & 1 deletion php/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
'last_backup_time' => $configurationManager->GetLastBackupTime(),
'backup_times' => $configurationManager->GetBackupTimes(),
'current_channel' => $dockerActionManger->GetCurrentChannel(),
'is_x64_platform' => $configurationManager->isx64Platform(),
'is_clamav_enabled' => $configurationManager->isClamavEnabled(),
'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled(),
'is_collabora_enabled' => $configurationManager->isCollaboraEnabled(),
Expand Down
12 changes: 0 additions & 12 deletions php/src/Data/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,7 @@ public function wasStartButtonClicked() : bool {
}
}

public function isx64Platform() : bool {
if (php_uname('m') === 'x86_64') {
return true;
} else {
return false;
}
}

public function isClamavEnabled() : bool {
if (!$this->isx64Platform()) {
return false;
}

$config = $this->GetConfig();
if (isset($config['isClamavEnabled']) && $config['isClamavEnabled'] === 1) {
return true;
Expand Down
4 changes: 1 addition & 3 deletions php/templates/containers.twig
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,8 @@
<script type="text/javascript" src="options-form-submit.js"></script>
</form>
<b>Minimal system requirements:</b> When any optional container is enabled, at least 2GB RAM, a dual-core CPU and 40GB system storage are required. When enabling ClamAV, Nextcloud Talk Recording-server or Fulltextsearch, at least 3GB RAM are required. For Talk Recording-server additional 2 vCPUs are required. When enabling everything, at least 5GB RAM and a quad-core CPU are required. Recommended are at least 1GB more RAM than the minimal requirement. For further advices and recommendations see <b><a href="https://github.com/nextcloud/all-in-one/discussions/1335">this documentation</a></b><br>
{% if isAnyRunning == true or is_x64_platform == false %}
<script type="text/javascript" src="disable-clamav.js"></script>
{% endif %}
{% if isAnyRunning == true %}
<script type="text/javascript" src="disable-clamav.js"></script>
<script type="text/javascript" src="disable-docker-socket-proxy.js"></script>
<script type="text/javascript" src="disable-talk.js"></script>
<script type="text/javascript" src="disable-collabora.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Yes. Please refer to the following documentation on this: [reverse-proxy.md](htt
### Which CPU architectures are supported?
You can check this on Linux by running: `uname -m`
- x86_64/x64/amd64
- aarch64/arm64/armv8 (Note: ClamAV is currently not supported on this CPU architecture)
- aarch64/arm64/armv8

### Which ports are mandatory to be open in your firewall/router?
Only those (if you access the Mastercontainer Interface internally via port 8080):
Expand Down