Initial commit
This commit is contained in:
1 parent
f5bcc9d121
commit
d22c95d9ea
7 files changed
+246
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<IfModule mod_ssl.c>
|
||||
<VirtualHost *:443>
|
||||
# TLS/SSL configuration, this is for the use of crypto.
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/apache2/ssl/wol.crt
|
||||
SSLCertificateKeyFile /etc/apache2/ssl/wol.key
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
<Directory /var/www/html/>
|
||||
AllowOverride AuthConfig FileInfo
|
||||
Order allow,deny
|
||||
allow from all
|
||||
Options -Indexes
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/ssl_error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel error
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
|
||||
|
||||
</VirtualHost>
|
||||
</IfModule>
|
||||
|
||||
<VirtualHost *:80>
|
||||
# Non-TLS/SSL configuration.
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
<Directory /var/www/html/>
|
||||
AllowOverride AuthConfig FileInfo
|
||||
Order allow,deny
|
||||
allow from all
|
||||
Options -Indexes
|
||||
</Directory>
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
# Possible values include: debug, info, notice, warn, error, crit,
|
||||
# alert, emerg.
|
||||
LogLevel error
|
||||
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
</VirtualHost>
|
||||
@@ -0,0 +1,46 @@
|
||||
FROM php:7.2-apache
|
||||
MAINTAINER ex0nuss
|
||||
|
||||
RUN apt-get -y update && \
|
||||
apt install -y --no-install-recommends \
|
||||
iputils-ping \
|
||||
wakeonlan \
|
||||
git
|
||||
#RUN docker-php-ext-install curl
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
RUN chmod u+s `which ping`
|
||||
RUN git clone https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server.git
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
RUN a2enmod headers &&\
|
||||
service apache2 restart
|
||||
|
||||
RUN mv -f Remote-Wake-Sleep-On-LAN-Server/000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||
COPY ports.conf /etc/apache2/
|
||||
|
||||
RUN sed -i.bak "s/expose_php = On/expose_php = Off/g" $PHP_INI_DIR/php.ini &&\
|
||||
sed -i.bak "s/E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED/error_reporting = E_ERROR/g" $PHP_INI_DIR/php.ini &&\
|
||||
sed -i.bak "s/ServerSignature On/ServerSignature Off/g" /etc/apache2/conf-available/security.conf &&\
|
||||
sed -i.bak "s/ServerTokens OS/ServerTokens Prod/g" /etc/apache2/conf-available/security.conf &&\
|
||||
service apache2 restart
|
||||
|
||||
RUN mv Remote-Wake-Sleep-On-LAN-Server/* /var/www/html &&\
|
||||
mv Remote-Wake-Sleep-On-LAN-Server/.htaccess /var/www/html &&\
|
||||
rm -rf Remote-Wake-Sleep-On-LAN-Server/ &&\
|
||||
rm -f /var/www/html/index.html
|
||||
# mv /var/www/html/config_sample.php /var/www/html/config.php
|
||||
|
||||
COPY config.php /var/www/html/config.php
|
||||
COPY entrypoint.sh /
|
||||
|
||||
ENV APACHE2_PORT=80
|
||||
ENV PASSPHRASE=
|
||||
ENV RWSOLS_MAX_PINGS=15
|
||||
ENV RWSOL_SLEEP_TIME=5
|
||||
ENV RWSOLS_COMPUTER_NAME=
|
||||
ENV RWSOLS_COMPUTER_MAC=
|
||||
ENV RWSOLS_COMPUTER_IP=
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
Remote Wake/Sleep-On-LAN Server [CONFIGURATION FILE]
|
||||
https://github.com/sciguy14/Remote-Wake-Sleep-On-LAN-Server
|
||||
Original Author: Jeremy E. Blum (http://www.jeremyblum.com)
|
||||
Security Edits By: Felix Ryan (https://www.felixrr.pro)
|
||||
License: GPL v3 (http://www.gnu.org/licenses/gpl.html)
|
||||
|
||||
UPDATE THE VALUES IN THIS FILE AND CHANGE THE NAME TO: "config.php"
|
||||
*/
|
||||
|
||||
// Set the below to "true" (no quotes) to enforce HTTPS connections (don't forget to create a self-signed cert and enable it in Apache2)
|
||||
$USE_HTTPS = false;
|
||||
|
||||
// Choose a passphrase and find the sha256 hash of that passphrase.
|
||||
// You can use an online calculator to generate the hash: http://www.xorbin.com/tools/sha256-hash-calculator.
|
||||
// Unless you are using an SSL connection to your server, remember that passphrases can still be obtained via a man-in-the-middle attack.
|
||||
$APPROVED_HASH = "RWSOLS_HASH";
|
||||
|
||||
// This is the number of times that the WOL server will try to ping the target computer to check if it has woken up. Default = 15.
|
||||
$MAX_PINGS = REPLACE_RWSOLS_MAX_PINGS;
|
||||
// This is the number of seconds to wait between pings commands when waking up or sleeping. Waking from shutdown or sleep will impact this.
|
||||
$SLEEP_TIME = REPLACE_RWSOL_SLEEP_TIME;
|
||||
|
||||
// This is the Name of the computers to appear in the drop down
|
||||
$COMPUTER_NAME = array(REPLACE_RWSOLS_COMPUTER_NAME);
|
||||
|
||||
// This is the MAC address of the Network Interface on the computer you are trying to wake.
|
||||
$COMPUTER_MAC = array(REPLACE_RWSOLS_COMPUTER_MAC);
|
||||
|
||||
// This is the LOCAL IP address of the computer you are trying to wake. Use a reserved DHCP through your router's administration interface to ensure it doesn't change.
|
||||
$COMPUTER_LOCAL_IP = array(REPLACE_RWSOLS_COMPUTER_IP);
|
||||
|
||||
// This is the Port being used by the Windows SleepOnLan Utility to initiate a Sleep State
|
||||
// http://www.ireksoftware.com/SleepOnLan/
|
||||
// Alternate Download Link: http://www.jeremyblum.com/wp-content/uploads/2013/07/SleepOnLan.zip
|
||||
$COMPUTER_SLEEP_CMD_PORT = 7760;
|
||||
|
||||
// Command to be issued by the windows sleeponlan utility
|
||||
// options are suspend, hibernate, logoff, poweroff, forcepoweroff, lock, reboot
|
||||
// You can create a windows scheduled task that starts sleeponlan.exe on boot with following startup parameters /auto /port=7760
|
||||
$COMPUTER_SLEEP_CMD = "suspend";
|
||||
|
||||
// This is the location of the bootstrap style folder relative to your index and config file. Default = "" (Same folder as this file)
|
||||
// Directory must be called "bootstrap". You may wish to move if this WOL script is the "child" of a larger web project on your Pi, that will also use bootstrap styling.
|
||||
// If if it on directory up, for example, you would set this to "../"
|
||||
// Two directories up? Set too "../../"
|
||||
// etc...
|
||||
$BOOTSTRAP_LOCATION_PREFIX = "";
|
||||
?>
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
#File to edit
|
||||
file='/var/www/html/config.php'
|
||||
|
||||
#Searches $1 and replaces with $2 in $file
|
||||
function search_and_replace {
|
||||
sed -i 's|'$1'|'$2'|g' "$file"
|
||||
}
|
||||
|
||||
#RWSOLS
|
||||
#Does everything for ENV-vars with RWSOLS_*
|
||||
compgen -A variable RWSOLS_ | while read v; do
|
||||
#Checks if REPLACE_envvar is in $file
|
||||
if grep -q "REPLACE_$v" "$file"; then
|
||||
echo "search_and_replace REPLACE_$v with ${!v}"
|
||||
search_and_replace REPLACE_$v ${!v}
|
||||
fi
|
||||
done
|
||||
|
||||
#Settings RWSOLS_HASH for keyphrase
|
||||
RWSOLS_HASH=$(echo -n $PASSPHRASE | sha256sum | cut -d " " -f 1)
|
||||
search_and_replace RWSOLS_HASH $RWSOLS_HASH
|
||||
|
||||
|
||||
#APACHE2 port mapping
|
||||
echo "search_and_replace port 80 with $APACHE2_PORT"
|
||||
sed -i 's|'80'|'$APACHE2_PORT'|g' '/etc/apache2/ports.conf'
|
||||
|
||||
|
||||
#Starting apache2
|
||||
service apache2 reload
|
||||
exec apache2-foreground
|
||||
|
||||
|
||||
#TODO
|
||||
# 1. PHP-Arrays mit env vars testen: z.B. RWSOLS_COMPUTER_NAME="PcTest","PcTest1"
|
||||
# 2. Für alle Config-Settings Env vars erstellen
|
||||
# 3. Hash for Keyphrase erstellen
|
||||
@@ -0,0 +1,15 @@
|
||||
# If you just change the port or add more ports here, you will likely also
|
||||
# have to change the VirtualHost statement in
|
||||
# /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
Listen 80
|
||||
|
||||
<IfModule ssl_module>
|
||||
Listen 443
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_gnutls.c>
|
||||
Listen 443
|
||||
</IfModule>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
Reference in new issue
Block a user