mirror of
https://github.com/nextcloud/vm.git
synced 2025-10-26 11:27:32 +00:00
Merge branch 'main' into desec-apps
This commit is contained in:
commit
697ddddab5
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
2
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -38,7 +38,7 @@ body:
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots, Videos, or Pastebins
|
||||
description: If applicable, add screenshots and/or a short video to help explain your problem. You can use https://0bin.net for long error messages or logs.
|
||||
description: If applicable, add screenshots and/or a short video to help explain your problem. You can use https://paste.sh for long error messages or logs.
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
|
||||
@ -10,7 +10,7 @@ jobs:
|
||||
name: Github Actions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
- name: Run Shellcheck
|
||||
uses: ludeeus/action-shellcheck@master
|
||||
with:
|
||||
|
||||
4
.github/workflows/reviewdog.yml
vendored
4
.github/workflows/reviewdog.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
name: Shellcheck testing
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v5
|
||||
- name: shellcheck
|
||||
uses: reviewdog/action-shellcheck@v1
|
||||
with:
|
||||
@ -25,7 +25,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: spelling or typos
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v5
|
||||
- name: misspell
|
||||
uses: reviewdog/action-misspell@v1
|
||||
with:
|
||||
|
||||
23
CHANGELOG.md
23
CHANGELOG.md
@ -2,7 +2,7 @@
|
||||
|
||||
**Please note that BOTH disks need to be imported for the VM to function properly.**
|
||||
|
||||
- Check the latest commits here: https://github.com/nextcloud/vm/commits/master
|
||||
- Check the latest commits here: https://github.com/nextcloud/vm/commits/main
|
||||
- Documentation can be found here: https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W7Du9uPiqQz3_Mr1/nextcloud-vm-machine-configuration
|
||||
|
||||
PR's are more than welcome. Happy Nextclouding!
|
||||
@ -10,6 +10,13 @@ PR's are more than welcome. Happy Nextclouding!
|
||||
### Different versions
|
||||
If you run Hyper-V or want 500 GB, 1 TB or 2 TB VM you can download it from [T&M Hansson IT's shop](https://shop.hanssonit.se/product-category/virtual-machine/nextcloud/).
|
||||
|
||||
## All future releases
|
||||
|
||||
### Full changelog:
|
||||
- [VM](https://github.com/nextcloud/vm/releases/)
|
||||
- [Nextcloud](https://nextcloud.com/changelog/)
|
||||
|
||||
|
||||
## 26.0.0
|
||||
|
||||
### Full changelog:
|
||||
@ -241,7 +248,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- Add the Azure kernel for Hyper-V VMs
|
||||
- Shorten the time files are stored in trashbin (can still be configured)
|
||||
- Escape all Apache Log dirs correctly
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported)
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported)
|
||||
- Minor bugfixes and improvements
|
||||
- And more...
|
||||
|
||||
@ -265,7 +272,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- ClamAV - improve weekly full-scan tremendously
|
||||
- Update geoblock database - april
|
||||
- Speed up the network check if the network already works
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported)
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported)
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
### Full changelog:
|
||||
@ -292,7 +299,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- Don't break update when enabling app
|
||||
- Fix not enabled PECL extensions
|
||||
- Prevent apps from breaking the update due to incompatibility
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported)
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported)
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
### Full changelog:
|
||||
@ -305,7 +312,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- Ask to get the latest `update.sh` script when running updates from `menu.sh`
|
||||
- Allow to reinstall Bitwarden RS also if local files are present
|
||||
- Updated geoblock database files
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported)
|
||||
- Made some enhancements to scripts in the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported)
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
### Full changelog:
|
||||
@ -377,7 +384,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- Allow to reinstall automatic updates
|
||||
- Improved partition check during the install-script
|
||||
- Fixed some typo's
|
||||
- Added more options to the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported) and made some enhancements
|
||||
- Added more options to the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported) and made some enhancements
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
|
||||
@ -415,7 +422,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- Fixed problems with static-ip
|
||||
- Added Docker migrate script
|
||||
- Fixed and issue with ClamAV
|
||||
- Added more options to the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported) and made some enhancements
|
||||
- Added more options to the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported) and made some enhancements
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
### Full changelog:
|
||||
@ -438,7 +445,7 @@ This release is quite huge, including Ubuntu 22.04 (minimal), PHP-FPM 8.1, and P
|
||||
- SMBmount: Introduce the option to customize the mount before adding as external storage to Nextcloud
|
||||
- SMBmount: Add the option to utilize inotify to actively watch over externally changed files and folders
|
||||
- Repository: cleanup by removing duplicate scripts and not-needed functions
|
||||
- Repository: added the [not-supported folder](https://github.com/nextcloud/vm/tree/master/not-supported) with additional options like creating a SMB-server
|
||||
- Repository: added the [not-supported folder](https://github.com/nextcloud/vm/tree/main/not-supported) with additional options like creating a SMB-server
|
||||
|
||||
- Minor bugfixes and improvements
|
||||
|
||||
|
||||
31
README.md
31
README.md
@ -17,12 +17,12 @@ Server installation. Simplified. :cloud:
|
||||
--------------------
|
||||
|
||||
## Dependencies:
|
||||
(Ubuntu Server 22.04 LTS *minimal* 64-bit)
|
||||
(Ubuntu Server 24.04 LTS *minimal* 64-bit)
|
||||
<br>
|
||||
(Linux Kernel: 5.15)
|
||||
(Linux Kernel: 6.8)
|
||||
- Apache 2.4
|
||||
- PostgreSQL 14
|
||||
- PHP-FPM 8.1
|
||||
- PostgreSQL 16
|
||||
- PHP-FPM 8.3
|
||||
- Redis Memcache (latest stable version from PECL)
|
||||
- PHP-igbinary (latest stable version from PECL
|
||||
- PHP-smbclient (latest stable version from PECL)
|
||||
@ -32,15 +32,15 @@ Server installation. Simplified. :cloud:
|
||||
* [Create a PR](https://help.github.com/articles/creating-a-pull-request/) and improve the code
|
||||
* Report [your issue](https://github.com/nextcloud/vm/issues/new)
|
||||
* Help us with [existing issues](https://github.com/nextcloud/vm/issues)
|
||||
* Test what's not yet released into the stable VM. Please have a look at [this subfolder](https://github.com/nextcloud/vm/tree/master/not-supported) for further information.
|
||||
* Test what's not yet released into the stable VM. Please have a look at [this subfolder](https://github.com/nextcloud/vm/tree/main/not-supported) for further information.
|
||||
* Write scripts so that the release process becomes automated with [Vagrant](https://www.vagrantup.com/docs/getting-started/), [Terraform](https://www.terraform.io/) or similar
|
||||
* **[Donate](https://shop.hanssonit.se/product-category/donate/) or buy our [pre-configured VMs](https://shop.hanssonit.se/product-category/virtual-machine/): 500 GB, 1 TB, 2TB for both VMware, Hyper-V and [more](https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W7Du9uPiqQz3_Mr1/nextcloud-vm-machine-configuration?currentPageId=bls17dahv0jgrltpif20)**
|
||||
|
||||
**FYI**
|
||||
|
||||
Developed by [Daniel Hansson](https://github.com/enoch85) and the Nextcloud community. Nextcloud GmbH does not offer support for the VM in the [master branch](https://github.com/nextcloud/vm/tree/master) (full-version), as we only support manual tarball/zip-package installations. You can download the official Nextcloud VM appliance ([also from this repo](https://github.com/nextcloud/vm/tree/official-basic-vm)) from [our website](https://download.nextcloud.com/vm/Official-Nextcloud-VM.zip) to get a stripped down version for testing if you rather want to skip all the manual steps in our documentation.
|
||||
Developed by [Daniel Hansson](https://github.com/enoch85) and the Nextcloud community. Nextcloud GmbH does not offer support for the VM in the [main branch](https://github.com/nextcloud/vm/tree/main) (full-version), as we only support manual tarball/zip-package installations. You can download the official Nextcloud VM appliance ([also from this repo](https://github.com/nextcloud/vm/tree/official-basic-vm)) from [our website](https://download.nextcloud.com/vm/Official-Nextcloud-VM.zip) to get a stripped down version for testing if you rather want to skip all the manual steps in our documentation.
|
||||
|
||||
If you want support regarding the full-version VM in master, please contact our partner [Hansson IT](https://www.hanssonit.se/nextcloud-vm).
|
||||
If you want support regarding the full-version VM in main, please contact our partner [Hansson IT](https://www.hanssonit.se/nextcloud-vm).
|
||||
|
||||
## Full documentation
|
||||
* [VM](https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W6fMquPiqQz3_Moi/nextcloud-vm) (the easiest option)
|
||||
@ -66,7 +66,7 @@ Please keep in mind that this is only intended for testing and might crash your
|
||||
|
||||
The `nextcloud_install_production.sh` script can be run as part of Vagrant provisioning.
|
||||
|
||||
See [this subrepo](https://github.com/nextcloud/vm/tree/master/vagrant) for more information.
|
||||
See [this subrepo](https://github.com/nextcloud/vm/tree/main/vagrant) for more information.
|
||||
|
||||
Please report any issues you can find. Improvements are welcome!
|
||||
|
||||
@ -106,17 +106,18 @@ Please report any issues you can find. Improvements are welcome!
|
||||
* You? :)
|
||||
|
||||
## Special thanks to
|
||||
* [Ezra Holm](https://github.com/ezraholm50) @ [Tech and Me](https://www.techandme.se)
|
||||
* Ezra Holm @ [Tech and Me](https://www.techandme.se)
|
||||
* [Luis Guzman](https://github.com/Ark74) @ [SwITNet](https://switnet.net)
|
||||
* [Stefan Heitmüller](https://github.com/morph027) @ [morph027's Blog](https://morph027.gitlab.io/)
|
||||
* [Lorenzo Faleschini](https://github.com/penzoiders)
|
||||
* [Georg Großmann](https://github.com/ggeorgg)
|
||||
* [liao20081228](https://github.com/liao20081228)
|
||||
* [aaaskew](https://github.com/aaaskew)
|
||||
* IP address data powered by [IPinfo](https://ipinfo.io/)
|
||||
|
||||
[Nextcloud Server]: https://bit.ly/2CHIUkA
|
||||
[app store]: https://bit.ly/2HUy4v9
|
||||
[\*nix]: https://bit.ly/2UaCC7b
|
||||
[A+ security-rated]: https://bit.ly/2mvlyJ3
|
||||
[Collabora Online]: https://bit.ly/2WjVVZ8
|
||||
[ONLYOFFICE]: https://bit.ly/2FA0TKj
|
||||
[Nextcloud Server]: http://shortio.hanssonit.se/r1Rx0GqXa9
|
||||
[app store]: http://shortio.hanssonit.se/Rz1GEXt9dL
|
||||
[\*nix]: http://shortio.hanssonit.se/52hOTQbhdh
|
||||
[A+ security-rated]: http://shortio.hanssonit.se/aMTjg0SJi3
|
||||
[Collabora Online]: http://shortio.hanssonit.se/IKjBoOfQOT
|
||||
[ONLYOFFICE]: http://shortio.hanssonit.se/oRLShCfRK3
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
true
|
||||
SCRIPT_NAME="Check for 0-Byte files"
|
||||
# shellcheck source=lib.sh
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Automatic Updates"
|
||||
@ -42,7 +42,7 @@ mkdir -p "$VMLOGS"/updates
|
||||
crontab -u root -l | { cat; echo "0 $AUT_UPDATES_TIME * 1-12 6 $SCRIPTS/update.sh minor >> $VMLOGS/updates/update-\$(date +\%Y-\%m-\%d_\%H:\%M).log 2>&1"; } | crontab -u root -
|
||||
if yesno_box_yes "Do you want to reboot your server after every update? *recommended*"
|
||||
then
|
||||
sed -i "s|exit|/sbin/shutdown -r +1|g" "$SCRIPTS"/update.sh
|
||||
sed -i "s|exit|/sbin/shutdown -r +10|g" "$SCRIPTS"/update.sh
|
||||
echo "exit" >> "$SCRIPTS"/update.sh
|
||||
fi
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Set Cookie Lifetime"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="deSEC Registration"
|
||||
@ -140,9 +140,9 @@ then
|
||||
# Add DNS renewals with the deSEC hoock script
|
||||
print_text_in_color "$ICyan" "Preparing for DNS-renewals..."
|
||||
mkdir -p "$SCRIPTS"/deSEC
|
||||
curl_to_dir "https://raw.githubusercontent.com/nextcloud/vm/master/addons/deSEC" "hook.sh" "$SCRIPTS"/deSEC
|
||||
curl_to_dir "https://raw.githubusercontent.com/nextcloud/vm/main/addons/deSEC" "hook.sh" "$SCRIPTS"/deSEC
|
||||
chmod +x "$SCRIPTS"/deSEC/hook.sh
|
||||
curl_to_dir "https://raw.githubusercontent.com/nextcloud/vm/master/addons/deSEC" ".dedynauth" "$SCRIPTS"/deSEC
|
||||
curl_to_dir "https://raw.githubusercontent.com/nextcloud/vm/main/addons/deSEC" ".dedynauth" "$SCRIPTS"/deSEC
|
||||
check_command sed -i "s|DEDYN_TOKEN=.*|DEDYN_TOKEN=$DEDYNAUTHTOKEN|g" "$SCRIPTS"/deSEC/.dedynauth
|
||||
check_command sed -i "s|DEDYN_NAME=.*|DEDYN_NAME=$DEDYNDOMAIN|g" "$SCRIPTS"/deSEC/.dedynauth
|
||||
msg_box "DNS updates for deSEC are now set. This means you don't have to open any ports (80|443) for the renewal process since deSEC TLS renewals will be run with a built in hook. \
|
||||
@ -150,7 +150,7 @@ The hook files will end up in $SCRIPTS/deSEC, please don't touch that folder unl
|
||||
You can read more about it here: https://github.com/desec-io/desec-certbot-hook
|
||||
|
||||
Please remember that you still need to open the port you choose to make your server publicly available.
|
||||
You can read more about that here: https://goo.gl/iUGE2U"
|
||||
You can read more about that here: http://shortio.hanssonit.se/ffOQOXS6Kh"
|
||||
|
||||
# Run the TLS script
|
||||
run_script LETS_ENC activate-tls
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="deSEC Subdomain"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="deSEC Removal"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Based on: https://raw.githubusercontent.com/nextcloud-gmbh/mtime_fixer_tool_kit/main/solvable_files.sh
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Fix 'Could not update metadata due to invalid modified time'."
|
||||
@ -24,9 +25,6 @@ msg_box "OK, let's go!
|
||||
|
||||
Please note, this script might take several hours to run, depening on the size of your datadir. Don't abort it!"
|
||||
|
||||
# Download the script
|
||||
curl_to_dir https://raw.githubusercontent.com/nextcloud-gmbh/mtime_fixer_tool_kit/master solvable_files.sh $NCPATH
|
||||
|
||||
# Run all the needed variables
|
||||
ncdb
|
||||
|
||||
@ -38,8 +36,7 @@ fi
|
||||
|
||||
# Run the script and remove it
|
||||
print_text_in_color "$ICyan" "Running the scan and fixing broken files..."
|
||||
bash "$NCPATH"/solvable_files.sh "$NCDATA" "$NCDBTYPE" "$NCDBHOST" "$NCDBUSER" "$NCDBPASS" "$NCDB" fix use_birthday verbose
|
||||
rm "$NCPATH"/solvable_files.sh
|
||||
run_script ADDONS solvable_files
|
||||
|
||||
# Scan all files
|
||||
nextcloud_occ files:scan --all
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Locales"
|
||||
@ -30,6 +30,14 @@ then
|
||||
elif [ "$KEYBOARD_LAYOUT" = "de" ]
|
||||
then
|
||||
sudo locale-gen "de_DE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
# Set a better mirror (only for German servers)
|
||||
if grep -r archive.ubuntu.com /etc/apt/sources.list
|
||||
then
|
||||
sed -i "s|http://archive.ubuntu.com|https://ftp.uni-stuttgart.de|g" /etc/apt/sources.list
|
||||
elif grep -r de.archive.ubuntu.com /etc/apt/sources.list
|
||||
then
|
||||
sed -i "s|http://de.archive.ubuntu.com|https://ftp.uni-stuttgart.de|g" /etc/apt/sources.list
|
||||
fi
|
||||
elif [ "$KEYBOARD_LAYOUT" = "fr" ]
|
||||
then
|
||||
sudo locale-gen "fr_FR.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales
|
||||
|
||||
@ -1,57 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Locate Mirror"
|
||||
SCRIPT_NAME="Locate mirror"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Use another method if the new one doesn't work
|
||||
if [ -z "$REPO" ]
|
||||
then
|
||||
REPO=$(apt-get update -q4 && apt-cache policy | grep http | tail -1 | awk '{print $2}')
|
||||
fi
|
||||
|
||||
# Check where the best mirrors are and update
|
||||
msg_box "To make downloads as fast as possible when updating Ubuntu \
|
||||
SCRIPT_EXPLAINER="To make downloads as fast as possible when updating Ubuntu \
|
||||
you should download mirrors that are as geographically close to you as possible.
|
||||
|
||||
Please note that there are no guarantees that the download mirrors \
|
||||
this script finds will remain for the lifetime of this server.
|
||||
Because of this, we don't recommend that you change the mirror unless you live far away from the default.
|
||||
|
||||
This is the method used: https://github.com/jblakeman/apt-select"
|
||||
msg_box "Your current server repository is: $REPO"
|
||||
This is the method used: https://github.com/vegardit/fast-apt-mirror.sh"
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
# 0 = OFF
|
||||
DEBUG=0
|
||||
debug_mode
|
||||
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Check if Locate Mirror is already installed
|
||||
if ! [ -f /usr/local/bin/fast-apt-mirror ]
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
rm -f /usr/local/bin/fast-apt-mirror
|
||||
rm -f /etc/apt/sources.list.backup
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Install
|
||||
install_if_not bash
|
||||
install_if_not curl
|
||||
install_if_not apt-transport-https
|
||||
install_if_not ca-certificates
|
||||
curl_to_dir https://raw.githubusercontent.com/vegardit/fast-apt-mirror.sh/v1/ fast-apt-mirror.sh /usr/local/bin
|
||||
mv /usr/local/bin/fast-apt-mirror.sh /usr/local/bin/fast-apt-mirror
|
||||
chmod 755 /usr/local/bin/fast-apt-mirror
|
||||
|
||||
# Check current mirror
|
||||
CURRENT_MIRROR="$(fast-apt-mirror current)"
|
||||
msg_box "Current mirror is $CURRENT_MIRROR"
|
||||
|
||||
# Ask
|
||||
if ! yesno_box_no "Do you want to try to find a better mirror?"
|
||||
then
|
||||
print_text_in_color "$ICyan" "Keeping $REPO as mirror..."
|
||||
print_text_in_color "$ICyan" "Keeping $CURRENT_MIRROR as mirror..."
|
||||
sleep 1
|
||||
else
|
||||
if [[ "$KEYBOARD_LAYOUT" =~ ,|/|_ ]]
|
||||
if [[ "$KEYBOARD_LAYOUT" =~ ,|/|_ ]]
|
||||
then
|
||||
msg_box "Your keymap contains more than one language, or a special character. ($KEYBOARD_LAYOUT)
|
||||
This script can only handle one keymap at the time.\nThe default mirror ($REPO) will be kept."
|
||||
msg_box "Your keymap (country code) contains more than one language, or a special character. ($KEYBOARD_LAYOUT)
|
||||
This script can only handle one keymap at the time.\nThe default mirror ($CURRENT_MIRROR) will be kept."
|
||||
exit 1
|
||||
fi
|
||||
# Find
|
||||
FIND_MIRROR="$(fast-apt-mirror find -v --healthchecks 100 --speedtests 10 --country "$KEYBOARD_LAYOUT")"
|
||||
print_text_in_color "$ICyan" "Locating the best mirrors..."
|
||||
curl_to_dir https://bootstrap.pypa.io get-pip.py /tmp
|
||||
install_if_not python3
|
||||
install_if_not python3-testresources
|
||||
install_if_not python3-distutils
|
||||
cd /tmp && python3 get-pip.py
|
||||
pip install \
|
||||
--upgrade pip \
|
||||
apt-select
|
||||
check_command apt-select -m up-to-date -t 4 -c -C "$KEYBOARD_LAYOUT"
|
||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup && \
|
||||
if [ -f sources.list ]
|
||||
if [ "$CURRENT_MIRROR" != "$FIND_MIRROR" ]
|
||||
then
|
||||
sudo mv sources.list /etc/apt/
|
||||
if yesno_box_yes "Do you want to replace the $CURRENT_MIRROR with $FIND_MIRROR?"
|
||||
then
|
||||
# Backup
|
||||
cp -f /etc/apt/sources.list /etc/apt/sources.list.backup
|
||||
# Replace
|
||||
if fast-apt-mirror set "$FIND_MIRROR"
|
||||
then
|
||||
msg_box "Your Ubuntu repo was successfully changed to $FIND_MIRROR"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msg_box "You already have the fastest mirror available, congrats!"
|
||||
fi
|
||||
msg_box "The apt-mirror was successfully changed."
|
||||
fi
|
||||
|
||||
@ -4,7 +4,7 @@ SCRIPT_NAME="Redis Server Ubuntu"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
@ -16,9 +16,9 @@ debug_mode
|
||||
root_check
|
||||
|
||||
# Check Ubuntu version
|
||||
if ! version 18.04 "$DISTRO" 22.04.10
|
||||
if ! version 18.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 22.04.10 to run this script."
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 24.04.10 to run this script."
|
||||
msg_box "Please contact us to get support for upgrading your server:
|
||||
https://www.hanssonit.se/#contact
|
||||
https://shop.hanssonit.se/"
|
||||
@ -34,15 +34,40 @@ fi
|
||||
# Check the current PHPVER
|
||||
check_php
|
||||
|
||||
if is_this_installed redis-server
|
||||
then
|
||||
print_text_in_color "$ICyan" "Removing old Redis server installation..."
|
||||
if nextcloud_occ_no_check -V
|
||||
then
|
||||
# Remove the config from Nextclouds config.php
|
||||
nextcloud_occ config:system:delete memcache.local
|
||||
nextcloud_occ config:system:delete memcache.distributed
|
||||
nextcloud_occ config:system:delete filelocking.enabled
|
||||
nextcloud_occ config:system:delete memcache.locking
|
||||
nextcloud_occ config:system:delete redis password
|
||||
nextcloud_occ config:system:delete redis
|
||||
# Check that everything is functioning
|
||||
nextcloud_occ -V
|
||||
fi
|
||||
if pecl list | grep -q redis
|
||||
then
|
||||
pecl uninstall redis
|
||||
fi
|
||||
apt-get purge redis-server -y
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean
|
||||
fi
|
||||
|
||||
# Install Redis
|
||||
print_text_in_color "$ICyan" "Installing Redis server..."
|
||||
install_if_not php"$PHPVER"-dev
|
||||
pecl channel-update pecl.php.net
|
||||
if ! yes no | pecl install -Z redis
|
||||
then
|
||||
msg_box "PHP module installation failed"
|
||||
msg_box "Redis PHP module installation failed"
|
||||
exit 1
|
||||
else
|
||||
printf "${IGreen}\nPHP module installation OK!${Color_Off}\n"
|
||||
print_text_in_color "$IGreen" "Redis PHP module installation OK!"
|
||||
fi
|
||||
if [ ! -f $PHP_MODS_DIR/redis.ini ]
|
||||
then
|
||||
@ -56,26 +81,6 @@ then
|
||||
fi
|
||||
install_if_not redis-server
|
||||
|
||||
# Prepare for adding redis configuration
|
||||
sed -i "s|);||g" $NCPATH/config/config.php
|
||||
|
||||
# Add the needed config to Nextclouds config.php
|
||||
cat <<ADD_TO_CONFIG >> $NCPATH/config/config.php
|
||||
'memcache.local' => '\\OC\\Memcache\\Redis',
|
||||
'filelocking.enabled' => true,
|
||||
'memcache.distributed' => '\\OC\\Memcache\\Redis',
|
||||
'memcache.locking' => '\\OC\\Memcache\\Redis',
|
||||
'redis' =>
|
||||
array (
|
||||
'host' => '$REDIS_SOCK',
|
||||
'port' => 0,
|
||||
'timeout' => 0.5,
|
||||
'dbindex' => 0,
|
||||
'password' => '$REDIS_PASS',
|
||||
),
|
||||
);
|
||||
ADD_TO_CONFIG
|
||||
|
||||
## Redis performance tweaks ##
|
||||
if ! grep -Fxq "vm.overcommit_memory = 1" /etc/sysctl.conf
|
||||
then
|
||||
@ -95,19 +100,31 @@ fi
|
||||
# sysctl -w net.core.somaxconn=512
|
||||
# echo "net.core.somaxconn = 512" >> /etc/sysctl.conf
|
||||
#fi
|
||||
|
||||
# Set redis options
|
||||
sed -i "s|# unixsocket .*|unixsocket $REDIS_SOCK|g" $REDIS_CONF
|
||||
sed -i "s|# unixsocketperm .*|unixsocketperm 777|g" $REDIS_CONF
|
||||
sed -i "s|^port.*|port 0|" $REDIS_CONF
|
||||
sed -i "s|# requirepass .*|requirepass $REDIS_PASS|g" $REDIS_CONF
|
||||
sed -i 's|# rename-command CONFIG ""|rename-command CONFIG ""|' $REDIS_CONF
|
||||
redis-cli SHUTDOWN
|
||||
systemctl restart redis-server
|
||||
|
||||
# Add the needed config to Nextclouds config.php
|
||||
# Redis needs to be set first for the connection, else it will fail.
|
||||
nextcloud_occ config:system:set redis host --value="$REDIS_SOCK"
|
||||
nextcloud_occ config:system:set redis port --value=0
|
||||
nextcloud_occ config:system:set redis dbindex --value=0
|
||||
nextcloud_occ config:system:set redis timeout --value=0.5
|
||||
|
||||
nextcloud_occ config:system:set memcache.local --value='\OC\Memcache\Redis'
|
||||
nextcloud_occ config:system:set filelocking.enabled --value='true'
|
||||
nextcloud_occ config:system:set memcache.distributed --value='\OC\Memcache\Redis'
|
||||
nextcloud_occ config:system:set memcache.locking --value='\OC\Memcache\Redis'
|
||||
|
||||
# Secure Redis
|
||||
chown redis:root /etc/redis/redis.conf
|
||||
chmod 600 /etc/redis/redis.conf
|
||||
|
||||
apt-get update -q4 & spinner_loading
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean
|
||||
|
||||
exit
|
||||
# Set password
|
||||
sed -i "s|# requirepass .*|requirepass $REDIS_PASS|g" $REDIS_CONF
|
||||
nextcloud_occ config:system:set redis password --value="$REDIS_PASS"
|
||||
systemctl restart redis-server
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Extra Security"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -148,6 +148,17 @@ fi
|
||||
# Enter the recipient
|
||||
RECIPIENT=$(input_box_flow "Please enter the recipient email address that shall receive all mails.\nE.g. recipient@mail.com")
|
||||
|
||||
# Check if the server use self-signed certificates
|
||||
if yesno_box_no "Does the SMTP-server use self-signed certificates?"
|
||||
then
|
||||
SELF_SIGNED_CERT=yes
|
||||
nextcloud_occ config:system:set mail_smtpstreamoptions ssl allow_self_signed --value=true --type=boolean
|
||||
nextcloud_occ config:system:set mail_smtpstreamoptions ssl verify_peer --value=false --type=boolean
|
||||
nextcloud_occ config:system:set mail_smtpstreamoptions ssl verify_peer_name --value=false --type=boolean
|
||||
else
|
||||
SELF_SIGNED_CERT=no
|
||||
fi
|
||||
|
||||
# Present what we gathered, if everything okay, write to files
|
||||
msg_box "These are the settings that will be used. Please check that everything seems correct.
|
||||
|
||||
@ -156,11 +167,13 @@ Encryption=$PROTOCOL
|
||||
SMTP Port=$SMTP_PORT
|
||||
SMTP Username=$MAIL_USERNAME
|
||||
SMTP Password=$MAIL_PASSWORD
|
||||
Recipient=$RECIPIENT"
|
||||
Recipient=$RECIPIENT
|
||||
Self-signed TLS/SSL certificate=$SELF_SIGNED_CERT"
|
||||
|
||||
# Ask if everything is okay
|
||||
if ! yesno_box_yes "Does everything look correct?"
|
||||
then
|
||||
msg_box "OK, please start over by running this script again."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
99
addons/solvable_files.sh
Normal file
99
addons/solvable_files.sh
Normal file
@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Based on: https://raw.githubusercontent.com/nextcloud-gmbh/mtime_fixer_tool_kit/main/solvable_files.sh
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Fix 'Could not update metadata due to invalid modified time'."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# Get needed variables for database management
|
||||
ncdb
|
||||
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
#2023-05-04 Customized the original script to fit the Nextcloud VM users setup. Also fixed some shellcheck issues.
|
||||
|
||||
data_dir="$(realpath "$NCDATA")"
|
||||
export data_dir
|
||||
export db_type=$NCDBTYPE
|
||||
export db_host=$NCDBHOST
|
||||
export db_user=$NCDBUSER
|
||||
export db_pwd=$NCDBPASS
|
||||
export db_name=$NCDB
|
||||
export action=fix
|
||||
export scan_action=noscan
|
||||
export use_birthday=use_birthday
|
||||
export verbose=verbose
|
||||
|
||||
# In case you're using a different database table prefix, set this to your config's `dbtableprefix` value.
|
||||
export dbtableprefix="oc_"
|
||||
|
||||
# 1. Return if fs mtime <= 86400
|
||||
# 2. Compute username from filepath
|
||||
# 3. Query mtime from the database with the filename and the username
|
||||
# 4. Return if mtime_on_fs != mtime_in_db
|
||||
# 5. Correct the fs mtime with touch (optionally using the files change date/timestamp)
|
||||
correct_mtime() {
|
||||
filepath=$NCDATA
|
||||
|
||||
if [ ! -e "$filepath" ]
|
||||
then
|
||||
echo "File or directory $filepath does not exist. Skipping."
|
||||
return
|
||||
fi
|
||||
|
||||
relative_filepath="${filepath/#$data_dir\//}"
|
||||
mtime_on_fs="$(stat -c '%Y' "$filepath")"
|
||||
|
||||
username=$relative_filepath
|
||||
while [ "$(dirname "$username")" != "." ]
|
||||
do
|
||||
username=$(dirname "$username")
|
||||
done
|
||||
|
||||
relative_filepath_without_username="${relative_filepath/#$username\//}"
|
||||
|
||||
base64_relative_filepath="$(printf '%s' "$relative_filepath" | base64)"
|
||||
base64_relative_filepath_without_username="$(printf '%s' "$relative_filepath_without_username" | base64)"
|
||||
|
||||
if [ "$username" == "__groupfolders" ]
|
||||
then
|
||||
mtime_in_db=$(sudo -u postgres psql nextcloud_db --tuples-only --no-align -c "SELECT mtime FROM ${dbtableprefix}storages JOIN ${dbtableprefix}filecache ON ${dbtableprefix}storages.numeric_id = ${dbtableprefix}filecache.storage WHERE ${dbtableprefix}storages.id='local::$data_dir/' AND ${dbtableprefix}filecache.path=CONVERT_FROM(DECODE('$base64_relative_filepath', 'base64'), 'UTF-8')")
|
||||
else
|
||||
mtime_in_db=$(sudo -u postgres psql nextcloud_db --tuples-only --no-align -c "SELECT mtime FROM ${dbtableprefix}storages JOIN ${dbtableprefix}filecache ON ${dbtableprefix}storages.numeric_id = ${dbtableprefix}filecache.storage WHERE ${dbtableprefix}storages.id='home::$username' AND ${dbtableprefix}filecache.path=CONVERT_FROM(DECODE('$base64_relative_filepath_without_username', 'base64'), 'UTF-8')")
|
||||
fi
|
||||
|
||||
if [ "$mtime_in_db" == "" ]
|
||||
then
|
||||
echo "No mtime in database. File not indexed. Skipping $filepath"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$mtime_in_db" != "$mtime_on_fs" ]
|
||||
then
|
||||
echo "mtime in database do not match fs mtime (fs: $mtime_on_fs, db: $mtime_in_db). Skipping $filepath"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -e "$filepath" ]
|
||||
then
|
||||
newdate=$(stat -c "%w" "$filepath")
|
||||
if [ "$newdate" == "-" ]
|
||||
then
|
||||
newdate=$(stat -c "%z" "$filepath")
|
||||
touch -c -d "$newdate" "$filepath"
|
||||
else
|
||||
touch -c "$filepath"
|
||||
fi
|
||||
echo mtime for "$filepath" updated to "$(stat -c "%y" "$filepath")"
|
||||
elif [ ! -e "$filepath" ]
|
||||
then
|
||||
echo "File or directory $filepath does not exist. Skipping."
|
||||
return
|
||||
fi
|
||||
}
|
||||
export -f correct_mtime
|
||||
|
||||
find "$data_dir" -type f ! -newermt "@86400" -exec bash -c 'correct_mtime "$0"' {} \;
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Adminer"
|
||||
@ -28,6 +28,7 @@ else
|
||||
# Removal
|
||||
check_external_ip # Check that the script can see the external IP (apache fails otherwise)
|
||||
a2disconf adminer.conf
|
||||
restart_webserver
|
||||
rm -f $ADMINER_CONF
|
||||
rm -rf $ADMINERDIR
|
||||
check_command apt-get purge adminer -y
|
||||
@ -51,12 +52,16 @@ a2enmod ssl
|
||||
# Install Adminer
|
||||
apt-get update -q4 & spinner_loading
|
||||
install_if_not adminer
|
||||
curl_to_dir "http://www.adminer.org" "latest.php" "$ADMINERDIR"
|
||||
curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Adminer/master" "adminer.css" "$ADMINERDIR"
|
||||
ln -s "$ADMINERDIR"/latest.php "$ADMINERDIR"/adminer.php
|
||||
curl_to_dir "https://download.adminerevo.org/latest/adminer" "adminer-pgsql.zip" "$ADMINERDIR"
|
||||
install_if_not unzip
|
||||
# Unzip the latest version
|
||||
unzip "$ADMINERDIR"/adminer-pgsql.zip -d "$ADMINERDIR"
|
||||
rm -f "$ADMINERDIR"/adminer-pgsql.zip
|
||||
# curl_to_dir "https://raw.githubusercontent.com/Niyko/Hydra-Dark-Theme-for-Adminer/master" "adminer.css" "$ADMINERDIR"
|
||||
mv "$ADMINERDIR"/adminer-pgsql.php "$ADMINERDIR"/adminer.php
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
@ -64,6 +69,46 @@ fi
|
||||
# Get PHP version for the conf file
|
||||
check_php
|
||||
|
||||
# shellcheck disable=2154
|
||||
|
||||
# Add ability to add plugins easily
|
||||
cat << ADMINER_CREATE_PLUGIN > "$ADMINER_CONF_PLUGIN"
|
||||
<?php
|
||||
function adminer_object() {
|
||||
// required to run any plugin
|
||||
include_once "./plugins/plugin.php";
|
||||
|
||||
// autoloader
|
||||
foreach (glob("plugins/*.php") as $filename) {
|
||||
include_once "./$filename";
|
||||
}
|
||||
|
||||
// enable extra drivers just by including them
|
||||
//~ include "./plugins/drivers/simpledb.php";
|
||||
|
||||
$plugins = array(
|
||||
// specify enabled plugins here
|
||||
new AdminerDumpXml(),
|
||||
new AdminerTinymce(),
|
||||
new AdminerFileUpload("data/"),
|
||||
new AdminerSlugify(),
|
||||
new AdminerTranslation(),
|
||||
new AdminerForeignSystem(),
|
||||
);
|
||||
|
||||
/* It is possible to combine customization and plugins:
|
||||
class AdminerCustomization extends AdminerPlugin {
|
||||
}
|
||||
return new AdminerCustomization($plugins);
|
||||
*/
|
||||
|
||||
return new AdminerPlugin($plugins);
|
||||
}
|
||||
|
||||
// include original Adminer or Adminer Editor
|
||||
include "./adminer.php";
|
||||
ADMINER_CREATE_PLUGIN
|
||||
|
||||
cat << ADMINER_CREATE > "$ADMINER_CONF"
|
||||
<VirtualHost *:80>
|
||||
RewriteEngine On
|
||||
@ -107,7 +152,7 @@ Listen 9443
|
||||
<IfModule mod_dir.c>
|
||||
DirectoryIndex adminer.php
|
||||
</IfModule>
|
||||
AllowOverride None
|
||||
AllowOverride All
|
||||
|
||||
# Only allow connections from localhost:
|
||||
Require ip $GATEWAY/24
|
||||
@ -130,7 +175,6 @@ The script will exit."
|
||||
exit 1
|
||||
else
|
||||
# Allow local access:
|
||||
|
||||
check_command sed -i "s|local all postgres peer|local all postgres md5|g" /etc/postgresql/*/main/pg_hba.conf
|
||||
restart_webserver
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Bitwarden Mail Configuration"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Bitwarden Registration"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="BPYTOP"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="ClamAV"
|
||||
@ -101,7 +101,7 @@ install_and_enable_app files_antivirus
|
||||
nextcloud_occ config:app:set files_antivirus av_mode --value="socket"
|
||||
nextcloud_occ config:app:set files_antivirus av_socket --value="/var/run/clamav/clamd.ctl"
|
||||
nextcloud_occ config:app:set files_antivirus av_stream_max_length --value="1048576000"
|
||||
nextcloud_occ config:app:set files_antivirus av_max_file_size --value="-1"
|
||||
nextcloud_occ config:app:set files_antivirus av_max_file_size --value="1048576000"
|
||||
nextcloud_occ config:app:set files_antivirus av_infected_action --value="only_log"
|
||||
|
||||
# Create av notification script
|
||||
@ -198,7 +198,7 @@ esac
|
||||
cat << CLAMAV_REPORT > "$SCRIPTS"/clamav-fullscan.sh
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
@ -246,6 +246,11 @@ fi
|
||||
INFECTED_FILES_LOG="\$(sed -n '/----------- SCAN SUMMARY -----------/,\$p' $VMLOGS/clamav-fullscan.log)"
|
||||
INFECTED_FILES="\$(grep 'FOUND$' $VMLOGS/clamav-fullscan.log)"
|
||||
|
||||
if [ -z "$INFECTED_FILES" ]
|
||||
then
|
||||
INFECTED_FILES="No infected files found"
|
||||
fi
|
||||
|
||||
# Send notification
|
||||
if ! send_mail "Your weekly full-scan ClamAV report" "\$INFECTED_FILES_LOG\n
|
||||
\$INFECTED_FILES"
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Collabora (Docker)"
|
||||
SCRIPT_EXPLAINER="This script will install the Collabora Office Server bundled with Docker"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
|
||||
# To work with https://github.com/nextcloud/richdocuments/pull/2235
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
@ -57,7 +57,7 @@ NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|h
|
||||
|
||||
# Curl the library another time to get the correct https_conf
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
|
||||
|
||||
# Get all needed variables from the library
|
||||
nc_update
|
||||
@ -135,8 +135,8 @@ a2enmod proxy_http
|
||||
a2enmod ssl
|
||||
a2enmod headers
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Collabora (Integrated)"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Redirect to Recognize"
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# Inspired by https://github.com/nextcloud/nextcloudpi/blob/master/etc/nextcloudpi-config.d/fail2ban.sh
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Inspired by https://github.com/nextcloud/nextcloudpi/blob/main/etc/nextcloudpi-config.d/fail2ban.sh
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Fail2ban"
|
||||
SCRIPT_EXPLAINER="Fail2ban provides extra Brute Force protextion for Nextcloud.
|
||||
SCRIPT_EXPLAINER="Fail2ban provides extra Brute Force protection for Nextcloud.
|
||||
It scans the Nextcloud and SSH log files and bans IPs that show malicious \
|
||||
signs -- too many password failures, seeking for exploits, etc.
|
||||
Generally Fail2Ban is then used to update firewall rules to \
|
||||
@ -221,7 +221,7 @@ fi
|
||||
# Create Fail2ban report script
|
||||
cat << FAIL2BAN_REPORT > "$SCRIPTS/daily_fail2ban_report.sh"
|
||||
#!/bin/bash
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Look for ip addresses
|
||||
BANNED_IPS=\$(grep "Ban " /var/log/fail2ban.log | grep "\$(date +%Y-%m-%d)" \
|
||||
|
||||
@ -1,19 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# SwITNet Ltd © - 2023, https://switnet.net/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# SwITNet Ltd © - 2024, https://switnet.net/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Full Text Search"
|
||||
SCRIPT_EXPLAINER="Full Text Search provides OpenSearch for Nextcloud, which makes it possible to search for text inside files."
|
||||
SCRIPT_EXPLAINER="Full Text Search provides ElastichSearch for Nextcloud, which makes it possible to search for text inside files."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# Get all needed variables from the library
|
||||
ncdb
|
||||
nc_update
|
||||
opensearch_install
|
||||
ncdomain
|
||||
ncdb
|
||||
fulltextsearch_install
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
@ -24,24 +23,41 @@ debug_mode
|
||||
# Must be root
|
||||
root_check
|
||||
|
||||
# Nextcloud 21 is required.
|
||||
lowest_compatible_nc 21
|
||||
# Nextcloud 26 is required.
|
||||
lowest_compatible_nc 26
|
||||
|
||||
# Check if Full Text Search is already installed
|
||||
if ! does_this_docker_exist "$nc_fts" && ! does_this_docker_exist "$opens_fts" && ! is_app_installed fulltextsearch
|
||||
if ! does_this_docker_exist docker.elastic.co/elasticsearch/elasticsearch && ! is_app_installed fulltextsearch
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Remove live service
|
||||
systemctl stop "$FULLTEXTSEARCH_SERVICE"
|
||||
systemctl disable "$FULLTEXTSEARCH_SERVICE"
|
||||
rm -f "$FULLTEXTSEARCH_SERVICE"
|
||||
# Reset Full Text Search to be able to index again, and also remove the app to be able to install it again
|
||||
nextcloud_occ_no_check fulltextsearch:reset
|
||||
nextcloud_occ_no_check fulltextsearch:stop
|
||||
install_if_not expect
|
||||
REMOVE_FTS_INDEX=$(expect -c "
|
||||
set timeout 3
|
||||
spawn sudo -u www-data php $NCPATH/occ fulltextsearch:reset
|
||||
expect \"Do you really want to reset your indexed documents ? (y/N)\"
|
||||
send \"y\r\"
|
||||
expect \"Please confirm this destructive operation by typing 'reset ALL ALL':\"
|
||||
send \"reset ALL ALL\r\"
|
||||
expect eof
|
||||
")
|
||||
echo "$REMOVE_FTS_INDEX"
|
||||
apt -y purge expect
|
||||
# Drop database tables
|
||||
sudo -Hiu postgres psql "$NCDB" -c "DROP TABLE oc_fulltextsearch_ticks;"
|
||||
sudo -Hiu postgres psql "$NCDB" -c "DROP TABLE oc_fulltextsearch_index;"
|
||||
sudo -Hiu postgres psql "$NCDB" -c "DELETE FROM oc_migrations WHERE app='fulltextsearch';"
|
||||
sudo -Hiu postgres psql "$NCDB" -c "DELETE FROM oc_preferences WHERE appid='fulltextsearch';"
|
||||
# Remove apps
|
||||
APPS=(fulltextsearch fulltextsearch_elasticsearch files_fulltextsearch)
|
||||
for app in "${APPS[@]}"
|
||||
do
|
||||
@ -50,20 +66,26 @@ else
|
||||
nextcloud_occ app:remove "$app"
|
||||
fi
|
||||
done
|
||||
# Removal Docker image
|
||||
docker_prune_this "$nc_fts"
|
||||
docker_prune_volume "esdata"
|
||||
docker-compose_down "$OPNSDIR/docker-compose.yml"
|
||||
# Remove configuration files
|
||||
rm -rf "$RORDIR"
|
||||
rm -rf "$OPNSDIR"
|
||||
# Removal Elastichsearch Docker image
|
||||
docker_prune_this "docker.elastic.co/elasticsearch/elasticsearch"
|
||||
if docker network ls | grep "$FULLTEXTSEARCH_IMAGE_NAME"-network
|
||||
then
|
||||
docker network rm "$FULLTEXTSEARCH_IMAGE_NAME"-network
|
||||
fi
|
||||
rm -rf "$FULLTEXTSEARCH_DIR"
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
apt-get purge docker-compose -y
|
||||
fi
|
||||
|
||||
# Test RAM size (4GB min) + CPUs (min 2)
|
||||
ram_check 4 FullTextSearch
|
||||
# Check if version tag is available
|
||||
if [ -z "$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG" ]
|
||||
then
|
||||
msg_box "The Elasticsearch version tag is not available, please report this to $ISSUES"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test RAM size (6GB min) + CPUs (min 2)
|
||||
ram_check 6 FullTextSearch
|
||||
cpu_check 2 FullTextSearch
|
||||
|
||||
# Make sure there is an Nextcloud installation
|
||||
@ -89,6 +111,23 @@ then
|
||||
deluser --group solr
|
||||
fi
|
||||
|
||||
# Removal Opensearch Docker image
|
||||
if does_this_docker_exist "$nc_fts" || does_this_docker_exist "$opens_fts"
|
||||
then
|
||||
docker_prune_this "$nc_fts"
|
||||
docker_prune_this "$opens_fts"
|
||||
docker_prune_volume "esdata"
|
||||
nextcloud_occ fulltextsearch:migration:24
|
||||
if docker network ls | grep opensearch_fts_os-net
|
||||
then
|
||||
docker network rm opensearch_fts_os-net
|
||||
fi
|
||||
# Remove configuration files
|
||||
rm -rf "$RORDIR"
|
||||
rm -rf "$OPNSDIR"
|
||||
apt-get purge docker-compose -y
|
||||
fi
|
||||
|
||||
# Check if the app is compatible with the current Nextcloud version
|
||||
if ! install_and_enable_app fulltextsearch
|
||||
then
|
||||
@ -97,98 +136,23 @@ fi
|
||||
|
||||
# Check & install docker
|
||||
install_docker
|
||||
install_if_not docker-compose
|
||||
set_max_count
|
||||
mkdir -p "$OPNSDIR"
|
||||
docker pull "$opens_fts"
|
||||
BCRYPT_HASH="$(docker run --rm -it $opens_fts \
|
||||
bash -c "plugins/opensearch-security/tools/hash.sh -p $OPNSREST | tr -d ':\n' ")"
|
||||
|
||||
# Create configurations YML
|
||||
# opensearch.yml
|
||||
cat << YML_OPENSEARCH > $OPNSDIR/opensearch.yml
|
||||
cluster.name: docker-cluster
|
||||
# Avoid Docker assigning IP.
|
||||
network.host: 0.0.0.0
|
||||
|
||||
# Declaring single node cluster.
|
||||
discovery.type: single-node
|
||||
|
||||
######## Start Security Configuration ########
|
||||
plugins.security.ssl.transport.pemcert_filepath: node.pem
|
||||
plugins.security.ssl.transport.pemkey_filepath: node-key.pem
|
||||
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
|
||||
plugins.security.ssl.transport.enforce_hostname_verification: false
|
||||
|
||||
# Disable ssl at REST as Fulltextsearch can't accept self-signed CA certs.
|
||||
plugins.security.ssl.http.enabled: false
|
||||
#plugins.security.ssl.http.pemcert_filepath: node.pem
|
||||
#plugins.security.ssl.http.pemkey_filepath: node-key.pem
|
||||
#plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
|
||||
plugins.security.allow_unsafe_democertificates: false
|
||||
plugins.security.allow_default_init_securityindex: true
|
||||
plugins.security.authcz.admin_dn:
|
||||
- 'CN=admin,OU=FTS,O=OPENSEARCH,L=VM,ST=NEXTCLOUD,C=CA'
|
||||
plugins.security.nodes_dn:
|
||||
- 'CN=${NCDOMAIN},OU=FTS,O=OPENSEARCH,L=VM,ST=NEXTCLOUD,C=CA'
|
||||
|
||||
plugins.security.audit.type: internal_opensearch
|
||||
plugins.security.enable_snapshot_restore_privilege: true
|
||||
plugins.security.check_snapshot_restore_write_privileges: true
|
||||
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]
|
||||
plugins.security.system_indices.enabled: true
|
||||
plugins.security.system_indices.indices: [".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opendistro-notifications-*", ".opendistro-notebooks", ".opensearch-observability", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"]
|
||||
node.max_local_storage_nodes: 1
|
||||
######## End Security Configuration ########
|
||||
YML_OPENSEARCH
|
||||
|
||||
# internal_users.yml
|
||||
cat << YML_INTERNAL_USERS > $OPNSDIR/internal_users.yml
|
||||
_meta:
|
||||
type: "internalusers"
|
||||
config_version: 2
|
||||
|
||||
${INDEX_USER}:
|
||||
hash: "${BCRYPT_HASH}"
|
||||
reserved: true
|
||||
backend_roles:
|
||||
- "admin"
|
||||
description: "admin user for fts at opensearch."
|
||||
YML_INTERNAL_USERS
|
||||
|
||||
# roles_mapping.yml
|
||||
cat << YML_ROLES_MAPPING > $OPNSDIR/roles_mapping.yml
|
||||
_meta:
|
||||
type: "rolesmapping"
|
||||
config_version: 2
|
||||
|
||||
# Roles mapping
|
||||
all_access:
|
||||
reserved: false
|
||||
backend_roles:
|
||||
- "admin"
|
||||
description: "Maps admin to all_access"
|
||||
YML_ROLES_MAPPING
|
||||
|
||||
# docker-compose.yml
|
||||
cat << YML_DOCKER_COMPOSE > $OPNSDIR/docker-compose.yml
|
||||
version: '3'
|
||||
mkdir -p "$FULLTEXTSEARCH_DIR"
|
||||
cat << YML_DOCKER_COMPOSE > "$FULLTEXTSEARCH_DIR/docker-compose.yaml"
|
||||
services:
|
||||
fts_os-node:
|
||||
image: opensearchproject/opensearch:1
|
||||
container_name: fts_os-node
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:$FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG
|
||||
container_name: $FULLTEXTSEARCH_IMAGE_NAME
|
||||
restart: always
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- "/usr/share/opensearch/bin/opensearch-plugin list | grep -q ingest-attachment \
|
||||
|| /usr/share/opensearch/bin/opensearch-plugin install --batch ingest-attachment ;
|
||||
./opensearch-docker-entrypoint.sh"
|
||||
ports:
|
||||
- 127.0.0.1:9200:9200
|
||||
environment:
|
||||
- cluster.name=fts_os-cluster
|
||||
- node.name=fts_os-node
|
||||
- bootstrap.memory_lock=true
|
||||
- "OPENSEARCH_JAVA_OPTS=-Xms1024M -Xmx1024M"
|
||||
- discovery.type=single-node
|
||||
- xpack.security.enabled=true
|
||||
- xpack.security.http.ssl.enabled=false
|
||||
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
|
||||
- ELASTIC_PASSWORD=$ELASTIC_USER_PASSWORD
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
@ -196,87 +160,81 @@ services:
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
volumes:
|
||||
- fts_os-data:/usr/share/opensearch/data
|
||||
- $OPNSDIR/root-ca.pem:/usr/share/opensearch/config/root-ca.pem
|
||||
- $OPNSDIR/node.pem:/usr/share/opensearch/config/node.pem
|
||||
- $OPNSDIR/node-key.pem:/usr/share/opensearch/config/node-key.pem
|
||||
- $OPNSDIR/admin.pem:/usr/share/opensearch/config/admin.pem
|
||||
- $OPNSDIR/admin-key.pem:/usr/share/opensearch/config/admin-key.pem
|
||||
- $OPNSDIR/opensearch.yml:/usr/share/opensearch/config/opensearch.yml
|
||||
- $OPNSDIR/internal_users.yml:/usr/share/opensearch/plugins/opensearch-security/securityconfig/internal_users.yml
|
||||
- $OPNSDIR/roles_mapping.yml:/usr/share/opensearch/plugins/opensearch-security/securityconfig/roles_mapping.yml
|
||||
ports:
|
||||
- 127.0.0.1:9200:9200
|
||||
- 127.0.0.1:9600:9600 # Performance Analyzer [1]
|
||||
networks:
|
||||
- fts_os-net
|
||||
- $FULLTEXTSEARCH_IMAGE_NAME-network
|
||||
|
||||
volumes:
|
||||
fts_os-data:
|
||||
|
||||
$FULLTEXTSEARCH_IMAGE_NAME-data:
|
||||
networks:
|
||||
fts_os-net:
|
||||
|
||||
#[1] https://github.com/opensearch-project/performance-analyzer
|
||||
$FULLTEXTSEARCH_IMAGE_NAME-network:
|
||||
YML_DOCKER_COMPOSE
|
||||
|
||||
# Prepare certs
|
||||
create_certs "$NCDOMAIN"
|
||||
# Start the docker image
|
||||
cd "$FULLTEXTSEARCH_DIR"
|
||||
docker compose up -d
|
||||
|
||||
# Set permissions
|
||||
chmod 744 -R $OPNSDIR
|
||||
# Check if online
|
||||
until curl -sS "http://elastic:$ELASTIC_USER_PASSWORD@localhost:9200/_cat/health?h=status" | grep -q "green\|yellow"
|
||||
do
|
||||
countdown "Waiting for ElasticSearch to come online, please don't abort..." "10"
|
||||
done
|
||||
|
||||
# Launch docker-compose
|
||||
cd $OPNSDIR
|
||||
docker-compose up -d
|
||||
# Check logs
|
||||
print_text_in_color "$ICyan" "Checking logs..."
|
||||
docker logs "$FULLTEXTSEARCH_IMAGE_NAME"
|
||||
|
||||
# Wait for bootstrapping
|
||||
if [ "$(nproc)" -gt 2 ]
|
||||
then
|
||||
countdown "Waiting for Docker bootstrapping..." "60"
|
||||
else
|
||||
countdown "Waiting for Docker bootstrapping..." "120"
|
||||
fi
|
||||
|
||||
# Make sure password setup is enforced.
|
||||
docker-compose exec fts_os-node \
|
||||
bash -c "cd \
|
||||
plugins/opensearch-security/tools/ && \
|
||||
bash securityadmin.sh -f \
|
||||
../securityconfig/internal_users.yml \
|
||||
-t internalusers \
|
||||
-icl \
|
||||
-nhnv \
|
||||
-cacert ../../../config/root-ca.pem \
|
||||
-cert ../../../config/admin.pem \
|
||||
-key ../../../config/admin-key.pem && \
|
||||
chmod 0600 ../../../config/root-ca.pem ../../../config/admin.pem ../../../config/admin-key.pem"
|
||||
|
||||
docker logs $fts_node
|
||||
countdown "Waiting a bit more before testing..." "10"
|
||||
|
||||
# Get Full Text Search app for nextcloud
|
||||
install_and_enable_app fulltextsearch
|
||||
install_and_enable_app fulltextsearch_elasticsearch
|
||||
install_and_enable_app files_fulltextsearch
|
||||
chown -R www-data:www-data $NC_APPS_PATH
|
||||
chown -R www-data:www-data "$NC_APPS_PATH"
|
||||
|
||||
# Final setup
|
||||
nextcloud_occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}'
|
||||
nextcloud_occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://${INDEX_USER}:${OPNSREST}@localhost:9200\",\"elastic_index\":\"${INDEX_USER}-index\"}"
|
||||
nextcloud_occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://elastic:$ELASTIC_USER_PASSWORD@localhost:9200\",\"elastic_index\":\"${NEXTCLOUD_INDEX}\"}"
|
||||
nextcloud_occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}"
|
||||
|
||||
# Add SystemD service for live indexing
|
||||
cat << SYSTEMCTL_FTS > "/etc/systemd/system/$FULLTEXTSEARCH_SERVICE"
|
||||
[Unit]
|
||||
Description=Elasticsearch Worker for Nextcloud FullTextSearch
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory=$NCPATH
|
||||
ExecStart=/usr/bin/php $NCPATH/occ fulltextsearch:live -q
|
||||
ExecStop=/usr/bin/php $NCPATH/occ fulltextsearch:stop
|
||||
Nice=19
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
SYSTEMCTL_FTS
|
||||
|
||||
# Wait further for cache for index to work
|
||||
countdown "Waiting for a few seconds before indexing starts..." "10"
|
||||
if nextcloud_occ fulltextsearch:test
|
||||
then
|
||||
# Turn off swap temporarily https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html
|
||||
print_text_in_color "Turning of swap temporarily..."
|
||||
swapoff -a
|
||||
if nextcloud_occ fulltextsearch:index < /dev/null
|
||||
then
|
||||
msg_box "Full Text Search was successfully installed!"
|
||||
# Enable the live service
|
||||
systemctl enable "$FULLTEXTSEARCH_SERVICE"
|
||||
systemctl start "$FULLTEXTSEARCH_SERVICE"
|
||||
fi
|
||||
else
|
||||
msg_box "There seems to be an issue with the Full Text Search test. Please report this to $ISSUES."
|
||||
fi
|
||||
|
||||
# Turn on swap again
|
||||
swapon -a
|
||||
|
||||
# Make sure the script exists
|
||||
exit
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# GNU General Public License v3.0
|
||||
# https://github.com/nextcloud/vm/blob/master/LICENSE
|
||||
# https://github.com/nextcloud/vm/blob/main/LICENSE
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Imaginary Docker"
|
||||
@ -21,14 +21,21 @@ debug_mode
|
||||
root_check
|
||||
|
||||
# Check recources
|
||||
ram_check 4
|
||||
cpu_check 2
|
||||
# If we can calculate the cpu and ram, then set it to the lowest possible, if not, then hardcode it to a recomended minimum.
|
||||
if which nproc >/dev/null 2>&1
|
||||
then
|
||||
ram_check 2 Imaginary
|
||||
cpu_check 2 Imaginary
|
||||
else
|
||||
ram_check 4 Imaginary
|
||||
cpu_check 2 Imaginary
|
||||
fi
|
||||
|
||||
# Compatible with NC24 and above
|
||||
lowest_compatible_nc 26
|
||||
|
||||
# Check if Imaginary is already installed
|
||||
if ! does_this_docker_exist nextcloud/aio-imaginary
|
||||
if ! does_this_docker_exist nextcloud/aio-imaginary && ! does_this_docker_exist ghcr.io/nextcloud-releases/aio-imaginary
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
@ -39,7 +46,8 @@ else
|
||||
if yesno_box_yes "Do you want to remove the Imaginary and all it's settings?"
|
||||
then
|
||||
# Remove docker container
|
||||
docker_prune_this 'nextcloud/aio-imaginary'
|
||||
docker_prune_this 'nextcloud/aio-imaginary' 'imaginary'
|
||||
docker_prune_this 'ghcr.io/nextcloud-releases/aio-imaginary' 'imaginary'
|
||||
# reset the preview formats
|
||||
nextcloud_occ config:system:delete "preview_imaginary_url"
|
||||
nextcloud_occ config:system:delete "enabledPreviewProviders"
|
||||
@ -62,13 +70,13 @@ else
|
||||
fi
|
||||
|
||||
# Remove everything that is related to previewgenerator
|
||||
if is_app_enabled previewgenerator
|
||||
if crontab -u www-data -l | grep -q "preview:pre-generate"
|
||||
then
|
||||
if yesno_box_yes "We noticed that you have Preview Generator enabled. Imagniary replaces this, and the old app Preview Generator is now legacy.\nWe recommend you to remove it. Do you want to do that?"
|
||||
then
|
||||
# Remove the app
|
||||
nextcloud_occ app:remove previewgenerator
|
||||
# Reset the cronjob
|
||||
nextcloud_occ_no_check app:remove previewgenerator
|
||||
# Remove the cronjob
|
||||
crontab -u www-data -l | grep -v 'preview:pre-generate' | crontab -u www-data -
|
||||
# Remove dependecies
|
||||
DEPENDENCY=(php-imagick php"$PHPVER"-imagick libmagickcore-6.q16-3-extra imagemagick-6.q16-extra)
|
||||
@ -90,8 +98,10 @@ This will most likely clear a lot of space! Also, pre-generated previews are not
|
||||
rm -rfv "$NCDATA"/appdata_*/preview/*
|
||||
print_text_in_color "$ICyan" "Scanning Nextclouds appdata directory after removing all previews. \
|
||||
This can take a while..."
|
||||
# Don't execute the update before all cronjobs are finished
|
||||
check_running_cronjobs
|
||||
nextcloud_occ files:scan-app-data preview -vvv
|
||||
msg_box "All previews were successfully removed."
|
||||
print_text_in_color "$IGreen" "All previews were successfully removed."
|
||||
fi
|
||||
# Remove log
|
||||
rm -f "$VMLOGS"/previewgenerator.log
|
||||
@ -101,8 +111,8 @@ fi
|
||||
install_docker
|
||||
|
||||
# Pull and start
|
||||
docker pull nextcloud/aio-imaginary:latest
|
||||
docker run -t -d -p 127.0.0.1:9000:9000 --restart always --name imaginary nextcloud/aio-imaginary -concurrency 50 -enable-url-source -log-level debug
|
||||
docker pull ghcr.io/nextcloud-releases/aio-imaginary:latest
|
||||
docker run -t -d -p 127.0.0.1:9000:9000 --restart always --name imaginary ghcr.io/nextcloud-releases/aio-imaginary –cap-add=sys_nice -concurrency 50 -enable-url-source -return-size -log-level debug
|
||||
|
||||
# Test if imaginary is working
|
||||
countdown "Testing if it works in 3 sedonds" "3"
|
||||
@ -133,6 +143,7 @@ fi
|
||||
|
||||
# Set providers (https://github.com/nextcloud/server/blob/master/lib/private/Preview/Imaginary.php#L60)
|
||||
# https://github.com/nextcloud/vm/issues/2465
|
||||
# Already enabled: https://github.com/nextcloud/server/blob/5e96228eb1f7999a327dacab22055ec2aa8e28a3/lib/private/Preview/Imaginary.php#L60
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\Imaginary"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\Image"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\MarkDown"
|
||||
@ -140,13 +151,16 @@ nextcloud_occ config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\TXT"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\OpenDocument"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\Movie"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 7 --value="OC\\Preview\\Krita"
|
||||
nextcloud_occ config:system:set enabledPreviewProviders 8 --value="OC\Preview\ImaginaryPDF"
|
||||
nextcloud_occ config:system:set preview_imaginary_url --value="http://127.0.0.1:9000"
|
||||
|
||||
# Set general values
|
||||
nextcloud_occ config:system:set preview_max_x --value="2048"
|
||||
nextcloud_occ config:system:set preview_max_y --value="2048"
|
||||
nextcloud_occ config:system:set jpeg_quality --value="60"
|
||||
nextcloud_occ config:system:set preview_max_memory --value="256"
|
||||
nextcloud_occ config:system:set preview_format --value="webp"
|
||||
nextcloud_occ config:app:set preview webp_quality --value="65"
|
||||
|
||||
if docker logs imaginary
|
||||
then
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Netdata"
|
||||
@ -22,16 +22,6 @@ debug_mode
|
||||
# Must be sudo
|
||||
root_check
|
||||
|
||||
# Can't be run as pure root user
|
||||
if [ -z "$UNIXUSER" ]
|
||||
then
|
||||
msg_box "You can't run this script as a pure root user. You need to issue the following command:
|
||||
sudo -u regular_user sudo bash $SCRIPTS/menu.sh
|
||||
|
||||
Then choose Additional Apps --> Netdata"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if netdata is already installed
|
||||
if ! [ -d /etc/netdata ]
|
||||
then
|
||||
@ -63,6 +53,8 @@ else
|
||||
rm -rf /etc/netdata
|
||||
apt-get purge netdata -y
|
||||
apt-get autoremove -y
|
||||
rm -rf /var/cache/netdata
|
||||
rm -rf /var/log/netdata
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
@ -71,8 +63,8 @@ fi
|
||||
is_process_running dpkg
|
||||
is_process_running apt
|
||||
apt-get update -q4 & spinner_loading
|
||||
curl_to_dir https://my-netdata.io kickstart.sh $SCRIPTS
|
||||
sudo -u "$UNIXUSER" bash $SCRIPTS/kickstart.sh --reinstall-even-if-unsafe --non-interactive --no-updates --stable-channel --disable-cloud
|
||||
curl_to_dir https://get.netdata.cloud kickstart.sh $SCRIPTS
|
||||
bash $SCRIPTS/kickstart.sh --reinstall-even-if-unsafe --non-interactive --no-updates --stable-channel --disable-cloud
|
||||
rm -f $SCRIPTS/kickstart.sh
|
||||
|
||||
# Check Netdata instructions after script is done
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -39,16 +39,14 @@ then
|
||||
exit 1
|
||||
fi
|
||||
# Check TLS
|
||||
NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
|
||||
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
|
||||
check_nextcloud_https "Notify Push"
|
||||
|
||||
# Get the NCDOMAIN variable
|
||||
if [ -z "$NCDOMAIN" ]
|
||||
then
|
||||
msg_box "It seems like Nextcloud is not installed or that you don't use https on:
|
||||
$NCDOMAIN.
|
||||
Please install Nextcloud and make sure your domain is reachable, or activate TLS
|
||||
on your domain to be able to run this script.
|
||||
If you use the Nextcloud VM you can use the Let's Encrypt script to get TLS and activate your Nextcloud domain."
|
||||
exit 1
|
||||
ncdomain
|
||||
fi
|
||||
|
||||
# Check apache conf
|
||||
if ! [ -f "$SITES_AVAILABLE/$NCDOMAIN.conf" ]
|
||||
then
|
||||
|
||||
@ -31,6 +31,7 @@ else
|
||||
nextcloud_occ config:system:delete allow_local_remote_servers
|
||||
nextcloud_occ config:system:delete onlyoffice
|
||||
nextcloud_occ config:system:delete onlyoffice jwt_secret
|
||||
nextcloud_occ config:app:delete onlyoffice jwt_secret
|
||||
nextcloud_occ config:system:delete onlyoffice jwt_header
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
@ -151,8 +152,8 @@ a2enmod proxy_http
|
||||
a2enmod ssl
|
||||
a2enmod headers
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
@ -262,6 +263,7 @@ then
|
||||
# Allow remote servers with local addresses e.g. in federated shares, webcal services and more
|
||||
nextcloud_occ config:system:set allow_local_remote_servers --value="true"
|
||||
nextcloud_occ config:system:set onlyoffice jwt_secret --value="$ONLYOFFICE_SECRET"
|
||||
nextcloud_occ config:app:set onlyoffice jwt_secret --value="$ONLYOFFICE_SECRET"
|
||||
nextcloud_occ config:system:set onlyoffice jwt_header --value="AuthorizationJwt"
|
||||
# Add prune command
|
||||
add_dockerprune
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="OnlyOffice (Integrated)"
|
||||
@ -89,7 +89,7 @@ sleep 2
|
||||
if install_and_enable_app documentserver_community
|
||||
then
|
||||
chown -R www-data:www-data "$NC_APPS_PATH"
|
||||
nextcloud_occ config:app:set onlyoffice DocumentServerUrl --value="$(nextcloud_occ_no_check config:system:get overwrite.cli.url)index.php/apps/documentserver_community/"
|
||||
nextcloud_occ config:app:set onlyoffice DocumentServerUrl --value="$(nextcloud_occ_no_check config:system:get overwrite.cli.url)/index.php/apps/documentserver_community/"
|
||||
msg_box "OnlyOffice was successfully installed."
|
||||
else
|
||||
msg_box "The documentserver_community app failed to install. Please try again later.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -214,8 +214,8 @@ a2enmod proxy_http
|
||||
a2enmod ssl
|
||||
a2enmod headers
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# GNU General Public License v3.0
|
||||
# https://github.com/nextcloud/vm/blob/master/LICENSE
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Fix LEGACY Preview Generator"
|
||||
# shellcheck source=lib.sh
|
||||
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
|
||||
####### TEMPORARY 2023-04-01 #######
|
||||
|
||||
run_script APP imaginary
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Recognize for Nextcloud"
|
||||
@ -27,26 +27,6 @@ fi
|
||||
# Compatible with NC26 and above
|
||||
lowest_compatible_nc 26
|
||||
|
||||
# Check if suspicious_login are installed
|
||||
# https://github.com/nextcloud/recognize/issues/676
|
||||
if is_app_enabled suspicious_login
|
||||
then
|
||||
msg_box "Since you have the app Suspicious Login Detection installed, you can't install Recognize. The reason is that it will cause issues with cron.php.\nIf you choose 'No' the installer will exit"
|
||||
if yesno_box_no "Do you want to disable Suspicious Login to be able to install Recognize?"
|
||||
then
|
||||
nextcloud_occ app:disable suspicious_login
|
||||
if ! [ -f /etc/fail2ban/filter.d/nextcloud.conf ] || ! is_this_installed fail2ban
|
||||
then
|
||||
if yesno_box_yes "Do you want to install Fail2ban (IP blocking in Linux) instead?"
|
||||
then
|
||||
run_script APP fail2ban
|
||||
fi
|
||||
fi
|
||||
else
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if face-recognition is installed and ask to remove it
|
||||
if is_app_installed facerecognition
|
||||
then
|
||||
@ -58,7 +38,7 @@ then
|
||||
4. Install
|
||||
|
||||
We will run the uninstaller for you now, then exit."
|
||||
wget https://raw.githubusercontent.com/nextcloud/vm/master/old/face-recognition.sh && bash face-recognition.sh && rm -f face-recognition.sh
|
||||
wget https://raw.githubusercontent.com/nextcloud/vm/main/old/face-recognition.sh && bash face-recognition.sh && rm -f face-recognition.sh
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -77,7 +77,7 @@ then
|
||||
msg_box "All $MAX_COUNT slots are occupied. No mounting slots available. Please delete one of the SMB-mounts.
|
||||
If you really want to mount more, you can simply download the smb-mount script \
|
||||
directly and edit the variable 'MAX_COUNT' to a higher value than $MAX_COUNT by running:
|
||||
'curl -sLO https://raw.githubusercontent.com/nextcloud/vm/master/apps/smbmount.sh' # Download the script
|
||||
'curl -sLO https://raw.githubusercontent.com/nextcloud/vm/main/apps/smbmount.sh' # Download the script
|
||||
'nano smbmount.sh' # Edit MAX_COUNT=$MAX_COUNT to your likings and save the file
|
||||
'sudo bash smbmount.sh' # Execute the script." "$SUBTITLE"
|
||||
return
|
||||
@ -340,7 +340,7 @@ We please you to do the math yourself if the number is high enough for your setu
|
||||
fi
|
||||
|
||||
# Install the inotify PHP extension
|
||||
# https://github.com/icewind1991/files_inotify/blob/master/README.md
|
||||
# https://github.com/icewind1991/files_inotify/blob/main/README.md
|
||||
if ! pecl list | grep -q inotify
|
||||
then
|
||||
print_text_in_color "$ICyan" "Installing the PHP inotify extension..."
|
||||
|
||||
175
apps/talk.sh
175
apps/talk.sh
@ -1,12 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Nextcloud Talk"
|
||||
SCRIPT_EXPLAINER="This script installs Nextcloud Talk whcih is a replacement for Teams/Skype and similar.\
|
||||
You will also be offered the possibility to install the so-called High-Performance-Backend, which makes it possible to host more video calls than it would be with the standard Talk app. \
|
||||
It's called 'Talk Signaling' and you will be offered to install it as part two of this script."
|
||||
SCRIPT_EXPLAINER="This script installs Nextcloud Talk which is a replacement for Teams/Skype and similar.
|
||||
|
||||
You will also be offered the possibility to install the so-called High-Performance-Backend, which makes it possible to host more video calls than it would be with the standard Talk app.
|
||||
It's called 'Talk Signaling' and you will be offered to install it as part two of this script.
|
||||
|
||||
And last but not least, Talk Recording is also offered to be installed. It enables recording of sessions in Talk and it's part three of this script."
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
@ -33,29 +36,47 @@ else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
if [ -f "$SIGNALING_SERVER_CONF" ]
|
||||
then
|
||||
SUBDOMAIN=$(input_box_flow "Please enter the subdomain you were using for Talk Signaling, e.g: talk.yourdomain.com. This will be removed.")
|
||||
if [ -f "$CERTFILES/$SUBDOMAIN/cert.pem" ]
|
||||
then
|
||||
yes no | certbot revoke --cert-path "$CERTFILES/$SUBDOMAIN/cert.pem"
|
||||
REMOVE_OLD="$(find "$LETSENCRYPTPATH/" -name "$SUBDOMAIN*")"
|
||||
for remove in $REMOVE_OLD
|
||||
do rm -rf "$remove"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
sed "/# Talk Signaling Server/d" /etc/hosts >/dev/null 2>&1
|
||||
sed "/127.0.1.1 $SUBDOMAIN/d" /etc/hosts >/dev/null 2>&1
|
||||
systemctl stop nats-server
|
||||
systemctl disable nats-server
|
||||
deluser nats
|
||||
nextcloud_occ_no_check config:app:delete spreed stun_servers
|
||||
nextcloud_occ_no_check config:app:delete spreed turn_servers
|
||||
nextcloud_occ_no_check config:app:delete spreed signaling_servers
|
||||
nextcloud_occ_no_check config:app:delete spreed recording_servers
|
||||
nextcloud_occ_no_check app:remove spreed
|
||||
rm -rf \
|
||||
"$TURN_CONF" \
|
||||
"$SIGNALING_SERVER_CONF" \
|
||||
/etc/signaling \
|
||||
/etc/nats \
|
||||
/etc/janus \
|
||||
/etc/apt/trusted.gpg.d/morph027-janus.asc \
|
||||
/etc/apt/trusted.gpg.d/morph027-nats-server.asc \
|
||||
/etc/apt/trusted.gpg.d/morph027-nextcloud-spreed-signaling.asc \
|
||||
/etc/apt/trusted.gpg.d/morph027-coturn.asc \
|
||||
/etc/apt/keyrings/morph027-coturn.asc
|
||||
/etc/apt/sources.list.d/morph027-nextcloud-spreed-signaling.list\
|
||||
/etc/apt/keyrings/morph027-coturn.asc \
|
||||
/etc/apt/sources.list.d/morph027-nextcloud-spreed-signaling.list \
|
||||
/etc/apt/sources.list.d/morph027-janus.list \
|
||||
/etc/apt/sources.list.d/morph027-nats-server.list \
|
||||
/etc/apt/sources.list.d/morph027-coturn.list \
|
||||
$VMLOGS/talk_apache_error.log \
|
||||
$VMLOGS/talk_apache_access.log \
|
||||
$VMLOGS/turnserver.log \
|
||||
/lib/systemd/system/nats-server.service \
|
||||
"$VMLOGS"/talk_apache_error.log \
|
||||
"$VMLOGS"/talk_apache_access.log \
|
||||
"$VMLOGS"/turnserver.log \
|
||||
/var/www/html/error
|
||||
APPS=(coturn nats-server janus nextcloud-spreed-signaling)
|
||||
for app in "${APPS[@]}"
|
||||
@ -66,21 +87,23 @@ else
|
||||
fi
|
||||
done
|
||||
apt-get autoremove -y
|
||||
docker_prune_this nextcloud/aio-talk-recording
|
||||
docker_prune_this ghcr.io/nextcloud-releases/aio-talk-recording
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
fi
|
||||
|
||||
# Must be 22.04
|
||||
if ! version 20.04 "$DISTRO" 22.04.10
|
||||
# Must be 24.04
|
||||
if ! version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to install Talk"
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to install Talk"
|
||||
msg_box "Please contact us to get support for upgrading your server:
|
||||
https://www.hanssonit.se/#contact
|
||||
https://shop.hanssonit.se/"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Nextcloud 19 is required.
|
||||
# Nextcloud 20 is required.
|
||||
lowest_compatible_nc 20
|
||||
|
||||
####################### TALK (COTURN)
|
||||
@ -215,7 +238,7 @@ msg_box "You will now be presented with the option to install the Talk Signaling
|
||||
This aims to give you greater performance and ability to have more users in a call at the same time.
|
||||
|
||||
You can read more here:
|
||||
https://github.com/strukturag/nextcloud-spreed-signaling/blob/master/README.md
|
||||
https://github.com/strukturag/nextcloud-spreed-signaling/blob/main/README.md
|
||||
|
||||
We will use apt packages from https://gitlab.com/morph027 which is a trusted contributor to this repository.
|
||||
|
||||
@ -278,7 +301,48 @@ curl -sL -o "/etc/apt/trusted.gpg.d/morph027-nats-server.asc" "https://packaging
|
||||
echo "deb https://packaging.gitlab.io/nats-server nats main" > /etc/apt/sources.list.d/morph027-nats-server.list
|
||||
apt-get update -q4 & spinner_loading
|
||||
install_if_not nats-server
|
||||
getent passwd nats >/dev/null 2>&1 || adduser \
|
||||
--system \
|
||||
--shell /usr/sbin/nologin \
|
||||
--gecos 'High-Performance server for NATS, the cloud native messaging system.' \
|
||||
--group \
|
||||
--disabled-password \
|
||||
--no-create-home \
|
||||
nats
|
||||
|
||||
chown nats:nats /etc/nats/nats.conf
|
||||
|
||||
# Check if nats systemd service is in the package or not
|
||||
if [ ! -f "/lib/systemd/system/nats-server.service" ];
|
||||
then
|
||||
# Generate nats systemd service
|
||||
cat << NATS_SYSTEMD > /lib/systemd/system/nats-server.service
|
||||
[Unit]
|
||||
Description=NATS messaging server
|
||||
Documentation=https://docs.nats.io/nats-server/
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/nats-server --config /etc/nats/nats.conf
|
||||
User=nats
|
||||
Group=nats
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
NATS_SYSTEMD
|
||||
if [ -f "/lib/systemd/system/nats-server.service" ];
|
||||
then
|
||||
print_text_in_color "$IGreen" "NATS systemd service was successfully created."
|
||||
else
|
||||
print_text_in_color "$IRed" "Unable to create NATS systemd service , exiting..."
|
||||
print_text_in_color "$IRed" "Please report this issue here $ISSUES"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
print_text_in_color "$IGreen" "Nats systemd service is already in place, continuing"
|
||||
fi
|
||||
|
||||
start_if_stopped nats-server
|
||||
check_command systemctl enable nats-server
|
||||
|
||||
@ -319,24 +383,34 @@ then
|
||||
cat << SIGNALING_CONF_CREATE > "$SIGNALING_SERVER_CONF"
|
||||
[http]
|
||||
listen = 127.0.0.1:8081
|
||||
|
||||
[app]
|
||||
debug = false
|
||||
|
||||
[sessions]
|
||||
hashkey = $(openssl rand -hex 16)
|
||||
blockkey = $(openssl rand -hex 16)
|
||||
|
||||
[clients]
|
||||
internalsecret = $(openssl rand -hex 16)
|
||||
internalsecret = ${TURN_INTERNAL_SECRET}
|
||||
|
||||
[backend]
|
||||
allowed = ${TURN_DOMAIN}
|
||||
backends = backend-1
|
||||
allowall = false
|
||||
secret = ${NC_SECRET}
|
||||
timeout = 10
|
||||
connectionsperhost = 8
|
||||
|
||||
[backend-1]
|
||||
url = https://${TURN_DOMAIN}
|
||||
secret = ${SIGNALING_SECRET}
|
||||
|
||||
[nats]
|
||||
url = nats://localhost:4222
|
||||
url = nats://127.0.0.1:4222
|
||||
|
||||
[mcu]
|
||||
type = janus
|
||||
url = ws://127.0.0.1:8188
|
||||
|
||||
[turn]
|
||||
apikey = ${JANUS_API_KEY}
|
||||
secret = ${TURN_SECRET}
|
||||
@ -361,17 +435,17 @@ a2enmod headers
|
||||
a2enmod remoteip
|
||||
|
||||
# Allow CustomLog
|
||||
touch $VMLOGS/talk_apache_access.log
|
||||
touch $VMLOGS/talk_apache_error.log
|
||||
chown www-data:www-data $VMLOGS/talk_apache_error.log $VMLOGS/talk_apache_access.log
|
||||
touch "$VMLOGS"/talk_apache_access.log
|
||||
touch "$VMLOGS"/talk_apache_error.log
|
||||
chown root:adm "$VMLOGS"/talk_apache_*
|
||||
|
||||
# Prep the error page
|
||||
mkdir -p /var/www/html/error
|
||||
echo "Hi there! :) If you see this page, the Apache2 proxy for $SCRIPT_NAME is up and running." > /var/www/html/error/404_proxy.html
|
||||
chown -R www-data:www-data /var/www/html/error
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
@ -403,8 +477,8 @@ then
|
||||
|
||||
# Logs
|
||||
LogLevel warn
|
||||
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||
CustomLog $VMLOGS/talk_apache_access.log common
|
||||
ErrorLog $VMLOGS/talk_apache_error.log
|
||||
|
||||
# Just in case - see below
|
||||
SSLProxyEngine On
|
||||
@ -467,7 +541,7 @@ else
|
||||
fi
|
||||
|
||||
# Set signaling server strings
|
||||
SIGNALING_SERVERS_STRING="{\"servers\":[{\"server\":\"https://$SUBDOMAIN/\",\"verify\":true}],\"secret\":\"$NC_SECRET\"}"
|
||||
SIGNALING_SERVERS_STRING="{\"servers\":[{\"server\":\"https://$SUBDOMAIN/\",\"verify\":true}],\"secret\":\"$SIGNALING_SECRET\"}"
|
||||
nextcloud_occ config:app:set spreed signaling_servers --value="$SIGNALING_SERVERS_STRING" --output json
|
||||
|
||||
# Add to /etc/hosts
|
||||
@ -483,6 +557,51 @@ then
|
||||
msg_box "Installation failed. :/\n\nPlease run this script again to uninstall if you want to clean the system, or choose to reinstall if you want to try again.\n\nLogging can be found by typing: journalctl -lfu signaling"
|
||||
exit 1
|
||||
else
|
||||
msg_box "Congratulations, everything is working as intended! The installation succeeded.\n\nLogging can be found by typing: journalctl -lfu signaling"
|
||||
exit 0
|
||||
msg_box "Congratulations, everything is working as intended! The Talk Signaling installation succeeded.\n\nLogging can be found by typing: journalctl -lfu signaling"
|
||||
fi
|
||||
|
||||
####### Talk recording
|
||||
if ! yesno_box_yes "Do you want install Talk Recording to be able to record your calls?"
|
||||
then
|
||||
exit
|
||||
fi
|
||||
|
||||
# Nextcloud 26 is required.
|
||||
lowest_compatible_nc 26
|
||||
|
||||
# It's pretty recource intensive
|
||||
cpu_check 4 "Talk Recording"
|
||||
ram_check 4 "Talk Recording"
|
||||
|
||||
print_text_in_color "$ICyan" "Setting up Talk recording..."
|
||||
|
||||
# Pull and start
|
||||
docker pull ghcr.io/nextcloud-releases/aio-talk-recording:latest
|
||||
docker run -t -d -p "$TURN_RECORDING_HOST":"$TURN_RECORDING_HOST_PORT":"$TURN_RECORDING_HOST_PORT" \
|
||||
--restart always \
|
||||
--name talk-recording \
|
||||
--shm-size=2GB \
|
||||
-e NC_DOMAIN="${TURN_DOMAIN}" \
|
||||
-e HPB_DOMAIN="${SUBDOMAIN}" \
|
||||
-e HPB_PATH=/ \
|
||||
-e TZ="$(cat /etc/timezone)" \
|
||||
-e RECORDING_SECRET="${TURN_RECORDING_SECRET}" \
|
||||
-e INTERNAL_SECRET="${TURN_INTERNAL_SECRET}" \
|
||||
ghcr.io/nextcloud-releases/aio-talk-recording:latest
|
||||
|
||||
# Talk recording
|
||||
if [ -d "$NCPATH/apps/spreed" ]
|
||||
then
|
||||
if does_this_docker_exist ghcr.io/nextcloud-releases/aio-talk-recording
|
||||
then
|
||||
install_if_not netcat-traditional
|
||||
while ! nc -z "$TURN_RECORDING_HOST" "$TURN_RECORDING_HOST_PORT"
|
||||
do
|
||||
print_text_in_color "$ICyan" "Waiting for Talk Recording to become available..."
|
||||
sleep 5
|
||||
done
|
||||
# Set values in Nextcloud
|
||||
RECORDING_SERVERS_STRING="{\"servers\":[{\"server\":\"http://$TURN_RECORDING_HOST:$TURN_RECORDING_HOST_PORT/\",\"verify\":false}],\"secret\":\"$TURN_RECORDING_SECRET\"}"
|
||||
nextcloud_occ_no_check config:app:set spreed recording_servers --value="$RECORDING_SERVERS_STRING" --output json
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Bitwarden"
|
||||
@ -102,7 +102,6 @@ https://imgur.com/a/3ytwvp6"
|
||||
|
||||
# Install Docker
|
||||
install_docker
|
||||
install_if_not docker-compose
|
||||
|
||||
# Create bitwarden user
|
||||
if ! id "$BITWARDEN_USER" >/dev/null 2>&1
|
||||
@ -182,7 +181,7 @@ USERGROUPID=$(id -g $BITWARDEN_USER)
|
||||
sed -i "s|database_docker_volume:.*|database_docker_volume: true|g" "$BITWARDEN_HOME"/bwdata/config.yml
|
||||
sed -i "s|LOCAL_UID=.*|LOCAL_UID=$USERID|g" "$BITWARDEN_HOME"/bwdata/env/uid.env
|
||||
sed -i "s|LOCAL_GID=.*|LOCAL_GID=$USERGROUPID|g" "$BITWARDEN_HOME"/bwdata/env/uid.env
|
||||
# Get Subdomain from config.yml and change it to https
|
||||
# Get subdomain from config.yml and change it to https
|
||||
SUBDOMAIN=$(grep ^url "$BITWARDEN_HOME"/bwdata/config.yml)
|
||||
SUBDOMAIN=${SUBDOMAIN##*url: http://}
|
||||
sed -i "s|^url: .*|url: https://$SUBDOMAIN|g" "$BITWARDEN_HOME"/bwdata/config.yml
|
||||
@ -241,8 +240,8 @@ a2enmod ssl
|
||||
a2enmod headers
|
||||
a2enmod remoteip
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Vaultwarden (formerly Bitwarden RS)"
|
||||
@ -122,8 +122,8 @@ a2enmod ssl
|
||||
a2enmod headers
|
||||
a2enmod remoteip
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Vaultwarden (formerly Bitwarden RS) Admin Panel"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Webmin"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# https://wiki.archlinux.org/index.php/ZFS#Using_zfs-mount-generator
|
||||
# Tested on Ubuntu 20.04
|
||||
# Tested on Ubuntu 22.04
|
||||
|
||||
# This script came to life when we were having issues with importing the ZFS pool (ncdata) on Ubuntu 20.04.
|
||||
# This script came to life when we were having issues with importing the ZFS pool (ncdata) on Ubuntu 22.04.
|
||||
# After some forum reading and some digging on Github, this is the result.
|
||||
# The intention here is to make the import process more robust, and less prune to fail
|
||||
# Essentially, changing from 'zfs-mount.service' to 'zfs-mount-generator' which by many has been working better.
|
||||
@ -18,12 +18,12 @@ source /var/scripts/fetch_lib.sh
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
# Needs to be Ubuntu 20.04 and Multiverse
|
||||
# Needs to be Ubuntu 22.04 and Multiverse
|
||||
check_distro_version
|
||||
check_multiverse
|
||||
|
||||
# Import if missing and export again to import it with UUID
|
||||
# https://github.com/nextcloud/vm/blob/master/lib.sh#L1233
|
||||
# https://github.com/nextcloud/vm/blob/main/lib.sh#L1233
|
||||
# Set a different name for the pool (if used outside of this repo)
|
||||
# export POOLNAME=ncdata
|
||||
zpool_import_if_missing
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Create daily ZFS prune script"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Format Chosen Disk"
|
||||
@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
# Needs to be Ubuntu 20.04 and Multiverse
|
||||
# Needs to be Ubuntu 22.04 and Multiverse
|
||||
check_distro_version
|
||||
check_multiverse
|
||||
|
||||
@ -43,9 +43,13 @@ elif [ "$SYSVENDOR" == "Xen" ];
|
||||
then
|
||||
SYSNAME="Xen/XCP-NG"
|
||||
DEVTYPE=xvdb
|
||||
elif [[ "$SYSVENDOR" == "QEMU" || "$SYSVENDOR" == "Red Hat" ]];
|
||||
elif [[ "$SYSVENDOR" == "QEMU" ]];
|
||||
then
|
||||
SYSNAME="KVM/QEMU"
|
||||
SYSNAME="Proxmox/QEMU"
|
||||
DEVTYPE=sdb
|
||||
elif [ "$SYSVENDOR" == "Red Hat" ];
|
||||
then
|
||||
SYSNAME="Red Hat"
|
||||
DEVTYPE=vdb
|
||||
elif [ "$SYSVENDOR" == "DigitalOcean" ];
|
||||
then
|
||||
@ -99,7 +103,7 @@ while
|
||||
done
|
||||
[[ -z "${devtype_present+x}" ]]
|
||||
do
|
||||
printf "${BRed}$DEVTYPE is not a valid disk. Please try again.${Color_Off}\n"
|
||||
print_text_in_color "$BRed" "$DEVTYPE is not a valid disk. Please try again."
|
||||
:
|
||||
done
|
||||
|
||||
@ -172,13 +176,18 @@ then
|
||||
check_command zpool create -f -o ashift=12 "$POOLNAME" "$DISKTYPE"
|
||||
check_command zpool set failmode=continue "$POOLNAME"
|
||||
check_command zfs set mountpoint="$MOUNT_" "$POOLNAME"
|
||||
check_command zfs set compression=lz4 "$POOLNAME"
|
||||
check_command zfs set compression=zstd "$POOLNAME"
|
||||
check_command zfs set sync=standard "$POOLNAME"
|
||||
check_command zfs set xattr=sa "$POOLNAME"
|
||||
check_command zfs set primarycache=all "$POOLNAME"
|
||||
check_command zfs set atime=off "$POOLNAME"
|
||||
check_command zfs set recordsize=128k "$POOLNAME"
|
||||
check_command zfs set logbias=latency "$POOLNAME"
|
||||
if [ -d /sys/firmware/efi ]
|
||||
then
|
||||
# dnodesize can't boot on BIOS, only UEFI mode
|
||||
check_command zfs set dnodesize=auto "$POOLNAME"
|
||||
fi
|
||||
|
||||
else
|
||||
msg_box "It seems like /dev/$DEVTYPE does not exist.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Format sdb"
|
||||
@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh
|
||||
# Check if root
|
||||
root_check
|
||||
|
||||
# Needs to be Ubuntu 20.04 and Multiverse
|
||||
# Needs to be Ubuntu 22.04 and Multiverse
|
||||
check_distro_version
|
||||
check_multiverse
|
||||
|
||||
@ -43,9 +43,13 @@ elif [ "$SYSVENDOR" == "Xen" ];
|
||||
then
|
||||
SYSNAME="Xen/XCP-NG"
|
||||
DEVTYPE=xvdb
|
||||
elif [[ "$SYSVENDOR" == "QEMU" || "$SYSVENDOR" == "Red Hat" ]];
|
||||
elif [[ "$SYSVENDOR" == "QEMU" ]];
|
||||
then
|
||||
SYSNAME="KVM/QEMU"
|
||||
SYSNAME="Proxmox/QEMU"
|
||||
DEVTYPE=sdb
|
||||
elif [ "$SYSVENDOR" == "Red Hat" ];
|
||||
then
|
||||
SYSNAME="Red Hat"
|
||||
DEVTYPE=vdb
|
||||
elif [ "$SYSVENDOR" == "DigitalOcean" ];
|
||||
then
|
||||
@ -155,13 +159,18 @@ then
|
||||
check_command zpool create -f -o ashift=12 "$POOLNAME" "$DISKTYPE"
|
||||
check_command zpool set failmode=continue "$POOLNAME"
|
||||
check_command zfs set mountpoint="$MOUNT_" "$POOLNAME"
|
||||
check_command zfs set compression=lz4 "$POOLNAME"
|
||||
check_command zfs set compression=zstd "$POOLNAME"
|
||||
check_command zfs set sync=standard "$POOLNAME"
|
||||
check_command zfs set xattr=sa "$POOLNAME"
|
||||
check_command zfs set primarycache=all "$POOLNAME"
|
||||
check_command zfs set atime=off "$POOLNAME"
|
||||
check_command zfs set recordsize=128k "$POOLNAME"
|
||||
check_command zfs set logbias=latency "$POOLNAME"
|
||||
if [ -d /sys/firmware/efi ]
|
||||
then
|
||||
# dnodesize can't boot on BIOS, only UEFI mode
|
||||
check_command zfs set dnodesize=auto "$POOLNAME"
|
||||
fi
|
||||
|
||||
else
|
||||
msg_box "It seems like /dev/$DEVTYPE does not exist.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Prune ZFS Snapshots"
|
||||
@ -36,7 +36,7 @@ and avoid a fatal crash. Please check $VMLOGS/zfs_prune.log for the results."
|
||||
# On screen information
|
||||
msg_box "Your disk space is almost full (more than 70% or less than 100GB left).
|
||||
|
||||
To solve that, we will now delete ZFS snapshots older than 4 weeks
|
||||
To solve that, we will now delete ZFS snapshots older than 2 days.
|
||||
|
||||
The script will also delete everything in trashbin for all users to free up some space."
|
||||
countdown "To abort, please press CTRL+C within 10 seconds." 10
|
||||
@ -59,7 +59,7 @@ The script will also delete everything in trashbin for all users to free up some
|
||||
fi
|
||||
# Prune snapshots
|
||||
touch $VMLOGS/zfs_prune.log
|
||||
./zfs-prune-snapshots.sh 2d ncdata >> $VMLOGS/zfs_prune.log
|
||||
./zfs-prune-snapshots.sh 2d ncdata | tee -a $VMLOGS/zfs_prune.log
|
||||
# Create daily prune to avoid disk being full again
|
||||
if [ ! -f "$SCRIPTS/daily-zfs-prune.sh" ]
|
||||
then
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -114,7 +114,7 @@ then
|
||||
cat << SMART_NOTIFICATION > "$SCRIPTS/smart-notification.sh"
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -161,7 +161,7 @@ $SCRIPTS/smart-notification.sh -s (S/../.././01|L/../../6/02)" > /etc/smartd.con
|
||||
cat << SMART_NOTIFICATION > "$SCRIPTS/smart-notification.sh"
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,22 +0,0 @@
|
||||
# What is this folder about?
|
||||
This folder is only meant for storing GeoIP Legacy Databases which are used by the [geoip script](https://github.com/nextcloud/vm/blob/master/network/geoblock.sh).
|
||||
|
||||
All .dat files in this folder are from https://www.miyuru.lk/geoiplegacy and converted by Miyuru Sankalpa.
|
||||
|
||||
## How to add updated Database files in here?
|
||||
1. Check if the files were updated by Miyuru Sankalpa by visiting [twitter](https://twitter.com/miyurulk) or verifying the **Last Updated** tag on his [website](https://www.miyuru.lk/geoiplegacy)
|
||||
2. If the files were updated, download the newest [Maxmind Country IPv4](https://dl.miyuru.lk/geoip/maxmind/country/maxmind4.dat.gz) and [Maxmind Country IPv6](https://dl.miyuru.lk/geoip/maxmind/country/maxmind6.dat.gz) files
|
||||
3. Extract them
|
||||
4. Create a PR with those updated database files, add them to this folder and follow this naming scheme:
|
||||
|
||||
### Naming scheme:
|
||||
**for IPv4:**<br>
|
||||
`yyyy-mm-Maxmind-Country-IPv4.dat`<br>
|
||||
**for IPv6:**<br>
|
||||
`yyyy-mm-Maxmind-Country-IPv6.dat`<br>
|
||||
_(Year and month should be chosen based on when the files were updated by Sankalpa)_<br><br>
|
||||
**One example is:**<br>
|
||||
`2020-09-Maxmind-Country-IPv4.dat`<br>
|
||||
and<br>
|
||||
`2020-09-Maxmind-Country-IPv6.dat`<br>
|
||||
_(If the files were updated on September 2020 by Sankalpa)_
|
||||
@ -4,7 +4,7 @@ SCRIPT_NAME="Activate TLS"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
@ -115,19 +115,41 @@ fi
|
||||
# To get the correct version for the Apache conf file
|
||||
check_php
|
||||
|
||||
# Only add TLS 1.3 on Ubuntu later than 20.04
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
# Only add TLS 1.3 on Ubuntu later than 22.04
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
TLS13="+TLSv1.3"
|
||||
fi
|
||||
|
||||
# Fix zero file sizes
|
||||
# See https://github.com/nextcloud/server/issues/3056
|
||||
if version 22.04 "$DISTRO" 26.04.10
|
||||
if version 24.04 "$DISTRO" 26.04.10
|
||||
then
|
||||
SETENVPROXY="SetEnv proxy-sendcl 1"
|
||||
fi
|
||||
|
||||
# Install Brotli
|
||||
if version 24.04 "$DISTRO" 26.04.10
|
||||
then
|
||||
if ! [ -f /etc/apache2/conf-available/brotli.conf ]
|
||||
then
|
||||
# Install needed packaages
|
||||
install_if_not brotli
|
||||
|
||||
# Add the config
|
||||
{
|
||||
echo "# Brotli support"
|
||||
echo "<IfModule mod_brotli.c>"
|
||||
echo " AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/json application/x-font-ttf application/vnd.ms-fontobject image/x-icon"
|
||||
echo "</IfModule>"
|
||||
} > /etc/apache2/conf-available/brotli.conf
|
||||
|
||||
# Enable the config
|
||||
a2enmod brotli
|
||||
a2enconf brotli
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate nextcloud_tls_domain.conf
|
||||
if [ ! -f "$tls_conf" ]
|
||||
then
|
||||
@ -137,7 +159,7 @@ then
|
||||
cat << TLS_CREATE > "$tls_conf"
|
||||
<VirtualHost *:80>
|
||||
RewriteEngine On
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
|
||||
RewriteRule ^(.*)$ https://%{HTTP_HOST}\$1 [END,NE,R=permanent]
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
@ -156,7 +178,7 @@ then
|
||||
SSLEngine on
|
||||
SSLCompression off
|
||||
SSLProtocol -all +TLSv1.2 $TLS13
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
|
||||
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
|
||||
SSLHonorCipherOrder off
|
||||
SSLSessionTickets off
|
||||
ServerSignature off
|
||||
@ -166,33 +188,41 @@ then
|
||||
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Document root folder
|
||||
DocumentRoot $NCPATH
|
||||
|
||||
# The Nextcloud folder
|
||||
<Directory $NCPATH>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
### include all .htaccess
|
||||
Include $NCPATH/.htaccess
|
||||
Include $NCPATH/config/.htaccess
|
||||
Include $NCDATA/.htaccess
|
||||
###
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
Satisfy Any
|
||||
# This is to include all the Nextcloud rules due to that we use PHP-FPM and .htaccess aren't read
|
||||
Include $NCPATH/.htaccess
|
||||
</Directory>
|
||||
|
||||
# Deny access to your data directory
|
||||
<Directory $NCDATA>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# Deny access to the Nextcloud config folder
|
||||
<Directory $NCPATH/config/>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_dav.c>
|
||||
Dav off
|
||||
</IfModule>
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# The following lines prevent .htaccess and .htpasswd files from being
|
||||
# viewed by Web clients.
|
||||
# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# Disable HTTP TRACE method.
|
||||
TraceEnable off
|
||||
# Disable HTTP TRACK method.
|
||||
@ -207,8 +237,8 @@ then
|
||||
|
||||
### LOCATION OF CERT FILES ###
|
||||
|
||||
SSLCertificateChainFile $CERTFILES/$TLSDOMAIN/chain.pem
|
||||
SSLCertificateFile $CERTFILES/$TLSDOMAIN/cert.pem
|
||||
# SSLCertificateChainFile $CERTFILES/$TLSDOMAIN/chain.pem
|
||||
SSLCertificateFile $CERTFILES/$TLSDOMAIN/fullchain.pem
|
||||
SSLCertificateKeyFile $CERTFILES/$TLSDOMAIN/privkey.pem
|
||||
SSLOpenSSLConfCmd DHParameters $DHPARAMS_TLS
|
||||
</VirtualHost>
|
||||
@ -236,8 +266,11 @@ then
|
||||
if certbot certonly --manual --text --key-type ecdsa --renew-by-default --server https://acme-v02.api.letsencrypt.org/directory --no-eff-email --agree-tos --preferred-challenges dns --manual-auth-hook "$SCRIPTS"/deSEC/hook.sh --manual-cleanup-hook "$SCRIPTS"/deSEC/hook.sh -d "$DEDYNDOMAIN"
|
||||
then
|
||||
# Generate DHparams cipher
|
||||
if [ ! -f "$DHPARAMS_TLS" ]
|
||||
if [ -f "$DHPARAMS_TLS" ]
|
||||
then
|
||||
rm -f "$DHPARAMS_TLS"
|
||||
openssl dhparam -out "$DHPARAMS_TLS" 2048
|
||||
else
|
||||
openssl dhparam -out "$DHPARAMS_TLS" 2048
|
||||
fi
|
||||
# Choose which port for public access
|
||||
@ -296,8 +329,11 @@ else
|
||||
if [ -d "$CERTFILES" ]
|
||||
then
|
||||
# Generate DHparams cipher
|
||||
if [ ! -f "$DHPARAMS_TLS" ]
|
||||
if [ -f "$DHPARAMS_TLS" ]
|
||||
then
|
||||
rm -f "$DHPARAMS_TLS"
|
||||
openssl dhparam -out "$DHPARAMS_TLS" 2048
|
||||
else
|
||||
openssl dhparam -out "$DHPARAMS_TLS" 2048
|
||||
fi
|
||||
# Activate new config
|
||||
@ -317,7 +353,7 @@ Please consider showing them your gratitude:
|
||||
https://letsencrypt.org/become-a-sponsor/
|
||||
|
||||
If you want to contribute to these scripts, have a look here:
|
||||
https://github.com/nextcloud/vm/tree/master/lets-encrypt"
|
||||
https://github.com/nextcloud/vm/tree/main/lets-encrypt"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
|
||||
@ -4,7 +4,7 @@ SCRIPT_NAME="Test New Configuration"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
@ -34,8 +34,10 @@ then
|
||||
sed -i "s|env\[HOSTNAME\] = .*|env[HOSTNAME] = $(hostname -f)|g" "$PHP_POOL_DIR"/nextcloud.conf
|
||||
fi
|
||||
|
||||
# Set trusted domains
|
||||
run_script NETWORK trusted
|
||||
# Set the domain as trusted
|
||||
add_to_trusted_domains "$FQDOMAIN"
|
||||
nextcloud_occ config:system:set overwrite.cli.url --value="https://$FQDOMAIN"
|
||||
nextcloud_occ maintenance:update:htaccess
|
||||
|
||||
# Add crontab
|
||||
cat << CRONTAB > "$SCRIPTS/letsencryptrenew.sh"
|
||||
|
||||
350
lib.sh
350
lib.sh
@ -1,40 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# GNU General Public License v3.0
|
||||
# https://github.com/nextcloud/vm/blob/master/LICENSE
|
||||
# https://github.com/nextcloud/vm/blob/main/LICENSE
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
true
|
||||
# see https://github.com/koalaman/shellcheck/wiki/Directive
|
||||
|
||||
##### LEGACY #####
|
||||
## Remove 2022-09-01
|
||||
NCPATH=/var/www/nextcloud
|
||||
NCPASS=nextcloud
|
||||
NCUSER=ncadmin
|
||||
PGDB_USER=nextcloud_db_user
|
||||
if [ -f "$NCPATH"/config/config.php ]
|
||||
then
|
||||
NCCONFIGDBPASS="$(grep 'dbpassword' "$NCPATH"/config/config.php | awk '{print $3}' | sed "s/[',]//g")"
|
||||
NCCONFIGDB="$(grep 'dbname' "$NCPATH"/config/config.php | awk '{print $3}' | sed "s/[',]//g")"
|
||||
fi
|
||||
|
||||
|
||||
## VARIABLES
|
||||
|
||||
# Dirs
|
||||
SCRIPTS=/var/scripts
|
||||
NCPATH=/var/www/nextcloud
|
||||
HTML=/var/www
|
||||
NCPATH="$HTML"/nextcloud
|
||||
POOLNAME=ncdata
|
||||
NCDATA=/mnt/"$POOLNAME"
|
||||
SNAPDIR=/var/snap/spreedme
|
||||
GPGDIR=/tmp/gpg
|
||||
SHA256_DIR=/tmp/sha256
|
||||
BACKUP=/mnt/NCBACKUP
|
||||
RORDIR=/opt/es/
|
||||
OPNSDIR=/opt/opensearch
|
||||
NC_APPS_PATH=$NCPATH/apps
|
||||
VMLOGS=/var/log/nextcloud
|
||||
|
||||
@ -60,7 +45,6 @@ SYSVENDOR=$(cat /sys/devices/virtual/dmi/id/sys_vendor)
|
||||
# Network
|
||||
IFACE=$(ip r | grep "default via" | awk '{print $5}')
|
||||
IFACE2=$(ip -o link show | awk '{print $2,$9}' | grep 'UP' | cut -d ':' -f 1)
|
||||
REPO=$(grep "^deb " /etc/apt/sources.list | grep http | awk '{print $2}' | head -1)
|
||||
ADDRESS=$(hostname -I | cut -d ' ' -f 1)
|
||||
WANIP4=$(curl -s -k -m 5 -4 https://api64.ipify.org)
|
||||
INTERFACES="/etc/netplan/nextcloud.yaml"
|
||||
@ -70,8 +54,8 @@ INTERNET_DNS="9.9.9.9"
|
||||
# Default Quad9 DNS servers, overwritten by the systemd global DNS defined servers, if set
|
||||
DNS1="9.9.9.9"
|
||||
DNS2="149.112.112.112"
|
||||
NONO_PORTS=(22 25 53 80 443 1024 3012 3306 5178 5179 5432 7867 7983 8983 10000 8081 8443 9443 9000 9980 9090 9200 9600)
|
||||
# 9000 9980 9090 9200 9600 are local docker ports, don't remember if they are needed here or not.
|
||||
NONO_PORTS=(22 25 53 80 443 1024 3012 3306 5178 5179 5432 7867 7983 8983 10000 8081 8443 9443 9000 9980 9090 9200 9600 1234)
|
||||
# 9000 9980 9090 9200 9600 1234 are local docker ports, don't remember if they are needed here or not.
|
||||
use_global_systemd_dns() {
|
||||
if [ -f "/etc/systemd/resolved.conf" ]
|
||||
then
|
||||
@ -102,7 +86,7 @@ Confirm by pressing [ENTER]. Cancel by pressing [ESC]."
|
||||
MENU_GUIDE="Navigate with the [ARROW] keys and confirm by pressing [ENTER]. Cancel by pressing [ESC]."
|
||||
RUN_LATER_GUIDE="You can view this script later by running 'sudo bash $SCRIPTS/menu.sh'."
|
||||
# Repo
|
||||
GITHUB_REPO="https://raw.githubusercontent.com/nextcloud/vm/master"
|
||||
GITHUB_REPO="https://raw.githubusercontent.com/nextcloud/vm/main"
|
||||
STATIC="$GITHUB_REPO/static"
|
||||
LETS_ENC="$GITHUB_REPO/lets-encrypt"
|
||||
APP="$GITHUB_REPO/apps"
|
||||
@ -114,7 +98,6 @@ DISK="$GITHUB_REPO/disk"
|
||||
NETWORK="$GITHUB_REPO/network"
|
||||
VAGRANT_DIR="$GITHUB_REPO/vagrant"
|
||||
NOT_SUPPORTED_FOLDER="$GITHUB_REPO/not-supported"
|
||||
GEOBLOCKDAT="$GITHUB_REPO/geoblockdat"
|
||||
NCREPO="https://download.nextcloud.com/server/releases"
|
||||
ISSUES="https://github.com/nextcloud/vm/issues"
|
||||
# User information
|
||||
@ -146,9 +129,14 @@ nc_update() {
|
||||
NCVERSION=$(curl -s -m 900 $NCREPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' | sort --version-sort | tail -1)
|
||||
STABLEVERSION="nextcloud-$NCVERSION"
|
||||
NCMAJOR="${NCVERSION%%.*}"
|
||||
CURRENTMAJOR="${CURRENTVERSION%%.*}"
|
||||
NCBAD=$((NCMAJOR-2))
|
||||
NCNEXT="$((${CURRENTVERSION%%.*}+1))"
|
||||
}
|
||||
maxmind_geoip() {
|
||||
# shellcheck source=/dev/null
|
||||
source <(curl -sL https://shortio.hanssonit.se/t3vm7ro4CP)
|
||||
}
|
||||
# Set the hour for automatic updates. This would be 18:00 as only the hour is configurable.
|
||||
AUT_UPDATES_TIME="18"
|
||||
# Keys
|
||||
@ -164,17 +152,23 @@ HTTP_CONF="nextcloud_http_domain_self_signed.conf"
|
||||
# Collabora App
|
||||
HTTPS_CONF="$SITES_AVAILABLE/$SUBDOMAIN.conf"
|
||||
HTTP2_CONF="/etc/apache2/mods-available/http2.conf"
|
||||
# GeoBlock
|
||||
GEOBLOCK_MOD_CONF="/etc/apache2/conf-available/geoblock.conf"
|
||||
GEOBLOCK_MOD="/etc/apache2/mods-available/maxminddb.load"
|
||||
GEOBLOCK_DIR="/usr/share/GeoIP"
|
||||
# PHP-FPM
|
||||
PHPVER=8.1
|
||||
PHPVER=8.3
|
||||
PHP_FPM_DIR=/etc/php/$PHPVER/fpm
|
||||
PHP_INI=$PHP_FPM_DIR/php.ini
|
||||
PHP_POOL_DIR=$PHP_FPM_DIR/pool.d
|
||||
PHP_MODS_DIR=/etc/php/"$PHPVER"/mods-available
|
||||
opcache_interned_strings_buffer_value=24
|
||||
# Notify push
|
||||
NOTIFY_PUSH_SERVICE_PATH="/etc/systemd/system/notify_push.service"
|
||||
# Adminer
|
||||
ADMINERDIR=/usr/share/adminer
|
||||
ADMINER_CONF="$SITES_AVAILABLE/adminer.conf"
|
||||
ADMINER_CONF_PLUGIN="$ADMINERDIR/extra_plugins.php"
|
||||
# Redis
|
||||
REDIS_CONF=/etc/redis/redis.conf
|
||||
REDIS_SOCK=/var/run/redis/redis-server.sock
|
||||
@ -184,21 +178,23 @@ SPAMHAUS=/etc/spamhaus.wl
|
||||
ENVASIVE=/etc/apache2/mods-available/mod-evasive.load
|
||||
APACHE2=/etc/apache2/apache2.conf
|
||||
# Full text Search
|
||||
opensearch_install() {
|
||||
INDEX_USER=$(gen_passwd "$SHUF" '[:lower:]')
|
||||
OPNSREST=$(gen_passwd "$SHUF" "A-Za-z0-9")
|
||||
fulltextsearch_install() {
|
||||
FULLTEXTSEARCH_DIR="$SCRIPTS"/fulltextsearch
|
||||
NEXTCLOUD_INDEX=$(gen_passwd "$SHUF" '[:lower:]')
|
||||
ELASTIC_USER_PASSWORD=$(gen_passwd "$SHUF" '[:lower:]')
|
||||
FULLTEXTSEARCH_IMAGE_NAME=fulltextsearch_es01
|
||||
FULLTEXTSEARCH_SERVICE=nextcloud-fulltext-elasticsearch-worker.service
|
||||
# Gets the version from the latest tag here: https://github.com/docker-library/official-images/blob/master/library/elasticsearch
|
||||
FULLTEXTSEARCH_IMAGE_NAME_LATEST_TAG="$(curl -s -m 900 https://raw.githubusercontent.com/docker-library/official-images/refs/heads/master/library/elasticsearch | grep "Tags:" | head -1 | awk '{print $2}')"
|
||||
# Legacy, changed 2023-09-21
|
||||
DOCKER_IMAGE_NAME=es01
|
||||
# Legacy, not used at all
|
||||
RORDIR=/opt/es/
|
||||
OPNSDIR=/opt/opensearch
|
||||
nc_fts="ark74/nc_fts"
|
||||
opens_fts="opensearchproject/opensearch:1"
|
||||
opens_fts="opensearchproject/opensearch"
|
||||
fts_node="fts_os-node"
|
||||
}
|
||||
create_certs(){
|
||||
download_script APP opensearch_certs
|
||||
check_command sed -i "s|__NCDOMAIN__|$1|" "$SCRIPTS"/opensearch_certs.sh
|
||||
check_command mv "$SCRIPTS"/opensearch_certs.sh "$OPNSDIR"
|
||||
check_command cd "$OPNSDIR"
|
||||
check_command bash opensearch_certs.sh
|
||||
rm -f "$OPNSDIR"/opensearch_certs.sh
|
||||
}
|
||||
# Name in trusted_config
|
||||
ncdomain() {
|
||||
NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
|
||||
@ -209,10 +205,14 @@ turn_install() {
|
||||
TURN_PORT=3478
|
||||
TURN_DOMAIN=$(sudo -u www-data /var/www/nextcloud/occ config:system:get overwrite.cli.url | sed 's|https://||;s|/||')
|
||||
SHUF=$(shuf -i 25-29 -n 1)
|
||||
TURN_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
|
||||
JANUS_API_KEY=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
|
||||
NC_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9@#*")
|
||||
TURN_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9")
|
||||
JANUS_API_KEY=$(gen_passwd "$SHUF" "a-zA-Z0-9")
|
||||
SIGNALING_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9")
|
||||
SIGNALING_SERVER_CONF=/etc/signaling/server.conf
|
||||
TURN_INTERNAL_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9")
|
||||
TURN_RECORDING_SECRET=$(gen_passwd "$SHUF" "a-zA-Z0-9")
|
||||
TURN_RECORDING_HOST=127.0.0.1
|
||||
TURN_RECORDING_HOST_PORT=1234
|
||||
}
|
||||
|
||||
## FUNCTIONS
|
||||
@ -390,60 +390,68 @@ something is wrong here. Please report this to $ISSUES"
|
||||
fi
|
||||
}
|
||||
|
||||
metadefender-scan() {
|
||||
# Usage:
|
||||
# metadefender-scan.sh $PATH $APIKEY, for example:
|
||||
hash="$(sha256sum "$1")"
|
||||
hash="${hash%% *}"
|
||||
apikey=7283aa9bbcee83132506659a4e5675bb
|
||||
curl "https://api.metadefender.com/v4/hash/$hash" -H "apikey: $apikey"
|
||||
}
|
||||
|
||||
# Used in geoblock.sh
|
||||
get_newest_dat_files() {
|
||||
# IPv4
|
||||
IPV4_NAME=$(curl -s https://github.com/nextcloud/vm/tree/master/geoblockdat \
|
||||
| grep -oP '202[0-9]-[01][0-9]-Maxmind-Country-IPv4\.dat' | sort -r | head -1)
|
||||
if [ -z "$IPV4_NAME" ]
|
||||
download_geoip_mmdb() {
|
||||
# Rate limit to 1 hour, we have 24 requests per day
|
||||
if [ -f "$GEOBLOCK_DIR/IPInfo-Country.mmdb" ]
|
||||
then
|
||||
print_text_in_color "$IRed" "Could not get the latest IPv4 name. Not updating the .dat file"
|
||||
sleep 1
|
||||
else
|
||||
if ! [ -f "$SCRIPTS/$IPV4_NAME" ]
|
||||
if [ "$(( $(date +"%s") - $(stat -c "%Y" "$GEOBLOCK_DIR/IPInfo-Country.mmdb") ))" -lt "3600" ]
|
||||
then
|
||||
print_text_in_color "$ICyan" "Downloading new IPv4 dat file..."
|
||||
sleep 1
|
||||
curl_to_dir "$GEOBLOCKDAT" "$IPV4_NAME" "$SCRIPTS"
|
||||
mkdir -p /usr/share/GeoIP
|
||||
rm -f /usr/share/GeoIP/GeoIP.dat
|
||||
check_command cp "$SCRIPTS/$IPV4_NAME" /usr/share/GeoIP
|
||||
check_command mv "/usr/share/GeoIP/$IPV4_NAME" /usr/share/GeoIP/GeoIP.dat
|
||||
chown root:root /usr/share/GeoIP/GeoIP.dat
|
||||
chmod 644 /usr/share/GeoIP/GeoIP.dat
|
||||
find /var/scripts -type f -regex \
|
||||
"$SCRIPTS/202[0-9]-[01][0-9]-Maxmind-Country-IPv4\.dat" -not -name "$IPV4_NAME" -delete
|
||||
else
|
||||
print_text_in_color "$ICyan" "The latest IPv4 dat file is already downloaded."
|
||||
sleep 1
|
||||
print_text_in_color "$IGreen" "No need to update $GEOBLOCK_DIR/IPInfo-Country.mmdb since it's newer than 1 hour."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
# IPv6
|
||||
IPV6_NAME=$(curl -s https://github.com/nextcloud/vm/tree/master/geoblockdat \
|
||||
| grep -oP '202[0-9]-[01][0-9]-Maxmind-Country-IPv6\.dat' | sort -r | head -1)
|
||||
if [ -z "$IPV6_NAME" ]
|
||||
elif [ -f "$GEOBLOCK_DIR/GeoLite2-Country.mmdb" ]
|
||||
then
|
||||
print_text_in_color "$IRed" "Could not get the latest IPv6 name. Not updating the .dat file"
|
||||
sleep 1
|
||||
else
|
||||
if ! [ -f "$SCRIPTS/$IPV6_NAME" ]
|
||||
then
|
||||
print_text_in_color "$ICyan" "Downloading new IPv6 dat file..."
|
||||
sleep 1
|
||||
curl_to_dir "$GEOBLOCKDAT" "$IPV6_NAME" "$SCRIPTS"
|
||||
mkdir -p /usr/share/GeoIP
|
||||
rm -f /usr/share/GeoIP/GeoIPv6.dat
|
||||
check_command cp "$SCRIPTS/$IPV6_NAME" /usr/share/GeoIP
|
||||
check_command mv "/usr/share/GeoIP/$IPV6_NAME" /usr/share/GeoIP/GeoIPv6.dat
|
||||
chown root:root /usr/share/GeoIP/GeoIPv6.dat
|
||||
chmod 644 /usr/share/GeoIP/GeoIPv6.dat
|
||||
find /var/scripts -type f -regex \
|
||||
"$SCRIPTS/202[0-9]-[01][0-9]-Maxmind-Country-IPv6\.dat" -not -name "$IPV6_NAME" -delete
|
||||
else
|
||||
print_text_in_color "$ICyan" "The latest IPv6 dat file is already downloaded."
|
||||
sleep 1
|
||||
fi
|
||||
print_text_in_color "$ICyan" "Replacing Maxmind with IPInfo GeoIP database..."
|
||||
fi
|
||||
|
||||
# Download or update current GeoIP DB
|
||||
maxmind_geoip
|
||||
export x8v8GyVQg2UejdPh
|
||||
print_text_in_color "$ICyan" "Downloading latest GeoIP database from https://ipinfo.io..."
|
||||
if ! curl -sfL https://ipinfo.io/data/free/country.mmdb?token="$x8v8GyVQg2UejdPh" -o "$GEOBLOCK_DIR"/IPInfo-Country.mmdb
|
||||
then
|
||||
print_text_in_color "$IRed" "Failed downloading GeoIP database from IPInfo, trying plan B..."
|
||||
export MwKfcYATm43NMT
|
||||
export i9HL69SLnp4ymy
|
||||
{
|
||||
echo "GEOIPUPDATE_ACCOUNT_ID=$MwKfcYATm43NMT"
|
||||
echo "GEOIPUPDATE_LICENSE_KEY=$i9HL69SLnp4ymy"
|
||||
echo "GEOIPUPDATE_EDITION_IDS=GeoLite2-Country"
|
||||
echo "GEOIPUPDATE_FREQUENCY=0"
|
||||
echo "GEOIPUPDATE_PRESERVE_FILE_TIMES=1"
|
||||
echo "GEOIPUPDATE_VERBOSE=1"
|
||||
} > /tmp/dockerenv
|
||||
unset MwKfcYATm43NMT
|
||||
unset i9HL69SLnp4ymy
|
||||
install_docker
|
||||
if docker run --name maxmind --env-file /tmp/dockerenv -v "$GEOBLOCK_DIR":"$GEOBLOCK_DIR" ghcr.io/maxmind/geoipupdate
|
||||
then
|
||||
docker rm -f maxmind
|
||||
rm -f /tmp/dockerenv
|
||||
# Since only one mmdb file can exist at the same time due to Apache "if" confitions, remove IPInfos config
|
||||
rm -f "$GEOBLOCK_DIR"/IPInfo-Country.mmdb
|
||||
print_text_in_color "$IGreen" "Maxmind GeoIP database downloaded!"
|
||||
else
|
||||
docker rm -f maxmind
|
||||
rm -f /tmp/dockerenv
|
||||
print_text_in_color "$IRed" "Rate limit for Maxmind GeoIP database reached! Can't continue from here, please report this to $ISSUES"
|
||||
fi
|
||||
else
|
||||
# Since only one mmdb file can exist at the same time due to Apache "if" confitions, remove MaxMinds config
|
||||
rm -f "$GEOBLOCK_DIR"/GeoLite2-Country.mmdb
|
||||
return 0
|
||||
fi
|
||||
unset x8v8GyVQg2UejdPh
|
||||
}
|
||||
|
||||
# Check if process is runnnig: is_process_running dpkg
|
||||
@ -467,19 +475,28 @@ done
|
||||
check_running_cronjobs() {
|
||||
while [ -n "$(pgrep -f nextcloud/cron.php)" ]
|
||||
do
|
||||
countdown "Waiting for the Nextcloud cronjob to finish..." "30"
|
||||
# Check if virus scan is running, could take ages for it to finish...
|
||||
if ! pgrep -f clamd
|
||||
then
|
||||
# If not running, then keep waiting
|
||||
countdown "Waiting for the Nextcloud cronjob to finish..." "30"
|
||||
else
|
||||
# If virus scan is running, then wait a bit longer, and kill it to release cron.php
|
||||
countdown "Waiting for the Nextcloud cronjob and virusscan to finish..." "120"
|
||||
pkill -f clamd
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Checks if site is reachable with a HTTP 200 status
|
||||
site_200() {
|
||||
print_text_in_color "$ICyan" "Checking connection..."
|
||||
print_text_in_color "$ICyan" "Checking connection to ${1}..."
|
||||
CURL_STATUS="$(curl -LI "${1}" -o /dev/null -w '%{http_code}\n' -s)"
|
||||
if [[ "$CURL_STATUS" = "200" ]]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
print_text_in_color "$IRed" "curl didn't produce a 200 status, is ${1} reachable?"
|
||||
msg_box "curl didn't produce a 200 status, is ${1} reachable? Please report this to $ISSUES."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@ -504,7 +521,8 @@ You can use this site to check if the IP seems correct: https://www.whatsmydns.n
|
||||
fi
|
||||
|
||||
# Is the DNS record same as the external IP address of the server?
|
||||
if dig +short "${1}" @resolver1.opendns.com | grep -q "$WANIP4"
|
||||
DIG="$(dig +short "${1}" @resolver1.opendns.com)"
|
||||
if [ "$DIG" = "$WANIP4" ]
|
||||
then
|
||||
print_text_in_color "$IGreen" "DNS seems correct when checking with dig!"
|
||||
else
|
||||
@ -704,10 +722,10 @@ version(){
|
||||
|
||||
[[ $2 != "$h" && $2 != "$t" ]]
|
||||
}
|
||||
if ! version 20.04 "$DISTRO" 22.04.10
|
||||
if ! version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
print_text_in_color "$IRed" "Your current Ubuntu version is $DISTRO but must be between \
|
||||
20.04 - 22.04.10 to run this script."
|
||||
22.04 - 24.04.10 to run this script."
|
||||
print_text_in_color "$ICyan" "Please contact us for support upgrading your server:"
|
||||
print_text_in_color "$ICyan" "https://www.hanssonit.se/#contact"
|
||||
print_text_in_color "$ICyan" "https://shop.hanssonit.se/"
|
||||
@ -759,27 +777,37 @@ fi
|
||||
|
||||
# Check if Nextcloud is installed with TLS
|
||||
check_nextcloud_https() {
|
||||
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
|
||||
if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https"
|
||||
then
|
||||
# Check if it's used by any of the Documentserver apps and adopt the message to that
|
||||
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
|
||||
then
|
||||
if [ "$1" == 'Collabora (Docker)' ] || [ "$1" == 'OnlyOffice (Docker)' ]
|
||||
ncdomain
|
||||
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
|
||||
then
|
||||
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
|
||||
You can easily activate TLS (HTTPS) by running the Let's Encrypt script.
|
||||
More info here: https://bit.ly/37wRCin
|
||||
More info here: http://shortio.hanssonit.se/1EAgBmPyFc
|
||||
|
||||
To run this script again, just exectue 'sudo bash $SCRIPTS/menu.sh' and choose:
|
||||
Additional Apps --> Documentserver --> $1."
|
||||
exit
|
||||
else
|
||||
fi
|
||||
else
|
||||
# Adopt the error message to anything else but the Documentserver apps
|
||||
ncdomain
|
||||
if ! curl -s https://"$NCDOMAIN"/status.php | grep -q 'installed":true'
|
||||
then
|
||||
msg_box "Sorry, but Nextcloud needs to be run on HTTPS.
|
||||
You can easily activate TLS (HTTPS) by running the Let's Encrypt script.
|
||||
More info here: https://bit.ly/37wRCin
|
||||
More info here: http://shortio.hanssonit.se/1EAgBmPyFc
|
||||
|
||||
To run this script again, just exectue 'sudo bash $SCRIPTS/menu.sh' and choose:
|
||||
Additional Apps --> $1."
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
restart_webserver() {
|
||||
@ -841,7 +869,7 @@ local standalone="certbot certonly --standalone --pre-hook \"systemctl stop apa
|
||||
#tls-alpn-01
|
||||
local tls_alpn_01="certbot certonly --preferred-challenges tls-alpn-01 $default_le"
|
||||
#dns
|
||||
local dns="certbot certonly --manual --manual-public-ip-logging-ok --preferred-challenges dns $default_le"
|
||||
local dns="certbot certonly --manual --preferred-challenges dns $default_le"
|
||||
local methods=(standalone dns)
|
||||
|
||||
for f in "${methods[@]}"
|
||||
@ -1074,16 +1102,16 @@ remove_from_trusted_domains() {
|
||||
}
|
||||
|
||||
check_distro_version() {
|
||||
# Subṕport Ubuntu 22.0.4 jammy, and Ubuntu 20.04 focal.
|
||||
# Support Ubuntu 22.04 jammy, and Ubuntu 24.04 noble.
|
||||
|
||||
# Check Ubuntu version
|
||||
if [ "${CODENAME}" == "jammy" ] || [ "${CODENAME}" == "focal" ]
|
||||
if [ "${CODENAME}" == "jammy" ] || [ "${CODENAME}" == "noble" ]
|
||||
then
|
||||
OS=1
|
||||
elif lsb_release -i | grep -ic "Ubuntu" &> /dev/null
|
||||
then
|
||||
OS=1
|
||||
elif uname -a | grep -ic "jammy" &> /dev/null || uname -a | grep -ic "focal" &> /dev/null
|
||||
elif uname -a | grep -ic "jammy" &> /dev/null || uname -a | grep -ic "noble" &> /dev/null
|
||||
then
|
||||
OS=1
|
||||
elif uname -v | grep -ic "Ubuntu" &> /dev/null
|
||||
@ -1100,8 +1128,8 @@ You can find the download link here: https://www.ubuntu.com/download/server"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! version 20.04 "$DISTRO" 22.04.10; then
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to run this script."
|
||||
if ! version 22.04 "$DISTRO" 24.04.10; then
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to run this script."
|
||||
msg_box "Please contact us to get support for upgrading your server:
|
||||
https://www.hanssonit.se/#contact
|
||||
https://shop.hanssonit.se/product/upgrade-ubuntu-os-between-major-versions/"
|
||||
@ -1132,6 +1160,12 @@ fi
|
||||
install_if_not() {
|
||||
if ! dpkg-query -W -f='${Status}' "${1}" | grep -q "ok installed"
|
||||
then
|
||||
# https://askubuntu.com/questions/1235914/hash-sum-mismatch-error-due-to-identical-sha1-and-md5-but-different-sha256#1242739
|
||||
#if ! -f /etc/gcrypt/hwf.deny ]
|
||||
#then
|
||||
# mkdir -p /etc/gcrypt
|
||||
# echo all > /etc/gcrypt/hwf.deny
|
||||
#fi
|
||||
apt-get update -q4 & spinner_loading && RUNLEVEL=1 apt-get install "${1}" -y
|
||||
fi
|
||||
}
|
||||
@ -1200,14 +1234,37 @@ $ISSUES and include the output of the error message. Thank you!" \
|
||||
fi
|
||||
}
|
||||
|
||||
# Example: nextcloud_occ 'maintenance:mode --on'
|
||||
|
||||
# Example: nextcloud_occ_no_check 'maintenance:mode --on'
|
||||
nextcloud_occ() {
|
||||
check_command sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
# Check it maintenance:mode is enabled
|
||||
if sudo -u www-data php "$NCPATH"/occ maintenance:mode | grep -q enabled >/dev/null 2>&1
|
||||
then
|
||||
# Disable maintenance:mode
|
||||
sudo -u www-data php "$NCPATH"/occ maintenance:mode --off >/dev/null 2>&1
|
||||
# Run the actual command
|
||||
check_command sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
# Enable maintenance:mode again
|
||||
sudo -u www-data php "$NCPATH"/occ maintenance:mode --on >/dev/null 2>&1
|
||||
else
|
||||
check_command sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
fi
|
||||
}
|
||||
|
||||
# Example: nextcloud_occ_no_check 'maintenance:mode --on'
|
||||
nextcloud_occ_no_check() {
|
||||
sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
# Check it maintenance:mode is enabled
|
||||
if sudo -u www-data php "$NCPATH"/occ maintenance:mode | grep -q enabled >/dev/null 2>&1
|
||||
then
|
||||
# Disable maintenance:mode
|
||||
sudo -u www-data php "$NCPATH"/occ maintenance:mode --off >/dev/null 2>&1
|
||||
# Run the actual command
|
||||
sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
# Enable maintenance:mode again
|
||||
sudo -u www-data php "$NCPATH"/occ maintenance:mode --on >/dev/null 2>&1
|
||||
else
|
||||
sudo -u www-data php "$NCPATH"/occ "$@";
|
||||
fi
|
||||
}
|
||||
|
||||
# Backwards compatibility (2020-10-08)
|
||||
@ -1231,7 +1288,7 @@ version(){
|
||||
|
||||
[[ $2 != "$h" && $2 != "$t" ]]
|
||||
}
|
||||
if version 20.04 "$DISTRO" 22.04.10
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
print_text_in_color "$ICyan" "Testing if network is OK..."
|
||||
if site_200 github.com
|
||||
@ -1256,7 +1313,7 @@ then
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 20.04 - 22.04.10 to run this script."
|
||||
msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to run this script."
|
||||
msg_box "Please contact us to get support for upgrading your server:
|
||||
https://www.hanssonit.se/#contact
|
||||
https://shop.hanssonit.se/"
|
||||
@ -1359,7 +1416,7 @@ fi
|
||||
print_text_in_color "$ICyan" "Checking SHA256 checksum..."
|
||||
mkdir -p "$SHA256_DIR"
|
||||
curl_to_dir "$NCREPO" "$STABLEVERSION.tar.bz2.sha256" "$SHA256_DIR"
|
||||
SHA256SUM="$(tail "$SHA256_DIR"/"$STABLEVERSION".tar.bz2.sha256 | awk '{print$1}')"
|
||||
SHA256SUM="$(tail "$SHA256_DIR"/"$STABLEVERSION".tar.bz2.sha256 | awk '{print$1}' | head -1)"
|
||||
if ! echo "$SHA256SUM" "$STABLEVERSION.tar.bz2" | sha256sum -c
|
||||
then
|
||||
msg_box "The SHA256 checksums of $STABLEVERSION.tar.bz2 didn't match, please try again."
|
||||
@ -1428,7 +1485,7 @@ If it still fails, please report this issue to: $ISSUES."
|
||||
fi
|
||||
}
|
||||
|
||||
# Run any script in ../master
|
||||
# Run any script in ../main
|
||||
# call like: run_main_script name_of_script
|
||||
run_main_script() {
|
||||
run_script GITHUB_REPO "${1}"
|
||||
@ -1476,7 +1533,7 @@ any_key() {
|
||||
|
||||
lowest_compatible_nc() {
|
||||
# .ocdata needs to exist to be able to check version, occ relies on everytihgn working
|
||||
until [ -f "$NCDATA"/.ocdata ]
|
||||
until [ -f "$NCDATA"/.ocdata ] || [ -f "$NCDATA"/.ncdata ]
|
||||
do
|
||||
# SUPPORT LEGACY: If it's not in the standard path, check for existing datadir in config.php
|
||||
if [ -f "$NCPATH"/config/config.php ]
|
||||
@ -1489,7 +1546,7 @@ do
|
||||
If you think this is a bug, please report it to $ISSUES"
|
||||
else
|
||||
# Check again an break if found
|
||||
if [ -f "$NCDATA"/.ocdata ]
|
||||
if [ -f "$NCDATA"/.ocdata ] || [ -f "$NCDATA"/.ncdata ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
@ -1520,7 +1577,7 @@ or experience other issues then please report this to $ISSUES"
|
||||
|
||||
# Download the latest updater
|
||||
# cd $NCPATH
|
||||
# curl sLO https://github.com/nextcloud/updater/archive/master.zip
|
||||
# curl sLO https://github.com/nextcloud/updater/archive/main.zip
|
||||
# install_if_not unzip
|
||||
# unzip -q master.zip
|
||||
# rm master.zip*
|
||||
@ -1541,10 +1598,8 @@ fi
|
||||
|
||||
# Check new version
|
||||
# shellcheck source=lib.sh
|
||||
if [ -z "$NCVERSION" ]
|
||||
then
|
||||
nc_update
|
||||
fi
|
||||
source /var/scripts/fetch_lib.sh
|
||||
nc_update
|
||||
if [ "${CURRENTVERSION%%.*}" -ge "$1" ]
|
||||
then
|
||||
sleep 1
|
||||
@ -1712,10 +1767,11 @@ then
|
||||
"storage-driver": "overlay2"
|
||||
}
|
||||
OVERLAY2
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker.service
|
||||
# Only restart if changed
|
||||
systemctl daemon-reload
|
||||
systemctl restart docker.service
|
||||
fi
|
||||
}
|
||||
|
||||
# Remove all dockers excluding one
|
||||
@ -1739,15 +1795,22 @@ fi
|
||||
}
|
||||
|
||||
# Remove selected Docker image
|
||||
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'nextcloud/aio-imaginary'
|
||||
# docker_prune_this 'collabora/code' 'onlyoffice/documentserver' 'ark74/nc_fts' 'imaginary'
|
||||
docker_prune_this() {
|
||||
if does_this_docker_exist "$1"
|
||||
then
|
||||
if yesno_box_yes "Do you want to remove $1?"
|
||||
then
|
||||
docker stop "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
|
||||
docker rm "$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)" --volumes
|
||||
CONTAINER="$(docker container ls -a | grep "$1" | awk '{print $1}' | tail -1)"
|
||||
if [ -z "$CONTAINER" ]
|
||||
then
|
||||
# Special solution if the container name is scrambled, then search for the actual name instead
|
||||
CONTAINER="$(docker container ls -a | grep "$2" | awk '{print $1}' | tail -1)"
|
||||
fi
|
||||
docker stop "$CONTAINER"
|
||||
docker rm "$CONTAINER"
|
||||
docker image prune -a -f
|
||||
docker system prune -a -f
|
||||
else
|
||||
msg_box "OK, this script will now exit, but there's still leftovers to cleanup. You can run it again at any time."
|
||||
exit
|
||||
@ -1791,19 +1854,21 @@ fi
|
||||
docker_update_specific() {
|
||||
if is_docker_running && docker ps -a --format "{{.Names}}" | grep -q "^$1$"
|
||||
then
|
||||
docker run --rm --name temporary_watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --run-once "$1"
|
||||
print_text_in_color "$IGreen" "$2 docker image just got updated!"
|
||||
echo "Docker image just got updated! We just updated $2 docker image automatically! $(date +%Y%m%d)" >> "$VMLOGS"/update.log
|
||||
if docker run --rm --name temporary_watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --run-once "$1"
|
||||
then
|
||||
print_text_in_color "$IGreen" "$2 docker image just got updated!"
|
||||
echo "Docker image just got updated! We just updated $2 docker image automatically! $(date +%Y%m%d)" >> "$VMLOGS"/update.log
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# docker-compose_update 'fts_os-node' 'Full Text Search' "$OPNSDIR"
|
||||
# docker-compose_update 'fulltextsearch-elasticsearch' 'Full Text Search' "$FTSDIR"
|
||||
# (docker conainter name = $1, the name in text = $2 , docker-compose directory = $3)
|
||||
docker-compose_update() {
|
||||
if is_docker_running && docker ps -a --format "{{.Names}}" | grep -q "^$1$"
|
||||
then
|
||||
cd "$3"
|
||||
docker-compose pull
|
||||
docker-compose up -d --remove-orphans
|
||||
docker compose pull
|
||||
docker compose up -d --remove-orphans
|
||||
docker image prune -a -f
|
||||
print_text_in_color "$IGreen" "$2 docker image just got updated!"
|
||||
echo "Docker image just got updated! We just updated $2 docker image automatically! $(date +%Y%m%d)" >> "$VMLOGS"/update.log
|
||||
@ -1826,10 +1891,14 @@ printf "%b%s%b\n" "$1" "$2" "$Color_Off"
|
||||
}
|
||||
|
||||
# Apply patch
|
||||
# git_apply_patch 15992 server 16.0.2
|
||||
# App:
|
||||
# git_apply_patch "319" "fulltextsearch_elasticsearch" "27.1.1" "$NCPATH/apps/fulltextsearch_elasticsearch"
|
||||
# Server:
|
||||
# git_apply_patch "15992" "server" "16.0.2" "$NCPATH"
|
||||
# 1 = pull
|
||||
# 2 = repository
|
||||
# Nextcloud version
|
||||
# 3 = Nextcloud version
|
||||
# 4 = Folder on system
|
||||
git_apply_patch() {
|
||||
if [ -z "$NCVERSION" ]
|
||||
then
|
||||
@ -1839,7 +1908,7 @@ if [[ "$CURRENTVERSION" = "$3" ]]
|
||||
then
|
||||
curl_to_dir "https://patch-diff.githubusercontent.com/raw/nextcloud/${2}/pull" "${1}.patch" "/tmp"
|
||||
install_if_not git
|
||||
cd "$NCPATH"
|
||||
cd "${4}"
|
||||
if git apply --check /tmp/"${1}".patch >/dev/null 2>&1
|
||||
then
|
||||
print_text_in_color "$IGreen" "Applying patch https://github.com/nextcloud/${2}/pull/${1} ..."
|
||||
@ -1967,7 +2036,7 @@ zpool_import_if_missing() {
|
||||
# ZFS needs to be installed
|
||||
if ! is_this_installed zfsutils-linux
|
||||
then
|
||||
print_text_in_color "$IRed" "This function is only intened to be run if you have ZFS installed."
|
||||
print_text_in_color "$IRed" "This function is only intended to be run if you have ZFS installed."
|
||||
return 1
|
||||
elif [ -z "$POOLNAME" ]
|
||||
then
|
||||
@ -1998,7 +2067,7 @@ fi
|
||||
check_free_space() {
|
||||
if vgs &>/dev/null
|
||||
then
|
||||
FREE_SPACE=$(vgs | grep ubuntu-vg | awk '{print $7}' | grep g | grep -oP "[0-9]+[\.,][0-9]" | sed 's|\.||')
|
||||
FREE_SPACE=$(vgs | grep ubuntu-vg | awk '{print $7}' | grep g | grep -oP "[0-9]+[\.,][0-9]" | sed 's|[.,]||')
|
||||
fi
|
||||
if [ -z "$FREE_SPACE" ]
|
||||
then
|
||||
@ -2066,6 +2135,15 @@ then
|
||||
elif grep 8.3 <<< "$GETPHP" >/dev/null 2>&1
|
||||
then
|
||||
export PHPVER=8.3
|
||||
elif grep 8.4 <<< "$GETPHP" >/dev/null 2>&1
|
||||
then
|
||||
export PHPVER=8.4
|
||||
elif grep 8.5 <<< "$GETPHP" >/dev/null 2>&1
|
||||
then
|
||||
export PHPVER=8.5
|
||||
elif grep 8.6 <<< "$GETPHP" >/dev/null 2>&1
|
||||
then
|
||||
export PHPVER=8.6
|
||||
fi
|
||||
|
||||
# Export other PHP variables based on PHPVER
|
||||
@ -2126,7 +2204,7 @@ add_trusted_key_and_repo() {
|
||||
check_distro_version
|
||||
|
||||
# Do the magic
|
||||
if version 22.04 "$DISTRO" 22.04.10
|
||||
if version 22.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
# New recommended way not using apt-key
|
||||
print_text_in_color "$ICyan" "Adding trusted key in /etc/apt/keyrings/$1..."
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Additional Apps Menu"
|
||||
@ -50,14 +50,13 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"LDAP" "(Windows Active directory for Nextcloud)" OFF \
|
||||
"Notify Push" "(High Performance Files Backend for Nextcloud)" OFF \
|
||||
"Netdata" "(Real-time server monitoring in Web GUI)" OFF \
|
||||
"FullTextSearch" "(Search for text inside documents [4GB RAM])" OFF \
|
||||
"FullTextSearch" "(Search for text inside documents [6GB RAM])" OFF \
|
||||
"BPYTOP" "(Real-time server monitoring in CLI)" OFF \
|
||||
"ClamAV" "(Antivirus for Nextcloud and files)" OFF \
|
||||
"Midnight Commander" "(CLI file manager)" OFF \
|
||||
"Pico CMS" "(Lightweight CMS integration in Nextcloud)" OFF \
|
||||
"Whiteboard" "(Whiteboard for Nextcloud)" OFF \
|
||||
"Extract" "(Archive extraction for Nextcloud)" OFF \
|
||||
"PDF Annotations" "(Annotate PDF files in Nextcloud)" OFF 3>&1 1>&2 2>&3)
|
||||
"Extract" "(Archive extraction for Nextcloud)" OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Documentserver"*)
|
||||
@ -143,10 +142,6 @@ to finish the setup once this script is done." "$SUBTITLE"
|
||||
print_text_in_color "$ICyan" "Downloading the SMB-mount script..."
|
||||
run_script APP smbmount
|
||||
;;&
|
||||
*"PDF Annotations"*)
|
||||
print_text_in_color "$ICyan" "Downloading the PDF Annotations script..."
|
||||
run_script APP pdfannotate
|
||||
;;&
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Bitwarden Menu"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="deSEC Menu"
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Documentserver Menu"
|
||||
SCRIPT_NAME="Documentserver menu"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
|
||||
@ -17,12 +17,12 @@ debug_mode
|
||||
root_check
|
||||
|
||||
choice=$(whiptail --title "$TITLE" --menu \
|
||||
"Which Documentserver do you want to install?\n\nAutomatically configure and install the selected Documentserver.
|
||||
"Which Documentserver for online editing do you want to install?\n\nWe recomend Collabora with Docker. The subdomain could look like this:\noffice.your-nextcloud.tld\n\nAutomatically configure and install the selected Documentserver.
|
||||
$MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Collabora (Docker)" "(Online editing - Extra Subdomain required)" \
|
||||
"Collabora (Integrated)" "(Online editing - No Subdomain required)" \
|
||||
"OnlyOffice (Docker)" "(Online editing - Extra Subdomain required)" \
|
||||
"OnlyOffice (Integrated)" "(Online editing - No Subdomain required)" 3>&1 1>&2 2>&3)
|
||||
"Collabora (Docker)" "(Extra Subdomain required)" \
|
||||
"Collabora (Integrated)" "(No Subdomain required)" \
|
||||
"OnlyOffice (Docker)" "(Extra Subdomain required)" \
|
||||
"OnlyOffice (Integrated)" "(No Subdomain required)" 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
"Collabora (Docker)")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Fail2ban Menu"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Main Menu"
|
||||
@ -81,7 +81,7 @@ To upgrade to the latest version, please run: 'sudo bash $SCRIPTS/update.sh' fro
|
||||
download_script STATIC update
|
||||
if [ -n "$REBOOT_SET" ]
|
||||
then
|
||||
sed -i "s|exit|/sbin/shutdown -r +1|g" "$SCRIPTS"/update.sh
|
||||
sed -i "s|exit|/sbin/shutdown -r +10|g" "$SCRIPTS"/update.sh
|
||||
fi
|
||||
do_the_update
|
||||
else
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Main Menu"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Nextcloud Configuration Menu"
|
||||
@ -122,6 +122,11 @@ daily
|
||||
rotate 10
|
||||
copytruncate
|
||||
}
|
||||
$VMLOGS/audit.log {
|
||||
daily
|
||||
rotate 10
|
||||
copytruncate
|
||||
}
|
||||
NEXTCLOUD_CONF
|
||||
|
||||
# Set needed ownership for the Nextcloud log folder to work correctly
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Server Configuration Menu"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Startup Configuration Menu"
|
||||
@ -37,6 +37,13 @@ else
|
||||
fi
|
||||
|
||||
# Get the correct apt-mirror
|
||||
# Handle several sources
|
||||
FIND_SOURCES="$(find /etc/apt/ -type f -name "*sources*")"
|
||||
for source in $FIND_SOURCES
|
||||
do
|
||||
REPO=$(grep "URIs:" "$source" | grep http | awk '{print $2}' | head -1)
|
||||
done
|
||||
# Check if it matches
|
||||
if [ "$REPO" = 'http://archive.ubuntu.com/ubuntu' ]
|
||||
then
|
||||
MIRROR_SWITCH="ON"
|
||||
@ -59,7 +66,7 @@ choice=$(whiptail --title "$TITLE" --checklist \
|
||||
$CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Keyboard Layout" "(Change the keyboard layout from '$KEYBOARD_LAYOUT')" "$KEYBOARD_LAYOUT_SWITCH" \
|
||||
"Timezone" "(Change the timezone from $(cat /etc/timezone))" "$TIMEZONE_SWITCH" \
|
||||
"Locate Mirror" "(Change the apt-mirror from $REPO)" OFF 3>&1 1>&2 2>&3)
|
||||
"Locate Mirror" "(Change the apt repo for better download performance)" "$MIRROR_SWITCH" 3>&1 1>&2 2>&3)
|
||||
|
||||
case "$choice" in
|
||||
*"Keyboard Layout"*)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Implements this way of doing it: https://askubuntu.com/a/1281319
|
||||
|
||||
@ -46,18 +46,13 @@ mkdir -p "$INSTALLDIR"
|
||||
print_text_in_color "$ICyan" "Checking for newer version of firmware..."
|
||||
if ! curl -k -s https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software | grep "$RVERSION" >/dev/null
|
||||
then
|
||||
msg_box "It seems like there's a newer version of the Realtek Driver for the LAN network card.
|
||||
|
||||
Please report this to $ISSUES including this link:
|
||||
https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
|
||||
|
||||
Thanks!"
|
||||
print_text_in_color "$ICyan" "Newer firmware for your Realtek card available. Please check here for upgrading: https://github.com/awesometic/realtek-r8125-dkms"
|
||||
fi
|
||||
|
||||
# Download the driver before it's removed (no internet when it's removed)
|
||||
if [ ! -f "$INSTALLDIR"/r8125-"$RVERSION".tar.bz2 ]
|
||||
then
|
||||
curl_to_dir https://github.com/nextcloud/vm/raw/master/network/asusnuc r8125-"$RVERSION".tar.bz2 "$INSTALLDIR"
|
||||
curl_to_dir https://github.com/nextcloud/vm/raw/main/network/asusnuc r8125-"$RVERSION".tar.bz2 "$INSTALLDIR"
|
||||
fi
|
||||
|
||||
# Install latest driver
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# Copyright © 2021 Simon Lindner (https://github.com/szaimen)
|
||||
|
||||
true
|
||||
@ -22,40 +22,99 @@ debug_mode
|
||||
root_check
|
||||
|
||||
# Check if it is already configured
|
||||
if ! grep -q "^#Geoip-block" /etc/apache2/apache2.conf
|
||||
if [ ! -f "$GEOBLOCK_MOD_CONF" ] && [ ! -f "$GEOBLOCK_MOD" ] && ! grep -q "^#Geoip-block" /etc/apache2/apache2.conf
|
||||
then
|
||||
# Ask for installing
|
||||
install_popup "$SCRIPT_NAME"
|
||||
else
|
||||
# Ask for removal or reinstallation
|
||||
reinstall_remove_menu "$SCRIPT_NAME"
|
||||
# Removal
|
||||
# Remove Apache mod config
|
||||
rm -f "$GEOBLOCK_MOD_CONF"
|
||||
# Remove old database files
|
||||
find /var/scripts -type f -regex \
|
||||
"$SCRIPTS/202[0-9]-[01][0-9]-Maxmind-Country-IPv[46]\.dat" -delete
|
||||
find "$GEOBLOCK_DIR" -type f -regex \
|
||||
"*.dat" -delete
|
||||
rm -f "$GEOBLOCK_DIR"/IPInfo-Country.mmdb
|
||||
# Remove Apache2 mod
|
||||
if [ -f "$GEOBLOCK_MOD" ]
|
||||
then
|
||||
a2dismod maxminddb
|
||||
rm -f "$GEOBLOCK_MOD"
|
||||
rm -f /usr/lib/apache2/modules/mod_maxminddb.so
|
||||
fi
|
||||
if is_this_installed libapache2-mod-geoip
|
||||
then
|
||||
a2dismod geoip
|
||||
apt-get purge libapache2-mod-geoip -y
|
||||
fi
|
||||
apt-get autoremove -y
|
||||
sed -i "/^#Geoip-block-start/,/^#Geoip-block-end/d" /etc/apache2/apache2.conf
|
||||
check_command systemctl restart apache2
|
||||
# Remove PPA
|
||||
if grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep maxmind-ubuntu-ppa
|
||||
then
|
||||
install_if_not ppa-purge
|
||||
yes | ppa-purge maxmind/ppa
|
||||
rm -f /etc/apt/sources.list.d/maxmind*
|
||||
fi
|
||||
# Remove Apache config
|
||||
if grep "Geoip-block-start" /etc/apache2/apache2.conf
|
||||
then
|
||||
sed -i "/^#Geoip-block-start/,/^#Geoip-block-end/d" /etc/apache2/apache2.conf
|
||||
fi
|
||||
if [ -f "$GEOBLOCK_MOD_CONF" ]
|
||||
then
|
||||
a2disconf geoblock
|
||||
rm -f "$GEOBLOCK_MOD_CONF"
|
||||
fi
|
||||
# Show successful uninstall if applicable
|
||||
removal_popup "$SCRIPT_NAME"
|
||||
# Make sure it's clean from unused packages and files
|
||||
apt-get purge libmaxminddb0* libmaxminddb-dev* mmdb-bin* apache2-dev* -y
|
||||
apt-get autoremove -y
|
||||
check_command systemctl restart apache2
|
||||
fi
|
||||
|
||||
# Install needed tools
|
||||
install_if_not libapache2-mod-geoip
|
||||
# Download GeoIP Databases
|
||||
if ! download_geoip_mmdb
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Enable apache mod
|
||||
check_command a2enmod geoip rewrite
|
||||
##### GeoIP script (Apache Setup)
|
||||
# Install requirements
|
||||
yes | add-apt-repository ppa:maxmind/ppa
|
||||
apt-get update -q4 & spinner_loading
|
||||
install_if_not libmaxminddb0
|
||||
install_if_not libmaxminddb-dev
|
||||
install_if_not mmdb-bin
|
||||
install_if_not apache2-dev
|
||||
|
||||
# maxminddb_module https://github.com/maxmind/mod_maxminddb
|
||||
cd /tmp
|
||||
curl_to_dir https://github.com/maxmind/mod_maxminddb/releases/download/1.2.0/ mod_maxminddb-1.2.0.tar.gz /tmp
|
||||
tar -xzf mod_maxminddb-1.2.0.tar.gz
|
||||
cd mod_maxminddb-1.2.0
|
||||
if ./configure
|
||||
then
|
||||
make install
|
||||
# Delete conf made by module
|
||||
rm -f /etc/apache2/mods-enabled/maxminddb.conf
|
||||
# Check if module is enabled
|
||||
if ! apachectl -M | grep -i "maxminddb"
|
||||
then
|
||||
msg_box "Couldn't install the Apache module for MaxMind. Please report this to $ISSUES"
|
||||
exit 1
|
||||
fi
|
||||
# Cleanup
|
||||
rm -rf mod_maxminddb-1.2.0 mod_maxminddb-1.2.0.tar.gz
|
||||
fi
|
||||
|
||||
# Enable modules
|
||||
check_command a2enmod rewrite remoteip maxminddb
|
||||
# Delete conf made by module
|
||||
rm -f /etc/apache2/mods-enabled/maxminddb.conf
|
||||
check_command systemctl restart apache2
|
||||
|
||||
# Download newest dat files
|
||||
find /var/scripts -type f -regex \
|
||||
"$SCRIPTS/202[0-9]-[01][0-9]-Maxmind-Country-IPv[46]\.dat" -delete
|
||||
get_newest_dat_files
|
||||
|
||||
# Restrict to countries and/or continents
|
||||
choice=$(whiptail --title "$TITLE" --checklist \
|
||||
"Do you want to restrict to countries and/or continents?
|
||||
@ -71,7 +130,7 @@ fi
|
||||
if [[ "$choice" = *"Countries"* ]]
|
||||
then
|
||||
# Download csv file
|
||||
if ! curl_to_dir "https://dev.maxmind.com/csv-files/codes" "iso3166.csv" "$SCRIPTS"
|
||||
if ! curl_to_dir "https://dev.maxmind.com/static/csv/codes" "iso3166.csv" "$SCRIPTS"
|
||||
then
|
||||
msg_box "Could not download the iso3166.csv file.
|
||||
Please report this to $ISSUES"
|
||||
@ -158,24 +217,44 @@ then
|
||||
mapfile -t choice <<< "$choice"
|
||||
fi
|
||||
|
||||
GEOIP_CONF="#Geoip-block-start - Please don't remove or change this line
|
||||
<IfModule mod_geoip.c>
|
||||
GeoIPEnable On
|
||||
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
|
||||
GeoIPDBFile /usr/share/GeoIP/GeoIPv6.dat
|
||||
# Create conf
|
||||
cat << GEOBLOCKCONF_CREATE > "$GEOBLOCK_MOD_CONF"
|
||||
<IfModule mod_maxminddb.c>
|
||||
MaxMindDBEnable On
|
||||
|
||||
# Check for IPinfo mmdb
|
||||
<IfFile "$GEOBLOCK_DIR/IPInfo-Country.mmdb">
|
||||
MaxMindDBFile DB $GEOBLOCK_DIR/IPInfo-Country.mmdb
|
||||
MaxMindDBEnv MM_CONTINENT_CODE DB/continent
|
||||
MaxMindDBEnv MM_COUNTRY_CODE DB/country
|
||||
</IfFile>
|
||||
# Check for Maxmind mmdb
|
||||
<IfFile "$GEOBLOCK_DIR/GeoLite2-Country.mmdb">
|
||||
MaxMindDBFile DB $GEOBLOCK_DIR/GeoLite2-Country.mmdb
|
||||
MaxMindDBEnv MM_CONTINENT_CODE DB/continent/code
|
||||
MaxMindDBEnv MM_COUNTRY_CODE DB/country/iso_code
|
||||
</IfFile>
|
||||
</IfModule>
|
||||
<Location />\n"
|
||||
|
||||
# Geoblock rules
|
||||
GEOBLOCKCONF_CREATE
|
||||
|
||||
# Add <Location> parameters to maxmind conf
|
||||
echo "<Location />" >> "$GEOBLOCK_MOD_CONF"
|
||||
for continent in "${choice[@]}"
|
||||
do
|
||||
GEOIP_CONF+=" SetEnvIf GEOIP_CONTINENT_CODE $continent AllowCountryOrContinent\n"
|
||||
GEOIP_CONF+=" SetEnvIf GEOIP_CONTINENT_CODE_V6 $continent AllowCountryOrContinent\n"
|
||||
echo " SetEnvIf MM_CONTINENT_CODE $continent AllowCountryOrContinent" >> "$GEOBLOCK_MOD_CONF"
|
||||
done
|
||||
for country in "${selected_options[@]}"
|
||||
do
|
||||
GEOIP_CONF+=" SetEnvIf GEOIP_COUNTRY_CODE $country AllowCountryOrContinent\n"
|
||||
GEOIP_CONF+=" SetEnvIf GEOIP_COUNTRY_CODE_V6 $country AllowCountryOrContinent\n"
|
||||
echo " SetEnvIf MM_COUNTRY_CODE $country AllowCountryOrContinent" >> "$GEOBLOCK_MOD_CONF"
|
||||
done
|
||||
GEOIP_CONF+=" Allow from env=AllowCountryOrContinent
|
||||
echo " Allow from env=AllowCountryOrContinent" >> "$GEOBLOCK_MOD_CONF"
|
||||
|
||||
# Add allow rules to maxmind conf
|
||||
cat << GEOBLOCKALLOW_CREATE >> "$GEOBLOCK_MOD_CONF"
|
||||
|
||||
# Specifically allow this
|
||||
Allow from 127.0.0.1/8
|
||||
Allow from 192.168.0.0/16
|
||||
Allow from 172.16.0.0/12
|
||||
@ -186,13 +265,18 @@ GEOIP_CONF+=" Allow from env=AllowCountryOrContinent
|
||||
Order Deny,Allow
|
||||
Deny from all
|
||||
</Location>
|
||||
#Geoip-block-end - Please don't remove or change this line"
|
||||
|
||||
# Write everything to the file
|
||||
echo -e "$GEOIP_CONF" >> /etc/apache2/apache2.conf
|
||||
# Logs
|
||||
LogLevel info
|
||||
CustomLog "$VMLOGS/geoblock_access.log" common
|
||||
GEOBLOCKALLOW_CREATE
|
||||
|
||||
check_command systemctl restart apache2
|
||||
# Enable config
|
||||
check_command a2enconf geoblock
|
||||
|
||||
msg_box "GeoBlock was successfully configured"
|
||||
|
||||
exit
|
||||
if check_command systemctl restart apache2
|
||||
then
|
||||
msg_box "GeoBlock was successfully configured"
|
||||
else
|
||||
msg_box "Something went wrong, please check Apache error logs."
|
||||
fi
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
|
||||
# Use local lib file in case there is no internet connection
|
||||
if printf "Testing internet connection..." && ping github.com -c 2 >/dev/null 2>&1
|
||||
@ -186,7 +186,7 @@ network:
|
||||
$IFACE: #object name
|
||||
dhcp4: false # dhcp v4 disable
|
||||
dhcp6: false # dhcp v6 disable
|
||||
addresses:
|
||||
addresses:
|
||||
- $LANIP
|
||||
routes:
|
||||
- to: default
|
||||
@ -198,6 +198,7 @@ IPCONFIG
|
||||
msg_box "These are your settings, please make sure they are correct:
|
||||
|
||||
$(cat /etc/netplan/nextcloud.yaml)"
|
||||
chmod 600 /etc/netplan/nextcloud.yaml
|
||||
netplan try
|
||||
set_systemd_resolved_dns "$IFACE"
|
||||
else
|
||||
@ -208,7 +209,7 @@ network:
|
||||
$IFACE2: #object name
|
||||
dhcp4: false # dhcp v4 disable
|
||||
dhcp6: false # dhcp v6 disable
|
||||
addresses:
|
||||
addresses:
|
||||
- $LANIP
|
||||
routes:
|
||||
- to: default
|
||||
@ -220,6 +221,7 @@ IPCONFIGnonvmware
|
||||
msg_box "These are your settings, please make sure they are correct:
|
||||
|
||||
$(cat /etc/netplan/nextcloud.yaml)"
|
||||
chmod 600 /etc/netplan/nextcloud.yaml
|
||||
netplan try
|
||||
set_systemd_resolved_dns "$IFACE2"
|
||||
fi
|
||||
|
||||
@ -1,28 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Trusted"
|
||||
SCRIPT_NAME="Set trusted domain"
|
||||
# shellcheck source=lib.sh
|
||||
source /var/scripts/fetch_lib.sh
|
||||
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
# 0 = OFF
|
||||
DEBUG=0
|
||||
debug_mode
|
||||
# Removed in NC 26.0.0.
|
||||
|
||||
download_script NETWORK update-config
|
||||
if [ -f $SCRIPTS/update-config.php ]
|
||||
then
|
||||
# Change config.php
|
||||
php $SCRIPTS/update-config.php $NCPATH/config/config.php 'trusted_domains[]' localhost "${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)" >/dev/null 2>&1
|
||||
php $SCRIPTS/update-config.php $NCPATH/config/config.php overwrite.cli.url https://"$(hostname --fqdn)"/ >/dev/null 2>&1
|
||||
|
||||
# Change .htaccess accordingly
|
||||
sed -i "s|RewriteBase /nextcloud|RewriteBase /|g" $NCPATH/.htaccess
|
||||
|
||||
# Cleanup
|
||||
rm -f $SCRIPTS/update-config.php
|
||||
fi
|
||||
# Set trusted domains
|
||||
nextcloud_occ config:system:set trusted_domains 0 --value="localhost"
|
||||
nextcloud_occ config:system:set trusted_domains 1 --value="$ADDRESS"
|
||||
nextcloud_occ config:system:set trusted_domains 2 --value="$(hostname -f)"
|
||||
nextcloud_occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)"
|
||||
nextcloud_occ maintenance:update:htaccess
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
|
||||
# Credit to: https://github.com/jnweiger
|
||||
|
||||
<?php
|
||||
|
||||
#
|
||||
# Update or delete an entry in config.php.
|
||||
# Called by kiwi's config.sh
|
||||
#
|
||||
if ($argc < 3)
|
||||
{
|
||||
print "Example Usage:\n\t". __FILE__." path/to/config.php overwritewebroot /nextcloud\n";
|
||||
print "\t".__FILE__." path/to/config.php trusted_domains[] 17.0.2.15 localhost\n";
|
||||
# nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!is_file($argv[1]))
|
||||
{
|
||||
# do not create the file, if missing.
|
||||
# Wrong permissions are deadly for nextcloud.
|
||||
## FIXME: get some proper errno or strerror() please?
|
||||
print($argv[1] . ": \$CONFIG cannot be loaded?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
include "$argv[1]";
|
||||
|
||||
if ($argc > 3)
|
||||
{
|
||||
# append [] to the key name, if you need to pass an array object.
|
||||
if (substr($argv[2], -2) === '[]')
|
||||
{
|
||||
$CONFIG[substr($argv[2],0,-2)] = array_slice($argv,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
$CONFIG[$argv[2]] = $argv[3];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# exactly two parameter given -- means delete.
|
||||
unset($CONFIG[$argv[2]]);
|
||||
}
|
||||
|
||||
$text = var_export($CONFIG, true);
|
||||
## A warning is printed, if argv[1] is not writable.
|
||||
## PHP does not issue proper errno or strerror() does it?
|
||||
file_put_contents($argv[1], "<?php\n\$CONFIG = $text;\n");
|
||||
?>
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# GNU General Public License v3.0
|
||||
# https://github.com/nextcloud/vm/blob/master/LICENSE
|
||||
# https://github.com/nextcloud/vm/blob/main/LICENSE
|
||||
|
||||
#########
|
||||
|
||||
@ -482,13 +482,16 @@ else
|
||||
fi
|
||||
|
||||
# Set correct amount of CPUs for Imaginary
|
||||
if which nproc >/dev/null 2>&1
|
||||
if does_this_docker_exist ghcr.io/nextcloud-releases/aio-imaginary
|
||||
then
|
||||
nextcloud_occ config:system:set preview_concurrency_new --value="$(nproc)"
|
||||
nextcloud_occ config:system:set preview_concurrency_all --value="$(($(nproc)*2))"
|
||||
else
|
||||
nextcloud_occ config:system:set preview_concurrency_new --value="2"
|
||||
nextcloud_occ config:system:set preview_concurrency_all --value="4"
|
||||
if which nproc >/dev/null 2>&1
|
||||
then
|
||||
nextcloud_occ config:system:set preview_concurrency_new --value="$(nproc)"
|
||||
nextcloud_occ config:system:set preview_concurrency_all --value="$(($(nproc)*2))"
|
||||
else
|
||||
nextcloud_occ config:system:set preview_concurrency_new --value="2"
|
||||
nextcloud_occ config:system:set preview_concurrency_all --value="4"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add temporary fix if needed
|
||||
@ -514,8 +517,11 @@ rm -f "$SCRIPTS/desec_menu.sh"
|
||||
rm -f "$NCDATA"/*.log
|
||||
|
||||
find /root "/home/$UNIXUSER" -type f \( -name '*.sh*' -o -name '*.html*' -o -name '*.tar*' -o -name 'results' -o -name '*.zip*' \) -delete
|
||||
find "$NCPATH" -type f \( -name 'results' -o -name '*.sh*' \) -delete
|
||||
sed -i "s|instruction.sh|nextcloud.sh|g" "/home/$UNIXUSER/.bash_profile"
|
||||
# TODO: Do we really need this?
|
||||
# https://github.com/nextcloud/server/issues/48773
|
||||
# find "$NCPATH" -type f \( -name 'results' -o -name '*.sh*' \) -delete
|
||||
find "$NCPATH" -type f \( -name 'results' \) -delete
|
||||
|
||||
truncate -s 0 \
|
||||
/root/.bash_history \
|
||||
@ -553,20 +559,27 @@ mesg n
|
||||
|
||||
ROOTNEWPROFILE
|
||||
|
||||
# Set trusted domain in config.php
|
||||
run_script NETWORK trusted
|
||||
# Set trusted domains
|
||||
run_script STATIC trusted_domains
|
||||
|
||||
# Upgrade system
|
||||
print_text_in_color "$ICyan" "System will now upgrade..."
|
||||
bash $SCRIPTS/update.sh minor
|
||||
|
||||
# Add missing indices (if any)
|
||||
nextcloud_occ db:add-missing-indices
|
||||
|
||||
# Check if new major is out, and inform on how to update
|
||||
if version_gt "$NCVERSION" "$CURRENTVERSION"
|
||||
nc_update
|
||||
if version_gt "$NCMAJOR" "$CURRENTMAJOR"
|
||||
then
|
||||
msg_box "We noticed that there's a new major release of Nextcloud ($NCVERSION).\nIf you want to update to the latest release instantly, please check this:\n
|
||||
https://docs.hanssonit.se/s/W6fMouPiqQz3_Mog/virtual-machines-vm/d/W7Du9uPiqQz3_Mr1/nextcloud-vm-machine-configuration?currentPageId=W7D3quPiqQz3_MsE"
|
||||
fi
|
||||
|
||||
# Repair
|
||||
nextcloud_occ maintenance:repair --include-expensive
|
||||
|
||||
# Cleanup 2
|
||||
apt-get autoremove -y
|
||||
apt-get autoclean
|
||||
@ -588,7 +601,7 @@ More info here: https://nextcloud.com/enterprise/
|
||||
Get your license here: https://shop.hanssonit.se/product/nextcloud-enterprise-license-100-users/"
|
||||
|
||||
msg_box "TIPS & TRICKS:
|
||||
1. Publish your server online: https://goo.gl/iUGE2U
|
||||
1. Publish your server online: http://shortio.hanssonit.se/ffOQOXS6Kh
|
||||
2. To login to PostgreSQL just type: sudo -u postgres psql nextcloud_db
|
||||
3. To update this server just type: sudo bash /var/scripts/update.sh
|
||||
4. Install apps, configure Nextcloud, and server: sudo bash $SCRIPTS/menu.sh"
|
||||
@ -613,7 +626,7 @@ Login to Nextcloud in your browser:
|
||||
### PLEASE HIT OK TO REBOOT ###"
|
||||
|
||||
# Reboot
|
||||
print_text_in_color "$IGreen" "Installation done, system will now reboot..."
|
||||
print_text_in_color "$IGreen" "Installation done! Please hit OK to cleanup the setup files, and reboot the system."
|
||||
check_command rm -f "$SCRIPTS/you-can-not-run-the-startup-script-several-times"
|
||||
check_command rm -f "$SCRIPTS/nextcloud-startup-script.sh"
|
||||
if ! reboot
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/
|
||||
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
|
||||
# GNU General Public License v3.0
|
||||
# https://github.com/nextcloud/vm/blob/master/LICENSE
|
||||
# https://github.com/nextcloud/vm/blob/main/LICENSE
|
||||
|
||||
# Prefer IPv4 for apt
|
||||
echo 'Acquire::ForceIPv4 "true";' >> /etc/apt/apt.conf.d/99force-ipv4
|
||||
@ -28,12 +28,20 @@ else
|
||||
apt-get install curl -y
|
||||
fi
|
||||
|
||||
# Install whiptail if not existing
|
||||
if [ "$(dpkg-query -W -f='${Status}' "whiptail" 2>/dev/null | grep -c "ok installed")" = "1" ]
|
||||
then
|
||||
echo "whiptail OK"
|
||||
else
|
||||
apt-get install whiptail -y
|
||||
fi
|
||||
|
||||
true
|
||||
SCRIPT_NAME="Nextcloud Install Script"
|
||||
SCRIPT_EXPLAINER="This script is installing all requirements that are needed for Nextcloud to run.
|
||||
It's the first of two parts that are necessary to finish your customized Nextcloud installation."
|
||||
# shellcheck source=lib.sh
|
||||
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh)
|
||||
source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/main/lib.sh)
|
||||
|
||||
# Check for errors + debug code and abort if something isn't right
|
||||
# 1 = ON
|
||||
@ -53,9 +61,9 @@ is_process_running apt
|
||||
is_process_running dpkg
|
||||
|
||||
# Check distribution and version
|
||||
if ! version 22.04 "$DISTRO" 22.04.10
|
||||
if ! version 24.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
msg_box "This script can only be run on Ubuntu 22.04 (server)."
|
||||
msg_box "This script can only be run on Ubuntu 24.04 (server)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -63,17 +71,6 @@ fi
|
||||
# Restart mode: (l)ist only, (i)nteractive or (a)utomatically.
|
||||
sed -i "s|#\$nrconf{restart} = .*|\$nrconf{restart} = 'a';|g" /etc/needrestart/needrestart.conf
|
||||
|
||||
# Install needed dependencies
|
||||
install_if_not lshw
|
||||
install_if_not net-tools
|
||||
install_if_not whiptail
|
||||
install_if_not apt-utils
|
||||
|
||||
# Nice to have dependencies
|
||||
install_if_not bash-completion
|
||||
install_if_not htop
|
||||
install_if_not iputils-ping
|
||||
|
||||
# Check for flags
|
||||
if [ "$1" = "" ]
|
||||
then
|
||||
@ -106,7 +103,8 @@ then
|
||||
if ! does_snapshot_exist "NcVM-installation" && yesno_box_no "Do you want to use LVM snapshots to be able to restore your root partition during upgrades and such?
|
||||
Please note: this feature will not be used by this script but by other scripts later on.
|
||||
For now we will only create a placeholder volume that will be used to let some space for snapshot volumes.
|
||||
Be aware that you will not be able to use the built-in backup solution if you choose 'No'!"
|
||||
Be aware that you will not be able to use the built-in backup solution if you choose 'No'!
|
||||
Enabling this will also force an automatic reboot after running the update script!"
|
||||
then
|
||||
check_free_space
|
||||
if [ "$FREE_SPACE" -ge 50 ]
|
||||
@ -122,38 +120,6 @@ Be aware that you will not be able to use the built-in backup solution if you ch
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download needed libraries before execution of the first script
|
||||
mkdir -p "$SCRIPTS"
|
||||
download_script GITHUB_REPO lib
|
||||
download_script STATIC fetch_lib
|
||||
|
||||
# Set locales
|
||||
run_script ADDONS locales
|
||||
|
||||
# Create new current user
|
||||
download_script STATIC adduser
|
||||
bash "$SCRIPTS"/adduser.sh "nextcloud_install_production.sh"
|
||||
rm -f "$SCRIPTS"/adduser.sh
|
||||
|
||||
check_universe
|
||||
check_multiverse
|
||||
|
||||
# Check if key is available
|
||||
if ! site_200 "$NCREPO"
|
||||
then
|
||||
msg_box "Nextcloud repo is not available, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test Home/SME function
|
||||
if home_sme_server
|
||||
then
|
||||
msg_box "This is the Home/SME server, function works!"
|
||||
else
|
||||
print_text_in_color "$ICyan" "Home/SME Server not detected. No worries, just testing the function."
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# Fix LVM on BASE image
|
||||
if grep -q "LVM" /etc/fstab
|
||||
then
|
||||
@ -186,6 +152,50 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install needed dependencies
|
||||
install_if_not lshw
|
||||
install_if_not net-tools
|
||||
install_if_not whiptail
|
||||
install_if_not apt-utils
|
||||
install_if_not keyboard-configuration
|
||||
|
||||
# Nice to have dependencies
|
||||
install_if_not bash-completion
|
||||
install_if_not htop
|
||||
install_if_not iputils-ping
|
||||
|
||||
# Download needed libraries before execution of the first script
|
||||
mkdir -p "$SCRIPTS"
|
||||
download_script GITHUB_REPO lib
|
||||
download_script STATIC fetch_lib
|
||||
|
||||
# Set locales
|
||||
run_script ADDONS locales
|
||||
|
||||
# Create new current user
|
||||
download_script STATIC adduser
|
||||
bash "$SCRIPTS"/adduser.sh "nextcloud_install_production.sh"
|
||||
rm -f "$SCRIPTS"/adduser.sh
|
||||
|
||||
check_universe
|
||||
check_multiverse
|
||||
|
||||
# Check if key is available
|
||||
if ! site_200 "$NCREPO"
|
||||
then
|
||||
msg_box "Nextcloud repo is not available, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test Home/SME function
|
||||
if home_sme_server
|
||||
then
|
||||
msg_box "This is the Home/SME server, function works!"
|
||||
else
|
||||
print_text_in_color "$ICyan" "Home/SME Server not detected. No worries, just testing the function."
|
||||
sleep 3
|
||||
fi
|
||||
|
||||
# Check if it's a clean server
|
||||
stop_if_installed postgresql
|
||||
stop_if_installed apache2
|
||||
@ -375,8 +385,9 @@ a2enmod rewrite \
|
||||
dir \
|
||||
authz_core \
|
||||
alias \
|
||||
mpm_event \
|
||||
ssl
|
||||
|
||||
|
||||
# We don't use Apache PHP (just to be sure)
|
||||
a2dismod mpm_prefork
|
||||
|
||||
@ -500,48 +511,55 @@ download_script STATIC setup_secure_permissions_nextcloud
|
||||
bash "$SECURE" & spinner_loading
|
||||
|
||||
# Ask to set a custom username
|
||||
if yesno_box_no "Nextcloud is about to be installed.\nDo you want to change the standard GUI user '$GUIUSER' to something else?"
|
||||
if [ -z "$PROVISIONING" ]
|
||||
then
|
||||
while :
|
||||
do
|
||||
GUIUSER=$(input_box_flow "Please type in the name of the Web Admin in Nextcloud.
|
||||
if yesno_box_no "Nextcloud is about to be installed.\nDo you want to change the standard GUI user '$GUIUSER' to something else?"
|
||||
then
|
||||
while :
|
||||
do
|
||||
GUIUSER=$(input_box_flow "Please type in the name of the Web Admin in Nextcloud.
|
||||
\nThe only allowed characters for the username are:
|
||||
'a-z', 'A-Z', '0-9', and '_.@-'")
|
||||
if [[ "$GUIUSER" == *" "* ]]
|
||||
then
|
||||
msg_box "Please don't use spaces."
|
||||
# - has to be escaped otherwise it won't work.
|
||||
# Inspired by: https://unix.stackexchange.com/a/498731/433213
|
||||
elif [ "${GUIUSER//[A-Za-z0-9_.\-@]}" ]
|
||||
then
|
||||
msg_box "Allowed characters for the username are:\na-z', 'A-Z', '0-9', and '_.@-'\n\nPlease try again."
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
while :
|
||||
do
|
||||
GUIPASS=$(input_box_flow "Please type in the new password for the new Web Admin ($GUIUSER) in Nextcloud.")
|
||||
if [[ "$GUIPASS" == *" "* ]]
|
||||
then
|
||||
msg_box "Please don't use spaces."
|
||||
fi
|
||||
if [ "${GUIPASS//[A-Za-z0-9_.\-@]}" ]
|
||||
then
|
||||
msg_box "Allowed characters for the password are:\na-z', 'A-Z', '0-9', and '_.@-'\n\nPlease try again."
|
||||
else
|
||||
msg_box "The new Web Admin in Nextcloud is now: $GUIUSER\nThe password is set to: $GUIPASS
|
||||
if [[ "$GUIUSER" == *" "* ]]
|
||||
then
|
||||
msg_box "Please don't use spaces."
|
||||
# - has to be escaped otherwise it won't work.
|
||||
# Inspired by: https://unix.stackexchange.com/a/498731/433213
|
||||
elif [ "${GUIUSER//[A-Za-z0-9_.\-@]}" ]
|
||||
then
|
||||
msg_box "Allowed characters for the username are:\na-z', 'A-Z', '0-9', and '_.@-'\n\nPlease try again."
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
while :
|
||||
do
|
||||
GUIPASS=$(input_box_flow "Please type in the new password for the new Web Admin ($GUIUSER) in Nextcloud.")
|
||||
if [[ "$GUIPASS" == *" "* ]]
|
||||
then
|
||||
msg_box "Please don't use spaces."
|
||||
fi
|
||||
if [ "${GUIPASS//[A-Za-z0-9_.\-@]}" ]
|
||||
then
|
||||
msg_box "Allowed characters for the password are:\na-z', 'A-Z', '0-9', and '_.@-'\n\nPlease try again."
|
||||
else
|
||||
msg_box "The new Web Admin in Nextcloud is now: $GUIUSER\nThe password is set to: $GUIPASS
|
||||
This is used when you login to Nextcloud itself, i.e. on the web."
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install Nextcloud
|
||||
print_text_in_color "$ICyan" "Installing Nextcloud..."
|
||||
# NC 29 fix ## TODO: is this needed in coming versions?
|
||||
chown www-data:www-data "$NCPATH"/data
|
||||
# Normal install
|
||||
print_text_in_color "$ICyan" "Installing Nextcloud, it might take a while..."
|
||||
cd "$NCPATH"
|
||||
nextcloud_occ maintenance:install \
|
||||
# Don't use nextcloud_occ here as it takes alooong time.
|
||||
# https://github.com/nextcloud/vm/issues/2542#issuecomment-1700406020
|
||||
check_command sudo -u www-data php "$NCPATH"/occ maintenance:install \
|
||||
--data-dir="$NCDATA" \
|
||||
--database=pgsql \
|
||||
--database-name=nextcloud_db \
|
||||
@ -549,115 +567,9 @@ nextcloud_occ maintenance:install \
|
||||
--database-pass="$PGDB_PASS" \
|
||||
--admin-user="$GUIUSER" \
|
||||
--admin-pass="$GUIPASS"
|
||||
echo
|
||||
print_text_in_color "$ICyan" "Nextcloud version:"
|
||||
nextcloud_occ status
|
||||
sleep 3
|
||||
echo
|
||||
|
||||
# Prepare cron.php to be run every 5 minutes
|
||||
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NCPATH/cron.php > /dev/null 2>&1"; } | crontab -u www-data -
|
||||
|
||||
# Run the updatenotification on a schedule
|
||||
nextcloud_occ config:system:set upgrade.disable-web --type=bool --value=true
|
||||
nextcloud_occ config:app:set updatenotification notify_groups --value="[]"
|
||||
print_text_in_color "$ICyan" "Configuring update notifications specific for this server..."
|
||||
download_script STATIC updatenotification
|
||||
check_command chmod +x "$SCRIPTS"/updatenotification.sh
|
||||
crontab -u root -l | { cat; echo "59 $AUT_UPDATES_TIME * * * $SCRIPTS/updatenotification.sh > /dev/null 2>&1"; } | crontab -u root -
|
||||
|
||||
# Change values in php.ini (increase max file size)
|
||||
# max_execution_time
|
||||
sed -i "s|max_execution_time =.*|max_execution_time = 3500|g" "$PHP_INI"
|
||||
# max_input_time
|
||||
sed -i "s|max_input_time =.*|max_input_time = 3600|g" "$PHP_INI"
|
||||
# memory_limit
|
||||
sed -i "s|memory_limit =.*|memory_limit = 512M|g" "$PHP_INI"
|
||||
# post_max
|
||||
sed -i "s|post_max_size =.*|post_max_size = 1100M|g" "$PHP_INI"
|
||||
# upload_max
|
||||
sed -i "s|upload_max_filesize =.*|upload_max_filesize = 1000M|g" "$PHP_INI"
|
||||
|
||||
# Set logging
|
||||
nextcloud_occ config:system:set log_type --value=file
|
||||
nextcloud_occ config:system:set logfile --value="$VMLOGS/nextcloud.log"
|
||||
rm -f "$NCDATA/nextcloud.log"
|
||||
nextcloud_occ config:system:set loglevel --value=2
|
||||
install_and_enable_app admin_audit
|
||||
nextcloud_occ config:app:set admin_audit logfile --value="$VMLOGS/audit.log"
|
||||
nextcloud_occ config:system:set log.condition apps 0 --value admin_audit
|
||||
|
||||
# Set SMTP mail
|
||||
nextcloud_occ config:system:set mail_smtpmode --value="smtp"
|
||||
|
||||
# Forget login/session after 30 minutes
|
||||
nextcloud_occ config:system:set remember_login_cookie_lifetime --value="1800"
|
||||
|
||||
# Set logrotate (max 10 MB)
|
||||
nextcloud_occ config:system:set log_rotate_size --value="10485760"
|
||||
|
||||
# Set trashbin retention obligation (save it in trashbin for 60 days or delete when space is needed)
|
||||
nextcloud_occ config:system:set trashbin_retention_obligation --value="auto, 60"
|
||||
|
||||
# Set versions retention obligation (save versions for 180 days or delete when space is needed)
|
||||
nextcloud_occ config:system:set versions_retention_obligation --value="auto, 180"
|
||||
|
||||
# Set activity retention obligation (save activity feed for 120 days, defaults to 365 days otherwise)
|
||||
nextcloud_occ config:system:set activity_expire_days --value="120"
|
||||
|
||||
# Remove simple signup
|
||||
nextcloud_occ config:system:set simpleSignUpLink.shown --type=bool --value=false
|
||||
|
||||
# Set chunk_size for files app to 100MB (defaults to 10MB)
|
||||
nextcloud_occ config:app:set files max_chunk_size --value="104857600"
|
||||
|
||||
# Set product name
|
||||
if home_sme_server
|
||||
then
|
||||
PRODUCTNAME="Nextcloud HanssonIT Server"
|
||||
else
|
||||
PRODUCTNAME="Nextcloud HanssonIT VM"
|
||||
fi
|
||||
if is_app_installed theming
|
||||
then
|
||||
if [ "$(nextcloud_occ config:app:get theming productName)" != "$PRODUCTNAME" ]
|
||||
then
|
||||
nextcloud_occ config:app:set theming productName --value "$PRODUCTNAME"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable OPCache for PHP
|
||||
# https://docs.nextcloud.com/server/14/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
|
||||
phpenmod opcache
|
||||
{
|
||||
echo "# OPcache settings for Nextcloud"
|
||||
echo "opcache.enable=1"
|
||||
echo "opcache.enable_cli=1"
|
||||
echo "opcache.interned_strings_buffer=16"
|
||||
echo "opcache.max_accelerated_files=10000"
|
||||
echo "opcache.memory_consumption=256"
|
||||
echo "opcache.save_comments=1"
|
||||
echo "opcache.revalidate_freq=1"
|
||||
echo "opcache.validate_timestamps=1"
|
||||
} >> "$PHP_INI"
|
||||
|
||||
# PHP-FPM optimization
|
||||
# https://geekflare.com/php-fpm-optimization/
|
||||
sed -i "s|;emergency_restart_threshold.*|emergency_restart_threshold = 10|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
sed -i "s|;emergency_restart_interval.*|emergency_restart_interval = 1m|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
sed -i "s|;process_control_timeout.*|process_control_timeout = 10|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
|
||||
# PostgreSQL values for PHP (https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html#postgresql-database)
|
||||
{
|
||||
echo ""
|
||||
echo "[PostgresSQL]"
|
||||
echo "pgsql.allow_persistent = On"
|
||||
echo "pgsql.auto_reset_persistent = Off"
|
||||
echo "pgsql.max_persistent = -1"
|
||||
echo "pgsql.max_links = -1"
|
||||
echo "pgsql.ignore_notice = 0"
|
||||
echo "pgsql.log_notice = 0"
|
||||
} >> "$PHP_FPM_DIR"/conf.d/20-pdo_pgsql.ini
|
||||
|
||||
# Install PECL dependencies
|
||||
install_if_not php"$PHPVER"-dev
|
||||
@ -709,6 +621,115 @@ echo "igbinary.compact_strings=On"
|
||||
restart_webserver
|
||||
fi
|
||||
|
||||
# Prepare cron.php to be run every 5 minutes
|
||||
crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NCPATH/cron.php > /dev/null 2>&1"; } | crontab -u www-data -
|
||||
|
||||
# Run the updatenotification on a schedule
|
||||
nextcloud_occ config:system:set upgrade.disable-web --type=bool --value=true
|
||||
nextcloud_occ config:app:set updatenotification notify_groups --value="[]"
|
||||
print_text_in_color "$ICyan" "Configuring update notifications specific for this server..."
|
||||
download_script STATIC updatenotification
|
||||
check_command chmod +x "$SCRIPTS"/updatenotification.sh
|
||||
crontab -u root -l | { cat; echo "59 $AUT_UPDATES_TIME * * * $SCRIPTS/updatenotification.sh > /dev/null 2>&1"; } | crontab -u root -
|
||||
|
||||
# Change values in php.ini (increase max file size)
|
||||
# max_execution_time
|
||||
sed -i "s|max_execution_time =.*|max_execution_time = 3500|g" "$PHP_INI"
|
||||
# max_input_time
|
||||
sed -i "s|max_input_time =.*|max_input_time = 3600|g" "$PHP_INI"
|
||||
# memory_limit
|
||||
sed -i "s|memory_limit =.*|memory_limit = 512M|g" "$PHP_INI"
|
||||
# post_max
|
||||
sed -i "s|post_max_size =.*|post_max_size = 1100M|g" "$PHP_INI"
|
||||
# upload_max
|
||||
sed -i "s|upload_max_filesize =.*|upload_max_filesize = 1000M|g" "$PHP_INI"
|
||||
|
||||
# Set logging
|
||||
nextcloud_occ config:system:set log_type --value=file
|
||||
nextcloud_occ config:system:set logfile --value="$VMLOGS/nextcloud.log"
|
||||
rm -f "$NCDATA/nextcloud.log"
|
||||
rm -f "$NCPATH/data/nextcloud.log"
|
||||
nextcloud_occ config:system:set loglevel --value=2
|
||||
install_and_enable_app admin_audit
|
||||
nextcloud_occ config:app:set admin_audit logfile --value="$VMLOGS/audit.log"
|
||||
nextcloud_occ config:system:set log.condition apps 0 --value admin_audit
|
||||
|
||||
# Set maintenance window for cron
|
||||
# https://docs.nextcloud.com/server/29/admin_manual/configuration_server/background_jobs_configuration.html#background-jobs
|
||||
nextcloud_occ config:system:set maintenance_window_start --type=integer --value=2
|
||||
|
||||
# Set SMTP mail
|
||||
nextcloud_occ config:system:set mail_smtpmode --value="smtp"
|
||||
|
||||
# Forget login/session after 30 minutes
|
||||
nextcloud_occ config:system:set remember_login_cookie_lifetime --value="1800"
|
||||
|
||||
# Set logrotate (max 10 MB)
|
||||
nextcloud_occ config:system:set log_rotate_size --value="10485760"
|
||||
|
||||
# Set trashbin retention obligation (save it in trashbin for 60 days or delete when space is needed)
|
||||
nextcloud_occ config:system:set trashbin_retention_obligation --value="auto, 60"
|
||||
|
||||
# Set versions retention obligation (save versions for 180 days or delete when space is needed)
|
||||
nextcloud_occ config:system:set versions_retention_obligation --value="auto, 180"
|
||||
|
||||
# Set activity retention obligation (save activity feed for 120 days, defaults to 365 days otherwise)
|
||||
nextcloud_occ config:system:set activity_expire_days --value="120"
|
||||
|
||||
# Remove simple signup
|
||||
nextcloud_occ config:system:set simpleSignUpLink.shown --type=bool --value=false
|
||||
|
||||
# Set chunk_size for files app to 100MB (defaults to 10MB)
|
||||
nextcloud_occ config:app:set files max_chunk_size --value="104857600"
|
||||
|
||||
# Set product name
|
||||
if home_sme_server
|
||||
then
|
||||
PRODUCTNAME="Nextcloud HanssonIT Server"
|
||||
else
|
||||
PRODUCTNAME="Nextcloud HanssonIT VM"
|
||||
fi
|
||||
if is_app_installed theming
|
||||
then
|
||||
if [ "$(nextcloud_occ config:app:get theming productName)" != "$PRODUCTNAME" ]
|
||||
then
|
||||
nextcloud_occ config:app:set theming productName --value "$PRODUCTNAME"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable OPCache for PHP
|
||||
# https://docs.nextcloud.com/server/14/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
|
||||
phpenmod opcache
|
||||
{
|
||||
echo "# OPcache settings for Nextcloud"
|
||||
echo "opcache.enable=1"
|
||||
echo "opcache.enable_cli=1"
|
||||
echo "opcache.interned_strings_buffer=$opcache_interned_strings_buffer_value"
|
||||
echo "opcache.max_accelerated_files=10000"
|
||||
echo "opcache.memory_consumption=256"
|
||||
echo "opcache.save_comments=1"
|
||||
echo "opcache.revalidate_freq=1"
|
||||
echo "opcache.validate_timestamps=1"
|
||||
} >> "$PHP_INI"
|
||||
|
||||
# PHP-FPM optimization
|
||||
# https://geekflare.com/php-fpm-optimization/
|
||||
sed -i "s|;emergency_restart_threshold.*|emergency_restart_threshold = 10|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
sed -i "s|;emergency_restart_interval.*|emergency_restart_interval = 1m|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
sed -i "s|;process_control_timeout.*|process_control_timeout = 10|g" /etc/php/"$PHPVER"/fpm/php-fpm.conf
|
||||
|
||||
# PostgreSQL values for PHP (https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html#postgresql-database)
|
||||
{
|
||||
echo ""
|
||||
echo "[PostgresSQL]"
|
||||
echo "pgsql.allow_persistent = On"
|
||||
echo "pgsql.auto_reset_persistent = Off"
|
||||
echo "pgsql.max_persistent = -1"
|
||||
echo "pgsql.max_links = -1"
|
||||
echo "pgsql.ignore_notice = 0"
|
||||
echo "pgsql.log_notice = 0"
|
||||
} >> "$PHP_FPM_DIR"/conf.d/20-pdo_pgsql.ini
|
||||
|
||||
# Fix https://github.com/nextcloud/vm/issues/714
|
||||
print_text_in_color "$ICyan" "Optimizing Nextcloud..."
|
||||
yes | nextcloud_occ db:convert-filecache-bigint
|
||||
@ -741,71 +762,69 @@ then
|
||||
|
||||
### YOUR SERVER ADDRESS ###
|
||||
# ServerAdmin admin@example.com
|
||||
# ServerName example.com
|
||||
# ServerAlias subdomain.example.com
|
||||
# ServerName cloud.example.com
|
||||
|
||||
### SETTINGS ###
|
||||
<FilesMatch "\.php$">
|
||||
SetHandler "proxy:unix:/run/php/php$PHPVER-fpm.nextcloud.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
|
||||
# Logs
|
||||
LogLevel warn
|
||||
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Document root folder
|
||||
DocumentRoot $NCPATH
|
||||
|
||||
# The Nextcloud folder
|
||||
<Directory $NCPATH>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
### include all .htaccess
|
||||
Include $NCPATH/.htaccess
|
||||
Include $NCPATH/config/.htaccess
|
||||
Include $NCDATA/.htaccess
|
||||
###
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
Satisfy Any
|
||||
# This is to include all the Nextcloud rules due to that we use PHP-FPM and .htaccess aren't read
|
||||
Include $NCPATH/.htaccess
|
||||
</Directory>
|
||||
|
||||
# Deny access to your data directory
|
||||
<Directory $NCDATA>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# Deny access to the Nextcloud config folder
|
||||
<Directory $NCPATH/config/>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_dav.c>
|
||||
Dav off
|
||||
</IfModule>
|
||||
|
||||
<Directory "$NCDATA">
|
||||
# just in case if .htaccess gets disabled
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# The following lines prevent .htaccess and .htpasswd files from being
|
||||
# viewed by Web clients.
|
||||
# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# Disable HTTP TRACE method.
|
||||
TraceEnable off
|
||||
|
||||
# Disable HTTP TRACK method.
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_METHOD} ^TRACK
|
||||
RewriteRule .* - [R=405,L]
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# Avoid "Sabre\DAV\Exception\BadRequest: expected filesize XXXX got XXXX"
|
||||
<IfModule mod_reqtimeout.c>
|
||||
RequestReadTimeout body=0
|
||||
</IfModule>
|
||||
|
||||
</VirtualHost>
|
||||
HTTP_CREATE
|
||||
print_text_in_color "$IGreen" "$SITES_AVAILABLE/$HTTP_CONF was successfully created."
|
||||
fi
|
||||
|
||||
# Fix zero file sizes
|
||||
# See https://github.com/nextcloud/server/issues/3056
|
||||
if version 22.04 "$DISTRO" 26.04.10
|
||||
then
|
||||
SETENVPROXY="SetEnv proxy-sendcl 1"
|
||||
fi
|
||||
|
||||
# Generate $TLS_CONF
|
||||
if [ ! -f "$SITES_AVAILABLE"/"$TLS_CONF" ]
|
||||
then
|
||||
@ -813,7 +832,7 @@ then
|
||||
cat << TLS_CREATE > "$SITES_AVAILABLE/$TLS_CONF"
|
||||
# <VirtualHost *:80>
|
||||
# RewriteEngine On
|
||||
# RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
|
||||
# RewriteRule ^(.*)$ https://%{HTTP_HOST}\$1 [END,NE,R=permanent]
|
||||
# </VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
@ -842,53 +861,56 @@ then
|
||||
CustomLog \${APACHE_LOG_DIR}/access.log combined
|
||||
ErrorLog \${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Document root folder
|
||||
DocumentRoot $NCPATH
|
||||
|
||||
# The Nextcloud folder
|
||||
<Directory $NCPATH>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
### include all .htaccess
|
||||
Include $NCPATH/.htaccess
|
||||
Include $NCPATH/config/.htaccess
|
||||
Include $NCDATA/.htaccess
|
||||
###
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
Satisfy Any
|
||||
# This is to include all the Nextcloud rules due to that we use PHP-FPM and .htaccess aren't read
|
||||
Include $NCPATH/.htaccess
|
||||
</Directory>
|
||||
|
||||
# Deny access to your data directory
|
||||
<Directory $NCDATA>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# Deny access to the Nextcloud config folder
|
||||
<Directory $NCPATH/config/>
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_dav.c>
|
||||
Dav off
|
||||
</IfModule>
|
||||
|
||||
<Directory "$NCDATA">
|
||||
# just in case if .htaccess gets disabled
|
||||
Require all denied
|
||||
</Directory>
|
||||
|
||||
# The following lines prevent .htaccess and .htpasswd files from being
|
||||
# viewed by Web clients.
|
||||
# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients.
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# Disable HTTP TRACE method.
|
||||
TraceEnable off
|
||||
|
||||
# Disable HTTP TRACK method.
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_METHOD} ^TRACK
|
||||
RewriteRule .* - [R=405,L]
|
||||
|
||||
SetEnv HOME $NCPATH
|
||||
SetEnv HTTP_HOME $NCPATH
|
||||
|
||||
# Avoid "Sabre\DAV\Exception\BadRequest: expected filesize XXXX got XXXX"
|
||||
<IfModule mod_reqtimeout.c>
|
||||
RequestReadTimeout body=0
|
||||
</IfModule>
|
||||
|
||||
# Avoid zero byte files (only works in Ubuntu 22.04 -->>)
|
||||
$SETENVPROXY
|
||||
|
||||
# Avoid zero byte files (only works in Ubuntu 24.04 -->>)
|
||||
# See https://github.com/nextcloud/server/issues/3056
|
||||
SetEnv proxy-sendcl 1
|
||||
|
||||
### LOCATION OF CERT FILES ###
|
||||
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
@ -919,7 +941,7 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \
|
||||
"Mail" "" ON \
|
||||
"Deck" "" ON \
|
||||
"Collectives" "" ON \
|
||||
"Suspicios Login detetion" "" ON \
|
||||
"Suspicious Login detection" "" ON \
|
||||
"IssueTemplate" "" OFF \
|
||||
"Group-Folders" "" OFF 3>&1 1>&2 2>&3)
|
||||
fi
|
||||
@ -960,8 +982,9 @@ case "$choice" in
|
||||
;;&
|
||||
*"Collectives"*)
|
||||
install_and_enable_app collectives
|
||||
install_if_not php"$PHPVER"-sqlite3
|
||||
;;&
|
||||
*"Suspicios Login detetion"*)
|
||||
*"Suspicious Login detection"*)
|
||||
install_and_enable_app suspicios_login
|
||||
;;&
|
||||
*"Group-Folders"*)
|
||||
@ -1028,11 +1051,11 @@ fi
|
||||
# Fix Realtek on PN51
|
||||
if asuspn51
|
||||
then
|
||||
if ! version 22.04 "$DISTRO" 22.04.10
|
||||
if ! version 24.04 "$DISTRO" 24.04.10
|
||||
then
|
||||
# Upgrade Realtek drivers
|
||||
print_text_in_color "$ICyan" "Upgrading Realtek firmware..."
|
||||
curl_to_dir https://raw.githubusercontent.com/nextcloud/vm/master/network/asusnuc pn51.sh "$SCRIPTS"
|
||||
curl_to_dir https://raw.githubusercontent.com/nextcloud/vm/main/network/asusnuc pn51.sh "$SCRIPTS"
|
||||
bash "$SCRIPTS"/pn51.sh
|
||||
fi
|
||||
fi
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user