Skip to content

Commit

Permalink
Add the ability to restrict access to info page (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
VyacheslavSemin authored Nov 22, 2023
1 parent 7aa39a8 commit acead28
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ENV DOCSERVICE_HOST_PORT=localhost:8000 \
NGINX_WORKER_CONNECTIONS=4096
EXPOSE 8888
RUN yum -y updateinfo && \
yum -y install gettext nginx && \
yum -y install gettext nginx httpd-tools && \
yum clean all && \
rm -f /var/log/*log
COPY --chown=ds:ds config/nginx/nginx.conf /etc/nginx/nginx.conf
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.noplugins
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ENV DOCSERVICE_HOST_PORT=localhost:8000 \
NGINX_WORKER_CONNECTIONS=4096
EXPOSE 8888
RUN yum -y updateinfo && \
yum -y install gettext nginx && \
yum -y install gettext nginx httpd-tools && \
yum clean all && \
rm -f /var/log/*log
COPY --chown=ds:ds config/nginx/nginx.conf /etc/nginx/nginx.conf
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ Below is the complete list of parameters for `onlyoffice/docs-proxy`.
- **NGINX_WORKER_CONNECTIONS**: Defines the nginx config [worker_connections](https://nginx.org/en/docs/ngx_core_module.html#worker_connections) directive. Defaults to `4096`.
- **SECURE_LINK_SECRET**: Defines secret for the nginx config directive [secure_link_md5](http://nginx.org/ru/docs/http/ngx_http_secure_link_module.html#secure_link_md5). Defaults to `verysecretstring`.
- **INFO_ALLOWED_IP**: Defines ip addresses for accessing the info page. You can specify multiple values separated by a space.
- **INFO_ALLOWED_USER**: Defines user name for accessing the info page. If not set to, [Nginx Basic Authentication](https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html) will not be applied to access the info page.
- **INFO_ALLOWED_PASSWORD**: Defines user password for accessing the info page. Used if `INFO_ALLOWED_USER` is set.

Below is the complete list of parameters for `onlyoffice/docs-docservice`, `onlyoffice/docs-converter`.
- **DB_TYPE**: The database type. Supported values are `postgres`, `mariadb` or `mysql`. Defaults to `postgres`.
Expand Down
5 changes: 5 additions & 0 deletions proxy-docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ if [[ -n "$INFO_ALLOWED_IP" ]]; then
sed -i '/(info)/a\ allow '$ip'\;' /tmp/proxy_nginx/includes/ds-docservice.conf
done
fi
if [[ -n "$INFO_ALLOWED_USER" ]]; then
htpasswd -c -b /tmp/auth "${INFO_ALLOWED_USER}" "${INFO_ALLOWED_PASSWORD:-password}"
sed -i '/(info)/a\ auth_basic \"Authentication Required\"\;' /tmp/proxy_nginx/includes/ds-docservice.conf
sed -i '/auth_basic/a\ auth_basic_user_file \/tmp\/auth\;' /tmp/proxy_nginx/includes/ds-docservice.conf
fi
exec nginx -c /tmp/proxy_nginx/nginx.conf -g 'daemon off;'

0 comments on commit acead28

Please sign in to comment.