Fixed sed commands

master
Keith Irwin 2022-11-07 10:49:18 -07:00
parent d3ed88a331
commit 3f2ff4e5fc
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 9 additions and 10 deletions

View File

@ -3,6 +3,7 @@ FROM debian:latest
# Change these
ENV LISTEN_PORT=4441
ENV ADMIN_EMAIL='me@example.com'
ENV SERVER_NAME='wg-test-admin.ksn.gf4'
# Install deps
RUN apt-get update && apt-get install --yes \
@ -16,18 +17,16 @@ RUN chown -R www-data:www-data /usr/lib/wgapi /var/log/wgapi /var/local/wgapi_to
# Configure apache
RUN a2enmod cgi rewrite
RUN sed -i "s/^Listen 80$/Listen ${LISTEN_PORT}/" \
/etc/apache2/ports.conf
RUN sed -i "s/^<VirtualHost \*:80>$/<VirtualHost *:${LISTEN_PORT}>/" \
/etc/apache2/sites-available/000-default.conf
RUN sed -i "s/ServerAdmin .*$/ServerAdmin ${ADMIN_EMAIL}/" \
/etc/apache2/sites-available/000-default.conf
RUN sed -i "s|DocumentRoot .*$|DocumentRoot /var/www\n\tScriptAlias / /usr/lib/cgi-bin/|" \
RUN sed -i "s/^Listen 80$/Listen ${LISTEN_PORT}/" /etc/apache2/ports.conf
RUN sed -i -e "s/^<VirtualHost \*:80>$/<VirtualHost *:${LISTEN_PORT}>/" \
-e "s/ServerAdmin .*$/ServerAdmin ${ADMIN_EMAIL}/" \
-e "s/#ServerName .*$/ServerName ${SERVER_NAME}/" \
-e 's|#Include conf-available/serve-cgi-bin.conf|Include conf-available/serve-cgi-bin.conf|' \
/etc/apache2/sites-available/000-default.conf
# Allow http to run these binaries as root with sudo
# Allow http user to run these binaries as root with sudo
RUN echo "www-data ALL=(ALL:ALL) NOPASSWD: /usr/bin/wg, /usr/bin/openssl, /usr/bin/[, /usr/bin/tee, /bin/cat, /bin/mkdir, /bin/rm, /bin/chmod, /bin/chgrp" \
| sudo EDITOR='tee -a' visudo
| sudo EDITOR='tee -a' visudo
# Copy over CGIs and libs
COPY admin_peer.cgi /usr/lib/cgi-bin/peer

View File

@ -22,7 +22,7 @@ RUN sed -i "s/^Listen 80$/Listen ${LISTEN_PORT}/" \
RUN sed -i -e "s/^<VirtualHost \*:80>$/<VirtualHost *:${LISTEN_PORT}>/" \
-e "s/ServerAdmin .*$/ServerAdmin ${ADMIN_EMAIL}/" \
-e "s/#ServerName .*$/ServerName ${SERVER_NAME}/" \
-e '/#Include conf-available/serve-cgi-bin.conf/s/^\t#/\t/' \
-e 's|#Include conf-available/serve-cgi-bin.conf|Include conf-available/serve-cgi-bin.conf|' \
/etc/apache2/sites-available/000-default.conf
# Allow http user to run these binaries as root with sudo