diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-03-29 13:57:39 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-04-01 19:08:10 +0300 |
commit | 925c6fe7e5ef094f61fb701a9aeb3d9618ac55b8 (patch) | |
tree | 239de40dba9a97aecf05fc24a14785afba75d622 /etc | |
parent | f31caf4d0411423230c58cbfed04072bea0a2d2e (diff) |
ncp-web: use random passwords for NC and ncp-webv0.53.7
Diffstat (limited to 'etc')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-admin.sh | 48 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-nextcloud.sh | 1 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-passwd.sh | 6 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-webui.sh | 7 |
4 files changed, 58 insertions, 4 deletions
diff --git a/etc/nextcloudpi-config.d/nc-admin.sh b/etc/nextcloudpi-config.d/nc-admin.sh new file mode 100644 index 00000000..16cf79ce --- /dev/null +++ b/etc/nextcloudpi-config.d/nc-admin.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Change password for the Nextcloud admin user +# +# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com> +# GPL licensed (see end of file) * Use at your own risk! +# +# Usage: +# +# ./installer.sh nc-admin.sh <IP> (<img>) +# +# See installer.sh instructions for details +# More at: https://ownyourbits.com +# + +USER_=ncp +PASSWORD_=ownyourbits +CONFIRM_=ownyourbits + +DESCRIPTION="Change password for the Nextcloud admin user" + +configure() +{ + [[ "$PASSWORD_" == "$CONFIRM_" ]] || { echo "passwords do not match"; return 1; } + + OC_PASS="$PASSWORD_" \ + sudo -E -u www-data php /var/www/nextcloud/occ \ + user:resetpassword --password-from-env "$USER_" +} + +install() { :; } + +# License +# +# This script is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this script; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA diff --git a/etc/nextcloudpi-config.d/nc-nextcloud.sh b/etc/nextcloudpi-config.d/nc-nextcloud.sh index 0eeea963..8cc9b2e6 100644 --- a/etc/nextcloudpi-config.d/nc-nextcloud.sh +++ b/etc/nextcloudpi-config.d/nc-nextcloud.sh @@ -221,7 +221,6 @@ EOF </Directory> </IfModule> EOF - a2ensite nextcloud cat > /etc/apache2/sites-available/000-default.conf <<'EOF' <VirtualHost _default_:80> diff --git a/etc/nextcloudpi-config.d/nc-passwd.sh b/etc/nextcloudpi-config.d/nc-passwd.sh index e6303ade..f5604137 100644 --- a/etc/nextcloudpi-config.d/nc-passwd.sh +++ b/etc/nextcloudpi-config.d/nc-passwd.sh @@ -18,11 +18,14 @@ CONFIRM_=ownyourbits DESCRIPTION="Change password for the NextCloudPi Panel" -configure() +configure() { echo -e "$PASSWORD_\n$CONFIRM_" | passwd ncp &>/dev/null && \ echo "password updated successfully" || \ { echo "passwords do not match"; return 1; } + a2ensite ncp nextcloud + a2dissite ncp-activation + bash -c "sleep 1.5 && service apache2 reload" &>/dev/null & } install() { :; } @@ -43,4 +46,3 @@ install() { :; } # along with this script; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA - diff --git a/etc/nextcloudpi-config.d/nc-webui.sh b/etc/nextcloudpi-config.d/nc-webui.sh index fe7437cb..6bd28579 100644 --- a/etc/nextcloudpi-config.d/nc-webui.sh +++ b/etc/nextcloudpi-config.d/nc-webui.sh @@ -13,10 +13,15 @@ # More at: https://ownyourbits.com # -ACTIVE_=yes +ACTIVE_=no LANGUAGE_=[_auto_,en,de] DESCRIPTION="Enable or disable the NCP web interface" +is_active() +{ + a2query -s ncp &>/dev/null +} + configure() { if [[ $ACTIVE_ != "yes" ]]; then |