Support for apps only on onion addresses
This commit is contained in:
parent
51ceb967a5
commit
190d60d448
|
@ -38,6 +38,7 @@ app_repo="TODO"
|
||||||
app_repo_commit='TODO'
|
app_repo_commit='TODO'
|
||||||
app_php=
|
app_php=
|
||||||
app_node=
|
app_node=
|
||||||
|
app_onion_only=
|
||||||
app_port=''
|
app_port=''
|
||||||
your_name=''
|
your_name=''
|
||||||
your_email=''
|
your_email=''
|
||||||
|
@ -59,6 +60,7 @@ function show_help {
|
||||||
echo $' -c --commit [hash] Git commit'
|
echo $' -c --commit [hash] Git commit'
|
||||||
echo $' --port [number] Port number for the app'
|
echo $' --port [number] Port number for the app'
|
||||||
echo $' --node [yes|no] Is this a nodejs app?'
|
echo $' --node [yes|no] Is this a nodejs app?'
|
||||||
|
echo $' -o --onion [yes|no] Is this app only available on an onion address?'
|
||||||
echo $' -p --php [yes|no] Is this a PHP app?'
|
echo $' -p --php [yes|no] Is this a PHP app?'
|
||||||
echo $' -d --database [mariadb|postgresql] Type of database'
|
echo $' -d --database [mariadb|postgresql] Type of database'
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -108,6 +110,12 @@ do
|
||||||
shift
|
shift
|
||||||
app_node="$1"
|
app_node="$1"
|
||||||
;;
|
;;
|
||||||
|
-o|--onion)
|
||||||
|
shift
|
||||||
|
if [[ "$1" == 'yes' ]]; then
|
||||||
|
app_onion_only=1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
--port)
|
--port)
|
||||||
shift
|
shift
|
||||||
app_port="$1"
|
app_port="$1"
|
||||||
|
@ -191,6 +199,9 @@ echo "VARIANTS='full full-vim'"
|
||||||
echo ''
|
echo ''
|
||||||
echo 'IN_DEFAULT_INSTALL=0'
|
echo 'IN_DEFAULT_INSTALL=0'
|
||||||
echo "SHOW_ON_ABOUT=${SHOW_ON_ABOUT}"
|
echo "SHOW_ON_ABOUT=${SHOW_ON_ABOUT}"
|
||||||
|
if [ $app_onion_only ]; then
|
||||||
|
echo 'SHOW_ICANN_ADDRESS_ON_ABOUT=0'
|
||||||
|
fi
|
||||||
echo ''
|
echo ''
|
||||||
echo "${app_name_upper}_DOMAIN_NAME="
|
echo "${app_name_upper}_DOMAIN_NAME="
|
||||||
echo "${app_name_upper}_CODE="
|
echo "${app_name_upper}_CODE="
|
||||||
|
@ -227,16 +238,20 @@ echo " echo '0'"
|
||||||
echo '}'
|
echo '}'
|
||||||
echo ''
|
echo ''
|
||||||
echo "function install_interactive_${app_name} {"
|
echo "function install_interactive_${app_name} {"
|
||||||
echo ' if [ ! $ONION_ONLY ]; then'
|
if [ ! $app_onion_only ]; then
|
||||||
echo " ONION_ONLY='no'"
|
echo ' if [ ! $ONION_ONLY ]; then'
|
||||||
echo ' fi'
|
echo " ONION_ONLY='no'"
|
||||||
echo ''
|
echo ' fi'
|
||||||
echo ' if [[ $ONION_ONLY != "no" ]]; then'
|
echo ''
|
||||||
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}.local'"
|
echo ' if [[ $ONION_ONLY != "no" ]]; then'
|
||||||
echo " write_config_param \"${app_name_upper}_DOMAIN_NAME\" \"\$${app_name_upper}_DOMAIN_NAME\""
|
echo " ${app_name_upper}_DOMAIN_NAME='${app_name}.local'"
|
||||||
echo ' else'
|
echo " write_config_param \"${app_name_upper}_DOMAIN_NAME\" \"\$${app_name_upper}_DOMAIN_NAME\""
|
||||||
echo " interactive_site_details \"${app_name}\" \"${app_name_upper}_DOMAIN_NAME\" \"${app_name}_CODE\""
|
echo ' else'
|
||||||
echo ' fi'
|
echo " interactive_site_details \"${app_name}\" \"${app_name_upper}_DOMAIN_NAME\" \"${app_name}_CODE\""
|
||||||
|
echo ' fi'
|
||||||
|
else
|
||||||
|
echo " echo -n ''"
|
||||||
|
fi
|
||||||
echo ' APP_INSTALLED=1'
|
echo ' APP_INSTALLED=1'
|
||||||
echo '}'
|
echo '}'
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -541,7 +556,7 @@ echo ''
|
||||||
echo " chmod g+w /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
echo " chmod g+w /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
echo " chown -R www-data:www-data /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
echo " chown -R www-data:www-data /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs"
|
||||||
|
|
||||||
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" ]]; then
|
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* ]]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo " ${app_name}_create_database"
|
echo " ${app_name}_create_database"
|
||||||
fi
|
fi
|
||||||
|
@ -551,53 +566,58 @@ echo ''
|
||||||
echo " ${app_name_upper}_ONION_HOSTNAME=\$(add_onion_service ${app_name} 80 \${${app_name_upper}_ONION_PORT})"
|
echo " ${app_name_upper}_ONION_HOSTNAME=\$(add_onion_service ${app_name} 80 \${${app_name_upper}_ONION_PORT})"
|
||||||
echo ''
|
echo ''
|
||||||
echo " ${app_name}_nginx_site=/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME"
|
echo " ${app_name}_nginx_site=/etc/nginx/sites-available/\$${app_name_upper}_DOMAIN_NAME"
|
||||||
echo ' if [[ $ONION_ONLY == "no" ]]; then'
|
|
||||||
if [[ "$app_php" == 'yes' ]]; then
|
if [ $app_onion_only ]; then
|
||||||
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.php\""
|
echo ' if [[ $ONION_ONLY == "no" ]]; then'
|
||||||
else
|
if [[ "$app_php" == 'yes' ]]; then
|
||||||
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.html\""
|
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.php\""
|
||||||
fi
|
else
|
||||||
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
echo " nginx_http_redirect \$${app_name_upper}_DOMAIN_NAME \"index index.html\""
|
||||||
echo " echo ' listen 443 ssl;' >> \$${app_name}_nginx_site"
|
fi
|
||||||
echo " echo ' listen [::]:443 ssl;' >> \$${app_name}_nginx_site"
|
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
||||||
echo " echo \" server_name \$${app_name_upper}_DOMAIN_NAME;\" >> \$${app_name}_nginx_site"
|
echo " echo ' listen 443 ssl;' >> \$${app_name}_nginx_site"
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
echo " echo ' listen [::]:443 ssl;' >> \$${app_name}_nginx_site"
|
||||||
echo " nginx_compress \$${app_name_upper}_DOMAIN_NAME"
|
echo " echo \" server_name \$${app_name_upper}_DOMAIN_NAME;\" >> \$${app_name}_nginx_site"
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' # Security' >> \$${app_name}_nginx_site"
|
|
||||||
echo " nginx_ssl \$${app_name_upper}_DOMAIN_NAME"
|
|
||||||
echo ''
|
|
||||||
echo " nginx_disable_sniffing \$${app_name_upper}_DOMAIN_NAME"
|
|
||||||
echo ''
|
|
||||||
echo " echo ' add_header Strict-Transport-Security max-age=15768000;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' # Logs' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' access_log /dev/null;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' error_log /dev/null;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' # Root' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\" >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
|
||||||
if [[ "$app_php" == 'yes' ]]; then
|
|
||||||
echo " echo ' index index.php;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' location ~ \.php {' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' include snippets/fastcgi-php.conf;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' fastcgi_read_timeout 30;' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo '' >> \$${app_name}_nginx_site"
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
echo " nginx_compress \$${app_name_upper}_DOMAIN_NAME"
|
||||||
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' # Security' >> \$${app_name}_nginx_site"
|
||||||
|
echo " nginx_ssl \$${app_name_upper}_DOMAIN_NAME"
|
||||||
|
echo ''
|
||||||
|
echo " nginx_disable_sniffing \$${app_name_upper}_DOMAIN_NAME"
|
||||||
|
echo ''
|
||||||
|
echo " echo ' add_header Strict-Transport-Security max-age=15768000;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' # Logs' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' access_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' error_log /dev/null;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' # Root' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo \" root /var/www/\$${app_name_upper}_DOMAIN_NAME/htdocs;\" >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
if [[ "$app_php" == 'yes' ]]; then
|
||||||
|
echo " echo ' index index.php;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' location ~ \.php {' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' include snippets/fastcgi-php.conf;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' fastcgi_read_timeout 30;' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo '' >> \$${app_name}_nginx_site"
|
||||||
|
else
|
||||||
|
echo " echo ' index index.html;' >> \$${app_name}_nginx_site"
|
||||||
|
fi
|
||||||
|
echo " echo ' # Location' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' location / {' >> \$${app_name}_nginx_site"
|
||||||
|
echo " nginx_limits \$${app_name_upper}_DOMAIN_NAME '15m'"
|
||||||
|
echo " echo ' try_files \$uri \$uri/ @${app_name};' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo ' }' >> \$${app_name}_nginx_site"
|
||||||
|
echo " echo '}' >> \$${app_name}_nginx_site"
|
||||||
|
echo ' else'
|
||||||
|
echo " echo -n '' > \$${app_name}_nginx_site"
|
||||||
|
echo ' fi'
|
||||||
else
|
else
|
||||||
echo " echo ' index index.html;' >> \$${app_name}_nginx_site"
|
echo " echo -n '' > \$${app_name}_nginx_site"
|
||||||
fi
|
fi
|
||||||
echo " echo ' # Location' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' location / {' >> \$${app_name}_nginx_site"
|
|
||||||
echo " nginx_limits \$${app_name_upper}_DOMAIN_NAME '15m'"
|
|
||||||
echo " echo ' try_files \$uri \$uri/ @${app_name};' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo ' }' >> \$${app_name}_nginx_site"
|
|
||||||
echo " echo '}' >> \$${app_name}_nginx_site"
|
|
||||||
echo ' else'
|
|
||||||
echo " echo -n '' > \$${app_name}_nginx_site"
|
|
||||||
echo ' fi'
|
|
||||||
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
echo " echo 'server {' >> \$${app_name}_nginx_site"
|
||||||
echo " echo \" listen 127.0.0.1:\$${app_name_upper}_ONION_PORT default_server;\" >> \$${app_name}_nginx_site"
|
echo " echo \" listen 127.0.0.1:\$${app_name_upper}_ONION_PORT default_server;\" >> \$${app_name}_nginx_site"
|
||||||
echo " echo \" server_name \$${app_name_upper}_ONION_HOSTNAME;\" >> \$${app_name}_nginx_site"
|
echo " echo \" server_name \$${app_name_upper}_ONION_HOSTNAME;\" >> \$${app_name}_nginx_site"
|
||||||
|
|
Loading…
Reference in New Issue