skraps

interworx-primer

Aug 23rd, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1.  
  2. Interworx – Lets Scratch the Inner Surface
  3. By: Jackie Craig Sparks :: 9/22/2011 :: [email protected] :: 336.790.2126
  4.  
  5. I'm wanting to write about Interworx control panel. It's a rather slick looking control panel, it is comparable to Cpanel. On the outside, but on the inside it is totally different than cpanel. Cpanel is based off of Perl while interworx appears to be mostly proboard and shell scripts etc. And Interworx thinks that ioncode encoding their system is a good thing(BOOO) . While Cpanel doesn't. So I give a lot of props to Cpanel.
  6. Services
  7. Interworx uses daemon tools to handle the stability and control of keeping services running for the most part, it still uses traditional /etc/init.d/ scripts for a lot of services, bringing them up and down. Interworx takes advantage of the DJ Bernstein suite of services, Qmail, Tinydns, daemontools.
  8.  
  9. /service/ - holds all the links to the daemons used, smtp, imap, dnscache, pop3,
  10. {/service/run, /service/log/run} – holds are the run scripts that svcan processes to init the daemons
  11.  
  12. /var/ - holds multiple daemons and some of the symbolic links from service point here – proftp, qmail, tinydns, vpopmail
  13. /var/qmail/ - Mail services Interworx uses qmail for its MTA which is actually really cool.
  14. /var/djbdns - DNS services. These services are tinydns, the actual DNS server then there is dnscache. DJ Bernstein implemented these services separately because he saw a problem with BIND. They would exploit the cache and gain access to the DNS server and vice versa. So he created them as separate entities.
  15. /var/proftpd – holds the ftpserver files
  16. /var/vpopmail – the system that enables Qmail to handle virtual domains that is controlled by a mysql database.
  17. /var/vpopmail/bin/ - This folder is the location of the executables that you are able to control adding domains , users, etc. But interworx uses a database map and if you add users / domains from the command line you will not be able to administer them from the web control panel.
  18. /etc/apf/ - Where all the firewall scripts and rules are stored.
  19. /chroot/ - This is a jailshell for users and applications.
  20.  
  21. Firewall
  22. APF is a really nice firewall plugin with interworx. It is one of the few core items that can be modified somewhat. If you want to modify the way the firewall starts or what it does you can so in the bash script located @ /etc/apf/apf
  23. Adding fwsnort and fail2ban capabilities
  24. fwsnort is a program made and provided for free by CipherDyne @ http://cipherdyne.org/fwsnort/ . This application is great it takes advantage of the SNORT intrusion detection system rule set. It will download the latest snort rule set and convert them into firewall rules. On my friends server we have incorporated this program into his setup. This is how.
  25. root@bigbird:~#wget http://cipherdyne.org/fwsnort/download/fwsnort-1.6.tar.bz2
  26. root@bigbird:~#tar jxf fwsnort-1.6.tar.bz2
  27. root@bigbird:~#cd fwsnort-1.6
  28. root@bigbird:/root/fwsnort-1.6/#./install.pl (follow the on screen instructions)
  29. root@bigbird:/root/fwsnort-1.6/#fwsnort --update
  30. root@bigbird:/root/fwsnort-1.6/#crontab -e
  31.  
  32. Add the following lines to your crontab
  33. * 1 * * * /usr/sbin/fwsnort --update
  34. 5 1 * * * /usr/sbin/fwsnort
  35. 10 1 * * * * /usr/sbin/fwsnort --Flush --no-ipt-INPUT --no-ipt-OUTPUT –no-ipt-FORWARD
  36. 15 1 * * * * /etc/fwsnort/fwsnort.sh
  37.  
  38.  
  39. fail2ban is a great program for detecting and blocking brute force attacks. We can install it by adding the yum repository for a easy auto-magic install.
  40.  
  41. root@bigbird:~#wget HTTP://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-3.noarch.rpm
  42. root@bigbird:~#rpm -i ./epel-release-5-3.noarch.rpm
  43. root@bigbird:~#yum install fail2ban
  44. root@bigbird:~#chkconfig –add fail2ban
  45. root@bigbird:~#chkconfig –level 3 fail2ban
  46.  
  47. Add the following to the /etc/apf/apf shell script
  48. #These will go right under the copy right message at the top
  49. IPT="/sbin/iptables"
  50.  
  51. fail2ban_conf="/etc/fail2ban/jail.conf"
  52. fail2banparse=`cat ${fail2ban_conf} | grep '\[name=[a-zA-Z0-9\]\{1,10\}'| sed -e 's/=/ /g' -e 's/\[/ /g' -e 's/\,//g' | grep -v 'sendmail' | awk '{ print $4 }'|uniq`
  53.  
  54.  
  55. #The following line will go right around line:176 – that should be right at the end of the apf firewall #script this makes sure interworx apf reloads the script when the firewall is reloaded.
  56. /etc/fwsnort/fwsnort.sh
  57. for i in $fail2banparse; do
  58. $IPT -N fail2ban-${i}
  59. $IPT -A fail2ban-${i} -j RETURN
  60. $IPT -I INPUT -j fail2ban-${i}
  61. done
  62.  
  63. Logging
  64. /service/{daemon}/log/ - holds log files for the specific daemons. On a fresh installation of interworx these are not rotated.
  65. /var/log/ - holds all the basic daemon and system logs. Log rotation is setup for most all these files except /var/log/maillog
  66. Log rotation can be setup using in the /etc/logrotate.d directory
  67. Log rotate scripts
  68.  
  69. ====/etc/logrotate.d/daemontools====
  70. /service/smtp-ssl/log/main/\@40000000* /service/tinydns-208.86.251.63/log/main/current {
  71. weekly
  72. rotate 52
  73. compress
  74. missingok
  75. notifempty
  76. sharedscripts
  77. }
  78.  
  79. /service/tinydns-208.86.251.63/log/main/\@40000000* /service/tinydns-208.86.251.63/log/main/current {
  80. weekly
  81. rotate 52
  82. compress
  83. missingok
  84. notifempty
  85. sharedscripts
  86. }
  87.  
  88. /service/tinydns-208.86.251.64/log/main/\@40000000* /service/tinydns-208.86.251.64/log/main/current {
  89. weekly
  90. rotate 52
  91. compress
  92. missingok
  93. notifempty
  94. sharedscripts
  95. }
  96.  
  97. /service/imap4/log/main/\@40000000* /service/imap4/log/main/current {
  98. weekly
  99. rotate 52
  100. compress
  101. missingok
  102. notifempty
  103. sharedscripts
  104. }
  105.  
  106. /service/imap4-ssl/log/main/\@40000000* /service/imap4-ssl/log/main/current {
  107. weekly
  108. rotate 52
  109. compress
  110. missingok
  111. notifempty
  112. sharedscripts
  113. }
  114.  
  115. /service/pop3/log/main/\@40000000* /service/pop3/log/main/current {
  116. weekly
  117. rotate 52
  118. compress
  119. missingok
  120. notifempty
  121. sharedscripts
  122. }
  123.  
  124. /service/pop3-ssl/log/main/\@40000000* /service/pop3-ssl/log/main/current {
  125. weekly
  126. rotate 52
  127. compress
  128. missingok
  129. notifempty
  130. sharedscripts
  131. }
  132.  
  133. /service/send/log/main/\@40000000* /service/send/log/main/current {
  134. weekly
  135. rotate 52
  136. compress
  137. missingok
  138. notifempty
  139. sharedscripts
  140. }
  141.  
  142. /service/smtp/log/main/\@40000000* /service/smtp/log/main/current {
  143. weekly
  144. rotate 52
  145. compress
  146. missingok
  147. notifempty
  148. sharedscripts
  149. }
  150.  
  151. /service/smtp2/log/main/\@40000000* /service/smtp2/log/main/current {
  152. weekly
  153. rotate 52
  154. compress
  155. missingok
  156. notifempty
  157. sharedscripts
  158. }
  159.  
  160. /service/supervise/log/main/\@40000000* /service/supervise/log/main/current {
  161. weekly
  162. rotate 52
  163. compress
  164. missingok
  165. notifempty
  166. sharedscripts
  167. }
  168.  
  169. /service/teamspeak/log/main/\@40000000* /service/teamspeak/log/main/current {
  170. weekly
  171. rotate 52
  172. compress
  173. missingok
  174. notifempty
  175. sharedscripts
  176. }
  177.  
  178. /service/axfrdns-208.86.251.63/log/main/\@40000000* /service/axfrdns-208.86.251.63/log/main/current {
  179. weekly
  180. rotate 52
  181. compress
  182. missingok
  183. notifempty
  184. sharedscripts
  185. }
  186. ====EOF====
Advertisement
Add Comment
Please, Sign In to add comment