---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: clamav-scan
  namespace: security
spec:
  schedule: "0 0 * * *"
  concurrencyPolicy: "Forbid"
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 5
  jobTemplate:
    spec:
      backoffLimit: 3
      ttlSecondsAfterFinished: 300
      template:
        spec:
          automountServiceAccountToken: false
          restartPolicy: Never
          containers:
            - name: cloudflare-ddns
              image: abesesr/clamscan-docker:1.4.6
              env:
                - name: SCAN_ONLY_NEW_FILES
                  value: "0"
                - name: FOLDER_TO_SCAN
                  value: "/scandir"
                - name: ALERT_SUBJECT
                  value: "Malware found by ClamAV"
                - name: ALERT_MAILTO
                  value: "${SECRET_ADMIN_EMAIL}"
                - name: SMTP_TLS
                  value: "on"
                - name: SMTP_HOST
                  value: "${SECRET_SMTP_HOST}"
                - name: SMTP_PORT
                  value: "587"
                - name: SMTP_USER
                  value: "${SECRET_SMTP_USERNAME}"
                - name: SMTP_PASSWORD
                  value: "${SECRET_SMTP_PASSWORD}"
              command:
                - "/docker-entrypoint.sh"
              volumeMounts:
                - name: nfs-home-heinrich
                  mountPath: "/scandir/heinrich"
                  readOnly: true
                - name: nfs-home-regina
                  mountPath: "/scandir/regina"
                  readOnly: true
                - name: nfs-home-seifert
                  mountPath: "/scandir/seifert"
                  readOnly: true
                - name: nfs-itstuff
                  mountPath: "/scandir/it-stuff"
                  readOnly: true
                - name: nfs-downloads
                  mountPath: "/scandir/downloads"
                  readOnly: true
          volumes:
            - name: nfs-home-heinrich
              nfs:
                server: 192.168.10.5
                path: "/mnt/hddstore01/home/heinrich"
            - name: nfs-home-regina
              nfs:
                server: 192.168.10.5
                path: "/mnt/hddstore01/home/regina"
            - name: nfs-home-seifert
              nfs:
                server: 192.168.10.5
                path: "/mnt/hddstore01/home/seifert"
            - name: nfs-itstuff
              nfs:
                server: 192.168.10.5
                path: "/mnt/hddstore01/it-stuff"
            - name: nfs-downloads
              nfs:
                server: 192.168.10.5
                path: "/mnt/hddstore01/media/downloads"
