feat: add new option FRESHRSS_TRUSTED_SOURCES
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2022-11-25 14:15:55 +01:00
parent 8ae6d67686
commit 6c0ec6e6ec
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
3 changed files with 26 additions and 20 deletions

View File

@ -48,7 +48,6 @@ FRESHRSS_BASE_URL="http://localhost/"
FRESHRSS_LANGUAGE="en" FRESHRSS_LANGUAGE="en"
FRESHRSS_TITLE="FreshRSS" FRESHRSS_TITLE="FreshRSS"
FRESHRSS_META_DESCRIPTION= FRESHRSS_META_DESCRIPTION=
FRESHRSS_DEFAULT_USER="_"
FRESHRSS_ALLOW_ANONYMOUS="false" FRESHRSS_ALLOW_ANONYMOUS="false"
FRESHRSS_ALLOW_ANONYMOUS_REFRESH="false" FRESHRSS_ALLOW_ANONYMOUS_REFRESH="false"
FRESHRSS_AUTH_TYPE="form" FRESHRSS_AUTH_TYPE="form"
@ -80,6 +79,8 @@ FRESHRSS_DB_BASE=
FRESHRSS_DB_PREFIX="freshrss_" FRESHRSS_DB_PREFIX="freshrss_"
## comma-seperated string, extensions must be installed! ## comma-seperated string, extensions must be installed!
FRESHRSS_EXTENSIONS_ENABLED="Tumblr-GDPR" FRESHRSS_EXTENSIONS_ENABLED="Tumblr-GDPR"
## comma-seperated string
FRESHRSS_TRUSTED_SOURCES=127.0.0.0/8,::1/128
``` ```
### PHP ### PHP

View File

@ -7,7 +7,7 @@ return array(
'language' => '{{ getenv "FRESHRSS_LANGUAGE" "en" }}', 'language' => '{{ getenv "FRESHRSS_LANGUAGE" "en" }}',
'title' => '{{ getenv "FRESHRSS_TITLE" "FreshRSS" }}', 'title' => '{{ getenv "FRESHRSS_TITLE" "FreshRSS" }}',
'meta_description' => '{{ getenv "FRESHRSS_META_DESCRIPTION" }}', 'meta_description' => '{{ getenv "FRESHRSS_META_DESCRIPTION" }}',
'default_user' => '{{ getenv "FRESHRSS_DEFAULT_USER" "_" }}', 'default_user' => '{{ getenv "FRESHRSS_DEFAULT_USER" "admin" }}',
'allow_anonymous' => {{ getenv "FRESHRSS_ALLOW_ANONYMOUS" "false" }}, 'allow_anonymous' => {{ getenv "FRESHRSS_ALLOW_ANONYMOUS" "false" }},
'allow_anonymous_refresh' => {{ getenv "FRESHRSS_ALLOW_ANONYMOUS_REFRESH" "false" }}, 'allow_anonymous_refresh' => {{ getenv "FRESHRSS_ALLOW_ANONYMOUS_REFRESH" "false" }},
'auth_type' => '{{ getenv "FRESHRSS_AUTH_TYPE" "form" }}', 'auth_type' => '{{ getenv "FRESHRSS_AUTH_TYPE" "form" }}',
@ -71,4 +71,10 @@ return array(
), ),
'disable_update' => true, 'disable_update' => true,
'trusted_sources' => [
{{- range (getenv "FRESHRSS_TRUSTED_SOURCES" "127.0.0.0/8,::1/128" | strings.Split ",") }}
'{{ . | strings.TrimSpace }}',
{{- end }}
]
); );

View File

@ -4,7 +4,6 @@
. /usr/local/lib/log.sh . /usr/local/lib/log.sh
/usr/local/bin/gomplate -o /etc/php8/php.ini -f /etc/templates/php.ini.tmpl /usr/local/bin/gomplate -o /etc/php8/php.ini -f /etc/templates/php.ini.tmpl
/usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl
/usr/local/bin/gomplate -o /var/www/app/constants.local.php -f /etc/templates/constants.local.php.tmpl /usr/local/bin/gomplate -o /var/www/app/constants.local.php -f /etc/templates/constants.local.php.tmpl
if [ -n "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" ] && [ ! -f "/var/www/.postgresql/root.crt" ]; then if [ -n "${FRESHRSS_POSTGRES_SSL_ROOTCERT}" ] && [ ! -f "/var/www/.postgresql/root.crt" ]; then
@ -35,11 +34,10 @@ else
exit $EXITCODE exit $EXITCODE
fi fi
if [ "${FRESHRSS_DEFAULT_USER}" ]; then
log_info "Ensure default user exists" log_info "Ensure default user exists"
ERROR=$(/usr/bin/php ./cli/create-user.php \ ERROR=$(/usr/bin/php ./cli/create-user.php \
--user "$FRESHRSS_DEFAULT_USER" \ --user "${FRESHRSS_DEFAULT_USER:-admin}" \
--password "$FRESHRSS_DEFAULT_PASSWORD" \ --password "${FRESHRSS_DEFAULT_PASSWORD:-freshrss}" \
--language "${FRESHRSS_LANGUAGE:-en}" \ --language "${FRESHRSS_LANGUAGE:-en}" \
2>&1) 2>&1)
EXITCODE=$? EXITCODE=$?
@ -48,12 +46,13 @@ if [ "${FRESHRSS_DEFAULT_USER}" ]; then
log_info "FreshRSS user already exists, skipped" log_info "FreshRSS user already exists, skipped"
elif [ $EXITCODE -eq 0 ]; then elif [ $EXITCODE -eq 0 ]; then
log_info "FreshRSS user successfully created" log_info "FreshRSS user successfully created"
./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user "$FRESHRSS_DEFAULT_USER" ./cli/list-users.php | xargs -n1 ./cli/actualize-user.php --user "${FRESHRSS_DEFAULT_USER:-admin}"
else else
log_error "FreshRSS error during the creation of a user: ${ERROR}" log_error "FreshRSS error during the creation of a user: ${ERROR}"
exit $EXITCODE exit $EXITCODE
fi fi
fi
/usr/local/bin/gomplate -o /var/www/app/data/config.php -f /etc/templates/config.php.tmpl
log_info "Start FreshRSS Server\n" log_info "Start FreshRSS Server\n"
supercronic /etc/crontabs/nginx & supercronic /etc/crontabs/nginx &