Skip to content
Snippets Groups Projects
Commit 86c6ebc5 authored by Bob Mottram's avatar Bob Mottram
Browse files

No basic auth initially

parent 94257175
No related branches found
No related tags found
No related merge requests found
...@@ -277,7 +277,7 @@ function remove_edith { ...@@ -277,7 +277,7 @@ function remove_edith {
} }
function install_edith { function install_edith {
$INSTALL_PACKAGES php-gettext php-curl php-gd php-mysql git curl $INSTALL_PACKAGES php-gettext php-curl php-gd php-mysql git curl apache2-utils
$INSTALL_PACKAGES memcached php-memcached php-intl exiftool libfcgi0ldbl $INSTALL_PACKAGES memcached php-memcached php-intl exiftool libfcgi0ldbl
function_check install_nodejs function_check install_nodejs
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
WEBADMIN_LOGIN_TEXT=$"Welcome to ${PROJECT_NAME}"
function web_admin_configure_installer_daemon { function web_admin_configure_installer_daemon {
if [ -f /etc/systemd/system/webadmin.service ]; then if [ -f /etc/systemd/system/webadmin.service ]; then
return return
...@@ -451,11 +453,31 @@ function web_admin_onion_only { ...@@ -451,11 +453,31 @@ function web_admin_onion_only {
} }
function web_admin_setup_login { function web_admin_setup_login {
if [ ! -f /usr/bin/htpasswd ]; then
$INSTALL_PACKAGES apache2-utils
fi
read_config_param MY_USERNAME read_config_param MY_USERNAME
webadmin_password=$("${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a webadmin) webadmin_password=$("${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a webadmin)
if [ ! "$webadmin_password" ]; then if [ ! "$webadmin_password" ]; then
webadmin_password="$(create_password "${MINIMUM_PASSWORD_LENGTH}")" webadmin_password="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
"${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a webadmin -p "$webadmin_password" "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a webadmin -p "$webadmin_password"
# create a password for users
if [ ! -f /etc/nginx/.webadminpasswd ]; then
touch /etc/nginx/.webadminpasswd
fi
if grep -q "$MY_USERNAME:" /etc/nginx/.webadminpasswd; then
sed -i "/$MY_USERNAME:/d" /etc/nginx/.webadminpasswd
fi
echo -n "$webadmin_password" | htpasswd -i -s -c /etc/nginx/.webadminpasswd "$MY_USERNAME"
if [ ! -f /etc/nginx/.webadminpasswd ]; then
echo $'/etc/nginx/.webadminpasswd not found'
exit 5637653
fi
#echo -n "$webadmin_password" > "/var/www/${local_hostname}/htdocs/admin/initiallogin.txt"
fi fi
} }
...@@ -463,8 +485,6 @@ function install_web_admin { ...@@ -463,8 +485,6 @@ function install_web_admin {
# This is intended as an admin web user interface # This is intended as an admin web user interface
# similar to Plinth or the yunohost # similar to Plinth or the yunohost
web_admin_setup_login
language_subdir=$(web_admin_get_language_subdir) language_subdir=$(web_admin_get_language_subdir)
local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local local_hostname=$(grep 'host-name' /etc/avahi/avahi-daemon.conf | awk -F '=' '{print $2}').local
...@@ -513,6 +533,8 @@ function install_web_admin { ...@@ -513,6 +533,8 @@ function install_web_admin {
echo ' error_log /dev/null;'; echo ' error_log /dev/null;';
echo ''; echo '';
echo ' location ^~ /admin {'; echo ' location ^~ /admin {';
echo " #auth_basic \"${WEBADMIN_LOGIN_TEXT}\";";
echo ' #auth_basic_user_file /etc/nginx/.webadminpasswd;';
echo " root /var/www/${local_hostname}/htdocs;"; echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;'; echo ' index index.html;';
echo " error_page 405 = \$uri;"; echo " error_page 405 = \$uri;";
...@@ -554,6 +576,8 @@ function install_web_admin { ...@@ -554,6 +576,8 @@ function install_web_admin {
{ echo ' add_header Strict-Transport-Security max-age=0;'; { echo ' add_header Strict-Transport-Security max-age=0;';
echo ''; echo '';
echo ' location ^~ /admin {'; echo ' location ^~ /admin {';
echo " #auth_basic \"${WEBADMIN_LOGIN_TEXT}\";";
echo ' #auth_basic_user_file /etc/nginx/.webadminpasswd;';
echo " root /var/www/${local_hostname}/htdocs;"; echo " root /var/www/${local_hostname}/htdocs;";
echo ' index index.html;'; echo ' index index.html;';
echo " error_page 405 = \$uri;"; echo " error_page 405 = \$uri;";
...@@ -602,6 +626,8 @@ function install_web_admin { ...@@ -602,6 +626,8 @@ function install_web_admin {
# make the list of apps # make the list of apps
web_admin_create_installed_apps web_admin_create_installed_apps
web_admin_setup_login
chown -R www-data:www-data "/var/www/${local_hostname}/htdocs" chown -R www-data:www-data "/var/www/${local_hostname}/htdocs"
web_admin_avahi web_admin_avahi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment