Compare commits

...
29 Commits
Author SHA1 Message Date
arakasi72 060a4b7660 Update rtinst 2019-08-02 22:33:55 +01:00
arakasi72 4ead4b71e1 Update rtinst 2019-08-02 14:33:57 +01:00
arakasi72 0c6d410dbe Update rtinst 2019-08-02 10:54:39 +01:00
arakasi72 9ca5721d08 Update README.md 2019-08-02 10:43:03 +01:00
arakasi72 f3ee539bd4 Update rtadmin 2019-08-02 10:41:14 +01:00
arakasi72 9f13ecbfa6 Develop (#422)
* Update rtinst

* Update README.md

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update README.md

* Update rtinst

* Update rtupdate

* Update rtupdate

* Create rtletsencrypt

* Changing file permissions

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst
2019-08-02 10:38:26 +01:00
arakasi72 7d200e9f58 Develop (#420)
* Update rtinst

* Update README.md

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update README.md

* Update rtinst

* Update rtupdate

* Update rtupdate
2019-07-28 08:50:33 +01:00
arakasi72 986b24086d Update rtinst 2019-07-28 08:07:20 +01:00
arakasi72 884d3e73bd Update rtupdate 2019-07-24 20:43:54 +01:00
arakasi72 9c14c2a82d Update rtupdate 2019-07-24 20:34:02 +01:00
arakasi72 25fa01635a Develop (#418)
* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate
2019-07-23 20:05:53 +01:00
arakasi72 4588907f07 Update README.md 2019-07-10 09:12:53 +01:00
arakasi72 318573ed63 Update rtinst 2019-07-10 08:48:10 +01:00
arakasi72 5035ab0a95 Develop (#416)
* Update rtinst

* Update rtinst

* Update rtupdate
2019-07-10 08:47:40 +01:00
arakasi72 1b9794ee7d Update rtupdate 2019-07-10 08:05:54 +01:00
arakasi72 eaffb50529 Update rtinst 2019-06-03 14:30:34 +01:00
arakasi72 00aed27199 Update rtupdate 2019-06-03 14:26:54 +01:00
arakasi72 fe023bed1a Update rtupdate 2019-06-02 21:32:57 +01:00
arakasi72 37354f386a Develop (#406)
* Update rtinst

* Update rtinst

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtinst

* Update rtupdate
2019-05-11 15:19:15 +01:00
Yo 54f12f7877 4.) rtdload $rtdaction - $rtdaction httpS downloads" (#405) 2019-05-10 21:06:50 +01:00
arakasi72 c366ab575c Update rtinst 2019-04-09 23:41:13 +01:00
arakasi72 d732810e83 Update rtinst 2019-04-09 23:40:32 +01:00
000xxx 79dd712da1 More better way to find external IP (#385)
* More better way to find external IP

Please change it because external IP is more usable than private IP

* External IP detection
2019-04-09 23:22:23 +01:00
arakasi72 6ba83f6097 Update ru.config 2019-04-09 23:16:47 +01:00
arakasi72 d3cb5e57e9 Update ru.ini 2019-04-09 23:14:20 +01:00
arakasi72 7bb8b0dd88 Update rtorrent.rc 2018-10-09 20:24:14 +01:00
arakasi72 29a3ad947b Update rtinst 2018-08-15 20:54:06 +01:00
arakasi72 98cac8525e Update rtupdate 2018-08-15 20:53:34 +01:00
arakasi72 c7d5d4a7ef Update rtupdate 2018-06-28 12:48:15 +01:00
9 changed files with 241 additions and 68 deletions
+7 -3
View File
@@ -1,5 +1,7 @@
## rtinst ## rtinst
### Note: Now installs Lets Encrypt SSL certificates
#### 30 Second Guide #### 30 Second Guide
Ubuntu and Debian Seedbox Installation Ubuntu and Debian Seedbox Installation
@@ -25,14 +27,16 @@ It has been tested with clean installs of:
Ubuntu 12 (unsupported) Ubuntu 12 (unsupported)
Ubuntu 13 (unsupported) Ubuntu 13 (unsupported)
Ubuntu 14 Ubuntu 14 (unsupported)
Ubuntu 15 Ubuntu 15 (unsupported)
Ubuntu 16 Ubuntu 16
Ubuntu 17 Ubuntu 17
Ubuntu 18 Ubuntu 18
Ubuntu 19
Debian 7 "Wheezy" (unsupported) Debian 7 "Wheezy" (unsupported)
Debian 8 "Jessie" Debian 8 "Jessie" (unsupported)
Debian 9 "Stretch" Debian 9 "Stretch"
Debian 10 "Buster"
Services that will be installed and configured are Services that will be installed and configured are
+1 -1
View File
@@ -8,7 +8,7 @@ method.insert = cfg.basedir, private|const|string, (cat,"<user home>/rtorren
method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/") method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/")
#method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/") #method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
#method.insert = cfg.logfile, private|const|string, (cat,(c fg.logs),"rtorrent-",(system.time),".log") #method.insert = cfg.logfile, private|const|string, (cat,(cfg.logs),"rtorrent-",(system.time),".log")
session.path.set = (cat,(cfg.basedir),".session") session.path.set = (cat,(cfg.basedir),".session")
directory.default.set = (cat,(cfg.basedir),"download") directory.default.set = (cat,(cfg.basedir),"download")
+1
View File
@@ -43,6 +43,7 @@ $pathToExternals = array(
"gzip" => '/bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH. "gzip" => '/bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH.
"id" => '/usr/bin/id', // Something like /usr/bin/id. If empty, will be found in PATH. "id" => '/usr/bin/id', // Something like /usr/bin/id. If empty, will be found in PATH.
"stat" => '/usr/bin/stat', // Something like /usr/bin/stat. If empty, will be found in PATH. "stat" => '/usr/bin/stat', // Something like /usr/bin/stat. If empty, will be found in PATH.
"pgrep" => '/usr/bin/pgrep', // Something like /usr/bin/pgrep. If empty, will be found in PATH.
); );
$localhosts = array( // list of local interfaces $localhosts = array( // list of local interfaces
+4
View File
@@ -100,6 +100,8 @@ enabled = yes
enabled = yes enabled = yes
;; Disabled ;; Disabled
[_cloudflare]
enabled = no
[check_port] [check_port]
enabled = no enabled = no
[chunks] [chunks]
@@ -120,5 +122,7 @@ enabled = no
enabled = no enabled = no
[scheduler] [scheduler]
enabled = no enabled = no
[spectrogram]
enabled = no
[xmpp] [xmpp]
enabled = no enabled = no
+6 -4
View File
@@ -23,9 +23,10 @@ while true
[5] ) rtupdate && return 0 ;; [5] ) rtupdate && return 0 ;;
[6] ) rutupgrade && return 0 ;; [6] ) rutupgrade && return 0 ;;
[7] ) rtwebmin && return 0 ;; [7] ) rtwebmin && return 0 ;;
[8] ) rtsslcert && return 0 ;; [8] ) rtletsencrypt && return 0 ;;
[9] ) rtsslcert && return 0 ;;
[Qq] ) exit ;; [Qq] ) exit ;;
* ) echo "Enter 1-8 (q to quit)";; * ) echo "Enter 1-9 (q to quit)";;
esac esac
done done
} }
@@ -49,11 +50,12 @@ echo "Select from the following options:"
echo "1.) rtsetup - update the rtinst scripts" echo "1.) rtsetup - update the rtinst scripts"
echo "2.) rtadduser - add new user" echo "2.) rtadduser - add new user"
echo "3.) rtremove - delete a user" echo "3.) rtremove - delete a user"
echo "4.) rtdload $rtdaction - $rtdaction http downloads" echo "4.) rtdload $rtdaction - $rtdaction https downloads"
echo "5.) rtupdate - up/down-grade rtorent/libtorrent" echo "5.) rtupdate - up/down-grade rtorent/libtorrent"
echo "6.) rutupgrade - upgrade to latest version of RuTorrent" echo "6.) rutupgrade - upgrade to latest version of RuTorrent"
echo "7.) rtwebmin - install webmin" echo "7.) rtwebmin - install webmin"
echo "8.) rtsslcert - generate new self signed ssl certificate" echo "8.) rtletsencrypt - install Lets Encypt ssl certificate"
echo "9.) rtsslcert - generate new self signed ssl certificate"
echo "Enter option or q to quit" echo "Enter option or q to quit"
select_task select_task
+73 -33
View File
@@ -15,12 +15,12 @@
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
# if left blank will install latest version of rtorrent, or set to a specific release E.G. '0.9.6' to install that release # if left blank will install latest version of rtorrent, or set to a specific release E.G. '0.9.6' to install that release
rtorrentrel='' rtorrentrel='0.9.6'
#url's of the major components #url's of the major components
rt_url="http://rtorrent.net/downloads/" rt_url="http://rtorrent.net/downloads/"
xmlrpc_url="https://svn.code.sf.net/p/xmlrpc-c/code/stable/" xmlrpc_url="https://svn.code.sf.net/p/xmlrpc-c/code/advanced/"
xmlrpc_url_alt="https://github.com/mirror/xmlrpc-c" xmlrpc_url_alt="https://github.com/mirror/xmlrpc-c"
ru_url="https://github.com/Novik/ruTorrent/" ru_url="https://github.com/Novik/ruTorrent/"
@@ -35,31 +35,53 @@ fullrel=$(lsb_release -sd)
osname=$(lsb_release -si) osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1) relno=$(lsb_release -sr | cut -d. -f1)
phpver=php5
phploc=/etc/php5
geoipver=php5-geoip
libcver=libcurl3
if [ "$relno" = "16" ] || [ "$relno" = "17" ] || [ "$relno" = "9" ]; then if [ "$relno" = "16" ] || [ "$relno" = "17" ] || [ "$relno" = "9" ]; then
phpver=php7.0 phpver=php7.0
phploc=/etc/php/7.0 phploc=/etc/php/7.0
geoipver=php-geoip libcver=libcurl3
fi fi
if [ $(lsb_release -sr) = "17.10" ]; then if [ $(lsb_release -sr) = "17.10" ]; then
phpver=php7.1 phpver=php7.1
phploc=/etc/php/7.1 phploc=/etc/php/7.1
geoipver=php-geoip libcver=libcurl3
fi fi
if [ "$relno" = "18" ]; then if [ "$relno" = "18" ] || [ "$relno" = "19" ]; then
phpver=php7.2 phpver=php7.2
phploc=/etc/php/7.2 phploc=/etc/php/7.2
geoipver=php-geoip
libcver=libcurl4 libcver=libcurl4
fi fi
export serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}') if [ "$relno" = "10" ]; then
phpver=php7.3
phploc=/etc/php/7.3
libcver=libcurl4
fi
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- ipecho.net/plain)
if [ "$serveripa" = "$serveripb" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
* ) echo "Enter 1 or 2";;
esac
done
fi
echo "IP set to "$serverip
export logfile="/dev/null" export logfile="/dev/null"
webpass='' webpass=''
cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent" cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent"
@@ -72,7 +94,7 @@ sshport=''
rudevflag=1 rudevflag=1
rurelease=master rurelease=master
passfile='/etc/nginx/.htpasswd' passfile='/etc/nginx/.htpasswd'
package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev $libcver libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config $phpver-fpm $phpver $phpver-cli $phpver-dev $phpver-curl $geoipver $phpver-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo software-properties-common aptitude $phpver-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl" package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl dtach htop irssi libcppunit-dev $libcver libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config $phpver-fpm $phpver $phpver-cli $phpver-dev $phpver-curl php-geoip $phpver-xmlrpc $phpver-xml python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo software-properties-common aptitude $phpver-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl"
Install_list="" Install_list=""
unixpass="" unixpass=""
passflag=0 passflag=0
@@ -234,11 +256,11 @@ if [ "$(id -u)" != "0" ]; then
fi fi
# determine system # determine system
if ([ "$osname" = "Ubuntu" ] && [ $relno -ge 14 ]) || ([ "$osname" = "Debian" ] && [ $relno -ge 8 ]) || ([ "$osname" = "Raspbian" ] && [ $relno -ge 8 ]); then if ([ "$osname" = "Ubuntu" ] && [ $relno -ge 16 ]) || ([ "$osname" = "Debian" ] && [ $relno -ge 9 ]) || ([ "$osname" = "Raspbian" ] && [ $relno -ge 9 ]); then
echo $fullrel echo $fullrel
else else
echo $fullrel echo $fullrel
echo "Only Ubuntu release 14 and later, and Debian and Raspbian release 8 and later, are supported" echo "Only Ubuntu release 16 and later, and Debian and Raspbian release 9 and later, are supported"
echo "Your system does not appear to be supported" echo "Your system does not appear to be supported"
echo "Check https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS to see if it is supported by an earlier rtinst release" echo "Check https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS to see if it is supported by an earlier rtinst release"
exit exit
@@ -316,9 +338,10 @@ echo
[ $forceyes = 1 ] && enter_ip [ $forceyes = 1 ] && enter_ip
echo "Your server's IP is set to $serverip" echo "Your server's IP is set to $serverip"
export serverip
# Determine domain name using server ip address # Determine domain name using server ip address
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])") export serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
if [ -z "$serverdn" ]; then if [ -z "$serverdn" ]; then
echo "Unable to determine domain" echo "Unable to determine domain"
else else
@@ -382,7 +405,7 @@ else
adduser --gecos "" $user adduser --gecos "" $user
else else
adduser --gecos "" $user --disabled-password adduser --gecos "" $user --disabled-password
echo "$user:$unixpass" | sudo chpasswd echo "$user:$unixpass" | chpasswd
fi fi
fi fi
@@ -533,19 +556,7 @@ fi
#install ffmpeg #install ffmpeg
if ! [ $osname = "Raspbian" ] && [ $(dpkg-query -W -f='${Status}' "ffmpeg" 2>/dev/null | grep -c "ok installed") = 0 ]; then if ! [ $osname = "Raspbian" ] && [ $(dpkg-query -W -f='${Status}' "ffmpeg" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Installing ffmpeg" echo "Installing ffmpeg"
if [ $relno = 14 ]; then apt-get -qq install ffmpeg >> $logfile 2>&1
apt-add-repository -y ppa:mc3man/trusty-media >> $logfile 2>&1
apt-get -qq update >> $logfile 2>&1
apt-get -qq install ffmpeg >> $logfile 2>&1
elif [ $relno = 8 ]; then
grep "deb http://www.deb-multimedia.org jessie main" /etc/apt/sources.list >> /dev/null || echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list
apt-get -qq update >> $logfile 2>&1
apt-get -qq --force-yes install deb-multimedia-keyring >> $logfile 2>&1
apt-get -qq update >> $logfile 2>&1
apt-get -qq --force-yes install ffmpeg >> $logfile 2>&1
else
apt-get -qq install ffmpeg >> $logfile 2>&1
fi
fi fi
echo "Completed installation of required packages " echo "Completed installation of required packages "
@@ -615,7 +626,14 @@ echo "SSH port set to $sshport"
############################### ###############################
# calls the script rtsslcert to generate the ssl certificated for vsftpd and nginx # calls the script rtsslcert to generate the ssl certificated for vsftpd and nginx
rtsslcert -d if rtletsencrypt ; then
leflag=0
echo "Lets Encrypt Certificates installed"
else
rtsslcert -d
leflag=1
echo "Self signed certificats installed"
fi
############################### ###############################
### INSTALL FTP ### ### INSTALL FTP ###
@@ -658,6 +676,11 @@ grep -Pq "^\s*ssl_tlsv1" /etc/vsftpd.conf && sed -i '/^\s*ssl_tlsv1/ c\ssl_tlsv
grep -Pq "^\s*require_ssl_reuse" /etc/vsftpd.conf && sed -i '/^\s*require_ssl_reuse/ c\require_ssl_reuse=NO' /etc/vsftpd.conf || echo "require_ssl_reuse=NO" >> /etc/vsftpd.conf grep -Pq "^\s*require_ssl_reuse" /etc/vsftpd.conf && sed -i '/^\s*require_ssl_reuse/ c\require_ssl_reuse=NO' /etc/vsftpd.conf || echo "require_ssl_reuse=NO" >> /etc/vsftpd.conf
grep -Pq "^\s*ssl_ciphers" /etc/vsftpd.conf && sed -i '/^\s*ssl_ciphers/ c\ssl_ciphers=HIGH' /etc/vsftpd.conf || echo "ssl_ciphers=HIGH" >> /etc/vsftpd.conf grep -Pq "^\s*ssl_ciphers" /etc/vsftpd.conf && sed -i '/^\s*ssl_ciphers/ c\ssl_ciphers=HIGH' /etc/vsftpd.conf || echo "ssl_ciphers=HIGH" >> /etc/vsftpd.conf
if [ $leflag = 0 ]; then
sed -i "/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=/etc/letsencrypt/live/$serverdn/fullchain.pem" /etc/vsftpd.conf
sed -i "/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=/etc/letsencrypt/live/$serverdn/privkey.pem" /etc/vsftpd.conf
fi
service vsftpd restart 1>> $logfile service vsftpd restart 1>> $logfile
ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g') ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g')
@@ -730,6 +753,12 @@ echo "location ~* \.(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ {" > /etc/nginx/
echo " expires 30d;" >> /etc/nginx/conf.d/cache echo " expires 30d;" >> /etc/nginx/conf.d/cache
echo "}" >> /etc/nginx/conf.d/cache echo "}" >> /etc/nginx/conf.d/cache
if [ $leflag = 0 ]; then
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverdn;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate / c\ ssl_certificate /etc/letsencrypt/live/$serverdn/fullchain.pem;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate_key / c\ ssl_certificate_key /etc/letsencrypt/live/$serverdn/privkey.pem;" /etc/nginx/sites-available/default
fi
service nginx restart && service $phpver-fpm restart service nginx restart && service $phpver-fpm restart
if [ $dlflag = 0 ]; then if [ $dlflag = 0 ]; then
@@ -947,7 +976,13 @@ if [ -z $ru_current ]; then
echo " RuTorrent was not installed" | tee -a $home/rtinst.info echo " RuTorrent was not installed" | tee -a $home/rtinst.info
else else
echo " RuTorrent $ru_current installed" | tee -a $home/rtinst.info echo " RuTorrent $ru_current installed" | tee -a $home/rtinst.info
echo " rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
if [ $leflag = 0 ]; then
echo " rutorrent can be accessed at https://$serverdn/rutorrent" | tee -a $home/rtinst.info
else
echo " rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
fi
if [ $passflag = 1 ]; then if [ $passflag = 1 ]; then
echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info
elif [ $passflag = 2 ]; then elif [ $passflag = 2 ]; then
@@ -957,7 +992,12 @@ else
fi fi
echo " to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info echo " to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info
echo | tee -a $home/rtinst.info echo | tee -a $home/rtinst.info
echo " If enabled, access https downloads at https://$serverip/download/$user" | tee -a $home/rtinst.info
if [ $leflag = 0 ]; then
echo " If enabled, access https downloads at https://$serverdn/download/$user" | tee -a $home/rtinst.info
else
echo " If enabled, access https downloads at https://$serverip/download/$user" | tee -a $home/rtinst.info
fi
fi fi
echo | tee -a $home/rtinst.info echo | tee -a $home/rtinst.info
+109
View File
@@ -0,0 +1,109 @@
#!/bin/bash
#########################################################################################
#
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
#
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
#########################################################################################
headless=0
osname=$(lsb_release -si)
[ -z $logfile ] && logfile="/dev/null"
if [ -z $serverip ]; then
headless=1
fi
#check it is being run as root
if [ "$(id -u)" != "0" ]; then
echo "Must be run from root or using sudo" && exit 1
fi
if [ $headless = 1 ]; then
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- ipecho.net/plain)
if [ "$serveripa" = "$serveripb" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
* ) echo "Enter 1 or 2";;
esac
done
fi
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
fi
echo "IP: $serverip"
echo "DN: $serverdn"
if [ -z $serverdn ]; then
echo "Unable to determine domain name cannot setup Lets Encypt"
exit 1
fi
#Installing Certbot
if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Installing certbot"
if [ "$osname" = "Ubuntu" ]; then
apt-get -q update >> $logfile 2>&1
add-apt-repository -y universe >> $logfile 2>&1
add-apt-repository -y ppa:certbot/certbot >> $logfile 2>&1
apt-get -q update >> $logfile 2>&1
apt-get install -y certbot python-certbot-nginx >> $logfile 2>&1
else
grep "^deb http\:\/\/deb\.debian\.org\/debian stretch-backports main" /etc/apt/sources.list > /dev/null || echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list
apt-get -q update >> $logfile 2>&1
apt-get install -y certbot python-certbot-nginx -t stretch-backports >> $logfile 2>&1
fi
else
echo "certbot already installed"
fi
if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Install Failed"
exit 1
fi
#Generating Certificates
certbot -q --nginx --register-unsafely-without-email --agree-tos certonly -d $serverdn >> $logfile 2>&1
if [ $? = 1 ]; then
echo "unable to generate certificates"
exit 1
fi
echo "Certificates Generated"
if [ $headless = 0 ]; then
exit 0
fi
if [ -d "/etc/letsencrypt/live/$serverdn" ]; then
echo "Replacing certificates in nginx and vsftpd"
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverdn;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate / c\ ssl_certificate /etc/letsencrypt/live/$serverdn/fullchain.pem;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate_key / c\ ssl_certificate_key /etc/letsencrypt/live/$serverdn/privkey.pem;" /etc/nginx/sites-available/default
service nginx restart
sed -i "/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=/etc/letsencrypt/live/$serverdn/fullchain.pem" /etc/vsftpd.conf
sed -i "/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=/etc/letsencrypt/live/$serverdn/privkey.pem" /etc/vsftpd.conf
service vsftpd restart
fi
+21 -6
View File
@@ -8,7 +8,6 @@
# #
######################################################################################### #########################################################################################
forceyes=1 forceyes=1
headless=1 headless=1
selfsign=1 selfsign=1
@@ -95,11 +94,27 @@ if [ $# -gt 0 ]; then
fi fi
if [ -z $serverip ]; then if [ -z $serverip ]; then
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
elif ! valid_ip $serverip; then serveripb=$(wget -qO- ipecho.net/plain)
echo "$serverip is not a valid IP address" if [ "$serveripa" = "$serveripb" ]; then
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') serverip=$serveripa
echo "will use $serverip instead" else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
* ) echo "Enter 1 or 2";;
esac
done
fi
echo "IP set to "$serverip
echo
fi fi
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])") serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
+19 -21
View File
@@ -14,20 +14,20 @@ osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1) relno=$(lsb_release -sr | cut -d. -f1)
sourcedir='http://rtorrent.net/downloads/' sourcedir='http://rtorrent.net/downloads/'
xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/stable/' xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/advanced/'
xmlrpcloc='svn://svn.code.sf.net/p/xmlrpc-c/code/stable/' xmlrpcloc='svn://svn.code.sf.net/p/xmlrpc-c/code/advanced/'
xmlrpc_url_alt='https://github.com/mirror/xmlrpc-c' xmlrpc_url_alt='https://github.com/mirror/xmlrpc-c'
xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/stable' xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/advanced'
rtdevrel=1 rtdevrel=1
if [ $relno = 9 ] || [ $(lsb_release -sr) = 17.10 ] || [ $relno = 18 ]; then if [ $(lsb_release -sr) = 17.10 ]; then
rtdevrel=0 rtdevrel=0
fi fi
if [ $rtdevrel = 0 ]; then if ([ "$osname" = "Debian" ] || [ "$osname" = "Raspbian" ] && [ $relno -ge 9 ]) || ([ "$osname" = "Ubuntu" ] && [ $relno -ge 18 ]); then
sourcedir='https://github.com/rakshasa/' rtdevrel=0
fi fi
listsize=6 listsize=6
@@ -139,13 +139,11 @@ if [ -z $passed_rtvers ]; then
# checks if the OS is debian 9, and forces the version to 0.9.7 of it is # checks if the OS is debian 9, and forces the version to 0.9.7 of it is
if [ $rtdevrel = 0 ]; then if [ $rtdevrel = 0 ]; then
libvers='0.13.7' echo "For Debian 9, and Ubuntu 17.10 and later, recommend libtorrent-0.13.7/rtorrent-0.9.7 or later"
rtvers='0.9.7'
echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.7/rtorrent-0.9.7"
else
list_version
fi fi
list_version
echo "Install libtorrent-$libvers and rtorrent-$rtvers" echo "Install libtorrent-$libvers and rtorrent-$rtvers"
echo "Your rtorrent config, torrents, and data will not be lost or changed" echo "Your rtorrent config, torrents, and data will not be lost or changed"
echo -n "Continue? " echo -n "Continue? "
@@ -166,9 +164,9 @@ else
# checks if the OS is debian 9, and forces the version to 0.9.7 of it is # checks if the OS is debian 9, and forces the version to 0.9.7 of it is
if [ $rtdevrel = 0 ]; then if [ $rtdevrel = 0 ]; then
libvers='0.13.7' libvers='0.13.8'
rtvers='0.9.7' rtvers='0.9.8'
echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.6/rtorrent-0.9.7" echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.7/rtorrent-0.9.7 or later"
fi fi
fi fi
@@ -192,13 +190,13 @@ rm -rf xmlrpc libtorrent* rtorrent*
echo "Fetching source files" echo "Fetching source files"
if [ $rtdevrel = 0 ]; then #if [ $rtdevrel = 0 ]; then
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers # git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers # git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers
else #else
curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz
curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz
fi #fi
if [ $xmlrpc_repo = 0 ]; then if [ $xmlrpc_repo = 0 ]; then
svn co $xmlrpcloc xmlrpc >> $logfile 2>&1 svn co $xmlrpcloc xmlrpc >> $logfile 2>&1
@@ -225,7 +223,7 @@ make -s install >> $logfile 2>&1
cd ../rtorrent-$rtvers cd ../rtorrent-$rtvers
echo "Installing rtorrent" | tee -a $logfile echo "Installing rtorrent" | tee -a $logfile
./autogen.sh >> $logfile 2>&1 ./autogen.sh >> $logfile 2>&1
./configure --prefix=/usr --with-xmlrpc-c >> $logfile 2>&1 ./configure --prefix=/usr --with-xmlrpc-c --enable-ipv6 >> $logfile 2>&1
make -j$(nproc) >> $logfile 2>&1 make -j$(nproc) >> $logfile 2>&1
make -s install >> $logfile 2>&1 make -s install >> $logfile 2>&1
ldconfig >> $logfile 2>&1 ldconfig >> $logfile 2>&1