mirror of
				https://github.com/zokradonh/kopano-docker
				synced 2025-10-31 18:37:15 +00:00 
			
		
		
		
	Improving setup.sh
- Bugfixing $LDAP_BIND_DN - Removing ADMIN-PWs for DB/LDAP in case of alternative server - Warning message in case of not using the bundled DB/LDAP
This commit is contained in:
		
							parent
							
								
									89450d8b34
								
							
						
					
					
						commit
						1d556156e9
					
				
							
								
								
									
										26
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								setup.sh
									
									
									
									
									
								
							| @ -16,6 +16,8 @@ if [ ! -e ./docker-compose.yml ]; then | |||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ ! -e ./.env ]; then | if [ ! -e ./.env ]; then | ||||||
|  |     PRINT_SETUP_SUCCESS="" | ||||||
|  | 
 | ||||||
| 	echo "Creating an .env file for you" | 	echo "Creating an .env file for you" | ||||||
| 	value_default=latest | 	value_default=latest | ||||||
| 	read -p "Which tag do you want to use for Kopano Core components? [$value_default]: " new_value | 	read -p "Which tag do you want to use for Kopano Core components? [$value_default]: " new_value | ||||||
| @ -32,12 +34,12 @@ if [ ! -e ./.env ]; then | |||||||
| 	value_default="kopano.demo" | 	value_default="kopano.demo" | ||||||
| 	read -p "FQDN to be used (for reverse proxy) [$value_default]: " new_value | 	read -p "FQDN to be used (for reverse proxy) [$value_default]: " new_value | ||||||
| 	FQDN=${new_value:-$value_default} | 	FQDN=${new_value:-$value_default} | ||||||
| 	LDAP_BASE_DN=$(fqdn_to_dn $FQDN) |  | ||||||
| 
 | 
 | ||||||
| 	value_default="self_signed" | 	value_default="self_signed" | ||||||
| 	read -p "Email address to use for Lets Encrypt. Use 'self_signed' as your email to create self signed certificates [$value_default]: " new_value | 	read -p "Email address to use for Lets Encrypt. Use 'self_signed' as your email to create self signed certificates [$value_default]: " new_value | ||||||
| 	EMAIL=${new_value:-$value_default} | 	EMAIL=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
|  | 	LDAP_BASE_DN=$(fqdn_to_dn $FQDN) | ||||||
| 	value_default="$LDAP_BASE_DN" | 	value_default="$LDAP_BASE_DN" | ||||||
| 	read -p "Name of the BASE DN for LDAP [$value_default]: " new_value | 	read -p "Name of the BASE DN for LDAP [$value_default]: " new_value | ||||||
| 	LDAP_BASE_DN=${new_value:-$value_default} | 	LDAP_BASE_DN=${new_value:-$value_default} | ||||||
| @ -47,24 +49,25 @@ if [ ! -e ./.env ]; then | |||||||
| 	LDAP_SERVER=${new_value:-$value_default} | 	LDAP_SERVER=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
| 	if [ "$LDAP_SERVER" != "$value_default" ]; then | 	if [ "$LDAP_SERVER" != "$value_default" ]; then | ||||||
| 		value_default="kopano123" | 	    # We don't need an admin password in case we don't use the bundled LDAP server | ||||||
| 		read -p "Password of the admin user [$value_default]: " new_value | 	    LDAP_ADMIN_PASSWORD="" | ||||||
| 		LDAP_ADMIN_PASSWORD=${new_value:-$value_default} |  | ||||||
| 
 | 
 | ||||||
| 		value_default="$LDAP_BASE_DN" | 		value_default="$LDAP_BASE_DN" | ||||||
| 		read -p "LDAP search base [$value_default]: " new_value | 		read -p "LDAP search base [$value_default]: " new_value | ||||||
| 		LDAP_SEARCH_BASE=${new_value:-$value_default} | 		LDAP_SEARCH_BASE=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
| 		value_default="CN=readonly,$LDAP_BASE_DN" | 		value_default="CN=readonly,$LDAP_BASE_DN" | ||||||
| 		read -p "LDAP bind user (needs only read permissions) [$value_default]: " new_value | 		read -p "LDAP bind user (needs read permissions) [$value_default]: " new_value | ||||||
| 		LDAP_BIND_DN=${new_value:-$value_default} | 		LDAP_BIND_DN=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
| 		value_default="kopano123" | 		value_default="kopano123" | ||||||
| 		read -p "LDAP bind password to be used [$value_default]: " new_value | 		read -p "LDAP bind password to be used [$value_default]: " new_value | ||||||
| 		LDAP_BIND_PW=${new_value:-$value_default} | 		LDAP_BIND_PW=${new_value:-$value_default} | ||||||
|  | 
 | ||||||
|  | 		PRINT_SETUP_SUCCESS="$PRINT_SETUP_SUCCESS \n!! You have specified the LDAP server '${LDAP_SERVER}', don't forget to remove the bundled ldap and ldap-admin services in docker-compose.yml\n" | ||||||
| 	else | 	else | ||||||
| 		LDAP_ADMIN_PASSWORD=$(random_string) | 		LDAP_ADMIN_PASSWORD=$(random_string) | ||||||
| 		LDAP_SEARCH_BASE="$LDAP_BIND_DN" | 		LDAP_SEARCH_BASE="$LDAP_BASE_DN" | ||||||
| 		LDAP_BIND_DN="CN=readonly,$LDAP_BASE_DN" | 		LDAP_BIND_DN="CN=readonly,$LDAP_BASE_DN" | ||||||
| 		LDAP_BIND_PW=$(random_string) | 		LDAP_BIND_PW=$(random_string) | ||||||
| 	fi | 	fi | ||||||
| @ -91,9 +94,8 @@ if [ ! -e ./.env ]; then | |||||||
| 	MYSQL_HOST=${new_value:-$value_default} | 	MYSQL_HOST=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
| 	if [ "$MYSQL_HOST" != "$value_default" ]; then | 	if [ "$MYSQL_HOST" != "$value_default" ]; then | ||||||
| 		value_default="kopano123" | 		# We don't need an admin password in case we don't use the bundled DB server | ||||||
| 		read -p "Password for the MySQL root user [$value_default]: " new_value | 		MYSQL_ROOT_PASSWORD="" | ||||||
| 		MYSQL_ROOT_PASSWORD=${new_value:-$value_default} |  | ||||||
| 
 | 
 | ||||||
| 		value_default="kopanoDbUser" | 		value_default="kopanoDbUser" | ||||||
| 		read -p "Username to connect to the database [$value_default]: " new_value | 		read -p "Username to connect to the database [$value_default]: " new_value | ||||||
| @ -104,8 +106,10 @@ if [ ! -e ./.env ]; then | |||||||
| 		MYSQL_PASSWORD=${new_value:-$value_default} | 		MYSQL_PASSWORD=${new_value:-$value_default} | ||||||
| 
 | 
 | ||||||
| 		value_default="kopano" | 		value_default="kopano" | ||||||
| 		read -p "Datebase to use for Kopano [$value_default]: " new_value | 		read -p "Database to use for Kopano [$value_default]: " new_value | ||||||
| 		MYSQL_DATABASE=${new_value:-$value_default} | 		MYSQL_DATABASE=${new_value:-$value_default} | ||||||
|  | 
 | ||||||
|  | 		PRINT_SETUP_SUCCESS="$PRINT_SETUP_SUCCESS \n!! You have specified the DB server '${MYSQL_HOST}', don't forget to remove the bundled db service in docker-compose.yml\n" | ||||||
| 	else | 	else | ||||||
| 		MYSQL_USER="kopano" | 		MYSQL_USER="kopano" | ||||||
| 		MYSQL_DATABASE="kopano" | 		MYSQL_DATABASE="kopano" | ||||||
| @ -113,6 +117,8 @@ if [ ! -e ./.env ]; then | |||||||
| 		MYSQL_PASSWORD=$(random_string) | 		MYSQL_PASSWORD=$(random_string) | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|  |     echo ${PRINT_SETUP_SUCCESS} | ||||||
|  | 
 | ||||||
|         cat <<-EOF >"./.env" |         cat <<-EOF >"./.env" | ||||||
| # please consult https://github.com/zokradonh/kopano-docker | # please consult https://github.com/zokradonh/kopano-docker | ||||||
| # for possible configuration values and their impact | # for possible configuration values and their impact | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user