Advertisement
Guest User

Untitled

a guest
Aug 6th, 2012
2,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.03 KB | None | 0 0
  1. This guide assumes a few things:
  2. - Ubuntu 10.04
  3. - You are connecting via Putty
  4. - After you are done editing via nano you know to hit Ctrl-O, Enter, Ctrl-X
  5. - This is on a remote server by OVH, Leasweb, etc... and you have root access
  6. - You are not retarded and can follow insructions :)
  7. - You know this will not setup all configurations for your specific site and/or your sources. This is a stepping stone.
  8. - You do not have to do all of the things in this guide if you do not want to. Pick and choose if youd like.
  9.  
  10. This guide shows you how to setup and configure for:
  11. - Setup root password, Delete Authorized Keys, Update System
  12. - Add user tup, Set visudo permissions
  13. - SSH setup
  14. - Windows Auto Logon SSH Tunnel
  15. - Install Packages
  16. - Setup tinyproxy (Proxy server to hide your IP, and this setup does so as Anonymous)
  17. - Ubuntu Desktop - Gnome No Recommended Packages
  18. - FreeNX
  19. - CPAN (for tuper client)
  20. - Tuper Client
  21. - rTorrent - libtorrent - xmlrpc
  22. - ruTorrent
  23. - Apache
  24. - Webmin
  25. - FTP (SFTP only)
  26. - Linux Firewall
  27. - Fail2Ban
  28.  
  29. - This guide is just an edit to a thread I made on T-I, I just added Jans Wiki to it for the auto uploader.
  30. - This guide is for those having troubles understanding how servers work and/or are new to Linux.
  31. - There are many, many ways to configure a server with the packages in this guide. If you have a better/newer/easier way for any of them leave a comment and maybe it will replace mine.
  32. - ...and lastly I hope this helps most n00bs in setting up thier servers and getting that much closer to learning how tuper works.
  33. - I lied....and now lastly....Thank You Jans for the awesome uploader, and to dent and all other who help out as well in forums in problem solving/reporting. :)
  34.  
  35. Now....On with the show....
  36.  
  37. #Setup root password, Delete Authorized Keys, Update System
  38. - sudo passwd
  39. - ls .ssh/authorized_keys2
  40. - rm .ssh/authorized_keys2
  41. - apt-get update && apt-get upgrade
  42. - apt-get clean && apt-get autoclean
  43.  
  44. #Add user tup, Set visudo permissions
  45. - adduser tup
  46. - visudo
  47. root ALL=(ALL) ALL
  48. tup ALL=(ALL) NOPASSWD: ALL
  49. www-data ALL=(ALL) NOPASSWD: ALL
  50. nx ALL=(ALL) NOPASSWD: ALL
  51.  
  52. #SSH setup
  53. - sudo nano /etc/ssh/sshd_config
  54. Port 22002
  55. Protocol 2
  56. PermitRootLogin no
  57. X11Forwarding no
  58. UseDNS no
  59. AllowUsers tup
  60. - sudo service ssh reload
  61.  
  62. #Windows Auto Logon SSH Tunnel
  63.  
  64. - MyEnTunnel
  65.  
  66. On your Windows machine open your internet browser and go to
  67. http://nemesis2.qx.net/pages/MyEnTunnel
  68. Scroll down and download the latest Stable version.
  69.  
  70. -Install it as Windows Service
  71. -Open MyEnTunnel
  72. -Click the settings tab
  73. -Set your settings as if it were Putty
  74. SSH Server = <Server IP address>
  75. SSH Port = <Servers SSH Port>
  76. Username = <Your Normal User on the Server>
  77. Passphrase = <Your Normal User's Password on the Server>
  78. Port = <Whatever port you want your tunnel to be under. I set mine to the same as the SSH Port on the server for less confusion>
  79. -Check mark whatever boxes youd like. Enable Dynamic Socks MUST be checked.
  80.  
  81. Other notable ones would be:
  82.  
  83. Connect on Startup
  84. Reconnect on Failure
  85. Infinite Retry Attempts
  86.  
  87. -Click Connect, and after it has connected click Save, and then Hide. Now it is in your systray, and will always auto reconnect if dropped.
  88. -Any program you want to use this tunnel (Firefox, uTorrent, mIRC, etc...) you must set it to use a SOCKS5 proxy with the IP address of 127.0.0.1 and the Port for
  89.  
  90. whatever you chose MyEnTunnel to use.
  91.  
  92. #Install Packages
  93. - sudo apt-get update && sudo apt-get upgrade
  94. - sudo apt-get clean && sudo apt-get autoclean
  95. - sudo apt-get install apache2 apache2.2-common apache2-utils aptitude apt-show-versions autoconf automake autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev cpp cpp-4.1 curl dpkg-dev fail2ban file firestarter g++ g++-4.1 gawk gcc gcc-4.1 git-core htop irssi libapache2-mod-php5 libapache2-mod-scgi libapr1 libaprutil1 libapt-pkg-perl libauthen-pam-perl libc6-dev libcppunit-dev libcurl3 libcurl4-openssl-dev libexpat1 libexpat1-dev libidn11 libidn11-dev libkdb5-4 libgssrpc4 libkrb5-dev libmagic1 libncurses5 libncurses5-dev libncursesw5-dev libneon26 libnet-ssleay-perl libpam-runtime libio-pty-perl libpcre3 libpq5 libsigc++-2.0-dev libsqlite0 libsqlite3-0 libssl-dev libssp0-dev libstdc++6-4.1-dev libsvn1 libtool libwww-perl libxml2 libxml-parser-perl linux-libc-dev lynx m4 make mktorrent mime-support ntp ntpdate openssl patch perl perl-base perl-modules php5 php5-cgi php5-cli php5-common php5-curl php5-dev php5-geoip php5-sqlite php5-xmlrpc pkg-config python python-minimal python-scgi rar screen sqlite ssl-cert subversion tinyproxy ucf unrar unzip zlib1g-dev
  96.  
  97. #Setup tinyproxy
  98. - sudo apt-get update && sudo apt-get upgrade
  99. - sudo apt-get clean && sudo apt-get autoclean
  100. - sudo nano /etc/tinyproxy.conf
  101. Port 32002
  102. BindSame yes
  103. ErrorFile 404 "/usr/share/tinyproxy/404.html"
  104. ErrorFile 400 "/usr/share/tinyproxy/400.html"
  105. ErrorFile 503 "/usr/share/tinyproxy/503.html"
  106. ErrorFile 403 "/usr/share/tinyproxy/403.html"
  107. ErrorFile 408 "/usr/share/tinyproxy/408.html"
  108. LogLevel Critical
  109. XTinyproxy No
  110. Allow 127.0.0.1
  111. Allow XXX.XXX.XXX.XXX
  112. DisableViaHeader Yes
  113. #ConnectPort 443
  114. #ConnectPort 563
  115. - sudo service tinyproxy start
  116.  
  117. #Ubuntu Desktop - Gnome No Recommended Packages
  118. - sudo apt-get update && sudo apt-get upgrade
  119. - sudo apt-get clean && sudo apt-get autoclean
  120. - sudo aptitude install --without-recommends ubuntu-desktop
  121.  
  122. #FreeNX
  123. - sudo apt-get update && sudo apt-get upgrade
  124. - sudo apt-get clean && sudo apt-get autoclean
  125. - sudo add-apt-repository ppa:freenx-team
  126. - sudo apt-get install python-software-properties
  127. - sudo apt-get install freenx
  128. - wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
  129. - tar xvf nxsetup.tar.gz
  130. sudo cp nxsetup /usr/lib/nx/nxsetup
  131. - sudo /usr/lib/nx/nxsetup --install
  132.  
  133. Now install NXclient on your home machine and connect through your SSH port
  134. #Unlimited Open Files
  135. - su root
  136. - nano /etc/pam.d/su
  137. session required pam_limits.so
  138. - nano /etc/security/limits.conf
  139.  
  140. soft nofile 100000
  141. hard nofile 100000
  142. -reboot
  143.  
  144. #CPAN
  145. -sudo cpan
  146.  
  147. Hit Enter when asked to accept defaults
  148.  
  149. -force install Config::Tiny Convert::Bencode Date::Parse DBI DBD::SQLite Digest::SHA1 HTML::Strip IO::Async IO::Async::SSL JSON::XS Net::BitTorrent::File PAR URI::Escape WWW::Curl XML::RPC XML::Simple String::CRC32 Encode LWP LWP::UserAgent LWP::Protocol::https HTTP::Cookies HTTP::Cookies::Netscape HTTP::Request HTTP::Request::Common URI Net::RTorrent::Socket ExtUtils::Constant Socket
  150.  
  151. Hit Enter to accept and install and other dependency modules when asked
  152.  
  153. -exit
  154.  
  155. #Tuper Client
  156. - cd /home/tup
  157. - svn co https://svn.janhouse.lv/repos/tuper-v3/trunk/tuper/ tuper/
  158. - svn co https://svn.janhouse.lv/repos/tuper-v3/trunk/web_panel/ www/web_panel/
  159. - svn co https://svn.janhouse.lv/repos/tuper-v3/trunk/browser_plugin/ www/browser_plugin/
  160.  
  161. When asked for SVN user and pass enter them.
  162. Store them if youd like as well.
  163.  
  164. - mkdir storage
  165. - cd storage && mkdir store watch1 watch2 && cd ~
  166. - mkdir .session1 .session2 downloads
  167. - cd tuper
  168. - mv default.tuper.conf tuper.conf
  169. - mv default.tuper.db ../storage/tuper.db
  170. - mv default.tuper.filter.conf tuper.filter.conf
  171. - cd ../www/web_panel
  172. - mv default.config.inc.php config.inc.php
  173. - cd ../browser_plugin
  174. - mv default.upload_plugin_config.php upload_plugin_config.php
  175. - nano upload_plugin_config.php
  176.  
  177. Change the password to something storng, for example:
  178. $access_key="EK&fY308VfdP";
  179.  
  180. - nano /home/tup/tuper/tuper.conf
  181.  
  182. Add your username and key given to you by Jans:
  183. username=
  184. key=
  185.  
  186. #rTorrent - libtorrent - xmlrpc
  187. - cd ~ && mkdir apps && cd apps
  188. - svn co https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/advanced xmlrpc-c
  189. - wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.2.tar.gz
  190. - wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.2.tar.gz
  191. - tar zxfv libtorrent-0.13.2.tar.gz
  192. - tar zxfv rtorrent-0.9.2.tar.gz
  193. - cd xmlrpc-c
  194. - ./configure && make && sudo make install
  195. - cd ../libtorrent-0.13.2
  196. - ./configure && make && sudo make install
  197. - cd ../rtorrent-0.9.2
  198. - ./configure --with-xmlrpc-c && make && sudo make install
  199. - sudo ldconfig && cd ..
  200. - rm *.tar.gz
  201. - cd ~ && mkdir rtorrent && cd rtorrent
  202. - mkdir .session downloads torrents
  203. - cd ~ && nano .rtorrent.rc
  204. #bind = 127.0.0.1
  205. #ip = 127.0.0.1
  206. encryption=allow_incoming,try_outgoing,enable_retry
  207. upload_rate = 30000
  208. download_rate = 95000
  209. use_udp_trackers = no
  210.  
  211. min_peers = 500
  212. max_peers = 500
  213. min_peers_seed = 100
  214. max_peers_seed = 500
  215. max_uploads = 300
  216.  
  217. directory = /home/tup/downloads/
  218. session = /home/tup/.session1/
  219.  
  220. schedule = watch_directory,5,5,load_start=/home/tup/storage/watch1/*.torrent
  221. schedule = tied_directory,5,5,start_tied=
  222. schedule = untied_directory,5,5,close_untied=
  223.  
  224. system.method.set_key = event.download.inserted_new,mark_start,"execute=/home/tup/tuper/tuper.sh,astatus,started,$d.get_hash="
  225. system.method.set_key = event.download.finished,mark_fin,"execute=/home/tup/tuper/tuper.sh,astatus,uploaded,$d.get_hash="
  226. system.method.set_key = event.download.finished,notify_me,"execute=/home/tup/tuper/tuper.sh,aupload,$d.get_hash="
  227. system.method.set_key = event.download.erased,mark_erase,"execute=/home/tup/tuper/tuper.sh,adel,down,$d.get_hash="
  228.  
  229. port_range = 21006-21010
  230. check_hash = no
  231. encryption = allow_incoming,enable_retry,prefer_plaintext
  232.  
  233. #hash_read_ahead = 8
  234. #hash_max_tries = 5
  235. #hash_interval = 10
  236.  
  237. Enable the default ratio group.
  238. ratio.enable=
  239.  
  240. Change the limits, the defaults should be sufficient.
  241. ratio.min.set=120
  242. ratio.max.set=200
  243. ratio.upload.set=20M
  244.  
  245. Changing the command triggered when the ratio is reached.
  246. system.method.set = group.seeding.ratio.command, d.erase=
  247.  
  248. scgi_port = localhost:5000
  249. #scgi_local = /home/tup/rpc.socket
  250.  
  251. dht = disable
  252.  
  253. peer_exchange = no
  254.  
  255. - nano .rtorrent2.rc
  256. #bind = 127.0.0.1
  257. #ip = 127.0.0.1
  258. encryption=allow_incoming,try_outgoing,enable_retry
  259. upload_rate = 95000
  260. download_rate = 15000
  261. use_udp_trackers = no
  262.  
  263. min_peers = 500
  264. max_peers = 500
  265. min_peers_seed = 500
  266. max_peers_seed = 500
  267. max_uploads = 500
  268.  
  269. directory = /home/tup/downloads/
  270. session = /home/tup/.session2/
  271.  
  272. schedule = watch_directory,5,5,load_start=/home/tup/storage/watch2/*.torrent
  273. schedule = tied_directory,5,5,start_tied=
  274. schedule = untied_directory,5,5,close_untied=
  275.  
  276. system.method.set_key = event.download.inserted_new,mark_seeded,"execute=/home/tup/tuper/tuper.sh,astatus,seeded,$d.get_hash="
  277. system.method.set_key = event.download.erased,mark_erase,"execute=/home/tup/tuper/tuper.sh,adel,up,$d.get_hash="
  278.  
  279. port_range = 21001-21005
  280. check_hash = no
  281. encryption = allow_incoming,enable_retry,prefer_plaintext
  282.  
  283. #hash_read_ahead = 8
  284. #hash_max_tries = 5
  285. #hash_interval = 10
  286.  
  287. Enable the default ratio group.
  288. #ratio.enable=
  289.  
  290. Change the limits, the defaults should be sufficient.
  291. ratio.min.set=850
  292. ratio.max.set=1200
  293. ratio.upload.set=250M
  294.  
  295. Changing the command triggered when the ratio is reached.
  296. system.method.set = group.seeding.ratio.command, d.erase=
  297.  
  298. scgi_port = localhost:5001
  299. #scgi_local = /home/tup/rpc.socket
  300.  
  301. dht = disable
  302.  
  303. peer_exchange = no
  304. - screen dmS rtorrent1 rtorrent -n -o import=~/.rtorrent.rc
  305. screen -dmS rtorrent2 rtorrent -n -o import=~/.rtorrent2.rc
  306.  
  307. #ruTorrent
  308. - cd ~ && mkdir www && cd www
  309. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/rutorrent
  310. - mv rutorrent rtorrent1
  311. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/rutorrent
  312. - mv rutorrent rtorrent2
  313. - cd rtorrent1/plugins
  314. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/throttle
  315. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/ratio
  316. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Diskspace
  317. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Source
  318. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Data
  319. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Cpuload
  320. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Theme
  321. - sudo svn co http://rutorrent.googlecode.com/svn/trunk/plugins/Data
  322. - cd ../ && cp -R plugins /home/tup/www/rtorrent2/
  323.  
  324. #Set permissions
  325. - cd ~ && sudo chown R tup:tup /home/tup
  326. cd ~ && sudo chown -R www-data:www-data www && sudo chmod -R 777 rutorrent
  327.  
  328. #Apache
  329. - sudo a2enmod ssl
  330. - sudo a2enmod auth_digest
  331. - sudo a2enmod scgi
  332. - sudo nano /etc/apache2/apache2.conf
  333.  
  334. Add these lines lines at the end:
  335. SCGIMount /rt1 127.0.0.1:5000
  336. SCGIMount /rt2 127.0.0.1:5001
  337. servername localhost
  338. - openssl req $@ new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
  339. chmod 600 /etc/apache2/apache.pem
  340. - sudo htdigest c /etc/apache2/passwords gods tup
  341. sudo nano /etc/apache2/sites-available/default
  342.  
  343. Replace all instances of <servername or IP> with your real servername or IP
  344.  
  345. <VirtualHost *:80>
  346. ServerAdmin webmaster@localhost
  347.  
  348. DocumentRoot /home/tup/www/
  349. <Directory />
  350. Options FollowSymLinks
  351. AllowOverride None
  352. </Directory>
  353. <Directory /home/tup/www/>
  354. Options Indexes FollowSymLinks MultiViews
  355. AllowOverride None
  356. Order allow,deny
  357. allow from all
  358. </Directory>
  359.  
  360. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  361. <Directory "/usr/lib/cgi-bin">
  362. AllowOverride None
  363. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  364. Order allow,deny
  365. Allow from all
  366. </Directory>
  367.  
  368. ErrorLog /var/log/apache2/error.log
  369.  
  370. Possible values include: debug, info, notice, warn, error, crit,
  371. alert, emerg.
  372. LogLevel warn
  373.  
  374. CustomLog /var/log/apache2/access.log combined
  375.  
  376. Alias /doc/ "/usr/share/doc/"
  377. <Directory "/usr/share/doc/">
  378. Options Indexes MultiViews FollowSymLinks
  379. AllowOverride None
  380. Order deny,allow
  381. Deny from all
  382. Allow from 127.0.0.0/255.0.0.0 ::1/128
  383. </Directory>
  384.  
  385. <Location /rtorrent1>
  386. AuthType Digest
  387. AuthName "gods"
  388. AuthDigestDomain /home/tup/www/rtorrent1/ http://<servername or IP>/rtorrent1
  389.  
  390. AuthDigestProvider file
  391. AuthUserFile /etc/apache2/passwords
  392. Require valid-user
  393. SetEnv R_ENV "/home/tup/www/rtorrent1"
  394. </Location>
  395.  
  396. <Location /rtorrent2>
  397. AuthType Digest
  398. AuthName "gods"
  399. AuthDigestDomain /home/tup/www/rtorrent2/ http://<servername or IP>/rtorrent2
  400.  
  401. AuthDigestProvider file
  402. AuthUserFile /etc/apache2/passwords
  403. Require valid-user
  404. SetEnv R_ENV "/home/tup/www/rtorrent2"
  405. </Location>
  406.  
  407. <Location /web_panel>
  408. AuthType Digest
  409. AuthName "gods"
  410. AuthDigestDomain /home/tup/www/web_panel/ http://<servername or IP>/web_panel
  411.  
  412. AuthDigestProvider file
  413. AuthUserFile /etc/apache2/passwords
  414. Require valid-user
  415. SetEnv R_ENV "/home/tup/www/web_panel"
  416. </Location>
  417.  
  418. <Location /browser_plugin>
  419. AuthType Digest
  420. AuthName "gods"
  421. AuthDigestDomain /home/tup/www/browser_plugin/ http://<servername or IP>/browser_plugin
  422.  
  423. AuthDigestProvider file
  424. AuthUserFile /etc/apache2/passwords
  425. Require valid-user
  426. SetEnv R_ENV "/home/tup/www/browser_plugin"
  427. </Location>
  428.  
  429. </VirtualHost>
  430.  
  431. <VirtualHost *:443>
  432. ServerAdmin webmaster@localhost
  433.  
  434. SSLEngine on
  435. SSLCertificateFile /etc/apache2/apache.pem
  436.  
  437. DocumentRoot /home/tup/www/
  438. <Directory />
  439. Options FollowSymLinks
  440. AllowOverride None
  441. </Directory>
  442. <Directory /home/tup/www/>
  443. Options Indexes FollowSymLinks MultiViews
  444. AllowOverride None
  445. Order allow,deny
  446. allow from all
  447. </Directory>
  448.  
  449. ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
  450. <Directory "/usr/lib/cgi-bin">
  451. AllowOverride None
  452. Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  453. Order allow,deny
  454. Allow from all
  455. </Directory>
  456.  
  457. ErrorLog /var/log/apache2/error.log
  458.  
  459. Possible values include: debug, info, notice, warn, error, crit,
  460. alert, emerg.
  461. LogLevel warn
  462.  
  463. CustomLog /var/log/apache2/access.log combined
  464.  
  465. Alias /doc/ "/usr/share/doc/"
  466. <Directory "/usr/share/doc/">
  467. Options Indexes MultiViews FollowSymLinks
  468. AllowOverride None
  469. Order deny,allow
  470. Deny from all
  471. Allow from 127.0.0.0/255.0.0.0 ::1/128
  472. </Directory>
  473. <Location /rtorrent1>
  474. AuthType Digest
  475. AuthName "gods"
  476. AuthDigestDomain /home/tup/www/rtorrent1/ http://<servername or IP>/rtorrent1
  477.  
  478. AuthDigestProvider file
  479. AuthUserFile /etc/apache2/passwords
  480. Require valid-user
  481. SetEnv R_ENV "/home/tup/www/rtorrent1"
  482. </Location>
  483. <Location /rtorrent2>
  484. AuthType Digest
  485. AuthName "gods"
  486. AuthDigestDomain /home/tup/www/rtorrent2/ http://<servername or IP>/rtorrent2
  487.  
  488. AuthDigestProvider file
  489. AuthUserFile /etc/apache2/passwords
  490. Require valid-user
  491. SetEnv R_ENV "/home/tup/www/rtorrent2"
  492. </Location>
  493. <Location /web_panel>
  494. AuthType Digest
  495. AuthName "gods"
  496. AuthDigestDomain /home/tup/www/web_panel/ http://<servername or IP>/web_panel
  497.  
  498. AuthDigestProvider file
  499. AuthUserFile /etc/apache2/passwords
  500. Require valid-user
  501. SetEnv R_ENV "/home/tup/www/web_panel"
  502. </Location>
  503. <Location /browser_plugin>
  504. AuthType Digest
  505. AuthName "gods"
  506. AuthDigestDomain /home/tup/www/browser_plugin/ http://<servername or IP>/browser_plugin
  507.  
  508. AuthDigestProvider file
  509. AuthUserFile /etc/apache2/passwords
  510. Require valid-user
  511. SetEnv R_ENV "/home/tup/www/browser_plugin"
  512. </Location>
  513. </VirtualHost>
  514. - sudo a2ensite default-ssl
  515. - sudo service apache2 reload
  516. Check that everything is working by opening a browser and going to:
  517.  
  518. http://<servername or IP>/rtorrent1
  519. http://<servername or IP>/rtorrent2
  520. http://<servername or IP>/web_panel
  521.  
  522. #Webmin
  523. - sudo nano /etc/apt/sources.list
  524. deb http://download.webmin.com/download/repository sarge contrib
  525. - wget http://www.webmin.com/jcameron-key.asc
  526. - sudo apt-key add jcameron-key.asc
  527. - sudo apt-get update
  528. - sudo apt-get install webmin
  529. https://<servername or IP>:10000
  530.  
  531. #SFTP
  532.  
  533. Connect via your FTP client. Set it to use SFTP and connect through your SSH, just like you would with Putty.
  534.  
  535. #Linux Firewall
  536.  
  537. Now it is time to set up the linux firewall to close all the ports other than the ones we need. This is where the GUI will come in handy for those who do not
  538.  
  539. understand IPTables.
  540.  
  541. - sudo apt-get update && sudo apt-get upgrade
  542. - sudo apt-get clean && sudo apt-get auto-clean
  543.  
  544. Connect with your NX client on your windows machine.
  545. - System > Administration > Firestarter
  546. - When you launch firestarter for the first time, it will take you through a setup wizard.
  547. -Click forward, and you will be able to select the network device. This device you must choose correctly. There may be a list of them. On almost all setups you will
  548.  
  549. chose eth0.
  550. -Select eth0
  551. -Do not check the other boxes.
  552. -Click Forward, and then click Forward again.
  553. -Uncheck to start the Firewall now. You must uncheck this or it will lock out all ports when you click Save.
  554. -Click the Policy tab
  555. -Make sure that Editing is set to Inboud Traffic Policy
  556. -Right click under Allow Service, and you will do this individually for all your ports you need open.
  557. Port = 32002, 80, 443, 10000, 57001
  558. Anyone should be set for 57001
  559. All others are to be set to your IP, unless you have a Dynamic IP address in which case you should set all of these ports to Anyone.
  560.  
  561. #Fail2Ban
  562. - su root
  563. - apt-get update && apt-get upgrade
  564. - apt-get clean && apt-get autoclean
  565. - nano /etc/fail2ban/jail.conf
  566. ignoreip = 127.0.0.1 Your_Home_IP
  567.  
  568. EX : ignoreip = 127.0.0.1 24.127.*.* 192.168.1.*
  569. You can use as many IP's as you want. Just use a space in between each IP address. If you have a Dynamic IP, it would be a good idea to accept the whole range like i gave in the example above.
  570.  
  571. [ssh]
  572. enabled = true
  573. port = ssh
  574. maxretry = 3
  575.  
  576. [Apache]
  577. All Apache modules should be changed to yes.
  578.  
  579. Scroll to the bottom of jail.conf and add these lines to monitor Webmin
  580.  
  581. [webmin-auth]
  582. enabled = true
  583. port = 10000
  584. filter = webmin-auth
  585. logpath = /var/log/auth.log
  586. maxretry = 3
  587.  
  588. - service fail2ban restart
  589.  
  590. To delete 1 rules:
  591. - iptables -F fail2ban-ssh
  592.  
  593. To delete just 1 IP rule:
  594. - iptables -D fail2ban-ssh host-name/ip DROP
  595.  
  596. #Update/Upgrade and Reboot
  597. - apt-get update && apt-get upgrade
  598. - apt-get clean && apt-get autoclean
  599. - reboot
  600.  
  601. ...and you're done
  602.  
  603. Replies (2)
  604. Comment
  605. RE: Server setup for n00bs - Added by Janhouse 18 days ago
  606.  
  607. Nice, this looks quite good. :)
  608. I didn't like the server setup part about visudo and the NOPASSWD. (!)
  609. Comment
  610. RE: Server setup for n00bs - Added by voidale 18 days ago
  611.  
  612. Installing the script seems to be easy the hard part is to setup download/upload scripts no good guides for it :( but nice work nonetheless
  613.  
  614. (1-2/2)
  615.  
  616. Reply
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement