first
This commit is contained in:
commit
b29d18c864
14 files changed
+4624
No files matched your search
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
source /assets/functions/00-container
|
||||
prepare_service
|
||||
PROCESS_NAME="osticket"
|
||||
|
||||
check_service_initialized init 20-php-fpm
|
||||
|
||||
### Sanity Test
|
||||
sanity_db
|
||||
sanity_var ADMIN_PASS "Admin Password"
|
||||
sanity_var ADMIN_EMAIL "Admin Email"
|
||||
sanity_var ADMIN_USER "Admin Username"
|
||||
sanity_var INSTALL_SECRET "Install Secret"
|
||||
|
||||
db_ready mariadb
|
||||
|
||||
### Adjust Runtime Variables
|
||||
sed -i -e "s/<CRON_PERIOD>/$CRON_PERIOD/g" /assets/cron/osticket.txt
|
||||
sed -i -e "s#<WEBROOT>#${NGINX_WEBROOT}#g" /assets/setup/install.php
|
||||
|
||||
### Check to see if this is a new install, if yes copy information from assets create directories...
|
||||
if [ ! -f "${NGINX_WEBROOT}"/index.php ] ; then
|
||||
print_warn "New OSTicket Installation Detected."
|
||||
mkdir -p "${NGINX_WEBROOT}"
|
||||
cp -R /assets/install/* "${NGINX_WEBROOT}"/
|
||||
chown -R "${NGINX_USER}":"${NGINX_GROUP}" "${NGINX_WEBROOT}"/
|
||||
chmod -R a+rX "${NGINX_WEBROOT}"
|
||||
chmod -R u+rw "${NGINX_WEBROOT}"
|
||||
chown -R root:root "${NGINX_WEBROOT}"/setup_hidden
|
||||
chmod 700 "${NGINX_WEBROOT}"/setup_hidden
|
||||
fi
|
||||
|
||||
# Automate installation
|
||||
silent php /assets/setup/install.php
|
||||
|
||||
## Check Memcache Settings
|
||||
if [ ${MEMCACHE_HOST:+1} ]; then
|
||||
print_notice "Setting Memcache"
|
||||
sed -i -e "s/# define('SESSION_BACKEND', 'memcache');/define('SESSION_BACKEND', 'memcache');/g" "${NGINX_WEBROOT}"/include/ost-config.php
|
||||
sed -i -e "s/# define('MEMCACHE_SERVERS', 'server1:11211,server2:11211');/define('MEMCACHE_SERVERS', '$MEMCACHE_HOST:$MEMCACHE_PORT');/g" "${NGINX_WEBROOT}"/include/ost-config.php
|
||||
fi
|
||||
|
||||
## Proxy Fix
|
||||
if [ ${VIRTUAL_HOST:+1} ]; then
|
||||
print_notice "Configuring Reverse Proxy settings"
|
||||
sed -i -e "s/define('TRUSTED_PROXIES', '');/define('TRUSTED_PROXIES', '*');/g" "${NGINX_WEBROOT}"/include/ost-config.php
|
||||
fi
|
||||
|
||||
print_notice "Applying configuration file security"
|
||||
chmod 644 "${NGINX_WEBROOT}"/include/ost-config.php
|
||||
|
||||
#if [ ${ADMIN_PASS:+1} ]; then
|
||||
# print_notice "Setting Administrative User Password"
|
||||
# mysqlcmd='mysql -u'$DB_USER' -h'$DB_HOST' -p'$DB_PASS' -P'$DB_PORT
|
||||
# $mysqlcmd -e "use "$DB_NAME"; UPDATE "$DB_PREFIX"staff SET passwd = MD5( '"$ADMIN_PASS"' ) WHERE username = '"$ADMIN_USER"';"
|
||||
#fi
|
||||
|
||||
### Force Reset Permissions for Security
|
||||
chown -R "${NGINX_USER}":"${NGINX_GROUP}" "${NGINX_WEBROOT}"
|
||||
chmod -R a+rX "${NGINX_WEBROOT}"/
|
||||
chmod -R u+rw "${NGINX_WEBROOT}"/
|
||||
chown -R root:root "${NGINX_WEBROOT}"/setup_hidden
|
||||
chmod 700 "${NGINX_WEBROOT}"/setup_hidden
|
||||
|
||||
liftoff
|
||||
@@ -0,0 +1,56 @@
|
||||
server {
|
||||
listen <LISTEN_PORT>;
|
||||
root <WEBROOT>;
|
||||
index index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
set $path_info "";
|
||||
|
||||
location ~ /include {
|
||||
deny all;
|
||||
return 403;
|
||||
}
|
||||
|
||||
if ($request_uri ~ "^/api(/[^\?]+)") {
|
||||
set $path_info $1;
|
||||
}
|
||||
|
||||
location /api {
|
||||
try_files $uri $uri/ /api/http.php?$query_string;
|
||||
}
|
||||
|
||||
if ($request_uri ~ "^/scp/.*\.php(/[^\?]+)") {
|
||||
set $path_info $1;
|
||||
}
|
||||
|
||||
location ~ ^/scp/ajax.php/.*$ {
|
||||
try_files $uri $uri/ /scp/ajax.php?$query_string;
|
||||
}
|
||||
|
||||
if ($request_uri ~ "^/ajax.php(/[^\?]+)") {
|
||||
set $path_info $1;
|
||||
}
|
||||
|
||||
location ~ ^/ajax.php/.*$ {
|
||||
try_files $uri $uri/ /ajax.php?$query_string;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ index.php;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include /etc/nginx/nginx.conf.d/php-fpm.conf;
|
||||
try_files $uri = 404;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param LARA_ENV local; # Environment variable for Laravel
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
}
|
||||
|
||||
### Don't edit past here
|
||||
include /etc/nginx/nginx.conf.d/site_optimization.conf;
|
||||
include /etc/nginx/nginx.conf.d/exploit_protection.conf;
|
||||
}
|
||||
Reference in new issue
Block a user