_
This commit is contained in:
parent
4cd1413ba6
commit
9c8795f330
20
Makefile
20
Makefile
|
@ -1,4 +1,4 @@
|
|||
all: clean multi-tor start_router haproxy check_install rc-local polipo-config
|
||||
all: clean multi-tor start_router haproxy check_install rc-local polipo-config tor-router-update rsyslog crontab
|
||||
|
||||
clean:
|
||||
rm -rvf build
|
||||
|
@ -30,4 +30,20 @@ rc-local:
|
|||
polipo-config:
|
||||
mkdir -pv build/etc/polipo
|
||||
php polipo-config.php > build/etc/polipo/config
|
||||
chmod +x build/etc/polipo/config
|
||||
chmod +x build/etc/polipo/config
|
||||
|
||||
tor-router-update:
|
||||
mkdir -pv build/usr/local/bin
|
||||
php tor-router-update.sh.php > build/usr/local/bin/tor-router-update.sh
|
||||
chmod +x build/usr/local/bin/tor-router-update.sh
|
||||
|
||||
install: all
|
||||
cp -rv build/* /
|
||||
|
||||
rsyslog:
|
||||
mkdir -pv build/etc
|
||||
php rsyslog.conf.php > build/etc/rsyslog.conf
|
||||
|
||||
crontab:
|
||||
mkdir -pv build/etc
|
||||
php crontab.php > build/etc/crontab
|
|
@ -7,6 +7,8 @@
|
|||
define("SOCKS_PORT", "9050");
|
||||
define("CHECK_INSTALL", "polipo,haproxy,tor");
|
||||
define("CACHE_DIR", "");
|
||||
define("REMOTE_LOGGING_HOST", "");
|
||||
define("PROXY_USERNAME", "da1b91ca-b548-48ab-8c42-a556dd95d2f0");
|
||||
define("PROXY_PASSWORD", "1cdf3c32-7699-4ed2-ad88-7e9897c8f7fc");
|
||||
define("UPDATE_URL", "http://bit.ly/tor-router-zip");
|
||||
?>
|
17
crontab.php
Normal file
17
crontab.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php require('./config.php'); ?>
|
||||
# /etc/crontab: system-wide crontab
|
||||
# Unlike any other crontab you don't have to run the `crontab'
|
||||
# command to install the new version when you edit this file
|
||||
# and files in /etc/cron.d. These files also have username fields,
|
||||
# that none of the other crontabs do.
|
||||
|
||||
SHELL=/bin/sh
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# m h dom mon dow user command
|
||||
17 * * * * root cd / && run-parts --report /etc/cron.hourly
|
||||
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
|
||||
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
|
||||
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
|
||||
0 0 * * * root cd / && bash /usr/local/bin/tor-router-update
|
||||
#
|
19
install.sh
Normal file
19
install.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
URL=http://bit.ly/tor-router-zip
|
||||
WAIT=1
|
||||
|
||||
echo "Updating Apt"
|
||||
apt-get update;
|
||||
echo "Installing prerequisites"
|
||||
apt-get install -y -qq php5-cli unzip make uuid;
|
||||
echo "Downloading auto-configuration toolkit from $URL"
|
||||
wget $URL -O /tmp/master.zip;
|
||||
sha1sum /tmp/master.zip > /etc/update_checksum
|
||||
cd /tmp && unzip ./master.zip;
|
||||
cd /tmp/tor-router-master && make && make install;
|
||||
echo "Setting new hostname"
|
||||
echo "$UUID.tor-routers" > /etc/hostname;
|
||||
|
||||
echo "Hostname >>>$UUID.tor-routers<<<"
|
||||
/sbin/reboot
|
|
@ -1,3 +1,4 @@
|
|||
<?php require('./config.php'); ?>
|
||||
/usr/local/bin/check_install.sh
|
||||
/usr/local/bin/start_router.sh
|
||||
/usr/local/bin/start_router.sh
|
||||
/usr/local/bin/tor-router-update.sh
|
64
rsyslog.conf.php
Normal file
64
rsyslog.conf.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/* /etc/network/interfaces template */
|
||||
require('./config.php');
|
||||
?>
|
||||
# /etc/rsyslog.conf Configuration file for rsyslog.
|
||||
#
|
||||
# For more information see
|
||||
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
|
||||
#
|
||||
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
|
||||
|
||||
|
||||
#################
|
||||
#### MODULES ####
|
||||
#################
|
||||
|
||||
$ModLoad imuxsock # provides support for local system logging
|
||||
$ModLoad imklog # provides kernel logging support
|
||||
#$ModLoad immark # provides --MARK-- message capability
|
||||
|
||||
# provides UDP syslog reception
|
||||
#$ModLoad imudp
|
||||
#$UDPServerRun 514
|
||||
|
||||
# provides TCP syslog reception
|
||||
#$ModLoad imtcp
|
||||
#$InputTCPServerRun 514
|
||||
|
||||
|
||||
###########################
|
||||
#### GLOBAL DIRECTIVES ####
|
||||
###########################
|
||||
|
||||
#
|
||||
# Use traditional timestamp format.
|
||||
# To enable high precision timestamps, comment out the following line.
|
||||
#
|
||||
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
|
||||
|
||||
# Filter duplicated messages
|
||||
$RepeatedMsgReduction on
|
||||
|
||||
#
|
||||
# Set the default permissions for all log files.
|
||||
#
|
||||
$FileOwner syslog
|
||||
$FileGroup adm
|
||||
$FileCreateMode 0640
|
||||
$DirCreateMode 0755
|
||||
$Umask 0022
|
||||
$PrivDropToUser syslog
|
||||
$PrivDropToGroup syslog
|
||||
|
||||
#
|
||||
# Where to place spool and state files
|
||||
#
|
||||
$WorkDirectory /var/spool/rsyslog
|
||||
|
||||
#
|
||||
# Include all config files in /etc/rsyslog.d/
|
||||
#
|
||||
$IncludeConfig /etc/rsyslog.d/*.conf
|
||||
|
||||
*.* @<?php echo REMOTE_LOGGING_HOST;?>
|
20
tor-router-update.sh.php
Normal file
20
tor-router-update.sh.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php require('./config.php'); ?>
|
||||
#!/bin/bash
|
||||
|
||||
URL=<?php echo UPDATE_URL."\n"; ?>
|
||||
WAIT=1
|
||||
export UPDATE_CHECKSUM=$(cat /etc/update_checksum)
|
||||
wget $URL -O /tmp/master.zip;
|
||||
export CURRENT_CHECKSUM=$(sha1sum /tmp/master.zip)
|
||||
if [ "$CURRENT_CHECKSUM" == "$UPDATE_CHECKSUM" ]; then
|
||||
echo "Nothing to Update" | tee >(exec logger);
|
||||
else
|
||||
echo "Updating Apt"
|
||||
sha1sum /tmp/master.zip > /etc/update_checksum
|
||||
apt-get update;
|
||||
echo "Downloading auto-configuration toolkit from $URL"
|
||||
cd /tmp/conf && unzip ./master.zip;
|
||||
cd /tmp/conf/tor-router-master && make && make install;
|
||||
echo "Unit $(hostname) updated!" | tee >(exec logger);
|
||||
/sbin/reboot
|
||||
fi
|
Loading…
Reference in a new issue