├── AutodlFilesDownloader.js ├── README.md ├── crontab-check.sh ├── crontabentries ├── mtn.sh ├── ports.conf ├── rtcheck ├── sbfmsc-dti-test.sh ├── sbfrmsc-14.04.bak ├── sbfrmsc-dti.sh ├── sbfrmsc.last.working.file ├── startznc ├── trial 0.9.4 └── webui.js /AutodlFilesDownloader.js: -------------------------------------------------------------------------------- 1 | /* ***** BEGIN LICENSE BLOCK ***** 2 | * Version: MPL 1.1 3 | * 4 | * The contents of this file are subject to the Mozilla Public License Version 5 | * 1.1 (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * http://www.mozilla.org/MPL/ 8 | * 9 | * Software distributed under the License is distributed on an "AS IS" basis, 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 11 | * for the specific language governing rights and limitations under the 12 | * License. 13 | * 14 | * The Original Code is IRC Auto Downloader. 15 | * 16 | * The Initial Developer of the Original Code is 17 | * David Nilsson. 18 | * Portions created by the Initial Developer are Copyright (C) 2010, 2011 19 | * the Initial Developer. All Rights Reserved. 20 | * 21 | * Contributor(s): 22 | * 23 | * ***** END LICENSE BLOCK ***** */ 24 | function autodl_ajax(obj) 25 | { 26 | // IE8 caches all Ajax requests! 27 | if (navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.match(/msie 6/i)) 28 | obj.cache = false; 29 | 30 | $.ajax(obj); 31 | } 32 | 33 | function getAjaxErrorString(status, ex) 34 | { 35 | var msg = "AJAX error"; 36 | 37 | if (status) 38 | msg += ", status: " + status; 39 | if (ex) 40 | msg += ", " + formatException(ex); 41 | 42 | return msg; 43 | } 44 | 45 | /** 46 | * @param pluginUrl URL of plugin directory (plugin.path), ending in a slash. 47 | */ 48 | function AutodlFilesDownloader(pluginUrl) 49 | { 50 | this.pluginUrl = pluginUrl; 51 | this.handler = null; 52 | this.isDownloading = false; 53 | this.files = 54 | { 55 | config: "", 56 | trackers: [] 57 | }; 58 | } 59 | 60 | AutodlFilesDownloader.prototype.getConfigFile = 61 | function() 62 | { 63 | return this.files.config; 64 | } 65 | 66 | AutodlFilesDownloader.prototype.setConfigFile = 67 | function(config) 68 | { 69 | this.files.config = config; 70 | } 71 | 72 | AutodlFilesDownloader.prototype.getTrackers = 73 | function() 74 | { 75 | return this.files.trackers; 76 | } 77 | 78 | AutodlFilesDownloader.prototype._notifyHandler = 79 | function(errorMessage) 80 | { 81 | try 82 | { 83 | this.filenames = null; 84 | this.isDownloading = false; 85 | var handler = this.handler; 86 | this.handler = null; 87 | try 88 | { 89 | handler(errorMessage); 90 | } 91 | catch (ex) 92 | { 93 | log("AutodlFilesDownloader._notifyHandler: handler: " + formatException(ex)); 94 | } 95 | } 96 | catch (ex) 97 | { 98 | log("AutodlFilesDownloader._notifyHandler: " + formatException(ex)); 99 | } 100 | } 101 | 102 | // Downloads the autodl.cfg file and all tracker files 103 | AutodlFilesDownloader.prototype.downloadAllFiles = 104 | function(handler) 105 | { 106 | if (this.isDownloading) 107 | throw "AutodlFilesDownloader.downloadAllFiles: Already downloading!"; 108 | 109 | try 110 | { 111 | this.handler = handler; 112 | 113 | var this_ = this; 114 | autodl_ajax( 115 | { 116 | url: this.pluginUrl + "getfiles.php", 117 | type: "GET", 118 | dataType: "json", 119 | success: function(data, status) { this_._onGetfiles(data); }, 120 | error: function(xhr, status, ex) 121 | { 122 | this_._notifyHandler("Could not get files listing: " + getAjaxErrorString(status, ex)); 123 | } 124 | }); 125 | } 126 | catch (ex) 127 | { 128 | this._notifyHandler("AutodlFilesDownloader.downloadAllFiles: " + formatException(ex)); 129 | } 130 | } 131 | 132 | AutodlFilesDownloader.prototype._onGetfiles = 133 | function(data) 134 | { 135 | try 136 | { 137 | if (data.error) 138 | return this._notifyHandler("Error getting files listing: " + data.error); 139 | 140 | this.files.trackers = []; 141 | this._downloadFiles(data.files); 142 | } 143 | catch (ex) 144 | { 145 | this._notifyHandler("AutodlFilesDownloader._onGetfiles: " + formatException(ex)); 146 | } 147 | } 148 | 149 | // Downloads only the autodl.cfg file 150 | AutodlFilesDownloader.prototype.downloadConfig = 151 | function(handler) 152 | { 153 | if (this.isDownloading) 154 | throw "AutodlFilesDownloader.downloadConfig: Already downloading!"; 155 | 156 | try 157 | { 158 | this.handler = handler; 159 | this._downloadFiles(['autodl.cfg']); 160 | } 161 | catch (ex) 162 | { 163 | this._notifyHandler("AutodlFilesDownloader.downloadAllFiles: " + formatException(ex)); 164 | } 165 | } 166 | 167 | AutodlFilesDownloader.prototype._downloadFiles = 168 | function(aryFiles) 169 | { 170 | try 171 | { 172 | this.filenames = aryFiles || []; 173 | this.filenameIndex = 0; 174 | this._getNextFile(); 175 | } 176 | catch (ex) 177 | { 178 | this._notifyHandler("AutodlFilesDownloader._downloadFiles: " + formatException(ex)); 179 | } 180 | } 181 | 182 | AutodlFilesDownloader.prototype._getNextFile = 183 | function() 184 | { 185 | try 186 | { 187 | if (this.filenameIndex >= this.filenames.length) 188 | return this._notifyHandler(""); 189 | var filename = this.filenames[this.filenameIndex++]; 190 | 191 | var dataType; 192 | if (filename.match(/\.tracker$/)) 193 | dataType = "xml"; 194 | else 195 | dataType = "text"; 196 | 197 | var this_ = this; 198 | autodl_ajax( 199 | { 200 | url: this.pluginUrl + "getfile.php", 201 | data: [{name: 'file', value: filename}], 202 | type: "GET", 203 | dataType: dataType, 204 | success: function(data, status) { this_._gotFileData(data, filename); }, 205 | error: function(xhr, status, ex) 206 | { 207 | this_._notifyHandler("Could not read file " + filename + ": " + getAjaxErrorString(status, ex)); 208 | } 209 | }); 210 | } 211 | catch (ex) 212 | { 213 | this._notifyHandler("AutodlFilesDownloader._getNextFile: " + formatException(ex)); 214 | } 215 | } 216 | 217 | AutodlFilesDownloader.prototype._gotFileData = 218 | function(data, filename) 219 | { 220 | try 221 | { 222 | if (filename === 'autodl.cfg') 223 | this.files.config = data; 224 | else if (filename.match(/\.tracker$/)) 225 | this.files.trackers.push(data); 226 | else 227 | log("Got unknown file " + filename); 228 | 229 | this._getNextFile(); 230 | } 231 | catch (ex) 232 | { 233 | this._notifyHandler("AutodlFilesDownloader._gotFileData: " + formatException(ex)); 234 | } 235 | } 236 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SBOXSETUP 2 | 3 | By dannyti ---> https://github.com/dannyti/ 4 | 5 | 6 | 7 | ## [Wiki](https://github.com/dannyti/sboxsetup/wiki) || [FAQ](https://github.com/dannyti/sboxsetup/wiki/FAQ) 8 | 9 | Intends to install sbox without errors alongwith crontab entries to restart services on reboots. 10 | This will properly populate tracker list for autodl. Make crontab entries for the user to restart rtorrent on reboots and check whether it's running. 11 | This script will also eliminate the msie browser errors due to jQuery updates. 12 | Other aesthetic corrections done as well. 13 | Adding new themes to it : Agent46 & Oblivion blue. 14 | 15 | Latest: Proper chroot specified users 16 | 17 | Latest: Site wide http redirects to https, More secure environment. 18 | 19 | Latest: Added following for Multi User environment: 20 | 21 | Individual Login info: https://Server IP or Server Name/private/SBinfo.txt 22 | 23 | Individual Data Download directory: https://Server IP/private/Downloads 24 | 25 | OpenVPN Fixed 26 | 27 | This script has the following features 28 | 29 | A multi-user enviroment, you'll have scripts to add and delete users. 30 | Linux Quota, to control how much space every user can use in your box. 31 | Individual User Login Info https:///private/SBinfo.txt 32 | Individual User Https Downloads directory (https:///private/Downloads) 33 | 34 | Installed software 35 | 36 | ruTorrent 3.7 + official plugins 37 | rTorrent 0.9.2 or 0.9.3 or 0.9.4(you can choose) 38 | Deluge 1.3.5 or 0.9.3 (you can choose, downgrade and upgrade at any time) 39 | libTorrrent 0.13.2 or 0.12.9 40 | mktorrent 41 | Fail2ban - to avoid apache and ssh exploits. Fail2ban bans IPs that show malicious signs -- too many password failures, seeking for exploits, etc. 42 | Apache (SSL) 43 | OpenVPN - Fixed 44 | ZNC Latest - To install it - Wait for script completion and reboot, after reboot you must run "installZNC" as main user and set it up 45 | PHP 5 and PHP-FPM (FastCGI to increase performance) 46 | Linux Quota 47 | SSH Server (for SSH terminal and sFTP connections) 48 | vsftpd (Very Secure FTP Deamon) <-- Working 49 | IRSSI 50 | Webmin (use it to manage your users quota) 51 | sabnzbd: http://sabnzbd.org/ 52 | Rapidleech (http://www.rapidleech.com) 53 | Subsonic - installSUBSONIC 54 | Sickrage - installSICKRAGE 55 | Plex Media Server - installPLEX 56 | Loadavg - Access hXXp://SERVER-IP/loadavg 57 | Speedtest 58 | iptodomain (Use FQDN ; Once Lets Encrypt certs are installed ; run 'iptodomain' ) 59 | 60 | # Main ruTorrent plugins 61 | 62 | autotoolscpuload, diskspace, erasedata, extratio, extsearch, feeds, filedrop, filemanager, geoip, history, logoff, mediainfo, mediastream, rss, scheduler, screenshots, theme, trafic and unpack 63 | Additional ruTorrent plugins 64 | 65 | Autodl-IRSSI (with an updated list of trackers) 66 | A modified version of Diskpace to support quota (by Notos) 67 | Filemanager (modified to handle rar, zip, unzip, tar and bzip) 68 | Fileupload 69 | Fileshare Plugin (http://forums.rutorrent.org/index.php?topic=705.0) 70 | MediaStream (to watch your videos right from your seedbox) 71 | Logoff 72 | Theme: Oblivion & Agent 46 73 | 74 | # Before installation 75 | 76 | You need to have a Fresh "blank" server installation. After that access your box using a SSH client, like PuTTY. 77 | Warnings 78 | If you don't know Linux ENOUGH: 79 | 80 | DO NOT install this script on a non OVH Host. It is doable, but you'll have to know Linux to solve some problems. 81 | 82 | DO NOT use capital letters, all your usernames should be written in lowercase. Passwords should NOT have spaces. Do NOT use words like root or shadow. 83 | 84 | DO NOT upgrade anything in your box, ask in the thread before even thinking about it. 85 | 86 | DO NOT try to reconfigure packages using other tutorials. 87 | 88 | ## How to install ? 89 | 90 | That is the question you must ask yourself. 91 | You must be logged in as root to run this installation or use sudo on it. 92 | Commands 93 | 94 | After installing you will have access to the following commands to be used directly in terminal 95 | 96 | createSeedboxUser 97 | deleteSeedboxUser 98 | changeUserPassword [ changeUserPassword rutorrent ] 99 | installRapidleech 100 | installOpenVPN 101 | installSABnzbd 102 | installWebmin 103 | updategitRepository 104 | removeWebmin 105 | installRTorrent 106 | installZNC - Let the script complete and reboot, then run this command 107 | restartSeedbox 108 | installSUBSONIC 109 | installSICKRAGE 110 | installPLEX 111 | speedTEST 112 | iptodomain 113 | 114 | While executing them, if sudo is needed, they will ask for a password. 115 | 116 | ## Services 117 | To access services installed on your new server point your browser to the following address: 118 | ``` 119 | https:///private/SBinfo.txt 120 | ``` 121 | 122 | ## Download Directory 123 | To access Downloaded data directory on your new server; point your browser to the following address: 124 | ``` 125 | https:///private/Downloads 126 | ``` 127 | 128 | #### OpenVPN 129 | To use your VPN you will need a VPN client compatible with [OpenVPN](http://openvpn.net/index.php?option=com_content&id=357), necessary files to configure your connection are in this link in your box: 130 | ``` 131 | https:///rutorrent/CLIENT-NAME.zip` and use it in any OpenVPN client. 132 | ``` 133 | 134 | Supported and tested servers 135 | 136 | Ubuntu Server 12.10.0 - 64bit (on VM environment) 137 | Ubuntu Server 12.04.x - 64bit (on VM environment) 138 | Ubuntu Server 14.04.x - 32bit (OVH's Kimsufi 2G and 16G - Precise) 139 | Ubuntu Server 14.04.x - 64bit (OVH's Kimsufi 2G and 16G - Precise) 140 | Ubuntu Server 14.10 - 32 and 64 bit 141 | Ubuntu Server 15.04 - 32 and 64 bit 142 | Ubuntu Server 15.10 - 32 and 64 bit 143 | Debian 6.0.6 - 32 and 64bit (OVH's Kimsufi 2G - Squeeze) 144 | Debian 6.0.6 - 32 and 64bit (on VM environment) 145 | Debian 7.0 - 32 and 64 bit 146 | Debian 8.X - 32 and 64 bit 147 | 148 | Quota 149 | 150 | Quota is disabled by default in your box. To enable and use it, you'll have to open Webmin, using the address you can find in one of the tables box above this. After you sucessfully logged on Webmin, enable it by clicking 151 | 152 | System => Disk and Network Filesystems => /home => Use Quotas? => Select "Only User" => Save 153 | 154 | Now you'll have to configure quota for each user, doing 155 | 156 | System => Disk Quotas => /home => => Configure the "Soft kilobyte limit" => Update 157 | 158 | As soon as you save it, your seedbox will also update the available space to all your users. 159 | Changelog 160 | 161 | Take a look at seedbox-from-scratch.sh and github commit history, it's all there. 162 | Support 163 | 164 | There is no real support for this script, but nerds are talking a lot about it here and you may find solutions for your problems in that thread. 165 | License 166 | 167 | Copyright (c) 2015 dannyti (https://github.com/dannyti/) 168 | 169 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 170 | 171 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 172 | 173 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 174 | 175 | --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 176 | 177 | 178 | -------------------------------------------------------------------------------- /crontab-check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # By dannyti ---> https://github.com/dannyti/ 3 | # 4 | # 5 | ###################################################################### 6 | # 7 | # Copyright (c) 2015 dannyti (https://github.com/dannyti/) 8 | user1="USERNAME" 9 | line1="@reboot ~/bin/rtcheck" 10 | line2="*/10 * * * * ~/bin/rtcheck" 11 | (crontab -u "$user1" -l; echo "$line1" ) | crontab -u "$user1" - 12 | (crontab -u "$user1" -l; echo "$line2" ) | crontab -u "$user1" - 13 | -------------------------------------------------------------------------------- /crontabentries: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | user1="USERNAME" 3 | line1="*/10 * * * * ~/bin/rtcheck >/dev/null 2>&1" 4 | (crontab -u "$user1" -l; echo "$line1" ) | crontab -u "$user1" - -------------------------------------------------------------------------------- /mtn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for i in *.wmv; 3 | do mtn "${i}" -f /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf -c 3 -r 3 -s 300; 4 | done; 5 | for i in *.mkv; 6 | do mtn "${i}" -f /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf -c 3 -r 3 -s 300; 7 | done; 8 | for i in *.mp4; 9 | do mtn "${i}" -f /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf -c 3 -r 3 -s 300; 10 | done; 11 | for i in *.avi; 12 | do mtn "${i}" -f /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf -c 3 -r 3 -s 300; 13 | done; -------------------------------------------------------------------------------- /ports.conf: -------------------------------------------------------------------------------- 1 | # If you just change the port or add more ports here, you will likely also 2 | # have to change the VirtualHost statement in 3 | # /etc/apache2/sites-enabled/000-default 4 | # This is also true if you have upgraded from before 2.2.9-3 (i.e. from 5 | # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and 6 | # README.Debian.gz 7 | 8 | NameVirtualHost *:80 9 | Listen 80 10 | 11 | 12 | # If you add NameVirtualHost *:443 here, you will also have to change 13 | # the VirtualHost statement in /etc/apache2/sites-available/default-ssl 14 | # to 15 | # Server Name Indication for SSL named virtual hosts is currently not 16 | # supported by MSIE on Windows XP. 17 | NameVirtualHost *:443 18 | Listen 443 19 | 20 | 21 | 22 | Listen 443 23 | 24 | 25 | ServerName localhost -------------------------------------------------------------------------------- /rtcheck: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # By dannyti ---> https://github.com/dannyti/ 3 | # 4 | # 5 | ###################################################################### 6 | # 7 | # Copyright (c) 2015 dannyti (https://github.com/dannyti/) 8 | # Starts rtorrent if it is not already running 9 | 10 | FILE="$HOME/downloads/.session/rtorrent.lock" 11 | SERVICE='rtorrent' 12 | PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin 13 | 14 | if pgrep -fx -u $LOGNAME $SERVICE > /dev/null 15 | then 16 | echo "$SERVICE is running." 17 | else 18 | rm -f $FILE 19 | echo "$SERVICE is not running, starting $SERVICE" && /home/$LOGNAME/restartSeedbox 20 | fi 21 | -------------------------------------------------------------------------------- /sbfmsc-dti-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Updated for $.broswer-msie error; will populate tracker list properly ; create check/start scripts; 4 | # create crontab entries. Rest is all perfect from Notos. Thanks. 5 | # 6 | # The Seedbox From Scratch Script 7 | # By Notos ---> https://github.com/Notos/ 8 | # Modified by dannyti ---> https://github.com/dannyti/ 9 | # 10 | ###################################################################### 11 | # 12 | # Copyright (c) 2013 Notos (https://github.com/Notos/) & dannyti (https://github.com/dannyti/) 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | # 20 | # --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 21 | # 22 | ###################################################################### 23 | # 24 | # git clone -b master https://github.com/Notos/seedbox-from-scratch.git /etc/seedbox-from-scratch 25 | # sudo git stash; sudo git pull 26 | # 27 | apt-get --yes install lsb-release 28 | SBFSCURRENTVERSION1=14.06 29 | OS1=$(lsb_release -si) 30 | OSV1=$(lsb_release -rs) 31 | OSV11=$(sed 's/\..*//' /etc/debian_version) 32 | logfile="/dev/null" 33 | # 34 | # Changelog 35 | # Version 14.06 (By dannyti) 36 | # Jan 16 2015 37 | # - RTorrent 0.9.4 supported 38 | # - Openvpn Fixed and Working 39 | # - Autodl tracker list correctly populated 40 | # - Diskspace fixed for multiuser environment 41 | # - Added http Data Download directory for users ; Can be accessed at http://Server-IP/private/Downloads ; Only http:// 42 | # - Sitewide https only 43 | # - User Login info can be accessed individually at http://Server-IP/private/SBinfo.txt 44 | # - Mediainfo fixed ; installtion from source 45 | # - Jquery Error corrected 46 | # - Crontab entries made for checking rtorrrent is running and starting it if not running 47 | # - Plowshare Fixed 48 | # - Deprecated seedboxInfo.php 49 | # 50 | # Version 2.1.9 (not stable yet) 51 | # Dec 26 2012 17:37 GMT-3 52 | # - RTorrent 0.9.3 support (optionally installed) 53 | # - New installRTorrent script: move to RTorrent 0.9.3 or back to 0.9.2 at any time 54 | # - Deluge v1.3.6 multi-user installation script (it will install the last stable version): installDeluge 55 | # - Optionally install Deluge when you first install your seedbox-from-scratch box 56 | # 57 | # Version 2.1.8 (stable) 58 | # - Bug fix release 59 | # 60 | # Version 2.1.4 (stable) 61 | # Dec 11 2012 2:34 GMT-3 62 | # - Debian 6 (Squeeze) Compatibile 63 | # - Check if user root is running the script 64 | # - vsftpd - FTP access with SSL (AUTH SSL - Explicit) 65 | # - vsftpd downgraded on Ubuntu to 2.3.2 (oneiric) 66 | # - iptables tweaked to make OpenVPN work as it should both on Ubuntu and Debian 67 | # - SABnzbd is now being installed from sources and works better 68 | # - New script: changeUserPassword --- example: changeUserPassword notos 133t rutorrent 69 | # - restartSeedbox now kill processes even if there are users attached on screens 70 | # - Installs rar, unrar and zip separately from main installations to prevent script from breaking on bad sources from non-OVH providers 71 | # 72 | # Version 2.1.2 (stable) 73 | # Nov 16 2012 20:48 GMT-3 74 | # - new upgradeSeedbox script (to download git files for a new version, it will not really upgrade it, at least for now :) 75 | # - ruTorrent fileshare Plugin (http://forums.rutorrent.org/index.php?topic=705.0) 76 | # - rapidleech (http://www.rapidleech.com/ - http://www.rapidleech.com/index.php?showtopic=2226|Go ** tutorial: http://www.seedm8.com/members/knowledgebase/24/Installing-Rapidleech-on-your-Seedbox.html 77 | # 78 | # Version 2.1.1 (stable) 79 | # Nov 12 2012 20:15 80 | # - OpenVPN was not working as expected (fixed) 81 | # - OpenVPN port now is configurable (at main install) and you can change it anytime before reinstalling: /etc/seedbox-from-scratch/openvpn.info 82 | # 83 | # Version 2.1.0 (not stable yet) 84 | # Nov 11 2012 20:15 85 | # - sabnzbd: http://wiki.sabnzbd.org/install-ubuntu-repo 86 | # - restartSeedbox script for each user 87 | # - User info files in /etc/seedbox-from-scratch/users 88 | # - Info about all users in https://hostname.tld/seedboxInfo.php 89 | # - Password protected webserver Document Root (/var/www/) 90 | # 91 | # Version 2.0.0 (stable) 92 | # Oct 31 2012 23:59 93 | # - chroot jail for users, using JailKit (http://olivier.sessink.nl/jailkit/) 94 | # - Fail2ban for ssh and apache - it bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. 95 | # - OpenVPN (after install you can download your key from http:///rutorrent/vpn.zip) 96 | # - createSeedboxUser script now asks if you want your user jailed, to have SSH access and if it should be added to sudoers 97 | # - Optionally install packages JailKit, Webmin, Fail2ban and OpenVPN 98 | # - Choose between RTorrent 0.8.9 and 0.9.2 (and their respective libtorrent libraries) 99 | # - Upgrade and downgrade RTorrent at any time 100 | # - Full automated install, now you just have to download script and run it in your box: 101 | # > wget -N https://raw.github.com/Notos/seedbox-from-scratch/v2.x.x/seedbox-from-scratch.sh 102 | # > time bash ~/seedbox-from-scratch.sh 103 | # - Due to a recent outage of Webmin site and SourceForge's svn repositories, some packages are now in git and will not be downloaded from those sites 104 | # - Updated list of trackers in Autodl-irssi 105 | # - vsftpd FTP Server (working in chroot jail) 106 | # - New ruTorrent default theme: Oblivion 107 | # 108 | # Version 1.30 109 | # Oct 23 2012 04:54:29 110 | # - Scripts now accept a full install without having to create variables and do anything else 111 | # 112 | # Version 1.20 113 | # Oct 19 2012 03:24 (by Notos) 114 | # - Install OpenVPN - (BETA) Still not in the script, just an outside script 115 | # Tested client: http://openvpn.net/index.php?option=com_content&id=357 116 | # 117 | # Version 1.11 118 | # Oct 18 2012 05:13 (by Notos) 119 | # - Added scripts to downgrade and upgrade RTorrent 120 | # 121 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 122 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 123 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 124 | # 125 | # Version 1.10 126 | # 06/10/2012 14:18 (by Notos) 127 | # - Added Fileupload plugin 128 | # 129 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 130 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 131 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 132 | # 133 | # Version 1.00 134 | # 30/09/2012 14:18 (by Notos) 135 | # - Changing some file names and depoying version 1.00 136 | # 137 | # Version 0.99b 138 | # 27/09/2012 19:39 (by Notos) 139 | # - Quota for users 140 | # - Download dir inside user home 141 | # 142 | # Version 0.99a 143 | # 27/09/2012 19:39 (by Notos) 144 | # - Quota for users 145 | # - Download dir inside user home 146 | # 147 | # Version 0.92a 148 | # 28/08/2012 19:39 (by Notos) 149 | # - Also working on Debian now 150 | # 151 | # Version 0.91a 152 | # 24/08/2012 19:39 (by Notos) 153 | # - First multi-user version sent to public 154 | # 155 | # Version 0.90a 156 | # 22/08/2012 19:39 (by Notos) 157 | # - Working version for OVH Kimsufi 2G Server - Ubuntu Based 158 | # 159 | # Version 0.89a 160 | # 17/08/2012 19:39 (by Notos) 161 | # 162 | function getString 163 | { 164 | local ISPASSWORD=$1 165 | local LABEL=$2 166 | local RETURN=$3 167 | local DEFAULT=$4 168 | local NEWVAR1=a 169 | local NEWVAR2=b 170 | local YESYES=YESyes 171 | local NONO=NOno 172 | local YESNO=$YESYES$NONO 173 | 174 | while [ ! $NEWVAR1 = $NEWVAR2 ] || [ -z "$NEWVAR1" ]; 175 | do 176 | clear 177 | echo "#" 178 | echo "#" 179 | echo "# The Seedbox From Scratch Script" 180 | echo "# By Notos ---> https://github.com/Notos/" 181 | echo "# Modified by dannyti ---> https://github.com/dannyti/" 182 | echo "#" 183 | echo "#" 184 | echo 185 | 186 | if [ "$ISPASSWORD" == "YES" ]; then 187 | read -s -p "$DEFAULT" -p "$LABEL" NEWVAR1 188 | else 189 | read -e -i "$DEFAULT" -p "$LABEL" NEWVAR1 190 | fi 191 | if [ -z "$NEWVAR1" ]; then 192 | NEWVAR1=a 193 | continue 194 | fi 195 | 196 | if [ ! -z "$DEFAULT" ]; then 197 | if grep -q "$DEFAULT" <<< "$YESNO"; then 198 | if grep -q "$NEWVAR1" <<< "$YESNO"; then 199 | if grep -q "$NEWVAR1" <<< "$YESYES"; then 200 | NEWVAR1=YES 201 | else 202 | NEWVAR1=NO 203 | fi 204 | else 205 | NEWVAR1=a 206 | fi 207 | fi 208 | fi 209 | 210 | if [ "$NEWVAR1" == "$DEFAULT" ]; then 211 | NEWVAR2=$NEWVAR1 212 | else 213 | if [ "$ISPASSWORD" == "YES" ]; then 214 | echo 215 | read -s -p "Retype: " NEWVAR2 216 | else 217 | read -p "Retype: " NEWVAR2 218 | fi 219 | if [ -z "$NEWVAR2" ]; then 220 | NEWVAR2=b 221 | continue 222 | fi 223 | fi 224 | 225 | 226 | if [ ! -z "$DEFAULT" ]; then 227 | if grep -q "$DEFAULT" <<< "$YESNO"; then 228 | if grep -q "$NEWVAR2" <<< "$YESNO"; then 229 | if grep -q "$NEWVAR2" <<< "$YESYES"; then 230 | NEWVAR2=YES 231 | else 232 | NEWVAR2=NO 233 | fi 234 | else 235 | NEWVAR2=a 236 | fi 237 | fi 238 | fi 239 | echo "---> $NEWVAR2" 240 | 241 | done 242 | eval $RETURN=\$NEWVAR1 243 | } 244 | # 0. 245 | 246 | if [[ $EUID -ne 0 ]]; then 247 | echo "This script must be run as root" 1>&2 248 | exit 1 249 | fi 250 | 251 | export DEBIAN_FRONTEND=noninteractive 252 | 253 | clear 254 | 255 | # 1. 256 | 257 | #localhost is ok this rtorrent/rutorrent installation 258 | IPADDRESS1=`ifconfig | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' | grep -v 127 | head -n 1` 259 | CHROOTJAIL1=NO 260 | 261 | #those passwords will be changed in the next steps 262 | PASSWORD1=a 263 | PASSWORD2=b 264 | 265 | getString NO "You need to create an user for your seedbox: " NEWUSER1 266 | getString YES "Password for user $NEWUSER1: " PASSWORD1 267 | getString NO "IP address of your box: " IPADDRESS1 $IPADDRESS1 268 | getString NO "SSH port: " NEWSSHPORT1 21976 269 | getString NO "vsftp port (usually 21): " NEWFTPPORT1 21201 270 | getString NO "OpenVPN port: " OPENVPNPORT1 31195 271 | #getString NO "Do you want to have some of your users in a chroot jail? " CHROOTJAIL1 YES 272 | getString NO "Install Webmin? " INSTALLWEBMIN1 YES 273 | getString NO "Install Fail2ban? " INSTALLFAIL2BAN1 YES 274 | getString NO "Install OpenVPN? " INSTALLOPENVPN1 NO 275 | getString NO "Install SABnzbd? " INSTALLSABNZBD1 NO 276 | getString NO "Install Rapidleech? " INSTALLRAPIDLEECH1 NO 277 | getString NO "Install Deluge? " INSTALLDELUGE1 NO 278 | getString NO "Wich RTorrent version would you like to install, '0.9.3' or '0.9.4' or '0.9.6'? " RTORRENT1 0.9.6 279 | 280 | if [ "$RTORRENT1" != "0.9.3" ] && [ "$RTORRENT1" != "0.9.6" ] && [ "$RTORRENT1" != "0.9.4" ]; then 281 | echo "$RTORRENT1 typed is not 0.9.6 or 0.9.4 or 0.9.3!" 282 | exit 1 283 | fi 284 | 285 | if [ "$OSV1" = "14.04" ]; then 286 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 >> $logfile 2>&1 287 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >> $logfile 2>&1 288 | fi 289 | echo -e "\033[0;32;148m18 Minutes to go... .. .\033[39m" 290 | 291 | apt-get --yes update >> $logfile 2>&1 292 | apt-get --yes install whois sudo makepasswd nano >> $logfile 2>&1 293 | apt-get --yes install git >> $logfile 2>&1 294 | 295 | echo -e "\033[0;32;148m.............\033[39m" 296 | rm -f -r /etc/seedbox-from-scratch >> $logfile 2>&1 297 | git clone -b v$SBFSCURRENTVERSION1 https://github.com/dannyti/seedbox-from-scratch.git /etc/seedbox-from-scratch >> $logfile 2>&1 298 | mkdir -p cd /etc/seedbox-from-scratch/source 299 | mkdir -p cd /etc/seedbox-from-scratch/users 300 | echo -e "\033[0;32;148mWork in progress.........\033[39m" 301 | 302 | if [ ! -f /etc/seedbox-from-scratch/seedbox-from-scratch.sh ]; then 303 | echo "" 304 | echo Looks like something is wrong, this script was not able to download its whole git repository. 305 | echo "git could not be installed :/ " 306 | echo "Do : apt-get update && apt-get --yes install git " 307 | echo " Then run script again. " 308 | exit 1 309 | fi 310 | 311 | # 3.1 312 | 313 | #show all commands 314 | #set -x verbose 315 | # 4. 316 | perl -pi -e "s/Port 22/Port $NEWSSHPORT1/g" /etc/ssh/sshd_config 317 | perl -pi -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config 318 | perl -pi -e "s/#Protocol 2/Protocol 2/g" /etc/ssh/sshd_config 319 | perl -pi -e "s/X11Forwarding yes/X11Forwarding no/g" /etc/ssh/sshd_config 320 | 321 | groupadd sshdusers 322 | groupadd sftponly 323 | echo -e "\033[0;32;148mPlease Standby................\033[39m" 324 | mkdir -p /usr/share/terminfo/l/ 325 | cp /lib/terminfo/l/linux /usr/share/terminfo/l/ 326 | #echo '/usr/lib/openssh/sftp-server' >> /etc/shells 327 | #if [ "$OS1" = "Ubuntu" ]; then 328 | echo "" | tee -a /etc/ssh/sshd_config > /dev/null 329 | echo "UseDNS no" | tee -a /etc/ssh/sshd_config > /dev/null 330 | echo "AllowGroups sshdusers root" >> /etc/ssh/sshd_config 331 | echo "Match Group sftponly" >> /etc/ssh/sshd_config 332 | echo "ChrootDirectory %h" >> /etc/ssh/sshd_config 333 | echo "ForceCommand internal-sftp" >> /etc/ssh/sshd_config 334 | echo "AllowTcpForwarding no" >> /etc/ssh/sshd_config 335 | #fi 336 | 337 | service ssh reload 338 | 339 | # 6. 340 | #remove cdrom from apt so it doesn't stop asking for it 341 | perl -pi -e "s/deb cdrom/#deb cdrom/g" /etc/apt/sources.list 342 | perl -pi.orig -e 's/^(deb .* universe)$/$1 multiverse/' /etc/apt/sources.list 343 | #add non-free sources to Debian Squeeze# those two spaces below are on purpose 344 | perl -pi -e "s/squeeze main/squeeze main contrib non-free/g" /etc/apt/sources.list 345 | perl -pi -e "s/squeeze-updates main/squeeze-updates main contrib non-free/g" /etc/apt/sources.list 346 | echo -e "\033[0;32;148mI am installing random stuff, Do you like coffee ?\033[39m" 347 | #apt-get --yes install python-software-properties 348 | #Adding debian pkgs for adding repo and installing ffmpeg 349 | apt-get --yes install software-properties-common >> $logfile 2>&1 350 | if [ "$OSV11" = "8" ]; then 351 | apt-add-repository --yes "deb http://www.deb-multimedia.org jessie main non-free" >> $logfile 2>&1 352 | apt-get update >> $logfile 2>&1 353 | apt-get --force-yes --yes install ffmpeg >> $logfile 2>&1 354 | fi 355 | 356 | echo -e "\033[0;32;148m.....\033[39m" 357 | # 7. 358 | # update and upgrade packages 359 | apt-get --yes install python-software-properties software-properties-common >> $logfile 2>&1 360 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV1" = "14.10" ]; then 361 | apt-add-repository --yes ppa:kirillshkrogalev/ffmpeg-next >> $logfile 2>&1 362 | fi 363 | apt-get --yes update >> $logfile 2>&1 364 | apt-get --yes upgrade >> $logfile 2>&1 365 | # 8. 366 | #install all needed packages 367 | apt-get --yes install apache2 apache2-utils autoconf build-essential ca-certificates comerr-dev curl cfv quota mktorrent dtach htop irssi libapache2-mod-php5 libcloog-ppl-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev openvpn libssl-dev libtool libxml2-dev ncurses-base ncurses-term ntp openssl patch libc-ares-dev pkg-config php5 php5-cli php5-dev php5-curl php5-geoip php5-mcrypt php5-gd php5-xmlrpc pkg-config python-scgi ssl-cert subversion texinfo unzip zlib1g-dev expect flex bison debhelper binutils-gold libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libxml-libxml-perl libjson-rpc-perl libarchive-zip-perl tcpdump >> $logfile 2>&1 368 | if [ $? -gt 0 ]; then 369 | echo 370 | echo 371 | echo *** ERROR *** 372 | echo 373 | echo "Looks like something is wrong with apt-get install, aborting." 374 | echo 375 | exit 1 376 | fi 377 | apt-get install screen >> $logfile 2>&1 378 | apt-get --yes install zip >> $logfile 2>&1 379 | 380 | apt-get --yes install ffmpeg >> $logfile 2>&1 381 | apt-get --yes install automake1.9 >> $logfile 2>&1 382 | 383 | apt-get --force-yes --yes install rar >> $logfile 2>&1 384 | if [ $? -gt 0 ]; then 385 | apt-get --yes install rar-free >> $logfile 2>&1 386 | fi 387 | 388 | #apt-get --yes install unrar 389 | #if [ $? -gt 0 ]; then 390 | # apt-get --yes install unrar-free 391 | #fi 392 | #if [ "$OSV11" = "8" ]; then 393 | # apt-get --yes install unrar-free >> $logfile 2>&1 394 | #fi 395 | 396 | apt-get --yes install dnsutils >> $logfile 2>&1 397 | 398 | if [ "$CHROOTJAIL1" = "YES" ]; then 399 | cd /etc/seedbox-from-scratch 400 | tar xvfz jailkit-2.15.tar.gz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 401 | cd source/jailkit-2.15 402 | ./debian/rules binary 403 | cd .. 404 | dpkg -i jailkit_2.15-1_*.deb >> $logfile 2>&1 405 | cp /etc/jailkit/jk_init.ini /etc/jailkit/jk_init.ini.original 406 | echo "" | tee -a /etc/jailkit/jk_init.ini >> /dev/null 407 | bash /etc/seedbox-from-scratch/updatejkinit >> $logfile 2>&1 408 | fi 409 | 410 | echo -e "\033[0;32;148mGo make coffee......\033[39m" 411 | # 8.1 additional packages for Ubuntu 412 | # this is better to be apart from the others 413 | apt-get --yes install php5-fpm >> $logfile 2>&1 414 | apt-get --yes install php5-xcache libxml2-dev >> $logfile 2>&1 415 | 416 | if [ "$OSV1" = "13.10" ]; then 417 | apt-get install php5-json 418 | fi 419 | 420 | #Check if its Debian and do a sysvinit by upstart replacement: 421 | #Commented the follwoing three lines for testing 422 | #if [ "$OS1" = "Debian" ]; then 423 | # echo 'Yes, do as I say!' | apt-get -y --force-yes install upstart 424 | #fi 425 | 426 | # 8.3 Generate our lists of ports and RPC and create variables 427 | 428 | #permanently adding scripts to PATH to all users and root 429 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /etc/profile > /dev/null 430 | echo "export PATH" | tee -a /etc/profile > /dev/null 431 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /root/.bashrc > /dev/null 432 | echo "export PATH" | tee -a /root/.bashrc > /dev/null 433 | 434 | rm -f /etc/seedbox-from-scratch/ports.txt 435 | for i in $(seq 51101 51999) 436 | do 437 | echo "$i" | tee -a /etc/seedbox-from-scratch/ports.txt > /dev/null 438 | done 439 | 440 | rm -f /etc/seedbox-from-scratch/rpc.txt 441 | for i in $(seq 2 1000) 442 | do 443 | echo "RPC$i" | tee -a /etc/seedbox-from-scratch/rpc.txt > /dev/null 444 | done 445 | 446 | # 8.4 447 | 448 | if [ "$INSTALLWEBMIN1" = "YES" ]; then 449 | #if webmin isup, download key 450 | WEBMINDOWN=YES 451 | ping -c1 -w2 www.webmin.com > /dev/null 452 | if [ $? = 0 ] ; then 453 | wget -t 5 http://www.webmin.com/jcameron-key.asc >> $logfile 2>&1 454 | apt-key add jcameron-key.asc >> $logfile 2>&1 455 | if [ $? = 0 ] ; then 456 | WEBMINDOWN=NO 457 | fi 458 | fi 459 | 460 | if [ "$WEBMINDOWN"="NO" ] ; then 461 | #add webmin source 462 | echo "" | tee -a /etc/apt/sources.list > /dev/null 463 | echo "deb http://download.webmin.com/download/repository sarge contrib" | tee -a /etc/apt/sources.list > /dev/null 464 | cd /tmp 465 | fi 466 | 467 | if [ "$WEBMINDOWN" = "NO" ]; then 468 | apt-get --yes update >> $logfile 2>&1 469 | apt-get --yes install webmin >> $logfile 2>&1 470 | fi 471 | fi 472 | 473 | echo -e "\033[0;32;148m.........\033[39m" 474 | # 9. 475 | a2enmod ssl >> $logfile 2>&1 476 | a2enmod auth_digest >> $logfile 2>&1 477 | a2enmod reqtimeout >> $logfile 2>&1 478 | a2enmod rewrite >> $logfile 2>&1 479 | #a2enmod scgi ############### if we cant make python-scgi works 480 | #cd /etc/apache2 481 | #rm apache2.conf 482 | #wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/apache2.conf 483 | cat /etc/seedbox-from-scratch/add2apache2.conf >> /etc/apache2/apache2.conf 484 | # 10. 485 | 486 | #remove timeout if there are any 487 | perl -pi -e "s/^Timeout [0-9]*$//g" /etc/apache2/apache2.conf 488 | 489 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 490 | echo "#seedbox values" | tee -a /etc/apache2/apache2.conf > /dev/null 491 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 492 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 493 | echo "ServerSignature Off" | tee -a /etc/apache2/apache2.conf > /dev/null 494 | echo "ServerTokens Prod" | tee -a /etc/apache2/apache2.conf > /dev/null 495 | echo "Timeout 30" | tee -a /etc/apache2/apache2.conf > /dev/null 496 | cd /etc/apache2 497 | rm ports.conf 498 | wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/ports.conf >> $logfile 2>&1 499 | service apache2 restart 500 | mkdir /etc/apache2/auth.users 501 | 502 | echo "$IPADDRESS1" > /etc/seedbox-from-scratch/hostname.info 503 | 504 | # 11. 505 | makepasswd | tee -a /etc/seedbox-from-scratch/sslca.info > /dev/null 506 | export TEMPHOSTNAME1=tsfsSeedBox 507 | export CERTPASS1=@@$TEMPHOSTNAME1.$NEWUSER1.ServerP7s$ 508 | export NEWUSER1 509 | export IPADDRESS1 510 | 511 | echo "$NEWUSER1" > /etc/seedbox-from-scratch/mainuser.info 512 | echo "$CERTPASS1" > /etc/seedbox-from-scratch/certpass.info 513 | 514 | bash /etc/seedbox-from-scratch/createOpenSSLCACertificate >> $logfile 2>&1 515 | 516 | mkdir -p /etc/ssl/private/ 517 | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -config /etc/seedbox-from-scratch/ssl/CA/caconfig.cnf >> $logfile 2>&1 518 | 519 | if [ "$OSV11" = "7" ]; then 520 | echo "deb http://ftp.cyconet.org/debian wheezy-updates main non-free contrib" >> /etc/apt/sources.list.d/wheezy-updates.cyconet.list 521 | apt-get update >> $logfile 2>&1 522 | apt-get install -y --force-yes -t wheezy-updates debian-cyconet-archive-keyring vsftpd libxml2-dev libcurl4-gnutls-dev subversion >> $logfile 2>&1 523 | elif [ "$OSV1" = "12.04" ]; then 524 | add-apt-repository -y ppa:thefrontiergroup/vsftpd 525 | apt-get update >> $logfile 2>&1 526 | apt-get -y install vsftpd >> $logfile 2>&1 527 | else 528 | apt-get -y install vsftpd >> $logfile 2>&1 529 | fi 530 | 531 | 532 | #if [ "$OSV1" = "12.04" ]; then 533 | # dpkg -i /etc/seedbox-from-scratch/vsftpd_2.3.2-3ubuntu5.1_`uname -m`.deb 534 | #fi 535 | 536 | perl -pi -e "s/anonymous_enable\=YES/\#anonymous_enable\=YES/g" /etc/vsftpd.conf 537 | perl -pi -e "s/connect_from_port_20\=YES/#connect_from_port_20\=YES/g" /etc/vsftpd.conf 538 | perl -pi -e 's/rsa_private_key_file/#rsa_private_key_file/' /etc/vsftpd.conf 539 | perl -pi -e 's/rsa_cert_file/#rsa_cert_file/' /etc/vsftpd.conf 540 | #perl -pi -e "s/rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/g" /etc/vsftpd.conf 541 | #perl -pi -e "s/rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/g" /etc/vsftpd.conf 542 | echo "listen_port=$NEWFTPPORT1" | tee -a /etc/vsftpd.conf >> /dev/null 543 | echo "ssl_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 544 | echo "allow_anon_ssl=YES" | tee -a /etc/vsftpd.conf >> /dev/null 545 | echo "force_local_data_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 546 | echo "force_local_logins_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 547 | echo "ssl_tlsv1=YES" | tee -a /etc/vsftpd.conf >> /dev/null 548 | echo "ssl_sslv2=NO" | tee -a /etc/vsftpd.conf >> /dev/null 549 | echo "ssl_sslv3=NO" | tee -a /etc/vsftpd.conf >> /dev/null 550 | echo "require_ssl_reuse=NO" | tee -a /etc/vsftpd.conf >> /dev/null 551 | echo "ssl_ciphers=HIGH" | tee -a /etc/vsftpd.conf >> /dev/null 552 | echo "rsa_cert_file=/etc/ssl/private/vsftpd.pem" | tee -a /etc/vsftpd.conf >> /dev/null 553 | echo "local_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 554 | echo "write_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 555 | echo "local_umask=022" | tee -a /etc/vsftpd.conf >> /dev/null 556 | echo "chroot_local_user=YES" | tee -a /etc/vsftpd.conf >> /dev/null 557 | echo "chroot_list_file=/etc/vsftpd.chroot_list" | tee -a /etc/vsftpd.conf >> /dev/null 558 | echo "passwd_chroot_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 559 | echo "allow_writeable_chroot=YES" | tee -a /etc/vsftpd.conf >> /dev/null 560 | echo "seccomp_sandbox=NO" | tee -a /etc/vsftpd.conf >> /dev/null 561 | echo "dual_log_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 562 | echo "syslog_enable=NO" | tee -a /etc/vsftpd.conf >> /dev/null 563 | #sed -i '147 d' /etc/vsftpd.conf 564 | #sed -i '149 d' /etc/vsftpd.conf 565 | touch /var/log/vsftpd.log 566 | 567 | apt-get install --yes subversion >> $logfile 2>&1 568 | apt-get install --yes dialog >> $logfile 2>&1 569 | # 13. 570 | 571 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "14.10" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV11" = "8" ]; then 572 | cp /var/www/html/index.html /var/www/index.html 573 | mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.ORI 574 | rm -f /etc/apache2/sites-available/000-default.conf 575 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/000-default.conf 576 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/000-default.conf 577 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/000-default.conf 578 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/000-default.conf 579 | else 580 | mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 581 | rm -f /etc/apache2/sites-available/default 582 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 583 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 584 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 585 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 586 | fi 587 | #mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 588 | #rm -f /etc/apache2/sites-available/default 589 | #cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 590 | #perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 591 | #perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 592 | #perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 593 | 594 | echo "ServerName $IPADDRESS1" | tee -a /etc/apache2/apache2.conf > /dev/null 595 | echo -e "\033[0;32;148mHow was the coffee ?\033[39m" 596 | # 14. 597 | a2ensite default-ssl >> $logfile 2>&1 598 | #ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load 599 | #service apache2 restart 600 | #apt-get --yes install libxmlrpc-core-c3-dev 601 | 602 | #14.1 Download xmlrpc, rtorrent & libtorrent for 0.9.4 603 | #cd 604 | #svn co https://svn.code.sf.net/p/xmlrpc-c/code/stable /etc/seedbox-from-scratch/source/xmlrpc 605 | cd /etc/seedbox-from-scratch/ 606 | #wget -c http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.4.tar.gz 607 | #wget -c http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.4.tar.gz 608 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.4.tar.gz >> $logfile 2>&1 609 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.4.tar.gz >> $logfile 2>&1 610 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz >> $logfile 2>&1 611 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz >> $logfile 2>&1 612 | 613 | #configure & make xmlrpc BASED ON RTORRENT VERSION 614 | if [ "$RTORRENT1" = "0.9.4" ] || [ "$RTORRENT1" = "0.9.6" ]; then 615 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.33.17.tgz -C /etc/seedbox-from-scratch/ >> $logfile 2>&1 616 | cd /etc/seedbox-from-scratch/xmlrpc-c-1.33.17 617 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 618 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 619 | make install >> $logfile 2>&1 620 | else 621 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.16.42.tgz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 622 | cd /etc/seedbox-from-scratch/source/ 623 | unzip ../xmlrpc-c-1.31.06.zip >> $logfile 2>&1 624 | cd xmlrpc-c-1.31.06 625 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 626 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 627 | make install >> $logfile 2>&1 628 | fi 629 | # 15. 630 | 631 | 632 | # 16. 633 | #cd xmlrpc-c-1.16.42 ### old, but stable, version, needs a missing old types.h file 634 | #ln -s /usr/include/curl/curl.h /usr/include/curl/types.h 635 | 636 | 637 | # 21. 638 | echo -e "\033[0;32;148mDo not give up on me.........Still Working....\033[39m" 639 | bash /etc/seedbox-from-scratch/installRTorrent $RTORRENT1 >> $logfile 2>&1 640 | 641 | ######### Below this /var/www/rutorrent/ has been replaced with /var/www/rutorrent for Ubuntu 14.04 642 | echo -e "\033[0;32;148mNo kidding.... Did you make coffee ?\033[39m" 643 | # 22. 644 | cd /var/www/ 645 | rm -f -r rutorrent 646 | svn checkout https://github.com/Novik/ruTorrent/trunk rutorrent >> $logfile 2>&1 647 | #svn checkout http://rutorrent.googlecode.com/svn/trunk/plugins 648 | #rm -r -f rutorrent/plugins 649 | #mv plugins rutorrent/ 650 | 651 | cp /etc/seedbox-from-scratch/action.php.template /var/www/rutorrent/plugins/diskspace/action.php 652 | 653 | groupadd admin 654 | 655 | echo "www-data ALL=(root) NOPASSWD: /usr/sbin/repquota" | tee -a /etc/sudoers > /dev/null 656 | 657 | cp /etc/seedbox-from-scratch/favicon.ico /var/www/ 658 | 659 | # 26. Installing Mediainfo from source 660 | apt-get install --yes mediainfo >> $logfile 2>&1 661 | if [ $? -gt 0 ]; then 662 | cd /tmp 663 | wget http://downloads.sourceforge.net/mediainfo/MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 664 | tar jxvf MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 665 | cd MediaInfo_CLI_GNU_FromSource/ 666 | sh CLI_Compile.sh >> $logfile 2>&1 667 | cd MediaInfo/Project/GNU/CLI 668 | make install >> $logfile 2>&1 669 | fi 670 | 671 | cd /var/www/rutorrent/js/ 672 | git clone https://github.com/gabceb/jquery-browser-plugin.git >> $logfile 2>&1 673 | mv jquery-browser-plugin/dist/jquery.browser.js . 674 | rm -r -f jquery-browser-plugin 675 | sed -i '31i\ ' /var/www/rutorrent/index.html 676 | 677 | cd /var/www/rutorrent/plugins 678 | git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi >> $logfile 2>&1 679 | #cp autodl-irssi/_conf.php autodl-irssi/conf.php 680 | #svn co https://svn.code.sf.net/p/autodl-irssi/code/trunk/rutorrent/autodl-irssi/ 681 | cd autodl-irssi 682 | 683 | 684 | # 30. 685 | 686 | 687 | # 31. ZNC 688 | #Have put this in script form 689 | 690 | # 32. Installing poweroff button on ruTorrent 691 | cd /var/www/rutorrent/plugins/ 692 | wget http://rutorrent-logoff.googlecode.com/files/logoff-1.0.tar.gz >> $logfile 2>&1 693 | tar -zxf logoff-1.0.tar.gz >> $logfile 2>&1 694 | rm -f logoff-1.0.tar.gz 695 | 696 | if [ "$INSTALLFAIL2BAN1" = "YES" ]; then 697 | apt-get --yes install fail2ban >> $logfile 2>&1 698 | if [ "$OS1" = "Ubuntu" ]; then 699 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 700 | cp /etc/seedbox-from-scratch/ubu.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 701 | elif [ "$OS1" = "Debian" ]; then 702 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 703 | cp /etc/seedbox-from-scratch/deb.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 704 | fi 705 | fail2ban-client reload 706 | fi 707 | 708 | #33. Tuning Part - Let me know if you find more. 709 | echo "vm.swappiness=1" >>/etc/sysctl.conf 710 | echo "net.core.somaxconn = 1000" >>/etc/sysctl.conf 711 | echo "net.core.netdev_max_backlog = 5000" >>/etc/sysctl.conf 712 | echo "net.core.rmem_max = 16777216" >>/etc/sysctl.conf 713 | echo "net.core.wmem_max = 16777216" >>/etc/sysctl.conf 714 | echo "net.ipv4.tcp_wmem = 4096 12582912 16777216" >>/etc/sysctl.conf 715 | echo "net.ipv4.tcp_rmem = 4096 12582912 16777216" >>/etc/sysctl.conf 716 | echo "net.ipv4.tcp_max_syn_backlog = 8096" >>/etc/sysctl.conf 717 | echo "net.ipv4.tcp_slow_start_after_idle = 0" >>/etc/sysctl.conf 718 | echo "net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf 719 | echo "net.ipv4.ip_local_port_range = 10240 65535" >>/etc/sysctl.conf 720 | echo "fs.file-max = 500000" >>/etc/sysctl.conf 721 | echo vm.min_free_kbytes=1024 >> /etc/sysctl.conf 722 | echo "session required pam_limits.so" >>/etc/pam.d/common-session 723 | echo "net.ipv4.tcp_low_latency=1" >> /etc/sysctl.conf 724 | echo "net.ipv4.tcp_sack = 1" >> /etc/sysctl.conf 725 | sysctl -p >> $logfile 2>&1 726 | 727 | if [ -f /proc/user_beancounters ] || [ -d /proc/bc ] || [ -d /sys/bus/xen ] || [ -f /proc/vz/veinfo ] || [ -d /proc/vz/veinfo ]; then 728 | echo "Its a VPS, Nothing to do here, Continuing...." 729 | else 730 | sed -i "s/defaults 1 1/defaults,noatime 0 0/" /etc/fstab 731 | fi 732 | 733 | # Installing Filemanager and MediaStream 734 | rm -f -R /var/www/rutorrent/plugins/filemanager >> $logfile 2>&1 735 | rm -f -R /var/www/rutorrent/plugins/fileupload >> $logfile 2>&1 736 | rm -f -R /var/www/rutorrent/plugins/mediastream >> $logfile 2>&1 737 | rm -f -R /var/www/stream >> $logfile 2>&1 738 | 739 | cd /var/www/rutorrent/plugins/ 740 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/mediastream >> $logfile 2>&1 741 | 742 | cd /var/www/rutorrent/plugins/ 743 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/filemanager >> $logfile 2>&1 744 | 745 | cp /etc/seedbox-from-scratch/rutorrent.plugins.filemanager.conf.php.template /var/www/rutorrent/plugins/filemanager/conf.php 746 | 747 | mkdir -p /var/www/stream/ 748 | ln -s /var/www/rutorrent/plugins/mediastream/view.php /var/www/stream/view.php 749 | chown www-data: /var/www/stream 750 | chown www-data: /var/www/stream/view.php 751 | 752 | echo "" | tee /var/www/rutorrent/plugins/mediastream/conf.php > /dev/null 753 | 754 | # 32.2 # FILEUPLOAD 755 | cd /var/www/rutorrent/plugins/ 756 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileupload >> $logfile 2>&1 757 | chmod 775 /var/www/rutorrent/plugins/fileupload/scripts/upload 758 | apt-get --yes -f install >> $logfile 2>&1 759 | rm /var/www/rutorrent/plugins/unpack/conf.php 760 | # 32.2 761 | chown -R www-data:www-data /var/www/rutorrent 762 | chmod -R 755 /var/www/rutorrent 763 | 764 | #32.3 765 | perl -pi -e "s/\\\$topDirectory\, \\\$fm/\\\$homeDirectory\, \\\$topDirectory\, \\\$fm/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 766 | perl -pi -e "s/\\\$this\-\>userdir \= addslash\(\\\$topDirectory\)\;/\\\$this\-\>userdir \= \\\$homeDirectory \? addslash\(\\\$homeDirectory\) \: addslash\(\\\$topDirectory\)\;/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 767 | perl -pi -e "s/\\\$topDirectory/\\\$homeDirectory/g" /var/www/rutorrent/plugins/filemanager/settings.js.php 768 | 769 | #32.4 770 | #unzip /etc/seedbox-from-scratch/rutorrent-oblivion.zip -d /var/www/rutorrent/plugins/ 771 | #echo "" | tee -a /var/www/rutorrent/css/style.css > /dev/null 772 | #echo "/* for Oblivion */" | tee -a /var/www/rutorrent/css/style.css > /dev/null 773 | #echo ".meter-value-start-color { background-color: #E05400 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 774 | #echo ".meter-value-end-color { background-color: #8FBC00 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 775 | #echo "::-webkit-scrollbar {width:12px;height:12px;padding:0px;margin:0px;}" | tee -a /var/www/rutorrent/css/style.css > /dev/null 776 | perl -pi -e "s/\$defaultTheme \= \"\"\;/\$defaultTheme \= \"Oblivion\"\;/g" /var/www/rutorrent/plugins/theme/conf.php 777 | git clone https://github.com/InAnimaTe/rutorrent-themes.git /var/www/rutorrent/plugins/theme/themes/Extra >> $logfile 2>&1 778 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/OblivionBlue /var/www/rutorrent/plugins/theme/themes/ 779 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/Agent46 /var/www/rutorrent/plugins/theme/themes/ 780 | rm -r /var/www/rutorrent/plugins/theme/themes/Extra 781 | #ln -s /etc/seedbox-from-scratch/seedboxInfo.php.template /var/www/seedboxInfo.php 782 | 783 | # 32.5 784 | cd /var/www/rutorrent/plugins/ 785 | rm -r /var/www/rutorrent/plugins/fileshare >> $logfile 2>&1 786 | rm -r /var/www/share >> $logfile 2>&1 787 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileshare >> $logfile 2>&1 788 | mkdir /var/www/share 789 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/share.php 790 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/index.php 791 | chown -R www-data:www-data /var/www/share 792 | cp /etc/seedbox-from-scratch/rutorrent.plugins.fileshare.conf.php.template /var/www/rutorrent/plugins/fileshare/conf.php 793 | perl -pi -e "s//$IPADDRESS1/g" /var/www/rutorrent/plugins/fileshare/conf.php 794 | 795 | mv /etc/seedbox-from-scratch/unpack.conf.php /var/www/rutorrent/plugins/unpack/conf.php 796 | 797 | # 33. 798 | echo -e "\033[0;32;148m.................\033[39m" 799 | bash /etc/seedbox-from-scratch/updateExecutables >> $logfile 2>&1 800 | 801 | #34. 802 | echo $SBFSCURRENTVERSION1 > /etc/seedbox-from-scratch/version.info 803 | echo $NEWFTPPORT1 > /etc/seedbox-from-scratch/ftp.info 804 | echo $NEWSSHPORT1 > /etc/seedbox-from-scratch/ssh.info 805 | echo $OPENVPNPORT1 > /etc/seedbox-from-scratch/openvpn.info 806 | 807 | # 36. 808 | wget -P /usr/share/ca-certificates/ --no-check-certificate https://certs.godaddy.com/repository/gd_intermediate.crt https://certs.godaddy.com/repository/gd_cross_intermediate.crt >> $logfile 2>&1 809 | update-ca-certificates >> $logfile 2>&1 810 | c_rehash >> $logfile 2>&1 811 | 812 | sleep 2 813 | 814 | # 96. 815 | if [ "$INSTALLOPENVPN1" = "YES" ]; then 816 | bash /etc/seedbox-from-scratch/installOpenVPN 817 | fi 818 | 819 | if [ "$INSTALLSABNZBD1" = "YES" ]; then 820 | bash /etc/seedbox-from-scratch/installSABnzbd 821 | fi 822 | 823 | if [ "$INSTALLRAPIDLEECH1" = "YES" ]; then 824 | bash /etc/seedbox-from-scratch/installRapidleech 825 | fi 826 | 827 | if [ "$INSTALLDELUGE1" = "YES" ]; then 828 | bash /etc/seedbox-from-scratch/installDeluge 829 | fi 830 | 831 | sleep 1 832 | 833 | # 97. First user will not be jailed 834 | echo -e "\033[0;32;148mLeave it now, About to Finish........\033[39m" 835 | # createSeedboxUser 836 | bash /etc/seedbox-from-scratch/createSeedboxUser $NEWUSER1 $PASSWORD1 YES YES YES NO >> $logfile 2>&1 837 | 838 | #Loadavg 839 | cd ~ 840 | git clone https://github.com/loadavg/loadavg.git >> $logfile 2>&1 841 | cd loadavg 842 | cd ~ 843 | mv loadavg /var/www/ 844 | cd /var/www/loadavg 845 | chmod 777 configure 846 | ./configure >> $logfile 2>&1 847 | 848 | cd ~ 849 | wget http://www.rarlab.com/rar/unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 850 | tar -xvf unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 851 | cd unrar 852 | sudo make -f makefile >> $logfile 2>&1 853 | sudo install -v -m755 unrar /usr/bin >> $logfile 2>&1 854 | cd .. 855 | rm -R unrar >> $logfile 2>&1 856 | rm unrarsrc-5.3.8.tar.gz 857 | 858 | cd ~ 859 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/m/m/magic/magic.zip >> $logfile 2>&1 860 | unzip magic.zip >> $logfile 2>&1 861 | mv default.sfx rarreg.key /usr/local/lib/ 862 | rm magic.zip 863 | 864 | cd /var/www 865 | chown -R www-data:www-data /var/www/rutorrent 866 | chown -R www-data:www-data /var/www/loadavg 867 | chmod -R 755 /var/www/rutorrent 868 | cd 869 | git clone https://github.com/mcrapet/plowshare.git plowshare >> $logfile 2>&1 870 | cd ~/plowshare 871 | make install >> $logfile 2>&1 872 | cd 873 | rm -r plowshare >> $logfile 2>&1 874 | 875 | export EDITOR=nano 876 | # 100 877 | cd /var/www/rutorrent/plugins 878 | sleep 1 879 | rm -frv diskspace >> $logfile 2>&1 880 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/main/b/base/hectortheone.rar >> $logfile 2>&1 881 | #wget http://dl.bintray.com/novik65/generi...ace-3.6.tar.gz 882 | #tar -xf diskspace-3.6.tar.gz 883 | unrar x hectortheone.rar >> $logfile 2>&1 884 | #rm diskspace-3.6.tar.gz 885 | rm hectortheone.rar 886 | cd quotaspace 887 | chmod 755 run.sh 888 | cd .. 889 | perl -pi -e "s/100/1024/g" /var/www/rutorrent/plugins/throttle/throttle.php 890 | #wget --no-check-certificate http://cheapseedboxes.com/trafic_check.rar >> $logfile 2>&1 891 | #unrar x trafic_check.rar >> $logfile 2>&1 892 | #rm trafic_check.rar 893 | #wget --no-check-certificate http://cheapseedboxes.com/plimits.rar >> $logfile 2>&1 894 | #unrar x plimits.rar >> $logfile 2>&1 895 | #rm plimits.rar 896 | #cd .. 897 | chown -R www-data:www-data /var/www/rutorrent 898 | echo -e "\033[0;32;148mFinishing Now .... .... .... ....\033[39m" 899 | 900 | if [ "$OSV11" = "8" ]; then 901 | systemctl enable apache2 >> $logfile 2>&1 902 | service apache2 start >> $logfile 2>&1 903 | fi 904 | #set +x verbose 905 | #clear 906 | 907 | echo "" 908 | echo -e "\033[0;32;148m<<< The Seedbox From Scratch Script >>>\033[39m" 909 | echo -e "\033[0;32;148mScript Modified by dannyti ---> https://github.com/dannyti/\033[39m" 910 | echo "" 911 | echo "Looks like everything is set." 912 | echo "" 913 | echo "Remember that your SSH port is now ======> $NEWSSHPORT1 " 914 | echo "" 915 | echo "Your Login info can also be found at https://$IPADDRESS1/private/SBinfo.txt" 916 | echo "Download Data Directory is located at https://$IPADDRESS1/private " 917 | echo "To install ZNC, run installZNC from ssh as main user" 918 | echo "" 919 | echo "IMPORTANT NOTE: Refresh rutorrent for Throttle plugin to load properly" 920 | echo "" 921 | echo "System will reboot now, but don't close this window until you take note of the port number: $NEWSSHPORT1" 922 | echo "" 923 | #echo -e "\033[0;32;148mPlease login as main user and only then close this Window\033[39m" 924 | 925 | #reboot 926 | 927 | ##################### LAST LINE ########### 928 | -------------------------------------------------------------------------------- /sbfrmsc-14.04.bak: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Updated for $.broswer-msie error; will populate tracker list properly ; create check/start scripts; 4 | # create crontab entries. Rest is all perfect from Notos. Thanks. 5 | # 6 | # The Seedbox From Scratch Script 7 | # By Notos ---> https://github.com/Notos/ 8 | # Modified by dannyti ---> https://github.com/dannyti/ 9 | # 10 | ###################################################################### 11 | # 12 | # Copyright (c) 2013 Notos (https://github.com/Notos/) & dannyti (https://github.com/dannyti/) 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | # 20 | # --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 21 | # 22 | ###################################################################### 23 | # 24 | # git clone -b master https://github.com/Notos/seedbox-from-scratch.git /etc/seedbox-from-scratch 25 | # sudo git stash; sudo git pull 26 | # 27 | apt-get --yes install lsb-release 28 | SBFSCURRENTVERSION1=14.06 29 | OS1=$(lsb_release -si) 30 | OSV1=$(lsb_release -rs) 31 | OSV11=$(sed 's/\..*//' /etc/debian_version) 32 | logfile="/dev/null" 33 | # 34 | # Changelog 35 | # Version 14.06 (By dannyti) 36 | # Jan 16 2015 37 | # - RTorrent 0.9.4 supported 38 | # - Openvpn Fixed and Working 39 | # - Autodl tracker list correctly populated 40 | # - Diskspace fixed for multiuser environment 41 | # - Added http Data Download directory for users ; Can be accessed at http://Server-IP/private/Downloads ; Only http:// 42 | # - Sitewide https only 43 | # - User Login info can be accessed individually at http://Server-IP/private/SBinfo.txt 44 | # - Mediainfo fixed ; installtion from source 45 | # - Jquery Error corrected 46 | # - Crontab entries made for checking rtorrrent is running and starting it if not running 47 | # - Plowshare Fixed 48 | # - Deprecated seedboxInfo.php 49 | # 50 | # Version 2.1.9 (not stable yet) 51 | # Dec 26 2012 17:37 GMT-3 52 | # - RTorrent 0.9.3 support (optionally installed) 53 | # - New installRTorrent script: move to RTorrent 0.9.3 or back to 0.9.2 at any time 54 | # - Deluge v1.3.6 multi-user installation script (it will install the last stable version): installDeluge 55 | # - Optionally install Deluge when you first install your seedbox-from-scratch box 56 | # 57 | # Version 2.1.8 (stable) 58 | # - Bug fix release 59 | # 60 | # Version 2.1.4 (stable) 61 | # Dec 11 2012 2:34 GMT-3 62 | # - Debian 6 (Squeeze) Compatibile 63 | # - Check if user root is running the script 64 | # - vsftpd - FTP access with SSL (AUTH SSL - Explicit) 65 | # - vsftpd downgraded on Ubuntu to 2.3.2 (oneiric) 66 | # - iptables tweaked to make OpenVPN work as it should both on Ubuntu and Debian 67 | # - SABnzbd is now being installed from sources and works better 68 | # - New script: changeUserPassword --- example: changeUserPassword notos 133t rutorrent 69 | # - restartSeedbox now kill processes even if there are users attached on screens 70 | # - Installs rar, unrar and zip separately from main installations to prevent script from breaking on bad sources from non-OVH providers 71 | # 72 | # Version 2.1.2 (stable) 73 | # Nov 16 2012 20:48 GMT-3 74 | # - new upgradeSeedbox script (to download git files for a new version, it will not really upgrade it, at least for now :) 75 | # - ruTorrent fileshare Plugin (http://forums.rutorrent.org/index.php?topic=705.0) 76 | # - rapidleech (http://www.rapidleech.com/ - http://www.rapidleech.com/index.php?showtopic=2226|Go ** tutorial: http://www.seedm8.com/members/knowledgebase/24/Installing-Rapidleech-on-your-Seedbox.html 77 | # 78 | # Version 2.1.1 (stable) 79 | # Nov 12 2012 20:15 80 | # - OpenVPN was not working as expected (fixed) 81 | # - OpenVPN port now is configurable (at main install) and you can change it anytime before reinstalling: /etc/seedbox-from-scratch/openvpn.info 82 | # 83 | # Version 2.1.0 (not stable yet) 84 | # Nov 11 2012 20:15 85 | # - sabnzbd: http://wiki.sabnzbd.org/install-ubuntu-repo 86 | # - restartSeedbox script for each user 87 | # - User info files in /etc/seedbox-from-scratch/users 88 | # - Info about all users in https://hostname.tld/seedboxInfo.php 89 | # - Password protected webserver Document Root (/var/www/) 90 | # 91 | # Version 2.0.0 (stable) 92 | # Oct 31 2012 23:59 93 | # - chroot jail for users, using JailKit (http://olivier.sessink.nl/jailkit/) 94 | # - Fail2ban for ssh and apache - it bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. 95 | # - OpenVPN (after install you can download your key from http:///rutorrent/vpn.zip) 96 | # - createSeedboxUser script now asks if you want your user jailed, to have SSH access and if it should be added to sudoers 97 | # - Optionally install packages JailKit, Webmin, Fail2ban and OpenVPN 98 | # - Choose between RTorrent 0.8.9 and 0.9.2 (and their respective libtorrent libraries) 99 | # - Upgrade and downgrade RTorrent at any time 100 | # - Full automated install, now you just have to download script and run it in your box: 101 | # > wget -N https://raw.github.com/Notos/seedbox-from-scratch/v2.x.x/seedbox-from-scratch.sh 102 | # > time bash ~/seedbox-from-scratch.sh 103 | # - Due to a recent outage of Webmin site and SourceForge's svn repositories, some packages are now in git and will not be downloaded from those sites 104 | # - Updated list of trackers in Autodl-irssi 105 | # - vsftpd FTP Server (working in chroot jail) 106 | # - New ruTorrent default theme: Oblivion 107 | # 108 | # Version 1.30 109 | # Oct 23 2012 04:54:29 110 | # - Scripts now accept a full install without having to create variables and do anything else 111 | # 112 | # Version 1.20 113 | # Oct 19 2012 03:24 (by Notos) 114 | # - Install OpenVPN - (BETA) Still not in the script, just an outside script 115 | # Tested client: http://openvpn.net/index.php?option=com_content&id=357 116 | # 117 | # Version 1.11 118 | # Oct 18 2012 05:13 (by Notos) 119 | # - Added scripts to downgrade and upgrade RTorrent 120 | # 121 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 122 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 123 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 124 | # 125 | # Version 1.10 126 | # 06/10/2012 14:18 (by Notos) 127 | # - Added Fileupload plugin 128 | # 129 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 130 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 131 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 132 | # 133 | # Version 1.00 134 | # 30/09/2012 14:18 (by Notos) 135 | # - Changing some file names and depoying version 1.00 136 | # 137 | # Version 0.99b 138 | # 27/09/2012 19:39 (by Notos) 139 | # - Quota for users 140 | # - Download dir inside user home 141 | # 142 | # Version 0.99a 143 | # 27/09/2012 19:39 (by Notos) 144 | # - Quota for users 145 | # - Download dir inside user home 146 | # 147 | # Version 0.92a 148 | # 28/08/2012 19:39 (by Notos) 149 | # - Also working on Debian now 150 | # 151 | # Version 0.91a 152 | # 24/08/2012 19:39 (by Notos) 153 | # - First multi-user version sent to public 154 | # 155 | # Version 0.90a 156 | # 22/08/2012 19:39 (by Notos) 157 | # - Working version for OVH Kimsufi 2G Server - Ubuntu Based 158 | # 159 | # Version 0.89a 160 | # 17/08/2012 19:39 (by Notos) 161 | # 162 | function getString 163 | { 164 | local ISPASSWORD=$1 165 | local LABEL=$2 166 | local RETURN=$3 167 | local DEFAULT=$4 168 | local NEWVAR1=a 169 | local NEWVAR2=b 170 | local YESYES=YESyes 171 | local NONO=NOno 172 | local YESNO=$YESYES$NONO 173 | 174 | while [ ! $NEWVAR1 = $NEWVAR2 ] || [ -z "$NEWVAR1" ]; 175 | do 176 | clear 177 | echo "#" 178 | echo "#" 179 | echo "# The Seedbox From Scratch Script" 180 | echo "# By Notos ---> https://github.com/Notos/" 181 | echo "# Modified by dannyti ---> https://github.com/dannyti/" 182 | echo "#" 183 | echo "#" 184 | echo 185 | 186 | if [ "$ISPASSWORD" == "YES" ]; then 187 | read -s -p "$DEFAULT" -p "$LABEL" NEWVAR1 188 | else 189 | read -e -i "$DEFAULT" -p "$LABEL" NEWVAR1 190 | fi 191 | if [ -z "$NEWVAR1" ]; then 192 | NEWVAR1=a 193 | continue 194 | fi 195 | 196 | if [ ! -z "$DEFAULT" ]; then 197 | if grep -q "$DEFAULT" <<< "$YESNO"; then 198 | if grep -q "$NEWVAR1" <<< "$YESNO"; then 199 | if grep -q "$NEWVAR1" <<< "$YESYES"; then 200 | NEWVAR1=YES 201 | else 202 | NEWVAR1=NO 203 | fi 204 | else 205 | NEWVAR1=a 206 | fi 207 | fi 208 | fi 209 | 210 | if [ "$NEWVAR1" == "$DEFAULT" ]; then 211 | NEWVAR2=$NEWVAR1 212 | else 213 | if [ "$ISPASSWORD" == "YES" ]; then 214 | echo 215 | read -s -p "Retype: " NEWVAR2 216 | else 217 | read -p "Retype: " NEWVAR2 218 | fi 219 | if [ -z "$NEWVAR2" ]; then 220 | NEWVAR2=b 221 | continue 222 | fi 223 | fi 224 | 225 | 226 | if [ ! -z "$DEFAULT" ]; then 227 | if grep -q "$DEFAULT" <<< "$YESNO"; then 228 | if grep -q "$NEWVAR2" <<< "$YESNO"; then 229 | if grep -q "$NEWVAR2" <<< "$YESYES"; then 230 | NEWVAR2=YES 231 | else 232 | NEWVAR2=NO 233 | fi 234 | else 235 | NEWVAR2=a 236 | fi 237 | fi 238 | fi 239 | echo "---> $NEWVAR2" 240 | 241 | done 242 | eval $RETURN=\$NEWVAR1 243 | } 244 | # 0. 245 | 246 | if [[ $EUID -ne 0 ]]; then 247 | echo "This script must be run as root" 1>&2 248 | exit 1 249 | fi 250 | 251 | export DEBIAN_FRONTEND=noninteractive 252 | 253 | clear 254 | 255 | # 1. 256 | 257 | #localhost is ok this rtorrent/rutorrent installation 258 | IPADDRESS1=`ifconfig | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' | grep -v 127 | head -n 1` 259 | CHROOTJAIL1=NO 260 | 261 | #those passwords will be changed in the next steps 262 | PASSWORD1=a 263 | PASSWORD2=b 264 | 265 | getString NO "You need to create an user for your seedbox: " NEWUSER1 266 | getString YES "Password for user $NEWUSER1: " PASSWORD1 267 | getString NO "IP address of your box: " IPADDRESS1 $IPADDRESS1 268 | getString NO "SSH port: " NEWSSHPORT1 21976 269 | getString NO "vsftp port (usually 21): " NEWFTPPORT1 21201 270 | getString NO "OpenVPN port: " OPENVPNPORT1 31195 271 | #getString NO "Do you want to have some of your users in a chroot jail? " CHROOTJAIL1 YES 272 | getString NO "Install Webmin? " INSTALLWEBMIN1 YES 273 | getString NO "Install Fail2ban? " INSTALLFAIL2BAN1 YES 274 | getString NO "Install OpenVPN? " INSTALLOPENVPN1 NO 275 | getString NO "Install SABnzbd? " INSTALLSABNZBD1 NO 276 | getString NO "Install Rapidleech? " INSTALLRAPIDLEECH1 NO 277 | getString NO "Install Deluge? " INSTALLDELUGE1 NO 278 | getString NO "Wich RTorrent version would you like to install, '0.9.3' or '0.9.4' or '0.9.6'? " RTORRENT1 0.9.6 279 | 280 | if [ "$RTORRENT1" != "0.9.3" ] && [ "$RTORRENT1" != "0.9.6" ] && [ "$RTORRENT1" != "0.9.4" ]; then 281 | echo "$RTORRENT1 typed is not 0.9.6 or 0.9.4 or 0.9.3!" 282 | exit 1 283 | fi 284 | 285 | if [ "$OSV1" = "14.04" ]; then 286 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 >> $logfile 2>&1 287 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >> $logfile 2>&1 288 | fi 289 | echo -e "\033[0;32;148m18 Minutes to go... .. .\033[39m" 290 | 291 | apt-get --yes update >> $logfile 2>&1 292 | apt-get --yes install whois sudo makepasswd nano >> $logfile 2>&1 293 | apt-get --yes install git >> $logfile 2>&1 294 | 295 | echo -e "\033[0;32;148m.............\033[39m" 296 | rm -f -r /etc/seedbox-from-scratch >> $logfile 2>&1 297 | git clone -b v$SBFSCURRENTVERSION1 https://github.com/dannyti/seedbox-from-scratch.git /etc/seedbox-from-scratch >> $logfile 2>&1 298 | mkdir -p cd /etc/seedbox-from-scratch/source 299 | mkdir -p cd /etc/seedbox-from-scratch/users 300 | echo -e "\033[0;32;148mWork in progress.........\033[39m" 301 | 302 | if [ ! -f /etc/seedbox-from-scratch/seedbox-from-scratch.sh ]; then 303 | echo "" 304 | echo Looks like something is wrong, this script was not able to download its whole git repository. 305 | echo "git could not be installed :/ " 306 | echo "Do : apt-get update && apt-get --yes install git " 307 | echo " Then run script again. " 308 | exit 1 309 | fi 310 | 311 | # 3.1 312 | 313 | #show all commands 314 | #set -x verbose 315 | # 4. 316 | perl -pi -e "s/Port 22/Port $NEWSSHPORT1/g" /etc/ssh/sshd_config 317 | perl -pi -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config 318 | perl -pi -e "s/#Protocol 2/Protocol 2/g" /etc/ssh/sshd_config 319 | perl -pi -e "s/X11Forwarding yes/X11Forwarding no/g" /etc/ssh/sshd_config 320 | 321 | groupadd sshdusers 322 | groupadd sftponly 323 | echo -e "\033[0;32;148mPlease Standby................\033[39m" 324 | mkdir -p /usr/share/terminfo/l/ 325 | cp /lib/terminfo/l/linux /usr/share/terminfo/l/ 326 | #echo '/usr/lib/openssh/sftp-server' >> /etc/shells 327 | #if [ "$OS1" = "Ubuntu" ]; then 328 | echo "" | tee -a /etc/ssh/sshd_config > /dev/null 329 | echo "UseDNS no" | tee -a /etc/ssh/sshd_config > /dev/null 330 | echo "AllowGroups sshdusers root" >> /etc/ssh/sshd_config 331 | echo "Match Group sftponly" >> /etc/ssh/sshd_config 332 | echo "ChrootDirectory %h" >> /etc/ssh/sshd_config 333 | echo "ForceCommand internal-sftp" >> /etc/ssh/sshd_config 334 | echo "AllowTcpForwarding no" >> /etc/ssh/sshd_config 335 | #fi 336 | 337 | service ssh reload >> $logfile 2>&1 338 | 339 | # 6. 340 | #remove cdrom from apt so it doesn't stop asking for it 341 | perl -pi -e "s/deb cdrom/#deb cdrom/g" /etc/apt/sources.list 342 | perl -pi.orig -e 's/^(deb .* universe)$/$1 multiverse/' /etc/apt/sources.list 343 | #add non-free sources to Debian Squeeze# those two spaces below are on purpose 344 | perl -pi -e "s/squeeze main/squeeze main contrib non-free/g" /etc/apt/sources.list 345 | perl -pi -e "s/squeeze-updates main/squeeze-updates main contrib non-free/g" /etc/apt/sources.list 346 | echo -e "\033[0;32;148mI am installing random stuff, Do you like coffee ?\033[39m" 347 | #apt-get --yes install python-software-properties 348 | #Adding debian pkgs for adding repo and installing ffmpeg 349 | apt-get --yes install software-properties-common >> $logfile 2>&1 350 | if [ "$OSV11" = "8" ]; then 351 | apt-add-repository --yes "deb http://www.deb-multimedia.org jessie main non-free" >> $logfile 2>&1 352 | apt-get update >> $logfile 2>&1 353 | apt-get --force-yes --yes install ffmpeg >> $logfile 2>&1 354 | fi 355 | 356 | echo -e "\033[0;32;148m.....\033[39m" 357 | # 7. 358 | # update and upgrade packages 359 | apt-get --yes install python-software-properties software-properties-common >> $logfile 2>&1 360 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV1" = "14.10" ]; then 361 | apt-add-repository --yes ppa:kirillshkrogalev/ffmpeg-next >> $logfile 2>&1 362 | fi 363 | apt-get --yes update >> $logfile 2>&1 364 | apt-get --yes upgrade >> $logfile 2>&1 365 | # 8. 366 | #install all needed packages 367 | apt-get --yes install apache2 apache2-utils autoconf build-essential ca-certificates comerr-dev curl cfv quota mktorrent dtach htop irssi libapache2-mod-php5 libcloog-ppl-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev openvpn libssl-dev libtool libxml2-dev ncurses-base ncurses-term ntp openssl patch libc-ares-dev pkg-config php5 php5-cli php5-dev php5-curl php5-geoip php5-mcrypt php5-gd php5-xmlrpc pkg-config python-scgi ssl-cert subversion texinfo unzip zlib1g-dev expect flex bison debhelper binutils-gold libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libxml-libxml-perl libjson-rpc-perl libarchive-zip-perl tcpdump >> $logfile 2>&1 368 | if [ $? -gt 0 ]; then 369 | echo 370 | echo 371 | echo *** ERROR *** 372 | echo 373 | echo "Looks like something is wrong with apt-get install, aborting." 374 | echo 375 | exit 1 376 | fi 377 | apt-get install screen >> $logfile 2>&1 378 | apt-get --yes install zip >> $logfile 2>&1 379 | 380 | apt-get --yes install ffmpeg >> $logfile 2>&1 381 | apt-get --yes install automake1.9 >> $logfile 2>&1 382 | 383 | apt-get --force-yes --yes install rar >> $logfile 2>&1 384 | if [ $? -gt 0 ]; then 385 | apt-get --yes install rar-free >> $logfile 2>&1 386 | fi 387 | 388 | #apt-get --yes install unrar 389 | #if [ $? -gt 0 ]; then 390 | # apt-get --yes install unrar-free 391 | #fi 392 | #if [ "$OSV11" = "8" ]; then 393 | # apt-get --yes install unrar-free >> $logfile 2>&1 394 | #fi 395 | 396 | apt-get --yes install dnsutils >> $logfile 2>&1 397 | 398 | if [ "$CHROOTJAIL1" = "YES" ]; then 399 | cd /etc/seedbox-from-scratch 400 | tar xvfz jailkit-2.15.tar.gz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 401 | cd source/jailkit-2.15 402 | ./debian/rules binary 403 | cd .. 404 | dpkg -i jailkit_2.15-1_*.deb >> $logfile 2>&1 405 | cp /etc/jailkit/jk_init.ini /etc/jailkit/jk_init.ini.original 406 | echo "" | tee -a /etc/jailkit/jk_init.ini >> /dev/null 407 | bash /etc/seedbox-from-scratch/updatejkinit >> $logfile 2>&1 408 | fi 409 | 410 | echo -e "\033[0;32;148mGo make coffee......\033[39m" 411 | # 8.1 additional packages for Ubuntu 412 | # this is better to be apart from the others 413 | apt-get --yes install php5-fpm >> $logfile 2>&1 414 | apt-get --yes install php5-xcache libxml2-dev >> $logfile 2>&1 415 | 416 | if [ "$OSV1" = "13.10" ]; then 417 | apt-get install php5-json 418 | fi 419 | 420 | #Check if its Debian and do a sysvinit by upstart replacement: 421 | #Commented the follwoing three lines for testing 422 | #if [ "$OS1" = "Debian" ]; then 423 | # echo 'Yes, do as I say!' | apt-get -y --force-yes install upstart 424 | #fi 425 | 426 | # 8.3 Generate our lists of ports and RPC and create variables 427 | 428 | #permanently adding scripts to PATH to all users and root 429 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /etc/profile > /dev/null 430 | echo "export PATH" | tee -a /etc/profile > /dev/null 431 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /root/.bashrc > /dev/null 432 | echo "export PATH" | tee -a /root/.bashrc > /dev/null 433 | 434 | rm -f /etc/seedbox-from-scratch/ports.txt 435 | for i in $(seq 51101 51999) 436 | do 437 | echo "$i" | tee -a /etc/seedbox-from-scratch/ports.txt > /dev/null 438 | done 439 | 440 | rm -f /etc/seedbox-from-scratch/rpc.txt 441 | for i in $(seq 2 1000) 442 | do 443 | echo "RPC$i" | tee -a /etc/seedbox-from-scratch/rpc.txt > /dev/null 444 | done 445 | 446 | # 8.4 447 | 448 | if [ "$INSTALLWEBMIN1" = "YES" ]; then 449 | #if webmin isup, download key 450 | WEBMINDOWN=YES 451 | ping -c1 -w2 www.webmin.com > /dev/null 452 | if [ $? = 0 ] ; then 453 | wget -t 5 http://www.webmin.com/jcameron-key.asc >> $logfile 2>&1 454 | apt-key add jcameron-key.asc >> $logfile 2>&1 455 | if [ $? = 0 ] ; then 456 | WEBMINDOWN=NO 457 | fi 458 | fi 459 | 460 | if [ "$WEBMINDOWN"="NO" ] ; then 461 | #add webmin source 462 | echo "" | tee -a /etc/apt/sources.list > /dev/null 463 | echo "deb http://download.webmin.com/download/repository sarge contrib" | tee -a /etc/apt/sources.list > /dev/null 464 | cd /tmp 465 | fi 466 | 467 | if [ "$WEBMINDOWN" = "NO" ]; then 468 | apt-get --yes update >> $logfile 2>&1 469 | apt-get --yes install webmin >> $logfile 2>&1 470 | fi 471 | fi 472 | 473 | echo -e "\033[0;32;148m.........\033[39m" 474 | # 9. 475 | a2enmod ssl >> $logfile 2>&1 476 | a2enmod auth_digest >> $logfile 2>&1 477 | a2enmod reqtimeout >> $logfile 2>&1 478 | a2enmod rewrite >> $logfile 2>&1 479 | #a2enmod scgi ############### if we cant make python-scgi works 480 | #cd /etc/apache2 481 | #rm apache2.conf 482 | #wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/apache2.conf 483 | cat /etc/seedbox-from-scratch/add2apache2.conf >> /etc/apache2/apache2.conf 484 | # 10. 485 | 486 | #remove timeout if there are any 487 | perl -pi -e "s/^Timeout [0-9]*$//g" /etc/apache2/apache2.conf 488 | 489 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 490 | echo "#seedbox values" | tee -a /etc/apache2/apache2.conf > /dev/null 491 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 492 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 493 | echo "ServerSignature Off" | tee -a /etc/apache2/apache2.conf > /dev/null 494 | echo "ServerTokens Prod" | tee -a /etc/apache2/apache2.conf > /dev/null 495 | echo "Timeout 30" | tee -a /etc/apache2/apache2.conf > /dev/null 496 | cd /etc/apache2 497 | rm ports.conf 498 | wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/ports.conf >> $logfile 2>&1 499 | service apache2 restart 500 | mkdir /etc/apache2/auth.users 501 | 502 | echo "$IPADDRESS1" > /etc/seedbox-from-scratch/hostname.info 503 | 504 | # 11. 505 | makepasswd | tee -a /etc/seedbox-from-scratch/sslca.info > /dev/null 506 | export TEMPHOSTNAME1=tsfsSeedBox 507 | export CERTPASS1=@@$TEMPHOSTNAME1.$NEWUSER1.ServerP7s$ 508 | export NEWUSER1 509 | export IPADDRESS1 510 | 511 | echo "$NEWUSER1" > /etc/seedbox-from-scratch/mainuser.info 512 | echo "$CERTPASS1" > /etc/seedbox-from-scratch/certpass.info 513 | 514 | bash /etc/seedbox-from-scratch/createOpenSSLCACertificate >> $logfile 2>&1 515 | 516 | mkdir -p /etc/ssl/private/ 517 | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -config /etc/seedbox-from-scratch/ssl/CA/caconfig.cnf >> $logfile 2>&1 518 | 519 | if [ "$OSV11" = "7" ]; then 520 | echo "deb http://ftp.cyconet.org/debian wheezy-updates main non-free contrib" >> /etc/apt/sources.list.d/wheezy-updates.cyconet.list 521 | apt-get update >> $logfile 2>&1 522 | apt-get install -y --force-yes -t wheezy-updates debian-cyconet-archive-keyring vsftpd libxml2-dev libcurl4-gnutls-dev subversion >> $logfile 2>&1 523 | elif [ "$OSV1" = "12.04" ]; then 524 | add-apt-repository -y ppa:thefrontiergroup/vsftpd 525 | apt-get update >> $logfile 2>&1 526 | apt-get -y install vsftpd >> $logfile 2>&1 527 | else 528 | apt-get -y install vsftpd >> $logfile 2>&1 529 | fi 530 | 531 | 532 | #if [ "$OSV1" = "12.04" ]; then 533 | # dpkg -i /etc/seedbox-from-scratch/vsftpd_2.3.2-3ubuntu5.1_`uname -m`.deb 534 | #fi 535 | 536 | perl -pi -e "s/anonymous_enable\=YES/\#anonymous_enable\=YES/g" /etc/vsftpd.conf 537 | perl -pi -e "s/connect_from_port_20\=YES/#connect_from_port_20\=YES/g" /etc/vsftpd.conf 538 | perl -pi -e 's/rsa_private_key_file/#rsa_private_key_file/' /etc/vsftpd.conf 539 | perl -pi -e 's/rsa_cert_file/#rsa_cert_file/' /etc/vsftpd.conf 540 | #perl -pi -e "s/rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/g" /etc/vsftpd.conf 541 | #perl -pi -e "s/rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/g" /etc/vsftpd.conf 542 | echo "listen_port=$NEWFTPPORT1" | tee -a /etc/vsftpd.conf >> /dev/null 543 | echo "ssl_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 544 | echo "allow_anon_ssl=YES" | tee -a /etc/vsftpd.conf >> /dev/null 545 | echo "force_local_data_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 546 | echo "force_local_logins_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 547 | echo "ssl_tlsv1=YES" | tee -a /etc/vsftpd.conf >> /dev/null 548 | echo "ssl_sslv2=NO" | tee -a /etc/vsftpd.conf >> /dev/null 549 | echo "ssl_sslv3=NO" | tee -a /etc/vsftpd.conf >> /dev/null 550 | echo "require_ssl_reuse=NO" | tee -a /etc/vsftpd.conf >> /dev/null 551 | echo "ssl_ciphers=HIGH" | tee -a /etc/vsftpd.conf >> /dev/null 552 | echo "rsa_cert_file=/etc/ssl/private/vsftpd.pem" | tee -a /etc/vsftpd.conf >> /dev/null 553 | echo "local_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 554 | echo "write_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 555 | echo "local_umask=022" | tee -a /etc/vsftpd.conf >> /dev/null 556 | echo "chroot_local_user=YES" | tee -a /etc/vsftpd.conf >> /dev/null 557 | echo "chroot_list_file=/etc/vsftpd.chroot_list" | tee -a /etc/vsftpd.conf >> /dev/null 558 | echo "passwd_chroot_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 559 | echo "allow_writeable_chroot=YES" | tee -a /etc/vsftpd.conf >> /dev/null ## Had to remove since patched applied by vsftpd devs 560 | #echo "seccomp_sandbox=NO" | tee -a /etc/vsftpd.conf >> /dev/null ## Had to remove since patched applied by vsftpd devs 561 | #echo "dual_log_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 562 | #echo "syslog_enable=NO" | tee -a /etc/vsftpd.conf >> /dev/null 563 | #sed -i '147 d' /etc/vsftpd.conf 564 | #sed -i '149 d' /etc/vsftpd.conf 565 | touch /var/log/vsftpd.log 566 | 567 | apt-get install --yes subversion >> $logfile 2>&1 568 | apt-get install --yes dialog >> $logfile 2>&1 569 | # 13. 570 | 571 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "14.10" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV11" = "8" ]; then 572 | cp /var/www/html/index.html /var/www/index.html 573 | mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.ORI 574 | rm -f /etc/apache2/sites-available/000-default.conf 575 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/000-default.conf 576 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/000-default.conf 577 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/000-default.conf 578 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/000-default.conf 579 | else 580 | mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 581 | rm -f /etc/apache2/sites-available/default 582 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 583 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 584 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 585 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 586 | fi 587 | #mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 588 | #rm -f /etc/apache2/sites-available/default 589 | #cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 590 | #perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 591 | #perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 592 | #perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 593 | 594 | echo "ServerName $IPADDRESS1" | tee -a /etc/apache2/apache2.conf > /dev/null 595 | echo -e "\033[0;32;148mHow was the coffee ?\033[39m" 596 | # 14. 597 | a2ensite default-ssl >> $logfile 2>&1 598 | #ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load 599 | #service apache2 restart 600 | #apt-get --yes install libxmlrpc-core-c3-dev 601 | 602 | #14.1 Download xmlrpc, rtorrent & libtorrent for 0.9.4 603 | #cd 604 | #svn co https://svn.code.sf.net/p/xmlrpc-c/code/stable /etc/seedbox-from-scratch/source/xmlrpc 605 | cd /etc/seedbox-from-scratch/ 606 | #wget -c http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.4.tar.gz 607 | #wget -c http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.4.tar.gz 608 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.4.tar.gz >> $logfile 2>&1 609 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.4.tar.gz >> $logfile 2>&1 610 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz >> $logfile 2>&1 611 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz >> $logfile 2>&1 612 | 613 | #configure & make xmlrpc BASED ON RTORRENT VERSION 614 | if [ "$RTORRENT1" = "0.9.4" ] || [ "$RTORRENT1" = "0.9.6" ]; then 615 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.33.17.tgz -C /etc/seedbox-from-scratch/ >> $logfile 2>&1 616 | cd /etc/seedbox-from-scratch/xmlrpc-c-1.33.17 617 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 618 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 619 | make install >> $logfile 2>&1 620 | else 621 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.16.42.tgz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 622 | cd /etc/seedbox-from-scratch/source/ 623 | unzip ../xmlrpc-c-1.31.06.zip >> $logfile 2>&1 624 | cd xmlrpc-c-1.31.06 625 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 626 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 627 | make install >> $logfile 2>&1 628 | fi 629 | # 15. 630 | 631 | 632 | # 16. 633 | #cd xmlrpc-c-1.16.42 ### old, but stable, version, needs a missing old types.h file 634 | #ln -s /usr/include/curl/curl.h /usr/include/curl/types.h 635 | 636 | 637 | # 21. 638 | echo -e "\033[0;32;148mDo not give up on me.........Still Working....\033[39m" 639 | bash /etc/seedbox-from-scratch/installRTorrent $RTORRENT1 >> $logfile 2>&1 640 | 641 | ######### Below this /var/www/rutorrent/ has been replaced with /var/www/rutorrent for Ubuntu 14.04 642 | echo -e "\033[0;32;148mNo kidding.... Did you make coffee ?\033[39m" 643 | # 22. 644 | cd /var/www/ 645 | rm -f -r rutorrent 646 | svn checkout https://github.com/Novik/ruTorrent/trunk rutorrent >> $logfile 2>&1 647 | #svn checkout http://rutorrent.googlecode.com/svn/trunk/plugins 648 | #rm -r -f rutorrent/plugins 649 | #mv plugins rutorrent/ 650 | 651 | cp /etc/seedbox-from-scratch/action.php.template /var/www/rutorrent/plugins/diskspace/action.php 652 | 653 | groupadd admin 654 | 655 | echo "www-data ALL=(root) NOPASSWD: /usr/sbin/repquota" | tee -a /etc/sudoers > /dev/null 656 | 657 | cp /etc/seedbox-from-scratch/favicon.ico /var/www/ 658 | 659 | # 26. Installing Mediainfo from source 660 | apt-get install --yes mediainfo >> $logfile 2>&1 661 | if [ $? -gt 0 ]; then 662 | cd /tmp 663 | wget http://downloads.sourceforge.net/mediainfo/MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 664 | tar jxvf MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 665 | cd MediaInfo_CLI_GNU_FromSource/ 666 | sh CLI_Compile.sh >> $logfile 2>&1 667 | cd MediaInfo/Project/GNU/CLI 668 | make install >> $logfile 2>&1 669 | fi 670 | 671 | cd /var/www/rutorrent/js/ 672 | git clone https://github.com/gabceb/jquery-browser-plugin.git >> $logfile 2>&1 673 | mv jquery-browser-plugin/dist/jquery.browser.js . 674 | rm -r -f jquery-browser-plugin 675 | sed -i '31i\ ' /var/www/rutorrent/index.html 676 | 677 | cd /var/www/rutorrent/plugins 678 | git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi >> $logfile 2>&1 679 | #cp autodl-irssi/_conf.php autodl-irssi/conf.php 680 | #svn co https://svn.code.sf.net/p/autodl-irssi/code/trunk/rutorrent/autodl-irssi/ 681 | cd autodl-irssi 682 | 683 | 684 | # 30. 685 | 686 | 687 | # 31. ZNC 688 | #Have put this in script form 689 | 690 | # 32. Installing poweroff button on ruTorrent 691 | cd /var/www/rutorrent/plugins/ 692 | wget http://rutorrent-logoff.googlecode.com/files/logoff-1.0.tar.gz >> $logfile 2>&1 693 | tar -zxf logoff-1.0.tar.gz >> $logfile 2>&1 694 | rm -f logoff-1.0.tar.gz 695 | 696 | if [ "$INSTALLFAIL2BAN1" = "YES" ]; then 697 | apt-get --yes install fail2ban >> $logfile 2>&1 698 | if [ "$OS1" = "Ubuntu" ]; then 699 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 700 | cp /etc/seedbox-from-scratch/ubu.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 701 | elif [ "$OS1" = "Debian" ]; then 702 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 703 | cp /etc/seedbox-from-scratch/deb.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 704 | fi 705 | fail2ban-client reload >> $logfile 2>&1 706 | fi 707 | 708 | #33. Tuning Part - Let me know if you find more. 709 | echo "vm.swappiness=1" >>/etc/sysctl.conf 710 | echo "net.core.somaxconn = 1024" >>/etc/sysctl.conf 711 | echo "net.core.netdev_max_backlog = 50000" >>/etc/sysctl.conf 712 | echo "net.ipv4.tcp_max_tw_buckets = 2000000" >>/etc/sysctl.conf 713 | echo "net.core.rmem_max = 25165824" >>/etc/sysctl.conf 714 | echo "net.core.wmem_max = 25165824" >>/etc/sysctl.conf 715 | echo "net.core.rmem_default = 25165824" >>/etc/sysctl.conf 716 | echo "net.core.wmem_default = 25165824" >>/etc/sysctl.conf 717 | echo "net.core.optmem_max = 25165824" >> /etc/sysctl.conf 718 | echo "net.ipv4.tcp_wmem = 20480 12582912 25165824" >>/etc/sysctl.conf 719 | echo "net.ipv4.tcp_rmem = 20480 12582912 25165824" >>/etc/sysctl.conf 720 | echo "net.ipv4.tcp_max_syn_backlog = 65536" >>/etc/sysctl.conf 721 | echo "net.ipv4.tcp_slow_start_after_idle = 0" >>/etc/sysctl.conf 722 | echo "net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf 723 | echo "net.ipv4.ip_local_port_range = 10240 65535" >>/etc/sysctl.conf 724 | echo "fs.file-max = 2097152" >>/etc/sysctl.conf 725 | echo "vm.min_free_kbytes = 1024" >> /etc/sysctl.conf 726 | echo "net.ipv4.tcp_rfc1337 = 1" >> /etc/sysctl.conf 727 | echo "net.ipv4.tcp_fin_timeout = 10" >> /etc/sysctl.conf 728 | echo "net.ipv4.udp_rmem_min = 8192" >> /etc/sysctl.conf 729 | echo "net.ipv4.udp_wmem_min = 8192" >> /etc/sysctl.conf 730 | echo "net.ipv4.conf.all.send_redirects = 0" >> /etc/sysctl.conf 731 | echo "net.ipv4.conf.all.accept_redirects = 0" >> /etc/sysctl.conf 732 | echo "net.ipv4.conf.all.accept_source_route = 0" >> /etc/sysctl.conf 733 | sysctl -p >> $logfile 2>&1 734 | 735 | echo "* soft nofile 500000" >>/etc/security/limits.conf 736 | echo "* hard nofile 500000" >>/etc/security/limits.conf 737 | echo "session required pam_limits.so" >>/etc/pam.d/common-session 738 | 739 | if [ -f /proc/user_beancounters ] || [ -d /proc/bc ] || [ -d /sys/bus/xen ] || [ -f /proc/vz/veinfo ] || [ -d /proc/vz/veinfo ]; then 740 | echo "Whoops, Its a VPS !!" 741 | else 742 | sed -i "s/defaults 1 1/defaults,noatime 0 0/" /etc/fstab 743 | fi 744 | 745 | # Installing Filemanager and MediaStream 746 | rm -f -R /var/www/rutorrent/plugins/filemanager >> $logfile 2>&1 747 | rm -f -R /var/www/rutorrent/plugins/fileupload >> $logfile 2>&1 748 | rm -f -R /var/www/rutorrent/plugins/mediastream >> $logfile 2>&1 749 | rm -f -R /var/www/stream >> $logfile 2>&1 750 | 751 | cd /var/www/rutorrent/plugins/ 752 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/mediastream >> $logfile 2>&1 753 | 754 | cd /var/www/rutorrent/plugins/ 755 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/filemanager >> $logfile 2>&1 756 | 757 | cp /etc/seedbox-from-scratch/rutorrent.plugins.filemanager.conf.php.template /var/www/rutorrent/plugins/filemanager/conf.php 758 | 759 | mkdir -p /var/www/stream/ 760 | ln -s /var/www/rutorrent/plugins/mediastream/view.php /var/www/stream/view.php 761 | chown www-data: /var/www/stream 762 | chown www-data: /var/www/stream/view.php 763 | 764 | echo "" | tee /var/www/rutorrent/plugins/mediastream/conf.php > /dev/null 765 | 766 | # 32.2 # FILEUPLOAD 767 | cd /var/www/rutorrent/plugins/ 768 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileupload >> $logfile 2>&1 769 | chmod 775 /var/www/rutorrent/plugins/fileupload/scripts/upload 770 | apt-get --yes -f install >> $logfile 2>&1 771 | rm /var/www/rutorrent/plugins/unpack/conf.php 772 | # 32.2 773 | chown -R www-data:www-data /var/www/rutorrent 774 | chmod -R 755 /var/www/rutorrent 775 | 776 | #32.3 777 | perl -pi -e "s/\\\$topDirectory\, \\\$fm/\\\$homeDirectory\, \\\$topDirectory\, \\\$fm/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 778 | perl -pi -e "s/\\\$this\-\>userdir \= addslash\(\\\$topDirectory\)\;/\\\$this\-\>userdir \= \\\$homeDirectory \? addslash\(\\\$homeDirectory\) \: addslash\(\\\$topDirectory\)\;/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 779 | perl -pi -e "s/\\\$topDirectory/\\\$homeDirectory/g" /var/www/rutorrent/plugins/filemanager/settings.js.php 780 | 781 | #32.4 782 | #unzip /etc/seedbox-from-scratch/rutorrent-oblivion.zip -d /var/www/rutorrent/plugins/ 783 | #echo "" | tee -a /var/www/rutorrent/css/style.css > /dev/null 784 | #echo "/* for Oblivion */" | tee -a /var/www/rutorrent/css/style.css > /dev/null 785 | #echo ".meter-value-start-color { background-color: #E05400 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 786 | #echo ".meter-value-end-color { background-color: #8FBC00 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 787 | #echo "::-webkit-scrollbar {width:12px;height:12px;padding:0px;margin:0px;}" | tee -a /var/www/rutorrent/css/style.css > /dev/null 788 | perl -pi -e "s/\$defaultTheme \= \"\"\;/\$defaultTheme \= \"Oblivion\"\;/g" /var/www/rutorrent/plugins/theme/conf.php 789 | git clone https://github.com/InAnimaTe/rutorrent-themes.git /var/www/rutorrent/plugins/theme/themes/Extra >> $logfile 2>&1 790 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/OblivionBlue /var/www/rutorrent/plugins/theme/themes/ 791 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/Agent46 /var/www/rutorrent/plugins/theme/themes/ 792 | rm -r /var/www/rutorrent/plugins/theme/themes/Extra 793 | #ln -s /etc/seedbox-from-scratch/seedboxInfo.php.template /var/www/seedboxInfo.php 794 | 795 | # 32.5 796 | cd /var/www/rutorrent/plugins/ 797 | rm -r /var/www/rutorrent/plugins/fileshare >> $logfile 2>&1 798 | rm -r /var/www/share >> $logfile 2>&1 799 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileshare >> $logfile 2>&1 800 | mkdir /var/www/share 801 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/share.php 802 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/index.php 803 | chown -R www-data:www-data /var/www/share 804 | cp /etc/seedbox-from-scratch/rutorrent.plugins.fileshare.conf.php.template /var/www/rutorrent/plugins/fileshare/conf.php 805 | perl -pi -e "s//$IPADDRESS1/g" /var/www/rutorrent/plugins/fileshare/conf.php 806 | 807 | mv /etc/seedbox-from-scratch/unpack.conf.php /var/www/rutorrent/plugins/unpack/conf.php 808 | 809 | # 33. 810 | echo -e "\033[0;32;148m.................\033[39m" 811 | bash /etc/seedbox-from-scratch/updateExecutables >> $logfile 2>&1 812 | 813 | #34. 814 | echo $SBFSCURRENTVERSION1 > /etc/seedbox-from-scratch/version.info 815 | echo $NEWFTPPORT1 > /etc/seedbox-from-scratch/ftp.info 816 | echo $NEWSSHPORT1 > /etc/seedbox-from-scratch/ssh.info 817 | echo $OPENVPNPORT1 > /etc/seedbox-from-scratch/openvpn.info 818 | 819 | # 36. 820 | wget -P /usr/share/ca-certificates/ --no-check-certificate https://certs.godaddy.com/repository/gd_intermediate.crt https://certs.godaddy.com/repository/gd_cross_intermediate.crt >> $logfile 2>&1 821 | update-ca-certificates >> $logfile 2>&1 822 | c_rehash >> $logfile 2>&1 823 | 824 | sleep 2 825 | 826 | # 96. 827 | if [ "$INSTALLOPENVPN1" = "YES" ]; then 828 | bash /etc/seedbox-from-scratch/installOpenVPN 829 | fi 830 | 831 | if [ "$INSTALLSABNZBD1" = "YES" ]; then 832 | bash /etc/seedbox-from-scratch/installSABnzbd 833 | fi 834 | 835 | if [ "$INSTALLRAPIDLEECH1" = "YES" ]; then 836 | bash /etc/seedbox-from-scratch/installRapidleech 837 | fi 838 | 839 | if [ "$INSTALLDELUGE1" = "YES" ]; then 840 | bash /etc/seedbox-from-scratch/installDeluge 841 | fi 842 | 843 | sleep 1 844 | 845 | # 97. First user will not be jailed 846 | echo -e "\033[0;32;148mLeave it now, About to Finish........\033[39m" 847 | # createSeedboxUser 848 | bash /etc/seedbox-from-scratch/createSeedboxUser $NEWUSER1 $PASSWORD1 YES YES YES NO >> $logfile 2>&1 849 | 850 | #Loadavg 851 | cd ~ 852 | git clone https://github.com/loadavg/loadavg.git >> $logfile 2>&1 853 | cd loadavg 854 | cd ~ 855 | mv loadavg /var/www/ 856 | cd /var/www/loadavg 857 | chmod 777 configure 858 | ./configure >> $logfile 2>&1 859 | 860 | cd /tmp 861 | wget https://rutorrent-tadd-labels.googlecode.com/files/lbll-suite_0.8.1.tar.gz >> $logfile 2>&1 862 | tar zxvf lbll-suite_0.8.1.tar.gz >> $logfile 2>&1 863 | sudo mv lbll-suite /var/www/rutorrent/plugins >> $logfile 2>&1 864 | 865 | cd ~ 866 | wget http://www.rarlab.com/rar/unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 867 | tar -xvf unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 868 | cd unrar 869 | sudo make -f makefile >> $logfile 2>&1 870 | sudo install -v -m755 unrar /usr/bin >> $logfile 2>&1 871 | cd .. 872 | rm -R unrar >> $logfile 2>&1 873 | rm unrarsrc-5.3.8.tar.gz 874 | 875 | sed -i 's/width: 380px; height: 290px/width: 380px; height: 330px/' /var/www/rutorrent/css/style.css 876 | 877 | cd ~ 878 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/m/m/magic/magic.zip >> $logfile 2>&1 879 | unzip magic.zip >> $logfile 2>&1 880 | mv default.sfx rarreg.key /usr/local/lib/ 881 | rm magic.zip 882 | 883 | cd /var/www 884 | chown -R www-data:www-data /var/www/rutorrent 885 | chown -R www-data:www-data /var/www/loadavg 886 | chmod -R 755 /var/www/rutorrent 887 | cd 888 | git clone https://github.com/mcrapet/plowshare.git plowshare >> $logfile 2>&1 889 | cd ~/plowshare 890 | make install >> $logfile 2>&1 891 | cd 892 | rm -r plowshare >> $logfile 2>&1 893 | 894 | export EDITOR=nano 895 | # 100 896 | cd /var/www/rutorrent/plugins 897 | sleep 1 898 | rm -frv diskspace >> $logfile 2>&1 899 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/main/b/base/hectortheone.rar >> $logfile 2>&1 900 | #wget http://dl.bintray.com/novik65/generi...ace-3.6.tar.gz 901 | #tar -xf diskspace-3.6.tar.gz 902 | unrar x hectortheone.rar >> $logfile 2>&1 903 | #rm diskspace-3.6.tar.gz 904 | rm hectortheone.rar 905 | cd quotaspace 906 | chmod 755 run.sh 907 | cd .. 908 | perl -pi -e "s/100/1024/g" /var/www/rutorrent/plugins/throttle/throttle.php 909 | #wget --no-check-certificate http://cheapseedboxes.com/trafic_check.rar >> $logfile 2>&1 910 | #unrar x trafic_check.rar >> $logfile 2>&1 911 | #rm trafic_check.rar 912 | #wget --no-check-certificate http://cheapseedboxes.com/plimits.rar >> $logfile 2>&1 913 | #unrar x plimits.rar >> $logfile 2>&1 914 | #rm plimits.rar 915 | #cd .. 916 | chown -R www-data:www-data /var/www/rutorrent 917 | echo -e "\033[0;32;148mFinishing Now .... .... .... ....\033[39m" 918 | 919 | if [ "$OSV11" = "8" ]; then 920 | systemctl enable apache2 >> $logfile 2>&1 921 | service apache2 start >> $logfile 2>&1 922 | fi 923 | #set +x verbose 924 | clear 925 | 926 | echo "" 927 | echo -e "\033[0;32;148m<<< The Seedbox From Scratch Script >>>\033[39m" 928 | echo -e "\033[0;32;148mScript Modified by dannyti ---> https://github.com/dannyti/\033[39m" 929 | echo "" 930 | echo "Looks like everything is set." 931 | echo "" 932 | echo "Remember that your SSH port is now ======> $NEWSSHPORT1 " 933 | echo "" 934 | echo "Your Login info can also be found at https://$IPADDRESS1/private/SBinfo.txt" 935 | echo "Download Data Directory is located at https://$IPADDRESS1/private " 936 | echo "To install ZNC, run installZNC from ssh as main user" 937 | echo "" 938 | echo "IMPORTANT NOTE: Refresh rutorrent for Throttle plugin to load properly" 939 | echo "" 940 | echo "System will reboot now, but don't close this window until you take note of the port number: $NEWSSHPORT1" 941 | echo "" 942 | echo -e "\033[0;32;148mPlease login as main user and only then close this Window\033[39m" 943 | 944 | reboot 945 | 946 | ##################### LAST LINE ########### 947 | -------------------------------------------------------------------------------- /sbfrmsc-dti.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Updated for $.broswer-msie error; will populate tracker list properly ; create check/start scripts; 4 | # create crontab entries. Rest is all perfect from Notos. Thanks. 5 | # 6 | # The Seedbox From Scratch Script 7 | # By Notos ---> https://github.com/Notos/ 8 | # Modified by dannyti ---> https://github.com/dannyti/ 9 | # 10 | ###################################################################### 11 | # 12 | # Copyright (c) 2013 Notos (https://github.com/Notos/) & dannyti (https://github.com/dannyti/) 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | # 20 | # --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 21 | # 22 | ###################################################################### 23 | # 24 | # git clone -b master https://github.com/Notos/seedbox-from-scratch.git /etc/seedbox-from-scratch 25 | # sudo git stash; sudo git pull 26 | # 27 | apt-get --yes install lsb-release >> $logfile 2>&1 28 | SBFSCURRENTVERSION1=14.06 29 | OS1=$(lsb_release -si) 30 | OSV1=$(lsb_release -rs) 31 | OSV11=$(sed 's/\..*//' /etc/debian_version) 32 | logfile="/dev/null" 33 | # 34 | # Changelog 35 | # Version 14.06 (By dannyti) 36 | # Jan 16 2015 37 | # - RTorrent 0.9.4 supported 38 | # - Openvpn Fixed and Working 39 | # - Autodl tracker list correctly populated 40 | # - Diskspace fixed for multiuser environment 41 | # - Added http Data Download directory for users ; Can be accessed at http://Server-IP/private/Downloads ; Only http:// 42 | # - Sitewide https only 43 | # - User Login info can be accessed individually at http://Server-IP/private/SBinfo.txt 44 | # - Mediainfo fixed ; installtion from source 45 | # - Jquery Error corrected 46 | # - Crontab entries made for checking rtorrrent is running and starting it if not running 47 | # - Plowshare Fixed 48 | # - Deprecated seedboxInfo.php 49 | # 50 | # Version 2.1.9 (not stable yet) 51 | # Dec 26 2012 17:37 GMT-3 52 | # - RTorrent 0.9.3 support (optionally installed) 53 | # - New installRTorrent script: move to RTorrent 0.9.3 or back to 0.9.2 at any time 54 | # - Deluge v1.3.6 multi-user installation script (it will install the last stable version): installDeluge 55 | # - Optionally install Deluge when you first install your seedbox-from-scratch box 56 | # 57 | # Version 2.1.8 (stable) 58 | # - Bug fix release 59 | # 60 | # Version 2.1.4 (stable) 61 | # Dec 11 2012 2:34 GMT-3 62 | # - Debian 6 (Squeeze) Compatibile 63 | # - Check if user root is running the script 64 | # - vsftpd - FTP access with SSL (AUTH SSL - Explicit) 65 | # - vsftpd downgraded on Ubuntu to 2.3.2 (oneiric) 66 | # - iptables tweaked to make OpenVPN work as it should both on Ubuntu and Debian 67 | # - SABnzbd is now being installed from sources and works better 68 | # - New script: changeUserPassword --- example: changeUserPassword notos 133t rutorrent 69 | # - restartSeedbox now kill processes even if there are users attached on screens 70 | # - Installs rar, unrar and zip separately from main installations to prevent script from breaking on bad sources from non-OVH providers 71 | # 72 | # Version 2.1.2 (stable) 73 | # Nov 16 2012 20:48 GMT-3 74 | # - new upgradeSeedbox script (to download git files for a new version, it will not really upgrade it, at least for now :) 75 | # - ruTorrent fileshare Plugin (http://forums.rutorrent.org/index.php?topic=705.0) 76 | # - rapidleech (http://www.rapidleech.com/ - http://www.rapidleech.com/index.php?showtopic=2226|Go ** tutorial: http://www.seedm8.com/members/knowledgebase/24/Installing-Rapidleech-on-your-Seedbox.html 77 | # 78 | # Version 2.1.1 (stable) 79 | # Nov 12 2012 20:15 80 | # - OpenVPN was not working as expected (fixed) 81 | # - OpenVPN port now is configurable (at main install) and you can change it anytime before reinstalling: /etc/seedbox-from-scratch/openvpn.info 82 | # 83 | # Version 2.1.0 (not stable yet) 84 | # Nov 11 2012 20:15 85 | # - sabnzbd: http://wiki.sabnzbd.org/install-ubuntu-repo 86 | # - restartSeedbox script for each user 87 | # - User info files in /etc/seedbox-from-scratch/users 88 | # - Info about all users in https://hostname.tld/seedboxInfo.php 89 | # - Password protected webserver Document Root (/var/www/) 90 | # 91 | # Version 2.0.0 (stable) 92 | # Oct 31 2012 23:59 93 | # - chroot jail for users, using JailKit (http://olivier.sessink.nl/jailkit/) 94 | # - Fail2ban for ssh and apache - it bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. 95 | # - OpenVPN (after install you can download your key from http:///rutorrent/vpn.zip) 96 | # - createSeedboxUser script now asks if you want your user jailed, to have SSH access and if it should be added to sudoers 97 | # - Optionally install packages JailKit, Webmin, Fail2ban and OpenVPN 98 | # - Choose between RTorrent 0.8.9 and 0.9.2 (and their respective libtorrent libraries) 99 | # - Upgrade and downgrade RTorrent at any time 100 | # - Full automated install, now you just have to download script and run it in your box: 101 | # > wget -N https://raw.github.com/Notos/seedbox-from-scratch/v2.x.x/seedbox-from-scratch.sh 102 | # > time bash ~/seedbox-from-scratch.sh 103 | # - Due to a recent outage of Webmin site and SourceForge's svn repositories, some packages are now in git and will not be downloaded from those sites 104 | # - Updated list of trackers in Autodl-irssi 105 | # - vsftpd FTP Server (working in chroot jail) 106 | # - New ruTorrent default theme: Oblivion 107 | # 108 | # Version 1.30 109 | # Oct 23 2012 04:54:29 110 | # - Scripts now accept a full install without having to create variables and do anything else 111 | # 112 | # Version 1.20 113 | # Oct 19 2012 03:24 (by Notos) 114 | # - Install OpenVPN - (BETA) Still not in the script, just an outside script 115 | # Tested client: http://openvpn.net/index.php?option=com_content&id=357 116 | # 117 | # Version 1.11 118 | # Oct 18 2012 05:13 (by Notos) 119 | # - Added scripts to downgrade and upgrade RTorrent 120 | # 121 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 122 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 123 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 124 | # 125 | # Version 1.10 126 | # 06/10/2012 14:18 (by Notos) 127 | # - Added Fileupload plugin 128 | # 129 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 130 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 131 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 132 | # 133 | # Version 1.00 134 | # 30/09/2012 14:18 (by Notos) 135 | # - Changing some file names and depoying version 1.00 136 | # 137 | # Version 0.99b 138 | # 27/09/2012 19:39 (by Notos) 139 | # - Quota for users 140 | # - Download dir inside user home 141 | # 142 | # Version 0.99a 143 | # 27/09/2012 19:39 (by Notos) 144 | # - Quota for users 145 | # - Download dir inside user home 146 | # 147 | # Version 0.92a 148 | # 28/08/2012 19:39 (by Notos) 149 | # - Also working on Debian now 150 | # 151 | # Version 0.91a 152 | # 24/08/2012 19:39 (by Notos) 153 | # - First multi-user version sent to public 154 | # 155 | # Version 0.90a 156 | # 22/08/2012 19:39 (by Notos) 157 | # - Working version for OVH Kimsufi 2G Server - Ubuntu Based 158 | # 159 | # Version 0.89a 160 | # 17/08/2012 19:39 (by Notos) 161 | # 162 | function getString 163 | { 164 | local ISPASSWORD=$1 165 | local LABEL=$2 166 | local RETURN=$3 167 | local DEFAULT=$4 168 | local NEWVAR1=a 169 | local NEWVAR2=b 170 | local YESYES=YESyes 171 | local NONO=NOno 172 | local YESNO=$YESYES$NONO 173 | 174 | while [ ! $NEWVAR1 = $NEWVAR2 ] || [ -z "$NEWVAR1" ]; 175 | do 176 | clear 177 | echo "#" 178 | echo "#" 179 | echo "# The Seedbox From Scratch Script" 180 | echo "# By Notos ---> https://github.com/Notos/" 181 | echo "# Modified by dannyti ---> https://github.com/dannyti/" 182 | echo "#" 183 | echo "#" 184 | echo 185 | 186 | if [ "$ISPASSWORD" == "YES" ]; then 187 | read -s -p "$DEFAULT" -p "$LABEL" NEWVAR1 188 | else 189 | read -e -i "$DEFAULT" -p "$LABEL" NEWVAR1 190 | fi 191 | if [ -z "$NEWVAR1" ]; then 192 | NEWVAR1=a 193 | continue 194 | fi 195 | 196 | if [ ! -z "$DEFAULT" ]; then 197 | if grep -q "$DEFAULT" <<< "$YESNO"; then 198 | if grep -q "$NEWVAR1" <<< "$YESNO"; then 199 | if grep -q "$NEWVAR1" <<< "$YESYES"; then 200 | NEWVAR1=YES 201 | else 202 | NEWVAR1=NO 203 | fi 204 | else 205 | NEWVAR1=a 206 | fi 207 | fi 208 | fi 209 | 210 | if [ "$NEWVAR1" == "$DEFAULT" ]; then 211 | NEWVAR2=$NEWVAR1 212 | else 213 | if [ "$ISPASSWORD" == "YES" ]; then 214 | echo 215 | read -s -p "Retype: " NEWVAR2 216 | else 217 | read -p "Retype: " NEWVAR2 218 | fi 219 | if [ -z "$NEWVAR2" ]; then 220 | NEWVAR2=b 221 | continue 222 | fi 223 | fi 224 | 225 | 226 | if [ ! -z "$DEFAULT" ]; then 227 | if grep -q "$DEFAULT" <<< "$YESNO"; then 228 | if grep -q "$NEWVAR2" <<< "$YESNO"; then 229 | if grep -q "$NEWVAR2" <<< "$YESYES"; then 230 | NEWVAR2=YES 231 | else 232 | NEWVAR2=NO 233 | fi 234 | else 235 | NEWVAR2=a 236 | fi 237 | fi 238 | fi 239 | echo "---> $NEWVAR2" 240 | 241 | done 242 | eval $RETURN=\$NEWVAR1 243 | } 244 | # 0. 245 | 246 | if [[ $EUID -ne 0 ]]; then 247 | echo "This script must be run as root" 1>&2 248 | exit 1 249 | fi 250 | 251 | export DEBIAN_FRONTEND=noninteractive 252 | 253 | clear 254 | 255 | # 1. 256 | 257 | #localhost is ok this rtorrent/rutorrent installation 258 | IPADDRESS1=`ifconfig | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' | grep -v 127 | head -n 1` 259 | CHROOTJAIL1=NO 260 | 261 | #those passwords will be changed in the next steps 262 | PASSWORD1=a 263 | PASSWORD2=b 264 | 265 | getString NO "You need to create an user for your seedbox: " NEWUSER1 266 | getString YES "Password for user $NEWUSER1: " PASSWORD1 267 | getString NO "IP address of your box: " IPADDRESS1 $IPADDRESS1 268 | getString NO "SSH port: " NEWSSHPORT1 21976 269 | getString NO "vsftp port (usually 21): " NEWFTPPORT1 21201 270 | getString NO "OpenVPN port: " OPENVPNPORT1 31195 271 | #getString NO "Do you want to have some of your users in a chroot jail? " CHROOTJAIL1 YES 272 | getString NO "Install Webmin? " INSTALLWEBMIN1 YES 273 | getString NO "Install Fail2ban? " INSTALLFAIL2BAN1 YES 274 | getString NO "Install OpenVPN? " INSTALLOPENVPN1 NO 275 | getString NO "Install SABnzbd? " INSTALLSABNZBD1 NO 276 | getString NO "Install Rapidleech? " INSTALLRAPIDLEECH1 NO 277 | getString NO "Install Deluge? " INSTALLDELUGE1 NO 278 | getString NO "Wich RTorrent version would you like to install, '0.9.3' or '0.9.4' or '0.9.6'? " RTORRENT1 0.9.6 279 | 280 | if [ "$RTORRENT1" != "0.9.3" ] && [ "$RTORRENT1" != "0.9.6" ] && [ "$RTORRENT1" != "0.9.4" ]; then 281 | echo "$RTORRENT1 typed is not 0.9.6 or 0.9.4 or 0.9.3!" 282 | exit 1 283 | fi 284 | 285 | if [ "$OSV1" = "14.04" ]; then 286 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 >> $logfile 2>&1 287 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >> $logfile 2>&1 288 | fi 289 | echo -e "\033[0;32;148m18 Minutes to go... .. .\033[39m" 290 | 291 | apt-get --yes update >> $logfile 2>&1 292 | apt-get --yes install whois sudo makepasswd nano >> $logfile 2>&1 293 | apt-get --yes install git >> $logfile 2>&1 294 | 295 | echo -e "\033[0;32;148m.............\033[39m" 296 | rm -f -r /etc/seedbox-from-scratch >> $logfile 2>&1 297 | git clone -b v$SBFSCURRENTVERSION1 https://github.com/dannyti/seedbox-from-scratch.git /etc/seedbox-from-scratch >> $logfile 2>&1 298 | mkdir -p cd /etc/seedbox-from-scratch/source 299 | mkdir -p cd /etc/seedbox-from-scratch/users 300 | echo -e "\033[0;32;148mWork in progress.........\033[39m" 301 | 302 | if [ ! -f /etc/seedbox-from-scratch/seedbox-from-scratch.sh ]; then 303 | echo "" 304 | echo Looks like something is wrong, this script was not able to download its whole git repository. 305 | echo "git could not be installed :/ " 306 | echo "Do : apt-get update && apt-get --yes install git " 307 | echo " Then run script again. " 308 | exit 1 309 | fi 310 | 311 | # 3.1 312 | 313 | #show all commands 314 | #set -x verbose 315 | # 4. 316 | perl -pi -e "s/Port 22/Port $NEWSSHPORT1/g" /etc/ssh/sshd_config 317 | perl -pi -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config 318 | perl -pi -e "s/#Protocol 2/Protocol 2/g" /etc/ssh/sshd_config 319 | perl -pi -e "s/X11Forwarding yes/X11Forwarding no/g" /etc/ssh/sshd_config 320 | 321 | groupadd sshdusers 322 | groupadd sftponly 323 | echo -e "\033[0;32;148mPlease Standby................\033[39m" 324 | mkdir -p /usr/share/terminfo/l/ 325 | cp /lib/terminfo/l/linux /usr/share/terminfo/l/ 326 | #echo '/usr/lib/openssh/sftp-server' >> /etc/shells 327 | #if [ "$OS1" = "Ubuntu" ]; then 328 | echo "" | tee -a /etc/ssh/sshd_config > /dev/null 329 | echo "UseDNS no" | tee -a /etc/ssh/sshd_config > /dev/null 330 | echo "AllowGroups sshdusers root" >> /etc/ssh/sshd_config 331 | echo "Match Group sftponly" >> /etc/ssh/sshd_config 332 | echo "ChrootDirectory %h" >> /etc/ssh/sshd_config 333 | echo "ForceCommand internal-sftp" >> /etc/ssh/sshd_config 334 | echo "AllowTcpForwarding no" >> /etc/ssh/sshd_config 335 | #fi 336 | 337 | service ssh reload >> $logfile 2>&1 338 | 339 | # 6. 340 | #remove cdrom from apt so it doesn't stop asking for it 341 | perl -pi -e "s/deb cdrom/#deb cdrom/g" /etc/apt/sources.list 342 | perl -pi.orig -e 's/^(deb .* universe)$/$1 multiverse/' /etc/apt/sources.list 343 | #add non-free sources to Debian Squeeze# those two spaces below are on purpose 344 | perl -pi -e "s/squeeze main/squeeze main contrib non-free/g" /etc/apt/sources.list 345 | perl -pi -e "s/squeeze-updates main/squeeze-updates main contrib non-free/g" /etc/apt/sources.list 346 | echo -e "\033[0;32;148mI am installing random stuff, Do you like coffee ?\033[39m" 347 | #apt-get --yes install python-software-properties 348 | #Adding debian pkgs for adding repo and installing ffmpeg 349 | apt-get --yes install software-properties-common >> $logfile 2>&1 350 | if [ "$OSV11" = "8" ]; then 351 | apt-add-repository --yes "deb http://www.deb-multimedia.org jessie main non-free" >> $logfile 2>&1 352 | apt-get update >> $logfile 2>&1 353 | apt-get --force-yes --yes install ffmpeg >> $logfile 2>&1 354 | fi 355 | 356 | echo -e "\033[0;32;148m.....\033[39m" 357 | # 7. 358 | # update and upgrade packages 359 | apt-get --yes install python-software-properties software-properties-common >> $logfile 2>&1 360 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV1" = "16.04" ] || [ "$OSV1" = "14.10" ]; then 361 | apt-add-repository --yes ppa:kirillshkrogalev/ffmpeg-next >> $logfile 2>&1 362 | fi 363 | apt-get --yes update >> $logfile 2>&1 364 | apt-get --yes upgrade >> $logfile 2>&1 365 | # 8. 366 | #install all needed packages 367 | apt-get --yes install apache2 apache2-utils autoconf build-essential ca-certificates comerr-dev curl cfv quota mktorrent dtach htop irssi libcloog-ppl-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev openvpn libssl-dev libtool libxml2-dev ncurses-base ncurses-term ntp openssl patch libc-ares-dev pkg-config pkg-config python-scgi ssl-cert subversion texinfo unzip zlib1g-dev expect flex bison debhelper binutils-gold libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libxml-libxml-perl libjson-rpc-perl libarchive-zip-perl tcpdump >> $logfile 2>&1 368 | if [ $? -gt 0 ]; then 369 | echo 370 | echo 371 | echo *** ERROR *** 372 | echo 373 | echo "Looks like something is wrong with apt-get install, aborting." 374 | echo 375 | exit 1 376 | fi 377 | 378 | apt-get --yes install libapache2-mod-php5 php5 php5-cli php5-dev php5-curl php5-geoip php5-mcrypt php5-gd php5-xmlrpc >> $logfile 2>&1 379 | 380 | if [ "$OSV1" = "16.04" ]; then 381 | apt-get --yes install php libapache2-mod-php php-mcrypt php-mysql php-xml >> $logfile 2>&1 382 | fi 383 | 384 | apt-get install screen >> $logfile 2>&1 385 | apt-get --yes install zip >> $logfile 2>&1 386 | 387 | apt-get --yes install ffmpeg >> $logfile 2>&1 388 | apt-get --yes install automake1.9 >> $logfile 2>&1 389 | 390 | apt-get --force-yes --yes install rar >> $logfile 2>&1 391 | if [ $? -gt 0 ]; then 392 | apt-get --yes install rar-free >> $logfile 2>&1 393 | fi 394 | 395 | #apt-get --yes install unrar 396 | #if [ $? -gt 0 ]; then 397 | # apt-get --yes install unrar-free 398 | #fi 399 | #if [ "$OSV11" = "8" ]; then 400 | # apt-get --yes install unrar-free >> $logfile 2>&1 401 | #fi 402 | 403 | apt-get --yes install dnsutils >> $logfile 2>&1 404 | 405 | if [ "$CHROOTJAIL1" = "YES" ]; then 406 | cd /etc/seedbox-from-scratch 407 | tar xvfz jailkit-2.15.tar.gz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 408 | cd source/jailkit-2.15 409 | ./debian/rules binary 410 | cd .. 411 | dpkg -i jailkit_2.15-1_*.deb >> $logfile 2>&1 412 | cp /etc/jailkit/jk_init.ini /etc/jailkit/jk_init.ini.original 413 | echo "" | tee -a /etc/jailkit/jk_init.ini >> /dev/null 414 | bash /etc/seedbox-from-scratch/updatejkinit >> $logfile 2>&1 415 | fi 416 | 417 | echo -e "\033[0;32;148mGo make coffee......\033[39m" 418 | # 8.1 additional packages for Ubuntu 419 | # this is better to be apart from the others 420 | apt-get --yes install php5-fpm >> $logfile 2>&1 421 | apt-get --yes install php5-xcache libxml2-dev >> $logfile 2>&1 422 | 423 | if [ "$OSV1" = "13.10" ]; then 424 | apt-get install php5-json 425 | fi 426 | 427 | #Check if its Debian and do a sysvinit by upstart replacement: 428 | #Commented the follwoing three lines for testing 429 | #if [ "$OS1" = "Debian" ]; then 430 | # echo 'Yes, do as I say!' | apt-get -y --force-yes install upstart 431 | #fi 432 | 433 | # 8.3 Generate our lists of ports and RPC and create variables 434 | 435 | #permanently adding scripts to PATH to all users and root 436 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /etc/profile > /dev/null 437 | echo "export PATH" | tee -a /etc/profile > /dev/null 438 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /root/.bashrc > /dev/null 439 | echo "export PATH" | tee -a /root/.bashrc > /dev/null 440 | 441 | rm -f /etc/seedbox-from-scratch/ports.txt 442 | for i in $(seq 51101 51999) 443 | do 444 | echo "$i" | tee -a /etc/seedbox-from-scratch/ports.txt > /dev/null 445 | done 446 | 447 | rm -f /etc/seedbox-from-scratch/rpc.txt 448 | for i in $(seq 2 1000) 449 | do 450 | echo "RPC$i" | tee -a /etc/seedbox-from-scratch/rpc.txt > /dev/null 451 | done 452 | 453 | # 8.4 454 | if [ "$INSTALLWEBMIN1" = "YES" ]; then 455 | echo "deb http://download.webmin.com/download/repository sarge contrib" | tee -a /etc/apt/sources.list > /dev/null 456 | wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add - >> $logfile 2>&1 457 | apt-get update >> $logfile 2>&1 458 | apt-get install -y webmin >> $logfile 2>&1 459 | fi 460 | 461 | #if [ "$INSTALLWEBMIN1" = "YES" ]; then 462 | # #if webmin isup, download key 463 | # WEBMINDOWN=YES 464 | # ping -c1 -w2 www.webmin.com > /dev/null 465 | # if [ $? = 0 ] ; then 466 | # wget -t 5 http://www.webmin.com/jcameron-key.asc >> $logfile 2>&1 467 | # apt-key add jcameron-key.asc >> $logfile 2>&1 468 | # if [ $? = 0 ] ; then 469 | # WEBMINDOWN=NO 470 | # fi 471 | # fi 472 | # 473 | # if [ "$WEBMINDOWN"="NO" ] ; then 474 | # #add webmin source 475 | # echo "" | tee -a /etc/apt/sources.list > /dev/null 476 | # echo "deb http://download.webmin.com/download/repository sarge contrib" | tee -a /etc/apt/sources.list > /dev/null 477 | # cd /tmp 478 | # fi 479 | # 480 | # if [ "$WEBMINDOWN" = "NO" ]; then 481 | # apt-get --yes update >> $logfile 2>&1 482 | # apt-get --yes install webmin >> $logfile 2>&1 483 | # fi 484 | #fi 485 | 486 | echo -e "\033[0;32;148m.........\033[39m" 487 | # 9. 488 | a2enmod ssl >> $logfile 2>&1 489 | a2enmod auth_digest >> $logfile 2>&1 490 | a2enmod reqtimeout >> $logfile 2>&1 491 | a2enmod rewrite >> $logfile 2>&1 492 | #a2enmod scgi ############### if we cant make python-scgi works 493 | #cd /etc/apache2 494 | #rm apache2.conf 495 | #wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/apache2.conf 496 | cat /etc/seedbox-from-scratch/add2apache2.conf >> /etc/apache2/apache2.conf 497 | # 10. 498 | 499 | #remove timeout if there are any 500 | perl -pi -e "s/^Timeout [0-9]*$//g" /etc/apache2/apache2.conf 501 | 502 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 503 | echo "#seedbox values" | tee -a /etc/apache2/apache2.conf > /dev/null 504 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 505 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 506 | echo "ServerSignature Off" | tee -a /etc/apache2/apache2.conf > /dev/null 507 | echo "ServerTokens Prod" | tee -a /etc/apache2/apache2.conf > /dev/null 508 | echo "Timeout 30" | tee -a /etc/apache2/apache2.conf > /dev/null 509 | cd /etc/apache2 510 | rm ports.conf 511 | wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/ports.conf >> $logfile 2>&1 512 | service apache2 restart >> $logfile 2>&1 513 | mkdir /etc/apache2/auth.users 514 | 515 | echo "$IPADDRESS1" > /etc/seedbox-from-scratch/hostname.info 516 | 517 | # 11. 518 | makepasswd | tee -a /etc/seedbox-from-scratch/sslca.info > /dev/null 519 | export TEMPHOSTNAME1=tsfsSeedBox 520 | export CERTPASS1=@@$TEMPHOSTNAME1.$NEWUSER1.ServerP7s$ 521 | export NEWUSER1 522 | export IPADDRESS1 523 | 524 | echo "$NEWUSER1" > /etc/seedbox-from-scratch/mainuser.info 525 | echo "$CERTPASS1" > /etc/seedbox-from-scratch/certpass.info 526 | 527 | bash /etc/seedbox-from-scratch/createOpenSSLCACertificate >> $logfile 2>&1 528 | 529 | mkdir -p /etc/ssl/private/ 530 | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -config /etc/seedbox-from-scratch/ssl/CA/caconfig.cnf >> $logfile 2>&1 531 | 532 | if [ "$OSV11" = "7" ]; then 533 | echo "deb http://ftp.cyconet.org/debian wheezy-updates main non-free contrib" >> /etc/apt/sources.list.d/wheezy-updates.cyconet.list 534 | apt-get update >> $logfile 2>&1 535 | apt-get install -y --force-yes -t wheezy-updates debian-cyconet-archive-keyring vsftpd libxml2-dev libcurl4-gnutls-dev subversion >> $logfile 2>&1 536 | elif [ "$OSV1" = "12.04" ]; then 537 | add-apt-repository -y ppa:thefrontiergroup/vsftpd 538 | apt-get update >> $logfile 2>&1 539 | apt-get -y install vsftpd >> $logfile 2>&1 540 | else 541 | apt-get -y install vsftpd >> $logfile 2>&1 542 | fi 543 | 544 | 545 | #if [ "$OSV1" = "12.04" ]; then 546 | # dpkg -i /etc/seedbox-from-scratch/vsftpd_2.3.2-3ubuntu5.1_`uname -m`.deb 547 | #fi 548 | 549 | perl -pi -e "s/anonymous_enable\=YES/\#anonymous_enable\=YES/g" /etc/vsftpd.conf 550 | perl -pi -e "s/connect_from_port_20\=YES/#connect_from_port_20\=YES/g" /etc/vsftpd.conf 551 | perl -pi -e 's/rsa_private_key_file/#rsa_private_key_file/' /etc/vsftpd.conf 552 | perl -pi -e 's/rsa_cert_file/#rsa_cert_file/' /etc/vsftpd.conf 553 | #perl -pi -e "s/rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/g" /etc/vsftpd.conf 554 | #perl -pi -e "s/rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/g" /etc/vsftpd.conf 555 | echo "listen_port=$NEWFTPPORT1" | tee -a /etc/vsftpd.conf >> /dev/null 556 | echo "ssl_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 557 | echo "allow_anon_ssl=YES" | tee -a /etc/vsftpd.conf >> /dev/null 558 | echo "force_local_data_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 559 | echo "force_local_logins_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 560 | echo "ssl_tlsv1=YES" | tee -a /etc/vsftpd.conf >> /dev/null 561 | echo "ssl_sslv2=NO" | tee -a /etc/vsftpd.conf >> /dev/null 562 | echo "ssl_sslv3=NO" | tee -a /etc/vsftpd.conf >> /dev/null 563 | echo "require_ssl_reuse=NO" | tee -a /etc/vsftpd.conf >> /dev/null 564 | echo "ssl_ciphers=HIGH" | tee -a /etc/vsftpd.conf >> /dev/null 565 | echo "rsa_cert_file=/etc/ssl/private/vsftpd.pem" | tee -a /etc/vsftpd.conf >> /dev/null 566 | echo "local_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 567 | echo "write_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 568 | echo "local_umask=022" | tee -a /etc/vsftpd.conf >> /dev/null 569 | echo "chroot_local_user=YES" | tee -a /etc/vsftpd.conf >> /dev/null 570 | echo "chroot_list_file=/etc/vsftpd.chroot_list" | tee -a /etc/vsftpd.conf >> /dev/null 571 | echo "passwd_chroot_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 572 | echo "allow_writeable_chroot=YES" | tee -a /etc/vsftpd.conf >> /dev/null ## Had to remove since patched applied by vsftpd devs 573 | #echo "seccomp_sandbox=NO" | tee -a /etc/vsftpd.conf >> /dev/null ## Had to remove since patched applied by vsftpd devs 574 | #echo "dual_log_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 575 | #echo "syslog_enable=NO" | tee -a /etc/vsftpd.conf >> /dev/null 576 | #sed -i '147 d' /etc/vsftpd.conf 577 | #sed -i '149 d' /etc/vsftpd.conf 578 | touch /var/log/vsftpd.log 579 | 580 | apt-get install --yes subversion >> $logfile 2>&1 581 | apt-get install --yes dialog >> $logfile 2>&1 582 | # 13. 583 | 584 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "14.10" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV1" = "16.04" ] || [ "$OSV11" = "8" ]; then 585 | cp /var/www/html/index.html /var/www/index.html 586 | mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.ORI 587 | rm -f /etc/apache2/sites-available/000-default.conf 588 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/000-default.conf 589 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/000-default.conf 590 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/000-default.conf 591 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/000-default.conf 592 | else 593 | mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 594 | rm -f /etc/apache2/sites-available/default 595 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 596 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 597 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 598 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 599 | fi 600 | #mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 601 | #rm -f /etc/apache2/sites-available/default 602 | #cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 603 | #perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 604 | #perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 605 | #perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 606 | 607 | echo "ServerName $IPADDRESS1" | tee -a /etc/apache2/apache2.conf > /dev/null 608 | echo -e "\033[0;32;148mHow was the coffee ?\033[39m" 609 | # 14. 610 | a2ensite default-ssl >> $logfile 2>&1 611 | #ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load 612 | #service apache2 restart 613 | #apt-get --yes install libxmlrpc-core-c3-dev 614 | 615 | #14.1 Download xmlrpc, rtorrent & libtorrent for 0.9.4 616 | #cd 617 | #svn co https://svn.code.sf.net/p/xmlrpc-c/code/stable /etc/seedbox-from-scratch/source/xmlrpc 618 | cd /etc/seedbox-from-scratch/ 619 | #wget -c http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.4.tar.gz 620 | #wget -c http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.4.tar.gz 621 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.4.tar.gz >> $logfile 2>&1 622 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.4.tar.gz >> $logfile 2>&1 623 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz >> $logfile 2>&1 624 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz >> $logfile 2>&1 625 | 626 | #configure & make xmlrpc BASED ON RTORRENT VERSION 627 | if [ "$RTORRENT1" = "0.9.4" ] || [ "$RTORRENT1" = "0.9.6" ]; then 628 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.33.17.tgz -C /etc/seedbox-from-scratch/ >> $logfile 2>&1 629 | cd /etc/seedbox-from-scratch/xmlrpc-c-1.33.17 630 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 631 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 632 | make install >> $logfile 2>&1 633 | else 634 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.16.42.tgz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 635 | cd /etc/seedbox-from-scratch/source/ 636 | unzip ../xmlrpc-c-1.31.06.zip >> $logfile 2>&1 637 | cd xmlrpc-c-1.31.06 638 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 639 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 640 | make install >> $logfile 2>&1 641 | fi 642 | # 15. 643 | 644 | 645 | # 16. 646 | #cd xmlrpc-c-1.16.42 ### old, but stable, version, needs a missing old types.h file 647 | #ln -s /usr/include/curl/curl.h /usr/include/curl/types.h 648 | 649 | 650 | # 21. 651 | echo -e "\033[0;32;148mDo not give up on me.........Still Working....\033[39m" 652 | bash /etc/seedbox-from-scratch/installRTorrent $RTORRENT1 >> $logfile 2>&1 653 | 654 | ######### Below this /var/www/rutorrent/ has been replaced with /var/www/rutorrent for Ubuntu 14.04 655 | echo -e "\033[0;32;148mNo kidding.... Did you make coffee ?\033[39m" 656 | # 22. 657 | cd /var/www/ 658 | rm -f -r rutorrent 659 | git clone https://github.com/Novik/ruTorrent rutorrent >> $logfile 2>&1 660 | 661 | 662 | cp /etc/seedbox-from-scratch/action.php.template /var/www/rutorrent/plugins/diskspace/action.php 663 | 664 | groupadd admin >> $logfile 2>&1 665 | 666 | echo "www-data ALL=(root) NOPASSWD: /usr/sbin/repquota" | tee -a /etc/sudoers > /dev/null 667 | 668 | cp /etc/seedbox-from-scratch/favicon.ico /var/www/ 669 | 670 | # 26. Installing Mediainfo from source 671 | apt-get install --yes mediainfo >> $logfile 2>&1 672 | if [ $? -gt 0 ]; then 673 | cd /tmp 674 | wget http://downloads.sourceforge.net/mediainfo/MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 675 | tar jxvf MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 676 | cd MediaInfo_CLI_GNU_FromSource/ 677 | sh CLI_Compile.sh >> $logfile 2>&1 678 | cd MediaInfo/Project/GNU/CLI 679 | make install >> $logfile 2>&1 680 | fi 681 | 682 | #cd /var/www/rutorrent/js/ 683 | #git clone https://github.com/gabceb/jquery-browser-plugin.git >> $logfile 2>&1 684 | #mv jquery-browser-plugin/dist/jquery.browser.js . 685 | #rm -r -f jquery-browser-plugin 686 | #sed -i '31i\ ' /var/www/rutorrent/index.html 687 | 688 | cd /var/www/rutorrent/plugins 689 | git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi >> $logfile 2>&1 690 | #cp autodl-irssi/_conf.php autodl-irssi/conf.php 691 | #svn co https://svn.code.sf.net/p/autodl-irssi/code/trunk/rutorrent/autodl-irssi/ 692 | cd autodl-irssi 693 | 694 | 695 | # 30. 696 | 697 | 698 | # 31. ZNC 699 | #Have put this in script form 700 | 701 | # 32. Installing poweroff button on ruTorrent 702 | cd /var/www/rutorrent/plugins/ 703 | wget http://rutorrent-logoff.googlecode.com/files/logoff-1.0.tar.gz >> $logfile 2>&1 704 | tar -zxf logoff-1.0.tar.gz >> $logfile 2>&1 705 | rm -f logoff-1.0.tar.gz 706 | 707 | if [ "$INSTALLFAIL2BAN1" = "YES" ]; then 708 | apt-get --yes install fail2ban >> $logfile 2>&1 709 | if [ "$OS1" = "Ubuntu" ]; then 710 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 711 | cp /etc/seedbox-from-scratch/ubu.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 712 | elif [ "$OS1" = "Debian" ]; then 713 | mv /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original 714 | cp /etc/seedbox-from-scratch/deb.etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf 715 | fi 716 | fail2ban-client reload >> $logfile 2>&1 717 | fi 718 | 719 | #33. Tuning Part - Let me know if you find more. 720 | echo "vm.swappiness=1" >>/etc/sysctl.conf 721 | echo "net.core.somaxconn = 1024" >>/etc/sysctl.conf 722 | echo "net.core.netdev_max_backlog = 50000" >>/etc/sysctl.conf 723 | echo "net.ipv4.tcp_max_tw_buckets = 2000000" >>/etc/sysctl.conf 724 | echo "net.core.rmem_max = 25165824" >>/etc/sysctl.conf 725 | echo "net.core.wmem_max = 25165824" >>/etc/sysctl.conf 726 | echo "net.core.rmem_default = 25165824" >>/etc/sysctl.conf 727 | echo "net.core.wmem_default = 25165824" >>/etc/sysctl.conf 728 | echo "net.core.optmem_max = 25165824" >> /etc/sysctl.conf 729 | echo "net.ipv4.tcp_wmem = 20480 12582912 25165824" >>/etc/sysctl.conf 730 | echo "net.ipv4.tcp_rmem = 20480 12582912 25165824" >>/etc/sysctl.conf 731 | echo "net.ipv4.tcp_max_syn_backlog = 65536" >>/etc/sysctl.conf 732 | echo "net.ipv4.tcp_slow_start_after_idle = 0" >>/etc/sysctl.conf 733 | echo "net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf 734 | echo "net.ipv4.ip_local_port_range = 10240 65535" >>/etc/sysctl.conf 735 | echo "fs.file-max = 2097152" >>/etc/sysctl.conf 736 | echo "vm.min_free_kbytes = 1024" >> /etc/sysctl.conf 737 | echo "net.ipv4.tcp_rfc1337 = 1" >> /etc/sysctl.conf 738 | echo "net.ipv4.tcp_fin_timeout = 10" >> /etc/sysctl.conf 739 | echo "net.ipv4.udp_rmem_min = 8192" >> /etc/sysctl.conf 740 | echo "net.ipv4.udp_wmem_min = 8192" >> /etc/sysctl.conf 741 | echo "net.ipv4.conf.all.send_redirects = 0" >> /etc/sysctl.conf 742 | echo "net.ipv4.conf.all.accept_redirects = 0" >> /etc/sysctl.conf 743 | echo "net.ipv4.conf.all.accept_source_route = 0" >> /etc/sysctl.conf 744 | sysctl -p >> $logfile 2>&1 745 | 746 | echo "* soft nofile 500000" >>/etc/security/limits.conf 747 | echo "* hard nofile 500000" >>/etc/security/limits.conf 748 | echo "session required pam_limits.so" >>/etc/pam.d/common-session 749 | 750 | if [ -f /proc/user_beancounters ] || [ -d /proc/bc ] || [ -f /proc/vz/veinfo ] || [ -d /proc/vz/veinfo ]; then 751 | echo -e "\033[0;32;148mLooks like this is a VPS. Moving on...\033[39m" 752 | else 753 | sed -i "s/defaults 1 1/defaults,noatime 0 0/" /etc/fstab 754 | fi 755 | 756 | # Installing Filemanager and MediaStream 757 | rm -f -R /var/www/rutorrent/plugins/filemanager >> $logfile 2>&1 758 | rm -f -R /var/www/rutorrent/plugins/fileupload >> $logfile 2>&1 759 | rm -f -R /var/www/rutorrent/plugins/mediastream >> $logfile 2>&1 760 | rm -f -R /var/www/stream >> $logfile 2>&1 761 | 762 | #############################rutorrent.org svn went down :( 763 | rm -r /var/www/rutorrent/plugins/fileshare >> $logfile 2>&1 764 | 765 | cd 766 | git clone https://github.com/nelu/rutorrent-thirdparty-plugins.git stable >> $logfile 2>&1 767 | cd stable 768 | cp -R filemanager fileshare fileupload mediastream /var/www/rutorrent/plugins/ 769 | #cd /var/www/rutorrent/plugins/ 770 | #svn co http://svn.rutorrent.org/svn/filemanager/trunk/mediastream >> $logfile 2>&1 771 | 772 | #cd /var/www/rutorrent/plugins/ 773 | #svn co http://svn.rutorrent.org/svn/filemanager/trunk/filemanager >> $logfile 2>&1 774 | 775 | cp /etc/seedbox-from-scratch/rutorrent.plugins.filemanager.conf.php.template /var/www/rutorrent/plugins/filemanager/conf.php 776 | 777 | mkdir -p /var/www/stream/ 778 | ln -s /var/www/rutorrent/plugins/mediastream/view.php /var/www/stream/view.php 779 | chown www-data: /var/www/stream 780 | chown www-data: /var/www/stream/view.php 781 | 782 | echo "" | tee /var/www/rutorrent/plugins/mediastream/conf.php > /dev/null 783 | 784 | # 32.2 # FILEUPLOAD 785 | #cd /var/www/rutorrent/plugins/ 786 | #svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileupload >> $logfile 2>&1 787 | chmod 775 /var/www/rutorrent/plugins/fileupload/scripts/upload 788 | apt-get --yes -f install >> $logfile 2>&1 789 | rm /var/www/rutorrent/plugins/unpack/conf.php 790 | # 32.2 791 | chown -R www-data:www-data /var/www/rutorrent 792 | chmod -R 755 /var/www/rutorrent 793 | 794 | apt-get --yes install gdebi >> $logfile 2>&1 795 | 796 | #32.3 797 | perl -pi -e "s/\\\$topDirectory\, \\\$fm/\\\$homeDirectory\, \\\$topDirectory\, \\\$fm/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 798 | perl -pi -e "s/\\\$this\-\>userdir \= addslash\(\\\$topDirectory\)\;/\\\$this\-\>userdir \= \\\$homeDirectory \? addslash\(\\\$homeDirectory\) \: addslash\(\\\$topDirectory\)\;/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 799 | perl -pi -e "s/\\\$topDirectory/\\\$homeDirectory/g" /var/www/rutorrent/plugins/filemanager/settings.js.php 800 | 801 | #32.4 802 | #unzip /etc/seedbox-from-scratch/rutorrent-oblivion.zip -d /var/www/rutorrent/plugins/ 803 | #echo "" | tee -a /var/www/rutorrent/css/style.css > /dev/null 804 | #echo "/* for Oblivion */" | tee -a /var/www/rutorrent/css/style.css > /dev/null 805 | #echo ".meter-value-start-color { background-color: #E05400 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 806 | #echo ".meter-value-end-color { background-color: #8FBC00 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 807 | #echo "::-webkit-scrollbar {width:12px;height:12px;padding:0px;margin:0px;}" | tee -a /var/www/rutorrent/css/style.css > /dev/null 808 | perl -pi -e "s/\$defaultTheme \= \"\"\;/\$defaultTheme \= \"Oblivion\"\;/g" /var/www/rutorrent/plugins/theme/conf.php 809 | git clone https://github.com/InAnimaTe/rutorrent-themes.git /var/www/rutorrent/plugins/theme/themes/Extra >> $logfile 2>&1 810 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/OblivionBlue /var/www/rutorrent/plugins/theme/themes/ 811 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/Agent46 /var/www/rutorrent/plugins/theme/themes/ 812 | rm -r /var/www/rutorrent/plugins/theme/themes/Extra 813 | #ln -s /etc/seedbox-from-scratch/seedboxInfo.php.template /var/www/seedboxInfo.php 814 | 815 | # 32.5 816 | #cd /var/www/rutorrent/plugins/ 817 | #rm -r /var/www/rutorrent/plugins/fileshare >> $logfile 2>&1 818 | rm -r /var/www/share >> $logfile 2>&1 819 | #svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileshare >> $logfile 2>&1 820 | mkdir /var/www/share 821 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/share.php 822 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/index.php 823 | chown -R www-data:www-data /var/www/share 824 | cp /etc/seedbox-from-scratch/rutorrent.plugins.fileshare.conf.php.template /var/www/rutorrent/plugins/fileshare/conf.php 825 | perl -pi -e "s//$IPADDRESS1/g" /var/www/rutorrent/plugins/fileshare/conf.php 826 | ############################### 827 | 828 | mv /etc/seedbox-from-scratch/unpack.conf.php /var/www/rutorrent/plugins/unpack/conf.php 829 | 830 | # 33. 831 | echo -e "\033[0;32;148m.................\033[39m" 832 | bash /etc/seedbox-from-scratch/updateExecutables >> $logfile 2>&1 833 | 834 | #34. 835 | echo $SBFSCURRENTVERSION1 > /etc/seedbox-from-scratch/version.info 836 | echo $NEWFTPPORT1 > /etc/seedbox-from-scratch/ftp.info 837 | echo $NEWSSHPORT1 > /etc/seedbox-from-scratch/ssh.info 838 | echo $OPENVPNPORT1 > /etc/seedbox-from-scratch/openvpn.info 839 | 840 | # 36. 841 | wget -P /usr/share/ca-certificates/ --no-check-certificate https://certs.godaddy.com/repository/gd_intermediate.crt https://certs.godaddy.com/repository/gd_cross_intermediate.crt >> $logfile 2>&1 842 | update-ca-certificates >> $logfile 2>&1 843 | c_rehash >> $logfile 2>&1 844 | 845 | sleep 2 846 | 847 | # 96. 848 | if [ "$INSTALLOPENVPN1" = "YES" ]; then 849 | bash /etc/seedbox-from-scratch/installOpenVPN 850 | fi 851 | 852 | if [ "$INSTALLSABNZBD1" = "YES" ]; then 853 | bash /etc/seedbox-from-scratch/installSABnzbd 854 | fi 855 | 856 | if [ "$INSTALLRAPIDLEECH1" = "YES" ]; then 857 | bash /etc/seedbox-from-scratch/installRapidleech 858 | fi 859 | 860 | if [ "$INSTALLDELUGE1" = "YES" ]; then 861 | bash /etc/seedbox-from-scratch/installDeluge 862 | fi 863 | 864 | sleep 1 865 | #Installing Movie Thumbnailer 866 | cd 867 | wget http://sourceforge.net/projects/moviethumbnail/files/movie%20thumbnailer%20linux%20binary/mtn-200808a-linux/mtn-200808a-linux.tgz/download -O mtn.tar.gz >> $logfile 2>&1 868 | tar xfvz mtn.tar.gz >> $logfile 2>&1 869 | cp mtn-200808a-linux/mtn /usr/local/bin/ 870 | rm -r mtn-200808a-linux/ 871 | 872 | # 97. First user will not be jailed 873 | echo -e "\033[0;32;148mLeave it now, About to Finish........\033[39m" 874 | # createSeedboxUser 875 | bash /etc/seedbox-from-scratch/createSeedboxUser $NEWUSER1 $PASSWORD1 YES YES YES NO >> $logfile 2>&1 876 | 877 | #Loadavg 878 | cd ~ 879 | git clone https://github.com/loadavg/loadavg.git >> $logfile 2>&1 880 | cd loadavg 881 | cd ~ 882 | mv loadavg /var/www/ 883 | cd /var/www/loadavg 884 | chmod 777 configure 885 | ./configure >> $logfile 2>&1 886 | 887 | cd /tmp 888 | wget https://rutorrent-tadd-labels.googlecode.com/files/lbll-suite_0.8.1.tar.gz >> $logfile 2>&1 889 | tar zxvf lbll-suite_0.8.1.tar.gz >> $logfile 2>&1 890 | sudo mv lbll-suite /var/www/rutorrent/plugins >> $logfile 2>&1 891 | 892 | cd ~ 893 | wget http://www.rarlab.com/rar/unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 894 | tar -xvf unrarsrc-5.3.8.tar.gz >> $logfile 2>&1 895 | cd unrar 896 | sudo make -f makefile >> $logfile 2>&1 897 | sudo install -v -m755 unrar /usr/bin >> $logfile 2>&1 898 | cd .. 899 | rm -R unrar >> $logfile 2>&1 900 | rm unrarsrc-5.3.8.tar.gz 901 | 902 | sed -i 's/width: 380px; height: 290px/width: 380px; height: 330px/' /var/www/rutorrent/css/style.css 903 | 904 | cd ~ 905 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/m/m/magic/magic.zip >> $logfile 2>&1 906 | unzip magic.zip >> $logfile 2>&1 907 | mv default.sfx rarreg.key /usr/local/lib/ 908 | rm magic.zip 909 | 910 | #Font Installation for mtn 911 | wget http://ftp.us.debian.org/debian/pool/main/f/fonts-liberation/fonts-liberation_1.07.4-1_all.deb >> $logfile 2>&1 912 | gdebi -n fonts-liberation_1.07.4-1_all.deb >> $logfile 2>&1 913 | 914 | cd /var/www 915 | chown -R www-data:www-data /var/www/rutorrent 916 | chown -R www-data:www-data /var/www/loadavg 917 | chmod -R 755 /var/www/rutorrent 918 | cd 919 | git clone https://github.com/mcrapet/plowshare.git plowshare >> $logfile 2>&1 920 | cd ~/plowshare 921 | make install >> $logfile 2>&1 922 | cd 923 | rm -r plowshare >> $logfile 2>&1 924 | 925 | cp /etc/seedbox-from-scratch/nano/ini.nanorc /usr/share/nano/ini.nanorc 926 | cp /etc/seedbox-from-scratch/nano/conf.nanorc /usr/share/nano/conf.nanorc 927 | cp /etc/seedbox-from-scratch/nano/xorg.nanorc /usr/share/nano/xorg.nanorc 928 | 929 | # édition conf nano 930 | echo " 931 | ## Config Files (.ini) 932 | include \"/usr/share/nano/ini.nanorc\" 933 | 934 | ## Config Files (.conf) 935 | include \"/usr/share/nano/conf.nanorc\" 936 | 937 | ## Xorg.conf 938 | include \"/usr/share/nano/xorg.nanorc\"">> /etc/nanorc 939 | 940 | # Additional Plugins 941 | cp -R /etc/seedbox-from-scratch/plugins/nfo /var/www/rutorrent/plugins/nfo 942 | 943 | export EDITOR=nano 944 | # 100 945 | cd /var/www/rutorrent/plugins 946 | sleep 1 947 | rm -frv diskspace >> $logfile 2>&1 948 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/main/b/base/hectortheone.rar >> $logfile 2>&1 949 | #wget http://dl.bintray.com/novik65/generi...ace-3.6.tar.gz 950 | #tar -xf diskspace-3.6.tar.gz 951 | unrar x hectortheone.rar >> $logfile 2>&1 952 | #rm diskspace-3.6.tar.gz 953 | rm hectortheone.rar 954 | cd quotaspace 955 | chmod 755 run.sh 956 | cd .. 957 | perl -pi -e "s/100/1024/g" /var/www/rutorrent/plugins/throttle/throttle.php 958 | #wget --no-check-certificate http://cheapseedboxes.com/trafic_check.rar >> $logfile 2>&1 959 | #unrar x trafic_check.rar >> $logfile 2>&1 960 | #rm trafic_check.rar 961 | #wget --no-check-certificate http://cheapseedboxes.com/plimits.rar >> $logfile 2>&1 962 | #unrar x plimits.rar >> $logfile 2>&1 963 | #rm plimits.rar 964 | #cd .. 965 | chown -R www-data:www-data /var/www/rutorrent 966 | cd 967 | wget http://p.outlyer.net/vcs/files/vcs_1.13.2-pon.1_all.deb >> $logfile 2>&1 968 | gdebi -n vcs_1.13.2-pon.1_all.deb >> $logfile 2>&1 969 | sleep 1 970 | rm -f *.deb 971 | #rm -rf cd usr 972 | echo -e "\033[0;32;148mFinishing Now .... .... .... ....\033[39m" 973 | 974 | if [ "$OSV11" = "8" ]; then 975 | systemctl enable apache2 >> $logfile 2>&1 976 | service apache2 start >> $logfile 2>&1 977 | fi 978 | #set +x verbose 979 | clear 980 | 981 | echo "" 982 | echo -e "\033[0;32;148m<<< The Seedbox From Scratch Script >>>\033[39m" 983 | echo -e "\033[0;32;148mScript Modified by dannyti ---> https://github.com/dannyti/\033[39m" 984 | echo "" 985 | echo "Looks like everything is set." 986 | echo "" 987 | echo "Remember that your SSH port is now ======> $NEWSSHPORT1 " 988 | echo "" 989 | echo "Your Login info can also be found at https://$IPADDRESS1/private/SBinfo.txt" 990 | echo "Download Data Directory is located at https://$IPADDRESS1/private " 991 | echo "To install ZNC, run installZNC from ssh as main user" 992 | echo "" 993 | echo "IMPORTANT NOTE: Refresh rutorrent for Throttle plugin to load properly" 994 | echo "" 995 | echo "System will reboot now, but don't close this window until you take note of the port number: $NEWSSHPORT1" 996 | echo "" 997 | echo -e "\033[0;32;148mPlease login as main user and only then close this Window\033[39m" 998 | 999 | reboot 1000 | 1001 | ##################### LAST LINE ########### 1002 | -------------------------------------------------------------------------------- /sbfrmsc.last.working.file: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Updated for $.broswer-msie error; will populate tracker list properly ; create check/start scripts; 4 | # create crontab entries. Rest is all perfect from Notos. Thanks. 5 | # 6 | # The Seedbox From Scratch Script 7 | # By Notos ---> https://github.com/Notos/ 8 | # Modified by dannyti ---> https://github.com/dannyti/ 9 | # 10 | ###################################################################### 11 | # 12 | # Copyright (c) 2013 Notos (https://github.com/Notos/) & dannyti (https://github.com/dannyti/) 13 | # 14 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | # 20 | # --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php 21 | # 22 | ###################################################################### 23 | # 24 | # git clone -b master https://github.com/Notos/seedbox-from-scratch.git /etc/seedbox-from-scratch 25 | # sudo git stash; sudo git pull 26 | # 27 | apt-get --yes install lsb-release 28 | SBFSCURRENTVERSION1=14.06 29 | OS1=$(lsb_release -si) 30 | OSV1=$(lsb_release -rs) 31 | OSV11=$(sed 's/\..*//' /etc/debian_version) 32 | logfile="/dev/null" 33 | # 34 | # Changelog 35 | # Version 14.06 (By dannyti) 36 | # Jan 16 2015 37 | # - RTorrent 0.9.4 supported 38 | # - Openvpn Fixed and Working 39 | # - Autodl tracker list correctly populated 40 | # - Diskspace fixed for multiuser environment 41 | # - Added http Data Download directory for users ; Can be accessed at http://Server-IP/private/Downloads ; Only http:// 42 | # - Sitewide https only 43 | # - User Login info can be accessed individually at http://Server-IP/private/SBinfo.txt 44 | # - Mediainfo fixed ; installtion from source 45 | # - Jquery Error corrected 46 | # - Crontab entries made for checking rtorrrent is running and starting it if not running 47 | # - Plowshare Fixed 48 | # - Deprecated seedboxInfo.php 49 | # 50 | # Version 2.1.9 (not stable yet) 51 | # Dec 26 2012 17:37 GMT-3 52 | # - RTorrent 0.9.3 support (optionally installed) 53 | # - New installRTorrent script: move to RTorrent 0.9.3 or back to 0.9.2 at any time 54 | # - Deluge v1.3.6 multi-user installation script (it will install the last stable version): installDeluge 55 | # - Optionally install Deluge when you first install your seedbox-from-scratch box 56 | # 57 | # Version 2.1.8 (stable) 58 | # - Bug fix release 59 | # 60 | # Version 2.1.4 (stable) 61 | # Dec 11 2012 2:34 GMT-3 62 | # - Debian 6 (Squeeze) Compatibile 63 | # - Check if user root is running the script 64 | # - vsftpd - FTP access with SSL (AUTH SSL - Explicit) 65 | # - vsftpd downgraded on Ubuntu to 2.3.2 (oneiric) 66 | # - iptables tweaked to make OpenVPN work as it should both on Ubuntu and Debian 67 | # - SABnzbd is now being installed from sources and works better 68 | # - New script: changeUserPassword --- example: changeUserPassword notos 133t rutorrent 69 | # - restartSeedbox now kill processes even if there are users attached on screens 70 | # - Installs rar, unrar and zip separately from main installations to prevent script from breaking on bad sources from non-OVH providers 71 | # 72 | # Version 2.1.2 (stable) 73 | # Nov 16 2012 20:48 GMT-3 74 | # - new upgradeSeedbox script (to download git files for a new version, it will not really upgrade it, at least for now :) 75 | # - ruTorrent fileshare Plugin (http://forums.rutorrent.org/index.php?topic=705.0) 76 | # - rapidleech (http://www.rapidleech.com/ - http://www.rapidleech.com/index.php?showtopic=2226|Go ** tutorial: http://www.seedm8.com/members/knowledgebase/24/Installing-Rapidleech-on-your-Seedbox.html 77 | # 78 | # Version 2.1.1 (stable) 79 | # Nov 12 2012 20:15 80 | # - OpenVPN was not working as expected (fixed) 81 | # - OpenVPN port now is configurable (at main install) and you can change it anytime before reinstalling: /etc/seedbox-from-scratch/openvpn.info 82 | # 83 | # Version 2.1.0 (not stable yet) 84 | # Nov 11 2012 20:15 85 | # - sabnzbd: http://wiki.sabnzbd.org/install-ubuntu-repo 86 | # - restartSeedbox script for each user 87 | # - User info files in /etc/seedbox-from-scratch/users 88 | # - Info about all users in https://hostname.tld/seedboxInfo.php 89 | # - Password protected webserver Document Root (/var/www/) 90 | # 91 | # Version 2.0.0 (stable) 92 | # Oct 31 2012 23:59 93 | # - chroot jail for users, using JailKit (http://olivier.sessink.nl/jailkit/) 94 | # - Fail2ban for ssh and apache - it bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. 95 | # - OpenVPN (after install you can download your key from http:///rutorrent/vpn.zip) 96 | # - createSeedboxUser script now asks if you want your user jailed, to have SSH access and if it should be added to sudoers 97 | # - Optionally install packages JailKit, Webmin, Fail2ban and OpenVPN 98 | # - Choose between RTorrent 0.8.9 and 0.9.2 (and their respective libtorrent libraries) 99 | # - Upgrade and downgrade RTorrent at any time 100 | # - Full automated install, now you just have to download script and run it in your box: 101 | # > wget -N https://raw.github.com/Notos/seedbox-from-scratch/v2.x.x/seedbox-from-scratch.sh 102 | # > time bash ~/seedbox-from-scratch.sh 103 | # - Due to a recent outage of Webmin site and SourceForge's svn repositories, some packages are now in git and will not be downloaded from those sites 104 | # - Updated list of trackers in Autodl-irssi 105 | # - vsftpd FTP Server (working in chroot jail) 106 | # - New ruTorrent default theme: Oblivion 107 | # 108 | # Version 1.30 109 | # Oct 23 2012 04:54:29 110 | # - Scripts now accept a full install without having to create variables and do anything else 111 | # 112 | # Version 1.20 113 | # Oct 19 2012 03:24 (by Notos) 114 | # - Install OpenVPN - (BETA) Still not in the script, just an outside script 115 | # Tested client: http://openvpn.net/index.php?option=com_content&id=357 116 | # 117 | # Version 1.11 118 | # Oct 18 2012 05:13 (by Notos) 119 | # - Added scripts to downgrade and upgrade RTorrent 120 | # 121 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 122 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 123 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 124 | # 125 | # Version 1.10 126 | # 06/10/2012 14:18 (by Notos) 127 | # - Added Fileupload plugin 128 | # 129 | # - Added all supported plowshare sites into fileupload plugin: 115, 1fichier, 2shared, 4shared, bayfiles, bitshare, config, cramit, data_hu, dataport_cz, 130 | # depositfiles, divshare, dl_free_fr, euroshare_eu, extabit, filebox, filemates, filepost, freakshare, go4up, hotfile, mediafire, megashares, mirrorcreator, multiupload, netload_in, 131 | # oron, putlocker, rapidgator, rapidshare, ryushare, sendspace, shareonline_biz, turbobit, uploaded_net, uploadhero, uploading, uptobox, zalaa, zippyshare 132 | # 133 | # Version 1.00 134 | # 30/09/2012 14:18 (by Notos) 135 | # - Changing some file names and depoying version 1.00 136 | # 137 | # Version 0.99b 138 | # 27/09/2012 19:39 (by Notos) 139 | # - Quota for users 140 | # - Download dir inside user home 141 | # 142 | # Version 0.99a 143 | # 27/09/2012 19:39 (by Notos) 144 | # - Quota for users 145 | # - Download dir inside user home 146 | # 147 | # Version 0.92a 148 | # 28/08/2012 19:39 (by Notos) 149 | # - Also working on Debian now 150 | # 151 | # Version 0.91a 152 | # 24/08/2012 19:39 (by Notos) 153 | # - First multi-user version sent to public 154 | # 155 | # Version 0.90a 156 | # 22/08/2012 19:39 (by Notos) 157 | # - Working version for OVH Kimsufi 2G Server - Ubuntu Based 158 | # 159 | # Version 0.89a 160 | # 17/08/2012 19:39 (by Notos) 161 | # 162 | function getString 163 | { 164 | local ISPASSWORD=$1 165 | local LABEL=$2 166 | local RETURN=$3 167 | local DEFAULT=$4 168 | local NEWVAR1=a 169 | local NEWVAR2=b 170 | local YESYES=YESyes 171 | local NONO=NOno 172 | local YESNO=$YESYES$NONO 173 | 174 | while [ ! $NEWVAR1 = $NEWVAR2 ] || [ -z "$NEWVAR1" ]; 175 | do 176 | clear 177 | echo "#" 178 | echo "#" 179 | echo "# The Seedbox From Scratch Script" 180 | echo "# By Notos ---> https://github.com/Notos/" 181 | echo "# Modified by dannyti ---> https://github.com/dannyti/" 182 | echo "#" 183 | echo "#" 184 | echo 185 | 186 | if [ "$ISPASSWORD" == "YES" ]; then 187 | read -s -p "$DEFAULT" -p "$LABEL" NEWVAR1 188 | else 189 | read -e -i "$DEFAULT" -p "$LABEL" NEWVAR1 190 | fi 191 | if [ -z "$NEWVAR1" ]; then 192 | NEWVAR1=a 193 | continue 194 | fi 195 | 196 | if [ ! -z "$DEFAULT" ]; then 197 | if grep -q "$DEFAULT" <<< "$YESNO"; then 198 | if grep -q "$NEWVAR1" <<< "$YESNO"; then 199 | if grep -q "$NEWVAR1" <<< "$YESYES"; then 200 | NEWVAR1=YES 201 | else 202 | NEWVAR1=NO 203 | fi 204 | else 205 | NEWVAR1=a 206 | fi 207 | fi 208 | fi 209 | 210 | if [ "$NEWVAR1" == "$DEFAULT" ]; then 211 | NEWVAR2=$NEWVAR1 212 | else 213 | if [ "$ISPASSWORD" == "YES" ]; then 214 | echo 215 | read -s -p "Retype: " NEWVAR2 216 | else 217 | read -p "Retype: " NEWVAR2 218 | fi 219 | if [ -z "$NEWVAR2" ]; then 220 | NEWVAR2=b 221 | continue 222 | fi 223 | fi 224 | 225 | 226 | if [ ! -z "$DEFAULT" ]; then 227 | if grep -q "$DEFAULT" <<< "$YESNO"; then 228 | if grep -q "$NEWVAR2" <<< "$YESNO"; then 229 | if grep -q "$NEWVAR2" <<< "$YESYES"; then 230 | NEWVAR2=YES 231 | else 232 | NEWVAR2=NO 233 | fi 234 | else 235 | NEWVAR2=a 236 | fi 237 | fi 238 | fi 239 | echo "---> $NEWVAR2" 240 | 241 | done 242 | eval $RETURN=\$NEWVAR1 243 | } 244 | # 0. 245 | 246 | if [[ $EUID -ne 0 ]]; then 247 | echo "This script must be run as root" 1>&2 248 | exit 1 249 | fi 250 | 251 | export DEBIAN_FRONTEND=noninteractive 252 | 253 | clear 254 | 255 | # 1. 256 | 257 | #localhost is ok this rtorrent/rutorrent installation 258 | IPADDRESS1=`ifconfig | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' | grep -v 127 | head -n 1` 259 | CHROOTJAIL1=NO 260 | 261 | #those passwords will be changed in the next steps 262 | PASSWORD1=a 263 | PASSWORD2=b 264 | 265 | getString NO "You need to create an user for your seedbox: " NEWUSER1 266 | getString YES "Password for user $NEWUSER1: " PASSWORD1 267 | getString NO "IP address of your box: " IPADDRESS1 $IPADDRESS1 268 | getString NO "SSH port: " NEWSSHPORT1 21976 269 | getString NO "vsftp port (usually 21): " NEWFTPPORT1 21201 270 | getString NO "OpenVPN port: " OPENVPNPORT1 31195 271 | #getString NO "Do you want to have some of your users in a chroot jail? " CHROOTJAIL1 YES 272 | getString NO "Install Webmin? " INSTALLWEBMIN1 YES 273 | getString NO "Install Fail2ban? " INSTALLFAIL2BAN1 YES 274 | getString NO "Install OpenVPN? " INSTALLOPENVPN1 NO 275 | getString NO "Install SABnzbd? " INSTALLSABNZBD1 NO 276 | getString NO "Install Rapidleech? " INSTALLRAPIDLEECH1 NO 277 | getString NO "Install Deluge? " INSTALLDELUGE1 NO 278 | getString NO "Wich RTorrent version would you like to install, '0.9.3' or '0.9.4' or '0.9.6'? " RTORRENT1 0.9.6 279 | 280 | if [ "$RTORRENT1" != "0.9.3" ] && [ "$RTORRENT1" != "0.9.6" ] && [ "$RTORRENT1" != "0.9.4" ]; then 281 | echo "$RTORRENT1 typed is not 0.9.6 or 0.9.4 or 0.9.3!" 282 | exit 1 283 | fi 284 | 285 | if [ "$OSV1" = "14.04" ]; then 286 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 >> $logfile 2>&1 287 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 >> $logfile 2>&1 288 | fi 289 | echo -e "\033[0;32;148m........\033[39m" 290 | echo -e "\033[0;32;148m.............\033[39m" 291 | echo -e "\033[0;32;148mWork in progress.........\033[39m" 292 | echo -e "\033[0;32;148mPlease Standby................\033[39m" 293 | apt-get --yes update >> $logfile 2>&1 294 | apt-get --yes install whois sudo makepasswd nano >> $logfile 2>&1 295 | apt-get --yes install git >> $logfile 2>&1 296 | 297 | rm -f -r /etc/seedbox-from-scratch 298 | git clone -b v$SBFSCURRENTVERSION1 https://github.com/dannyti/seedbox-from-scratch.git /etc/seedbox-from-scratch >> $logfile 2>&1 299 | mkdir -p cd /etc/seedbox-from-scratch/source 300 | mkdir -p cd /etc/seedbox-from-scratch/users 301 | 302 | if [ ! -f /etc/seedbox-from-scratch/seedbox-from-scratch.sh ]; then 303 | clear 304 | echo Looks like something is wrong, this script was not able to download its whole git repository. 305 | set -e 306 | exit 1 307 | fi 308 | 309 | # 3.1 310 | 311 | #show all commands 312 | #set -x verbose 313 | echo -e "\033[0;32;148mI am installing random stuff, Do you like coffee ?\033[39m" 314 | 315 | # 4. 316 | perl -pi -e "s/Port 22/Port $NEWSSHPORT1/g" /etc/ssh/sshd_config 317 | perl -pi -e "s/PermitRootLogin yes/PermitRootLogin no/g" /etc/ssh/sshd_config 318 | perl -pi -e "s/#Protocol 2/Protocol 2/g" /etc/ssh/sshd_config 319 | perl -pi -e "s/X11Forwarding yes/X11Forwarding no/g" /etc/ssh/sshd_config 320 | 321 | groupadd sshdusers 322 | groupadd sftponly 323 | 324 | mkdir -p /usr/share/terminfo/l/ 325 | cp /lib/terminfo/l/linux /usr/share/terminfo/l/ 326 | #echo '/usr/lib/openssh/sftp-server' >> /etc/shells 327 | if [ "$OS1" = "Ubuntu" ]; then 328 | echo "" | tee -a /etc/ssh/sshd_config > /dev/null 329 | echo "UseDNS no" | tee -a /etc/ssh/sshd_config > /dev/null 330 | echo "AllowGroups sshdusers root" >> /etc/ssh/sshd_config 331 | echo "Match Group sftponly" >> /etc/ssh/sshd_config 332 | echo "ChrootDirectory %h" >> /etc/ssh/sshd_config 333 | echo "ForceCommand internal-sftp" >> /etc/ssh/sshd_config 334 | echo "AllowTcpForwarding no" >> /etc/ssh/sshd_config 335 | fi 336 | 337 | service ssh reload 338 | 339 | # 6. 340 | #remove cdrom from apt so it doesn't stop asking for it 341 | perl -pi -e "s/deb cdrom/#deb cdrom/g" /etc/apt/sources.list 342 | perl -pi.orig -e 's/^(deb .* universe)$/$1 multiverse/' /etc/apt/sources.list 343 | #add non-free sources to Debian Squeeze# those two spaces below are on purpose 344 | perl -pi -e "s/squeeze main/squeeze main contrib non-free/g" /etc/apt/sources.list 345 | perl -pi -e "s/squeeze-updates main/squeeze-updates main contrib non-free/g" /etc/apt/sources.list 346 | 347 | #apt-get --yes install python-software-properties 348 | #Adding debian pkgs for adding repo and installing ffmpeg 349 | apt-get --yes install software-properties-common >> $logfile 2>&1 350 | if [ "$OSV11" = "8" ]; then 351 | apt-add-repository --yes "deb http://www.deb-multimedia.org jessie main non-free" >> $logfile 2>&1 352 | apt-get update >> $logfile 2>&1 353 | apt-get --force-yes --yes install ffmpeg >> $logfile 2>&1 354 | fi 355 | 356 | echo -e "\033[0;32;148m.....\033[39m" 357 | # 7. 358 | # update and upgrade packages 359 | apt-get --yes install python-software-properties software-properties-common >> $logfile 2>&1 360 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV1" = "14.10" ]; then 361 | apt-add-repository --yes ppa:kirillshkrogalev/ffmpeg-next >> $logfile 2>&1 362 | fi 363 | apt-get --yes update >> $logfile 2>&1 364 | apt-get --yes upgrade >> $logfile 2>&1 365 | # 8. 366 | #install all needed packages 367 | apt-get --yes install apache2 apache2-utils autoconf build-essential ca-certificates comerr-dev curl cfv quota mktorrent dtach htop irssi libapache2-mod-php5 libcloog-ppl-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev openvpn libssl-dev libtool libxml2-dev ncurses-base ncurses-term ntp openssl patch libc-ares-dev pkg-config php5 php5-cli php5-dev php5-curl php5-geoip php5-mcrypt php5-gd php5-xmlrpc pkg-config python-scgi screen ssl-cert subversion texinfo unzip zlib1g-dev expect flex bison debhelper binutils-gold libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libxml-libxml-perl libjson-rpc-perl libarchive-zip-perl tcpdump >> $logfile 2>&1 368 | if [ $? -gt 0 ]; then 369 | set +x verbose 370 | echo 371 | echo 372 | echo *** ERROR *** 373 | echo 374 | echo "Looks like something is wrong with apt-get install, aborting." 375 | echo 376 | echo "You do not have git installed. " 377 | echo "Do : apt-get update && apt-get install git " 378 | echo " Then run script again. " 379 | set -e 380 | exit 1 381 | fi 382 | apt-get --yes install zip >> $logfile 2>&1 383 | 384 | apt-get --yes install ffmpeg >> $logfile 2>&1 385 | apt-get --yes install automake1.9 >> $logfile 2>&1 386 | 387 | apt-get --force-yes --yes install rar 388 | if [ $? -gt 0 ]; then 389 | apt-get --yes install rar-free 390 | fi 391 | 392 | #apt-get --yes install unrar 393 | #if [ $? -gt 0 ]; then 394 | # apt-get --yes install unrar-free 395 | #fi 396 | if [ "$OSV11" = "8" ]; then 397 | apt-get --yes install unrar-free 398 | fi 399 | 400 | apt-get --yes install dnsutils >> $logfile 2>&1 401 | 402 | if [ "$CHROOTJAIL1" = "YES" ]; then 403 | cd /etc/seedbox-from-scratch 404 | tar xvfz jailkit-2.15.tar.gz -C /etc/seedbox-from-scratch/source/ 405 | cd source/jailkit-2.15 406 | ./debian/rules binary 407 | cd .. 408 | dpkg -i jailkit_2.15-1_*.deb 409 | fi 410 | 411 | echo -e "\033[0;32;148mGo make coffee......\033[39m" 412 | # 8.1 additional packages for Ubuntu 413 | # this is better to be apart from the others 414 | apt-get --yes install php5-fpm >> $logfile 2>&1 415 | apt-get --yes install php5-xcache libxml2-dev >> $logfile 2>&1 416 | 417 | if [ "$OSV1" = "13.10" ]; then 418 | apt-get install php5-json 419 | fi 420 | 421 | #Check if its Debian and do a sysvinit by upstart replacement: 422 | #Commented the follwoing three lines for testing 423 | #if [ "$OS1" = "Debian" ]; then 424 | # echo 'Yes, do as I say!' | apt-get -y --force-yes install upstart 425 | #fi 426 | 427 | # 8.3 Generate our lists of ports and RPC and create variables 428 | 429 | #permanently adding scripts to PATH to all users and root 430 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /etc/profile > /dev/null 431 | echo "export PATH" | tee -a /etc/profile > /dev/null 432 | echo "PATH=$PATH:/etc/seedbox-from-scratch:/sbin" | tee -a /root/.bashrc > /dev/null 433 | echo "export PATH" | tee -a /root/.bashrc > /dev/null 434 | 435 | rm -f /etc/seedbox-from-scratch/ports.txt 436 | for i in $(seq 51101 51999) 437 | do 438 | echo "$i" | tee -a /etc/seedbox-from-scratch/ports.txt > /dev/null 439 | done 440 | 441 | rm -f /etc/seedbox-from-scratch/rpc.txt 442 | for i in $(seq 2 1000) 443 | do 444 | echo "RPC$i" | tee -a /etc/seedbox-from-scratch/rpc.txt > /dev/null 445 | done 446 | 447 | # 8.4 448 | 449 | if [ "$INSTALLWEBMIN1" = "YES" ]; then 450 | #if webmin isup, download key 451 | WEBMINDOWN=YES 452 | ping -c1 -w2 www.webmin.com > /dev/null 453 | if [ $? = 0 ] ; then 454 | wget -t 5 http://www.webmin.com/jcameron-key.asc 455 | apt-key add jcameron-key.asc 456 | if [ $? = 0 ] ; then 457 | WEBMINDOWN=NO 458 | fi 459 | fi 460 | 461 | if [ "$WEBMINDOWN"="NO" ] ; then 462 | #add webmin source 463 | echo "" | tee -a /etc/apt/sources.list > /dev/null 464 | echo "deb http://download.webmin.com/download/repository sarge contrib" | tee -a /etc/apt/sources.list > /dev/null 465 | cd /tmp 466 | fi 467 | 468 | if [ "$WEBMINDOWN" = "NO" ]; then 469 | apt-get --yes update >> $logfile 2>&1 470 | apt-get --yes install webmin >> $logfile 2>&1 471 | fi 472 | fi 473 | 474 | if [ "$INSTALLFAIL2BAN1" = "YES" ]; then 475 | apt-get --yes install fail2ban >> $logfile 2>&1 476 | cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.conf.original >> $logfile 2>&1 477 | cp /etc/seedbox-from-scratch/etc.fail2ban.jail.conf.template /etc/fail2ban/jail.conf >> $logfile 2>&1 478 | fail2ban-client reload >> $logfile 2>&1 479 | fi 480 | echo -e "\033[0;32;148m.........\033[39m" 481 | # 9. 482 | a2enmod ssl 483 | a2enmod auth_digest 484 | a2enmod reqtimeout 485 | a2enmod rewrite 486 | #a2enmod scgi ############### if we cant make python-scgi works 487 | #cd /etc/apache2 488 | #rm apache2.conf 489 | #wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/apache2.conf 490 | cat /etc/seedbox-from-scratch/add2apache2.conf >> /etc/apache2/apache2.conf 491 | # 10. 492 | 493 | #remove timeout if there are any 494 | perl -pi -e "s/^Timeout [0-9]*$//g" /etc/apache2/apache2.conf 495 | 496 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 497 | echo "#seedbox values" | tee -a /etc/apache2/apache2.conf > /dev/null 498 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 499 | echo "" | tee -a /etc/apache2/apache2.conf > /dev/null 500 | echo "ServerSignature Off" | tee -a /etc/apache2/apache2.conf > /dev/null 501 | echo "ServerTokens Prod" | tee -a /etc/apache2/apache2.conf > /dev/null 502 | echo "Timeout 30" | tee -a /etc/apache2/apache2.conf > /dev/null 503 | cd /etc/apache2 504 | rm ports.conf 505 | wget --no-check-certificate https://raw.githubusercontent.com/dannyti/sboxsetup/master/ports.conf >> $logfile 2>&1 506 | service apache2 restart 507 | mkdir /etc/apache2/auth.users 508 | 509 | echo "$IPADDRESS1" > /etc/seedbox-from-scratch/hostname.info 510 | 511 | # 11. 512 | makepasswd | tee -a /etc/seedbox-from-scratch/sslca.info > /dev/null 513 | export TEMPHOSTNAME1=tsfsSeedBox 514 | export CERTPASS1=@@$TEMPHOSTNAME1.$NEWUSER1.ServerP7s$ 515 | export NEWUSER1 516 | export IPADDRESS1 517 | 518 | echo "$NEWUSER1" > /etc/seedbox-from-scratch/mainuser.info 519 | echo "$CERTPASS1" > /etc/seedbox-from-scratch/certpass.info 520 | 521 | bash /etc/seedbox-from-scratch/createOpenSSLCACertificate >> $logfile 2>&1 522 | 523 | mkdir -p /etc/ssl/private/ 524 | openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -config /etc/seedbox-from-scratch/ssl/CA/caconfig.cnf 525 | 526 | if [ "$OSV11" = "7" ]; then 527 | echo "deb http://ftp.cyconet.org/debian wheezy-updates main non-free contrib" >> /etc/apt/sources.list.d/wheezy-updates.cyconet.list 528 | apt-get update >> $logfile 2>&1 529 | apt-get install -y --force-yes -t wheezy-updates debian-cyconet-archive-keyring vsftpd libxml2-dev libcurl4-gnutls-dev subversion >> $logfile 2>&1 530 | elif [ "$OSV1" = "12.04" ]; then 531 | add-apt-repository -y ppa:thefrontiergroup/vsftpd 532 | apt-get update >> $logfile 2>&1 533 | apt-get -y install vsftpd >> $logfile 2>&1 534 | else 535 | apt-get -y install vsftpd >> $logfile 2>&1 536 | fi 537 | 538 | 539 | #if [ "$OSV1" = "12.04" ]; then 540 | # dpkg -i /etc/seedbox-from-scratch/vsftpd_2.3.2-3ubuntu5.1_`uname -m`.deb 541 | #fi 542 | 543 | perl -pi -e "s/anonymous_enable\=YES/\#anonymous_enable\=YES/g" /etc/vsftpd.conf 544 | perl -pi -e "s/connect_from_port_20\=YES/#connect_from_port_20\=YES/g" /etc/vsftpd.conf 545 | perl -pi -e 's/rsa_private_key_file/#rsa_private_key_file/' /etc/vsftpd.conf 546 | perl -pi -e 's/rsa_cert_file/#rsa_cert_file/' /etc/vsftpd.conf 547 | #perl -pi -e "s/rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/#rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem/g" /etc/vsftpd.conf 548 | #perl -pi -e "s/rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key/g" /etc/vsftpd.conf 549 | echo "listen_port=$NEWFTPPORT1" | tee -a /etc/vsftpd.conf >> /dev/null 550 | echo "ssl_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 551 | echo "allow_anon_ssl=YES" | tee -a /etc/vsftpd.conf >> /dev/null 552 | echo "force_local_data_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 553 | echo "force_local_logins_ssl=NO" | tee -a /etc/vsftpd.conf >> /dev/null 554 | echo "ssl_tlsv1=YES" | tee -a /etc/vsftpd.conf >> /dev/null 555 | echo "ssl_sslv2=NO" | tee -a /etc/vsftpd.conf >> /dev/null 556 | echo "ssl_sslv3=NO" | tee -a /etc/vsftpd.conf >> /dev/null 557 | echo "require_ssl_reuse=NO" | tee -a /etc/vsftpd.conf >> /dev/null 558 | echo "ssl_ciphers=HIGH" | tee -a /etc/vsftpd.conf >> /dev/null 559 | echo "rsa_cert_file=/etc/ssl/private/vsftpd.pem" | tee -a /etc/vsftpd.conf >> /dev/null 560 | echo "local_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 561 | echo "write_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 562 | echo "local_umask=022" | tee -a /etc/vsftpd.conf >> /dev/null 563 | echo "chroot_local_user=YES" | tee -a /etc/vsftpd.conf >> /dev/null 564 | echo "chroot_list_file=/etc/vsftpd.chroot_list" | tee -a /etc/vsftpd.conf >> /dev/null 565 | echo "passwd_chroot_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 566 | echo "allow_writeable_chroot=YES" | tee -a /etc/vsftpd.conf >> /dev/null 567 | echo "seccomp_sandbox=NO" | tee -a /etc/vsftpd.conf >> /dev/null 568 | echo "dual_log_enable=YES" | tee -a /etc/vsftpd.conf >> /dev/null 569 | echo "syslog_enable=NO" | tee -a /etc/vsftpd.conf >> /dev/null 570 | #sed -i '147 d' /etc/vsftpd.conf 571 | #sed -i '149 d' /etc/vsftpd.conf 572 | touch /var/log/vsftpd.log 573 | 574 | apt-get install --yes subversion >> $logfile 2>&1 575 | apt-get install --yes dialog >> $logfile 2>&1 576 | # 13. 577 | 578 | if [ "$OSV1" = "14.04" ] || [ "$OSV1" = "14.10" ] || [ "$OSV1" = "15.04" ] || [ "$OSV1" = "15.10" ] || [ "$OSV11" = "8" ]; then 579 | cp /var/www/html/index.html /var/www/index.html 580 | mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.ORI 581 | rm -f /etc/apache2/sites-available/000-default.conf 582 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/000-default.conf 583 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/000-default.conf 584 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/000-default.conf 585 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/000-default.conf 586 | else 587 | mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 588 | rm -f /etc/apache2/sites-available/default 589 | cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 590 | perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 591 | perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 592 | perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 593 | fi 594 | #mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.ORI 595 | #rm -f /etc/apache2/sites-available/default 596 | #cp /etc/seedbox-from-scratch/etc.apache2.default.template /etc/apache2/sites-available/default 597 | #perl -pi -e "s/http\:\/\/.*\/rutorrent/http\:\/\/$IPADDRESS1\/rutorrent/g" /etc/apache2/sites-available/default 598 | #perl -pi -e "s//$IPADDRESS1/g" /etc/apache2/sites-available/default 599 | #perl -pi -e "s//$NEWUSER1/g" /etc/apache2/sites-available/default 600 | 601 | echo "ServerName $IPADDRESS1" | tee -a /etc/apache2/apache2.conf > /dev/null 602 | echo -e "\033[0;32;148mHow was the coffee ?\033[39m" 603 | # 14. 604 | a2ensite default-ssl 605 | #ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load 606 | #service apache2 restart 607 | #apt-get --yes install libxmlrpc-core-c3-dev 608 | 609 | #14.1 Download xmlrpc, rtorrent & libtorrent for 0.9.4 610 | #cd 611 | #svn co https://svn.code.sf.net/p/xmlrpc-c/code/stable /etc/seedbox-from-scratch/source/xmlrpc 612 | cd /etc/seedbox-from-scratch/ 613 | #wget -c http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.4.tar.gz 614 | #wget -c http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.4.tar.gz 615 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.4.tar.gz >> $logfile 2>&1 616 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.4.tar.gz >> $logfile 2>&1 617 | wget -c http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz >> $logfile 2>&1 618 | wget -c http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz >> $logfile 2>&1 619 | 620 | #configure & make xmlrpc BASED ON RTORRENT VERSION 621 | if [ "$RTORRENT1" = "0.9.4" ] || [ "$RTORRENT1" = "0.9.6" ]; then 622 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.33.17.tgz -C /etc/seedbox-from-scratch/ >> $logfile 2>&1 623 | cd /etc/seedbox-from-scratch/xmlrpc-c-1.33.17 624 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 625 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 626 | make install >> $logfile 2>&1 627 | else 628 | tar xvfz /etc/seedbox-from-scratch/xmlrpc-c-1.16.42.tgz -C /etc/seedbox-from-scratch/source/ >> $logfile 2>&1 629 | cd /etc/seedbox-from-scratch/source/ 630 | unzip ../xmlrpc-c-1.31.06.zip >> $logfile 2>&1 631 | cd xmlrpc-c-1.31.06 632 | ./configure --prefix=/usr --enable-libxml2-backend --disable-libwww-client --disable-wininet-client --disable-abyss-server --disable-cgi-server >> $logfile 2>&1 633 | make -j$(grep -c ^processor /proc/cpuinfo) >> $logfile 2>&1 634 | make install >> $logfile 2>&1 635 | fi 636 | # 15. 637 | 638 | 639 | # 16. 640 | #cd xmlrpc-c-1.16.42 ### old, but stable, version, needs a missing old types.h file 641 | #ln -s /usr/include/curl/curl.h /usr/include/curl/types.h 642 | 643 | 644 | # 21. 645 | echo -e "\033[0;32;148m.............\033[39m" 646 | bash /etc/seedbox-from-scratch/installRTorrent $RTORRENT1 >> $logfile 2>&1 647 | 648 | ######### Below this /var/www/rutorrent/ has been replaced with /var/www/rutorrent for Ubuntu 14.04 649 | 650 | # 22. 651 | cd /var/www/ 652 | rm -f -r rutorrent 653 | svn checkout https://github.com/Novik/ruTorrent/trunk rutorrent >> $logfile 2>&1 654 | #svn checkout http://rutorrent.googlecode.com/svn/trunk/plugins 655 | #rm -r -f rutorrent/plugins 656 | #mv plugins rutorrent/ 657 | 658 | cp /etc/seedbox-from-scratch/action.php.template /var/www/rutorrent/plugins/diskspace/action.php 659 | 660 | groupadd admin 661 | 662 | echo "www-data ALL=(root) NOPASSWD: /usr/sbin/repquota" | tee -a /etc/sudoers > /dev/null 663 | 664 | cp /etc/seedbox-from-scratch/favicon.ico /var/www/ 665 | 666 | # 26. Installing Mediainfo from source 667 | apt-get install --yes mediainfo 668 | if [ $? -gt 0 ]; then 669 | cd /tmp 670 | wget http://downloads.sourceforge.net/mediainfo/MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 671 | tar jxvf MediaInfo_CLI_0.7.56_GNU_FromSource.tar.bz2 >> $logfile 2>&1 672 | cd MediaInfo_CLI_GNU_FromSource/ 673 | sh CLI_Compile.sh >> $logfile 2>&1 674 | cd MediaInfo/Project/GNU/CLI 675 | make install >> $logfile 2>&1 676 | fi 677 | 678 | cd /var/www/rutorrent/js/ 679 | git clone https://github.com/gabceb/jquery-browser-plugin.git >> $logfile 2>&1 680 | mv jquery-browser-plugin/dist/jquery.browser.js . 681 | rm -r -f jquery-browser-plugin 682 | sed -i '31i\ ' /var/www/rutorrent/index.html 683 | 684 | cd /var/www/rutorrent/plugins 685 | git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi >> $logfile 2>&1 686 | #cp autodl-irssi/_conf.php autodl-irssi/conf.php 687 | #svn co https://svn.code.sf.net/p/autodl-irssi/code/trunk/rutorrent/autodl-irssi/ 688 | cd autodl-irssi 689 | 690 | 691 | # 30. 692 | cp /etc/jailkit/jk_init.ini /etc/jailkit/jk_init.ini.original 693 | echo "" | tee -a /etc/jailkit/jk_init.ini >> /dev/null 694 | bash /etc/seedbox-from-scratch/updatejkinit 695 | 696 | # 31. ZNC 697 | #Have put this in script form 698 | 699 | # 32. Installing poweroff button on ruTorrent 700 | cd /var/www/rutorrent/plugins/ 701 | wget http://rutorrent-logoff.googlecode.com/files/logoff-1.0.tar.gz >> $logfile 2>&1 702 | tar -zxf logoff-1.0.tar.gz >> $logfile 2>&1 703 | rm -f logoff-1.0.tar.gz 704 | 705 | #33. Tuning Part - Let me know if you find more. 706 | echo "vm.swappiness=1" >>/etc/sysctl.conf 707 | echo "net.core.somaxconn = 1000" >>/etc/sysctl.conf 708 | echo "net.core.netdev_max_backlog = 5000" >>/etc/sysctl.conf 709 | echo "net.core.rmem_max = 16777216" >>/etc/sysctl.conf 710 | echo "net.core.wmem_max = 16777216" >>/etc/sysctl.conf 711 | echo "net.ipv4.tcp_wmem = 4096 12582912 16777216" >>/etc/sysctl.conf 712 | echo "net.ipv4.tcp_rmem = 4096 12582912 16777216" >>/etc/sysctl.conf 713 | echo "net.ipv4.tcp_max_syn_backlog = 8096" >>/etc/sysctl.conf 714 | echo "net.ipv4.tcp_slow_start_after_idle = 0" >>/etc/sysctl.conf 715 | echo "net.ipv4.tcp_tw_reuse = 1" >>/etc/sysctl.conf 716 | echo "net.ipv4.ip_local_port_range = 10240 65535" >>/etc/sysctl.conf 717 | echo "fs.file-max = 500000" >>/etc/sysctl.conf 718 | echo vm.min_free_kbytes=1024 >> /etc/sysctl.conf 719 | echo "session required pam_limits.so" >>/etc/pam.d/common-session 720 | echo "net.ipv4.tcp_low_latency=1" >> /etc/sysctl.conf 721 | echo "net.ipv4.tcp_sack = 1" >> /etc/sysctl.conf 722 | sysctl -p 723 | 724 | if [ -f /proc/user_beancounters ] || [ -d /proc/bc ]; then 725 | echo "Its a VPS, Nothing to do here, Continuing...." 726 | else 727 | sed -i "s/defaults 1 1/defaults,noatime 0 0/" /etc/fstab 728 | fi 729 | 730 | # Installing Filemanager and MediaStream 731 | rm -f -R /var/www/rutorrent/plugins/filemanager 732 | rm -f -R /var/www/rutorrent/plugins/fileupload 733 | rm -f -R /var/www/rutorrent/plugins/mediastream 734 | rm -f -R /var/www/stream 735 | echo -e "\033[0;32;148mNo kidding.... Did you make coffee ?\033[39m" 736 | cd /var/www/rutorrent/plugins/ 737 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/mediastream >> $logfile 2>&1 738 | 739 | cd /var/www/rutorrent/plugins/ 740 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/filemanager >> $logfile 2>&1 741 | 742 | cp /etc/seedbox-from-scratch/rutorrent.plugins.filemanager.conf.php.template /var/www/rutorrent/plugins/filemanager/conf.php 743 | 744 | mkdir -p /var/www/stream/ 745 | ln -s /var/www/rutorrent/plugins/mediastream/view.php /var/www/stream/view.php 746 | chown www-data: /var/www/stream 747 | chown www-data: /var/www/stream/view.php 748 | 749 | echo "" | tee /var/www/rutorrent/plugins/mediastream/conf.php > /dev/null 750 | 751 | # 32.2 # FILEUPLOAD 752 | cd /var/www/rutorrent/plugins/ 753 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileupload >> $logfile 2>&1 754 | chmod 775 /var/www/rutorrent/plugins/fileupload/scripts/upload 755 | apt-get --yes -f install >> $logfile 2>&1 756 | rm /var/www/rutorrent/plugins/unpack/conf.php 757 | # 32.2 758 | chown -R www-data:www-data /var/www/rutorrent 759 | chmod -R 755 /var/www/rutorrent 760 | 761 | #32.3 762 | perl -pi -e "s/\\\$topDirectory\, \\\$fm/\\\$homeDirectory\, \\\$topDirectory\, \\\$fm/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 763 | perl -pi -e "s/\\\$this\-\>userdir \= addslash\(\\\$topDirectory\)\;/\\\$this\-\>userdir \= \\\$homeDirectory \? addslash\(\\\$homeDirectory\) \: addslash\(\\\$topDirectory\)\;/g" /var/www/rutorrent/plugins/filemanager/flm.class.php 764 | perl -pi -e "s/\\\$topDirectory/\\\$homeDirectory/g" /var/www/rutorrent/plugins/filemanager/settings.js.php 765 | 766 | #32.4 767 | #unzip /etc/seedbox-from-scratch/rutorrent-oblivion.zip -d /var/www/rutorrent/plugins/ 768 | #echo "" | tee -a /var/www/rutorrent/css/style.css > /dev/null 769 | #echo "/* for Oblivion */" | tee -a /var/www/rutorrent/css/style.css > /dev/null 770 | #echo ".meter-value-start-color { background-color: #E05400 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 771 | #echo ".meter-value-end-color { background-color: #8FBC00 }" | tee -a /var/www/rutorrent/css/style.css > /dev/null 772 | #echo "::-webkit-scrollbar {width:12px;height:12px;padding:0px;margin:0px;}" | tee -a /var/www/rutorrent/css/style.css > /dev/null 773 | perl -pi -e "s/\$defaultTheme \= \"\"\;/\$defaultTheme \= \"Oblivion\"\;/g" /var/www/rutorrent/plugins/theme/conf.php 774 | git clone https://github.com/InAnimaTe/rutorrent-themes.git /var/www/rutorrent/plugins/theme/themes/Extra >> $logfile 2>&1 775 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/OblivionBlue /var/www/rutorrent/plugins/theme/themes/ 776 | cp -r /var/www/rutorrent/plugins/theme/themes/Extra/Agent46 /var/www/rutorrent/plugins/theme/themes/ 777 | rm -r /var/www/rutorrent/plugins/theme/themes/Extra 778 | #ln -s /etc/seedbox-from-scratch/seedboxInfo.php.template /var/www/seedboxInfo.php 779 | 780 | # 32.5 781 | cd /var/www/rutorrent/plugins/ 782 | rm -r /var/www/rutorrent/plugins/fileshare 783 | rm -r /var/www/share 784 | svn co http://svn.rutorrent.org/svn/filemanager/trunk/fileshare >> $logfile 2>&1 785 | mkdir /var/www/share 786 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/share.php 787 | ln -s /var/www/rutorrent/plugins/fileshare/share.php /var/www/share/index.php 788 | chown -R www-data:www-data /var/www/share 789 | cp /etc/seedbox-from-scratch/rutorrent.plugins.fileshare.conf.php.template /var/www/rutorrent/plugins/fileshare/conf.php 790 | perl -pi -e "s//$IPADDRESS1/g" /var/www/rutorrent/plugins/fileshare/conf.php 791 | 792 | mv /etc/seedbox-from-scratch/unpack.conf.php /var/www/rutorrent/plugins/unpack/conf.php 793 | 794 | # 33. 795 | echo -e "\033[0;32;148m.................\033[39m" 796 | bash /etc/seedbox-from-scratch/updateExecutables >> $logfile 2>&1 797 | 798 | #34. 799 | echo $SBFSCURRENTVERSION1 > /etc/seedbox-from-scratch/version.info 800 | echo $NEWFTPPORT1 > /etc/seedbox-from-scratch/ftp.info 801 | echo $NEWSSHPORT1 > /etc/seedbox-from-scratch/ssh.info 802 | echo $OPENVPNPORT1 > /etc/seedbox-from-scratch/openvpn.info 803 | 804 | # 36. 805 | wget -P /usr/share/ca-certificates/ --no-check-certificate https://certs.godaddy.com/repository/gd_intermediate.crt https://certs.godaddy.com/repository/gd_cross_intermediate.crt 806 | update-ca-certificates 807 | c_rehash 808 | 809 | sleep 2 810 | 811 | # 96. 812 | if [ "$INSTALLOPENVPN1" = "YES" ]; then 813 | bash /etc/seedbox-from-scratch/installOpenVPN 814 | fi 815 | 816 | if [ "$INSTALLSABNZBD1" = "YES" ]; then 817 | bash /etc/seedbox-from-scratch/installSABnzbd 818 | fi 819 | 820 | if [ "$INSTALLRAPIDLEECH1" = "YES" ]; then 821 | bash /etc/seedbox-from-scratch/installRapidleech 822 | fi 823 | 824 | if [ "$INSTALLDELUGE1" = "YES" ]; then 825 | bash /etc/seedbox-from-scratch/installDeluge 826 | fi 827 | 828 | sleep 1 829 | 830 | # 97. First user will not be jailed 831 | echo -e "\033[0;32;148mLeave it now, About to Finish........\033[39m" 832 | # createSeedboxUser 833 | bash /etc/seedbox-from-scratch/createSeedboxUser $NEWUSER1 $PASSWORD1 YES YES YES NO >> $logfile 2>&1 834 | 835 | #Loadavg 836 | cd ~ 837 | git clone https://github.com/loadavg/loadavg.git >> $logfile 2>&1 838 | cd loadavg 839 | cd ~ 840 | mv loadavg /var/www/ 841 | cd /var/www/loadavg 842 | chmod 777 configure 843 | ./configure >> $logfile 2>&1 844 | 845 | echo -e "\033[0;32;148mFinishing Now .... .... .... ....\033[39m" 846 | wget http://www.rarlab.com/rar/unrarsrc-5.3.8.tar.gz 847 | tar -xvf unrarsrc-5.3.8.tar.gz 848 | cd unrar 849 | sudo make -f makefile 850 | sudo install -v -m755 unrar /usr/bin 851 | cd .. 852 | rm -R unrar 853 | rm unrarsrc-5.3.8.tar.gz 854 | 855 | cd ~ 856 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/m/m/magic/magic.zip >> $logfile 2>&1 857 | unzip magic.zip >> $logfile 2>&1 858 | mv default.sfx rarreg.key /usr/local/lib/ 859 | rm magic.zip 860 | 861 | cd /var/www 862 | chown -R www-data:www-data /var/www/rutorrent 863 | chown -R www-data:www-data /var/www/loadavg 864 | chmod -R 755 /var/www/rutorrent 865 | cd 866 | git clone https://github.com/mcrapet/plowshare.git plowshare >> $logfile 2>&1 867 | cd ~/plowshare 868 | make install >> $logfile 2>&1 869 | cd 870 | rm -r plowshare 871 | 872 | export EDITOR=nano 873 | # 100 874 | cd /var/www/rutorrent/plugins 875 | sleep 1 876 | rm -frv diskspace 877 | wget --no-check-certificate https://bintray.com/artifact/download/hectortheone/base/pool/main/b/base/hectortheone.rar >> $logfile 2>&1 878 | #wget http://dl.bintray.com/novik65/generi...ace-3.6.tar.gz 879 | #tar -xf diskspace-3.6.tar.gz 880 | unrar x hectortheone.rar >> $logfile 2>&1 881 | #rm diskspace-3.6.tar.gz 882 | rm hectortheone.rar 883 | cd quotaspace 884 | chmod 755 run.sh 885 | cd .. 886 | perl -pi -e "s/100/1024/g" /var/www/rutorrent/plugins/throttle/throttle.php 887 | #wget --no-check-certificate http://cheapseedboxes.com/trafic_check.rar >> $logfile 2>&1 888 | #unrar x trafic_check.rar >> $logfile 2>&1 889 | #rm trafic_check.rar 890 | #wget --no-check-certificate http://cheapseedboxes.com/plimits.rar >> $logfile 2>&1 891 | #unrar x plimits.rar >> $logfile 2>&1 892 | #rm plimits.rar 893 | #cd .. 894 | chown -R www-data:www-data /var/www/rutorrent 895 | 896 | 897 | if [ "$OSV11" = "8" ]; then 898 | systemctl enable apache2 899 | service apache2 start 900 | fi 901 | #set +x verbose 902 | clear 903 | 904 | echo "" 905 | echo -e "\033[0;32;148m<<< The Seedbox From Scratch Script >>>\033[39m" 906 | echo -e "\033[0;32;148mScript Modified by dannyti ---> https://github.com/dannyti/\033[39m" 907 | echo "" 908 | echo "Looks like everything is set." 909 | echo "" 910 | echo "Remember that your SSH port is now ======> $NEWSSHPORT1 " 911 | echo "" 912 | echo "Your Login info can also be found at https://$IPADDRESS1/private/SBinfo.txt" 913 | echo "Download Data Directory is located at https://$IPADDRESS1/private " 914 | echo "To install ZNC, run installZNC from ssh as main user" 915 | echo "" 916 | echo "IMPORTANT NOTE: Refresh rutorrent for Throttle plugin to load properly" 917 | echo "" 918 | echo "System will reboot now, but don't close this window until you take note of the port number: $NEWSSHPORT1" 919 | echo "" 920 | #echo -e "\033[0;32;148mPlease login as main user and only then close this Window\033[39m" 921 | 922 | reboot 923 | 924 | ##################### LAST LINE ########### 925 | 926 | -------------------------------------------------------------------------------- /startznc: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | user1="USERNAME" 3 | line1="@reboot ~/znc/bin/znc >/dev/null 2>&1" 4 | (crontab -u "$user1" -l; echo "$line1" ) | crontab -u "$user1" - 5 | -------------------------------------------------------------------------------- /trial 0.9.4: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ------------------------------------------------------------------------------ 4 | # redtorrent.sh 5 | # Script to install the newest rTorrent and (optionally) ruTorrent front-end 6 | # Should work out-of-the-box on Debian and Ubuntu systems 7 | # 8 | # Call it with the user who will run rTorrent as an argument. Like this: 9 | # sudo sh redtorrent.sh 10 | # 11 | # Made by kabeleon 12 | # License: none (public domain) 13 | # ------------------------------------------------------------------------------ 14 | 15 | 16 | # Settings 17 | # For enable/disable settings: "0" to disable, any other value to enable 18 | 19 | # User who will run rTorrent 20 | USER="$1" 21 | # Command to use to install packages from the repo's 22 | PINSTALL="aptitude -y install" 23 | # Build packages using checkinstall? 24 | CHECKINSTALL="1" 25 | # Type of pacakge to build with checkinstall 26 | # Valid options are "slackware", "rpm" and "debian" 27 | # Not relevant if CHECKINSTALL isn't enabled 28 | PAK_TYPE="debian" 29 | # rTorrent version to install 30 | # libTorrent version will be chosen accordingly 31 | # Valid options are "0.9.3" and "0.9.4" 32 | RTVERSION="0.9.4" 33 | # Whether libTorrent should be built with atomic operations 34 | # Disable if you don't have GCC version 4.7 or newer 35 | # Not relevant if RTVERSION isn't set to "0.9.4" 36 | ATOMIC="1" 37 | # Install Apache + PHP5? 38 | # Only disable if you already have a different webserver setup 39 | APACHE="1" 40 | # Webserver root dir 41 | WEBROOT="/var/www" 42 | # Install ruTorrent? 43 | RUTORRENT="1" 44 | # Install ruTorrent plugins? 45 | # This will also install dependencies for the plugins 46 | # Not relevant if RUTORRENT isn't enabled 47 | RUTORRENT_PLUGINS="1" 48 | # Which ruTorrent RPC plugin? 49 | # Use "RPC" or "HTTPRPC" - any other value for native SCGI 50 | # If RUTORRENT_PLUGINS isn't enabled, native SCGI will be used 51 | RUTORRENT_RPC="HTTPRPC" 52 | # User owner of the website 53 | # Not relevant if RUTORRENT isn't enabled 54 | WUSER="$USER" 55 | # Group owner of the website 56 | # Not relevant if RUTORRENT isn't enabled 57 | WGROUP="www-data" 58 | # Permissions (chmod) for the website 59 | # Not relevant if RUTORRENT isn't enabled 60 | WPERM="770" 61 | # Init var for USER's home dir (do NOT change this one) 62 | USER_HOME=$(awk -F ":" "/^${USER}:/ {print \$6}" /etc/passwd) 63 | 64 | 65 | # Functions 66 | 67 | set -e 68 | 69 | exit_trap() { 70 | printf "\nExiting with status code ${?}.\n" 71 | rm -rf "${USER_HOME}/redtorrent" 72 | } 73 | trap exit_trap EXIT 74 | 75 | # Check if script is being run as root 76 | if [ "$(id -u)" != "0" ]; then 77 | printf "This script must be run as root." 78 | exit 1 79 | fi 80 | 81 | # Check if a valid user has been specified 82 | if [ -z "$USER" ]; then 83 | printf "Please specify a user." 84 | exit 1 85 | else 86 | USER_ID=$(awk -F ":" "/^${USER}:/ {print \$3}" /etc/passwd) 87 | 88 | if [ -z "$USER_ID" -o "$USER_ID" = "0" ]; then 89 | printf "Please specify a valid user." 90 | exit 1 91 | fi 92 | fi 93 | 94 | # If ruTorrent is to be installed, also check RUSER and RGROUP 95 | if [ "$RUTORRENT" != "0" ]; then 96 | if [ -z "$WUSER" ]; then 97 | printf "Please specify a website user owner." 98 | exit 1 99 | else 100 | WUSER_ID=$(awk -F ":" "/^${WUSER}:/ {print \$3}" /etc/passwd) 101 | 102 | if [ -z "$WUSER_ID" ]; then 103 | printf "Please specify a valid website user owner." 104 | exit 1 105 | fi 106 | fi 107 | 108 | if [ -z "$WGROUP" ]; then 109 | printf "Please specify a group." 110 | exit 1 111 | else 112 | WGID=$(awk -F ":" "/^${WGROUP}:/ {print \$3}" /etc/group) 113 | 114 | if [ -z "$WGID" ]; then 115 | printf "Please specify a valid website group owner." 116 | exit 1 117 | fi 118 | fi 119 | fi 120 | 121 | # Install dependencies 122 | eval "$PINSTALL build-essential automake pkg-config libcppunit-dev libtool \ 123 | libssl-dev libc-ares-dev libssh2-1-dev libidn11-dev \ 124 | subversion libxml2-dev \ 125 | libncurses5-dev \ 126 | dos2unix" 127 | 128 | if [ "$RTVERSION" = "0.9.4" ]; then 129 | LTVERSION="0.13.4" 130 | elif [ "$RTVERSION" = "0.9.3" ]; then 131 | eval "$PINSTALL libsigc++-2.0-dev" 132 | LTVERSION="0.13.3" 133 | else 134 | printf "Please specify a valid rTorrent version (0.9.3 or 0.9.4)." 135 | exit 1 136 | fi 137 | 138 | # If CHECKINSTALL is set, install the pacakage 139 | if [ "$CHECKINSTALL" != "0" ]; then 140 | eval "$PINSTALL checkinstall" 141 | fi 142 | 143 | export LTVERSION RTVERSION ATOMIC 144 | 145 | # Download and build rTorrent dependencies (as USER) 146 | su $USER << "build_dep" 147 | 148 | set -e 149 | 150 | # Create temp dir 151 | mkdir ~/redtorrent 152 | cd ~/redtorrent 153 | 154 | # libcurl/cURL 155 | wget http://curl.haxx.se/download/curl-7.37.0.tar.gz 156 | tar xzf curl-7.37.0.tar.gz 157 | cd curl-7.37.0 158 | ./buildconf 159 | ./configure --enable-ares --enable-tls-srp --with-zlib --with-ssl --with-libssh2 --with-libidn 160 | make 161 | cd .. 162 | 163 | # XMLRPC-C 164 | svn checkout https://svn.code.sf.net/p/xmlrpc-c/code/stable/ xmlrpc-c 165 | cd xmlrpc-c 166 | ./configure --enable-libxml2-backend --disable-abyss-server --disable-cgi-server 167 | make 168 | cd .. 169 | 170 | # libTorrent 171 | wget http://libtorrent.rakshasa.no/downloads/libtorrent-"$LTVERSION".tar.gz 172 | tar xzf libtorrent-"$LTVERSION".tar.gz 173 | cd libtorrent-"$LTVERSION" 174 | ./autogen.sh 175 | if [ "$LTVERSION" = "0.13.4" -a "$ATOMIC" = "0" ]; then 176 | ./configure --disable-instrumentation --with-posix-fallocate 177 | else 178 | ./configure --with-posix-fallocate 179 | fi 180 | make 181 | cd .. 182 | 183 | build_dep 184 | 185 | cd ${USER_HOME}/redtorrent 186 | 187 | # Install dependencies 188 | if [ "$CHECKINSTALL" != "0" ]; then 189 | # libcurl/cURL 190 | cd curl-7.37.0 191 | printf "command line library + tool for transferring data with URL syntax" > "description-pak" 192 | checkinstall \ 193 | --default \ 194 | --type="$PAK_TYPE" \ 195 | --pkgname="curl" \ 196 | --pkgversion="7.37.0" \ 197 | --fstrans="no" \ 198 | --install="yes" \ 199 | make install 200 | cd .. 201 | 202 | # XMLRPC-C 203 | cd xmlrpc-c 204 | printf "lightweight RPC library based on XML and HTTP" > "description-pak" 205 | VERSIONP1=$(awk "/^XMLRPC_MAJOR_RELEASE/ {print \$3}" version.mk) 206 | VERSIONP2=$(awk "/^XMLRPC_MINOR_RELEASE/ {print \$3}" version.mk) 207 | VERSIONP3=$(awk "/^XMLRPC_POINT_RELEASE/ {print \$3}" version.mk) 208 | checkinstall \ 209 | --default \ 210 | --type="$PAK_TYPE" \ 211 | --pkgname="xmlrpc-c" \ 212 | --pkgversion="${VERSIONP1}.${VERSIONP2}.${VERSIONP3}" \ 213 | --fstrans="no" \ 214 | --install="yes" \ 215 | make install 216 | cd .. 217 | 218 | # libTorrent 219 | cd libtorrent-"$LTVERSION" 220 | printf "BitTorrent library by Rakshasa" > "description-pak" 221 | checkinstall \ 222 | --default \ 223 | --type="$PAK_TYPE" \ 224 | --pkgname="libtorrent" \ 225 | --pkgversion="$LTVERSION" \ 226 | --fstrans="no" \ 227 | --install="yes" \ 228 | make install 229 | cd .. 230 | else 231 | cd curl-7.37.0 232 | make install 233 | cd .. 234 | cd xmlrpc-c 235 | make install 236 | cd .. 237 | cd libtorrent-"$LTVERSION" 238 | make install 239 | cd .. 240 | fi 241 | 242 | ldconfig 243 | 244 | # Download and build rTorrent (as USER) 245 | su $USER << "build_main" 246 | 247 | set -e 248 | 249 | cd ~/redtorrent 250 | 251 | # rTorrent 252 | wget http://libtorrent.rakshasa.no/downloads/rtorrent-"$RTVERSION".tar.gz 253 | tar xzf rtorrent-"$RTVERSION".tar.gz 254 | cd rtorrent-"$RTVERSION" 255 | ./autogen.sh 256 | ./configure --with-xmlrpc-c 257 | make 258 | cd .. 259 | 260 | # Download rTorrent config file template 261 | wget http://pastebin.com/raw.php?i=CkvtrH3L -O ~/.rtorrent.rc 262 | dos2unix ~/.rtorrent.rc 263 | 264 | build_main 265 | 266 | # Install rTorrent 267 | if [ "$CHECKINSTALL" != "0" ]; then 268 | # rTorrent 269 | cd rtorrent-"$RTVERSION" 270 | printf "BitTorrent client based on libTorrent by Rakshasa" > "description-pak" 271 | checkinstall \ 272 | --default \ 273 | --type="$PAK_TYPE" \ 274 | --pkgname="rtorrent" \ 275 | --pkgversion="$RTVERSION" \ 276 | --fstrans="no" \ 277 | --install="yes" \ 278 | make install 279 | cd .. 280 | else 281 | cd rtorrent-"$RTVERSION" 282 | make install 283 | cd .. 284 | fi 285 | 286 | ldconfig 287 | 288 | # Install and configure Apache if needed 289 | if [ "$APACHE" != "0" ]; then 290 | eval "$PINSTALL libapache2-mod-php5 libapache2-mod-scgi" 291 | 292 | printf "SCGIMount /RPC2 127.0.0.1:5000" > /etc/apache2/conf.d/rtorrent.conf 293 | a2enmod scgi 294 | fi 295 | 296 | # Install ruTorrent if needed 297 | if [ "$RUTORRENT" != "0" ]; then 298 | cd "${WEBROOT}" 299 | svn checkout http://rutorrent.googlecode.com/svn/trunk 300 | rm -rf trunk/rutorrent/plugins/ 301 | mv trunk/rutorrent/ /var/www/ 302 | 303 | # Install ruTorrent plugins if needed 304 | if [ "$RUTORRENT_PLUGINS" != "0" ]; then 305 | # Install dependencies 306 | eval "$PINSTALL unzip unrar-free php5-cli ffmpeg mediainfo" 307 | 308 | mv trunk/plugins/ /var/www/rutorrent/ 309 | 310 | # Configure ruTorrent and/or Apache to use the RPC plugin, the HTTPRPC plugin or native SCGI 311 | case "$RUTORRENT_RPC" in 312 | "RPC") 313 | printf "\n[httprpc]\nenabled = no\n[rpc]\nenabled = yes" >> "${WEBROOT}/rutorrent/conf/plugins.ini" 314 | rm /etc/apache2/conf.d/rtorrent.conf 315 | a2dismod scgi 316 | ;; 317 | "HTTPRPC") 318 | printf "\n[httprpc]\nenabled = yes\n[rpc]\nenabled = no" >> "${WEBROOT}/rutorrent/conf/plugins.ini" 319 | rm /etc/apache2/conf.d/rtorrent.conf 320 | a2dismod scgi 321 | ;; 322 | *) 323 | printf "\n[httprpc]\nenabled = no\n[rpc]\nenabled = no" >> "${WEBROOT}/rutorrent/conf/plugins.ini" 324 | esac 325 | fi 326 | 327 | rm -rf /var/www/trunk/ 328 | 329 | # Change ownerships and permissions 330 | chown -R ${WUSER_ID}:${WGID} "${WEBROOT}/rutorrent" 331 | chmod -R $WPERM "${WEBROOT}/rutorrent" 332 | fi 333 | 334 | if [ "$APACHE" != "0" ]; then 335 | service apache2 restart 336 | else 337 | if [ "$RUTORRENT" != "0" ]; then printf "Please restart your web server.\n"; fi 338 | fi 339 | 340 | printf "Finished. I recommend you to configure rTorrent now by editing the .rtorrent.rc file (located in you home dir)." 341 | --------------------------------------------------------------------------------