├── tests ├── prompt.sh ├── guess_pacman.sh ├── guess_plugin.sh └── cat_to_file.sh ├── .idea └── encodings.xml ├── .gitignore ├── readme.md ├── plugins ├── freebsd_10_x64 ├── freebsd_10_x86 ├── freebsd_11_x64 ├── freebsd_12_x64 ├── freebsd_13_x64 ├── freebsd_14_x64 ├── debian_8_x64 ├── debian_9_x64 ├── centos_7_x64 ├── debian_10_x64 ├── debian_11_x64 ├── debian_12_x64 └── centos_8_x64 ├── alib.sh └── LICENSE /tests/prompt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "================ Started ================="; 3 | read -p "Please tell me your dirtiest secret. I won't tell it anyone: " SECRET 4 | echo "I've lied"; 5 | echo ${SECRET}; 6 | 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/guess_pacman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #/usr/bin/env bash 3 | 4 | guess_pac_man(){ 5 | #Predefined list of well-known package managers; 6 | LIST="yum apt-get pkg pacman"; 7 | 8 | for MANAGER in ${LIST}; do 9 | which ${MANAGER} && break; 10 | done 11 | 12 | if [ x'' != x${MANAGER} ]; then 13 | BUILD_OPTIONS=" ${MANAGER} -y install"; 14 | fi; 15 | echo "Package manager: ${MANAGER}"; 16 | } 17 | 18 | guess_pac_man; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### JetBrains template 2 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 3 | 4 | *.iml 5 | 6 | ## Directory-based project format: 7 | .idea/ 8 | # if you remove the above rule, at least ignore the following: 9 | 10 | # User-specific stuff: 11 | # .idea/workspace.xml 12 | # .idea/tasks.xml 13 | # .idea/dictionaries 14 | 15 | # Sensitive or high-churn files: 16 | # .idea/dataSources.ids 17 | # .idea/dataSources.xml 18 | # .idea/sqlDataSources.xml 19 | # .idea/dynamic.xml 20 | # .idea/uiDesigner.xml 21 | 22 | # Gradle: 23 | # .idea/gradle.xml 24 | # .idea/libraries 25 | 26 | # Mongo Explorer plugin: 27 | # .idea/mongoSettings.xml 28 | 29 | ## File-based project format: 30 | *.ipr 31 | *.iws 32 | 33 | ## Plugin-specific files: 34 | 35 | # IntelliJ 36 | /out/ 37 | 38 | # mpeltonen/sbt-idea plugin 39 | .idea_modules/ 40 | 41 | # JIRA plugin 42 | atlassian-ide-plugin.xml 43 | 44 | # Crashlytics plugin (for Android Studio and IntelliJ) 45 | com_crashlytics_export_strings.xml 46 | crashlytics.properties 47 | crashlytics-build.properties 48 | 49 | # Created by .ignore support plugin (hsz.mobi) 50 | -------------------------------------------------------------------------------- /tests/guess_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ################################################################ 3 | # Test for guess_plugin func 4 | ################################################################ 5 | 6 | #load library 7 | . "../alib.sh"; 8 | 9 | get_os; 10 | 11 | echo "Alib Loaded: ${ALIB_LOADED}"; 12 | 13 | echo "################################################"; 14 | 15 | echo "OS: ${OS}"; 16 | echo "OS_VERSION: ${OS_VERSION}"; 17 | echo "OS_NAME: ${OS_NAME}"; 18 | echo "MACH: ${MACH}"; 19 | 20 | echo "################################################"; 21 | echo; 22 | guess_plugin(){ 23 | get_os; 24 | #OS_Name 25 | PLUGIN_OS_NAME=`echo ${OS_NAME} | tr '[:upper:]' '[:lower:]'`; 26 | # echo ${PLUGIN_OS_NAME}; 27 | 28 | #OS Major Version 29 | PLUGIN_OS_VERSION=`echo ${OS_VERSION} | grep -o -e '^[0-9]*'`; 30 | # echo ${PLUGIN_OS_VERSION}; 31 | 32 | #OS Architecture 33 | PLUGIN_OS_ARCH=`64`; 34 | 35 | if [ ! ${MACH} == 'amd64' ]; then 36 | if [ ! ${MACH} == 'x86_64' ]; then 37 | PLUGIN_OS_ARCH = '86'; 38 | fi 39 | fi 40 | # echo ${PLUGIN_OS_ARCH}; 41 | 42 | PLUGIN_NAME="${PLUGIN_OS_NAME}_${PLUGIN_OS_VERSION}_x${PLUGIN_OS_ARCH}"; 43 | echo ${PLUGIN_NAME}; 44 | echo; 45 | } 46 | 47 | guess_plugin; 48 | 49 | 50 | exit 0; 51 | -------------------------------------------------------------------------------- /tests/cat_to_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ####################################################### 4 | # This script test how here doc cat is working # 5 | ####################################################### 6 | 7 | cat << 'EOF' > /etc/init.d/radiusd 8 | #!/bin/bash 9 | # 10 | # radiusd This shell script takes care of starting and stopping 11 | # freeradius. 12 | # 13 | # chkconfig: - 58 74 14 | # description: radiusd is service access provider Daemon. \ 15 | 16 | ### BEGIN INIT INFO 17 | # Provides: radiusd 18 | # Should-Start: radiusd 19 | # Should-Stop: radiusd 20 | # Short-Description: start and stop radiusd 21 | # Description: radiusd is access provider service Daemon. 22 | ### END INIT INFO 23 | 24 | # Source function library. 25 | . /etc/init.d/functions 26 | 27 | prog=/usr/local/freeradius/sbin/radiusd 28 | lockfile=/var/lock/subsys/$prog 29 | 30 | start() { 31 | # Start daemons. 32 | echo -n $"Starting $prog: " 33 | daemon $prog $OPTIONS 34 | RETVAL=$? 35 | echo 36 | [ $RETVAL -eq 0 ] && touch $lockfile 37 | return $RETVAL 38 | } 39 | stop() { 40 | [ "$EUID" != "0" ] && exit 4 41 | echo -n $"Shutting down $prog: " 42 | killproc $prog 43 | RETVAL=$? 44 | echo 45 | [ $RETVAL -eq 0 ] && rm -f $lockfile 46 | return $RETVAL 47 | } 48 | # See how we were called. 49 | case "$1" in 50 | start) 51 | start 52 | ;; 53 | stop) 54 | stop 55 | ;; 56 | status) 57 | status $prog 58 | ;; 59 | restart|force-reload) 60 | stop 61 | start 62 | ;; 63 | try-restart|condrestart) 64 | if status $prog > /dev/null; then 65 | stop 66 | start 67 | fi 68 | ;; 69 | reload) 70 | exit 3 71 | ;; 72 | *) 73 | echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" 74 | exit 2 75 | esac 76 | 77 | EOF 78 | 79 | cat radiusd | grep 'start|stop|status|restart|try-restart|force-reload'; -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | 2 | Installer for ABillS based on plugin system 3 | =============================================== 4 | 5 | ver. 5.32 6 | 7 | Installing: 8 | * ABillS 9 | * MySQL 10 | * FreeRadius 11 | * Apache 12 | * Accel-PPPoE 13 | * Flow-tools 14 | * Fsbackup 15 | * MRTG 16 | 17 | Support OS: 18 | 19 | - centos_7_x64 20 | - debian_8_x64 21 | - debian_9_x64 22 | - debian_10_x64 23 | - debian_11_x64 24 | - freebsd_10_x64 25 | - freebsd_10_x86 26 | - freebsd_11_x64 27 | - ubuntu_14_x64 28 | - ubuntu_16_x64 29 | - ubuntu_18_x64 30 | - ubuntu_19_x64 31 | - ubuntu_20_x64 32 | 33 | Plugins are structured as plugins/Distributive_Version_Arch 34 | 35 | As of version 5.05 it can guess your system. 36 | If guessed wrong, use ''-p'' key 37 | 38 | 39 | # ./install.sh -p centos_7_x64 40 | 41 | 42 | If you want avoid tmux session use ''--in_tmux'' key 43 | 44 | 45 | # ./install.sh --in_tmux 46 | 47 | 48 | If you want to install custom version use ''--install-version'' key 49 | 50 | 51 | ./install.sh --install-version 78.25 52 | 53 | 54 | Plugin Format 55 | ------------- 56 | 57 | 58 | 59 | 62 | 65 | 66 | 67 | 70 | 73 | 74 | 75 | 78 | 81 | 82 | 83 | 86 | 89 | 90 | 91 |
60 | Section 61 | 63 | Example 64 |
68 | #OS OS_NAME OS_VERSION 69 | 71 | #OS freebsd 10 72 |
76 | #COMMENTS comments for plugin 77 | 79 | #COMMENTS CentOS comment 80 |
84 | #M [module_name]:[module describe]:[command] 85 | 87 | #M mysql:MySQL:_install_mysql 88 |
92 | 93 | As command you can use shell command like 94 | pkg install www 95 | or shell function: 96 | shell_function 97 | 98 | Inside plugin you can use these functions to execute custom commands. 99 | 100 | 101 | 104 | 107 | 108 | 109 | 112 | 115 | 116 |
102 | pre_install() 103 | 105 | executes before installing modules 106 |
110 | post_install() 111 | 113 | executes after full installation (before autoconf) 114 |
117 | 118 | 119 | Plugin execution flow 120 | ---------------- 121 | 122 | 125 | 128 | 131 | 134 | 137 |
123 | Pre install 124 |
126 | Install programs 127 |
129 | Post install 130 |
132 | Run misc/autoconf 133 |
135 | Show result 136 |
138 | 139 | Installer uses autoconf for module configuration and defining system startup. 140 | -------------------------------------------------------------------------------- /plugins/freebsd_10_x64: -------------------------------------------------------------------------------- 1 | #OS freebsd 10 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install mysql56-server 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | # fsbackup= 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim-lite tmux bash git 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | ln -s /usr/local/bin/perl /usr/bin/perl 42 | 43 | if [ ! -d /usr/bin/perl ];then 44 | ln -s /usr/local/bin/perl /usr/bin/perl; 45 | fi; 46 | 47 | if [ ! -d /etc/crontab ];then 48 | touch /etc/crontab; 49 | fi; 50 | 51 | 52 | if [ ! -d /etc/make.conf ];then 53 | touch /etc/make.conf; 54 | fi; 55 | 56 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 57 | if [ x'${WITHOUT_X11}' = x'' ]; then 58 | echo 'WITHOUT="X11"' >> /etc/make.conf 59 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 60 | fi; 61 | 62 | CURRENT_DIR=`pwd`; 63 | } 64 | 65 | 66 | #******************************************* 67 | # Install mailserver 68 | #******************************************* 69 | install_mail () { 70 | echo "Install mail server" 71 | 72 | BUILD_OPTIONS="&& make && make install" 73 | PORTS_LOCATION="/usr/ports/" 74 | 75 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 76 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 77 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 78 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 79 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 80 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 81 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 82 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 83 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 84 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 85 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 86 | 87 | if [ "${DEBUG}" != "" ]; then 88 | echo "CMD: ${cmd}"; 89 | fi; 90 | 91 | eval "${cmd}" 92 | 93 | exit; 94 | 95 | #Check apache php support 96 | check_apache=`pkg info | grep apache22` 97 | if [ "${check_apache}" = "" ]; then 98 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 99 | else 100 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 101 | fi; 102 | 103 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 104 | if [ w${check_php_conf} = w ]; then 105 | echo -n "Can\'t find php in apache config add it? (y/n): " 106 | read -p "" PHP_CONF 107 | if [ w${PHP_CONF} = wy ]; then 108 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 109 | fi; 110 | fi; 111 | 112 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 113 | if [ x"${PHP_INDEX}" = x ]; then 114 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 115 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 116 | fi; 117 | 118 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 119 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 120 | } 121 | 122 | 123 | 124 | #******************************************* 125 | # 126 | #******************************************* 127 | _install_freeradius(){ 128 | cd /usr/ports/net/freeradius2 && make WITH="MYSQL USER" WITHOUT="" BATCH=yes install 129 | 130 | 131 | RADIUS_ENABLED=`grep 'radiusd_enable' /etc/rc.conf` 132 | if [ x"${RADIUS_ENABLED}" = x"" ]; then 133 | echo "radiusd_enable=\"YES\"" >> /etc/rc.conf; 134 | fi; 135 | 136 | ln -s /usr/local/freeradius/sbin/radiusd /usr/sbin/radiusd 137 | 138 | cd ${CURRENT_DIR} 139 | 140 | service radiusd start 141 | } 142 | 143 | #******************************************* 144 | # 145 | #******************************************* 146 | _install_ipn(){ 147 | _install flow-tools; 148 | 149 | mkdir -p /usr/abills/var/log/ipn/ 150 | chown -R flowtools /usr/abills/var/log/ipn/ 151 | 152 | service flow_capture start; 153 | } 154 | 155 | #******************************************* 156 | # 157 | #******************************************* 158 | _install_apache(){ 159 | 160 | _install apache24 161 | 162 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 163 | 164 | LoadModule ssl_module libexec/apache24/mod_ssl.so 165 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 166 | LoadModule cgi_module libexec/apache24/mod_cgi.so 167 | 168 | [EOF_APACHE] 169 | 170 | apachectl -k restart 171 | 172 | } 173 | 174 | #******************************************* 175 | # 176 | #******************************************* 177 | post_install(){ 178 | 179 | cd /usr/abills/misc && ./perldeps.pl pkg -batch 180 | 181 | } 182 | -------------------------------------------------------------------------------- /plugins/freebsd_10_x86: -------------------------------------------------------------------------------- 1 | #OS freebsd 10 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install mysql56-server 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | # fsbackup= 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim-lite tmux bash git 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | ln -s /usr/local/bin/perl /usr/bin/perl 42 | 43 | if [ ! -d /usr/bin/perl ];then 44 | ln -s /usr/local/bin/perl /usr/bin/perl; 45 | fi; 46 | 47 | if [ ! -d /etc/crontab ];then 48 | touch /etc/crontab; 49 | fi; 50 | 51 | 52 | if [ ! -d /etc/make.conf ];then 53 | touch /etc/make.conf; 54 | fi; 55 | 56 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 57 | if [ x'${WITHOUT_X11}' = x'' ]; then 58 | echo 'WITHOUT="X11"' >> /etc/make.conf 59 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 60 | fi; 61 | 62 | CURRENT_DIR=`pwd`; 63 | } 64 | 65 | 66 | #******************************************* 67 | # Install mailserver 68 | #******************************************* 69 | install_mail () { 70 | echo "Install mail server" 71 | 72 | BUILD_OPTIONS="&& make && make install" 73 | PORTS_LOCATION="/usr/ports/" 74 | 75 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 76 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 77 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 78 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 79 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 80 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 81 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 82 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 83 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 84 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 85 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 86 | 87 | if [ "${DEBUG}" != "" ]; then 88 | echo "CMD: ${cmd}"; 89 | fi; 90 | 91 | eval "${cmd}" 92 | 93 | exit; 94 | 95 | #Check apache php support 96 | check_apache=`pkg info | grep apache22` 97 | if [ "${check_apache}" = "" ]; then 98 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 99 | else 100 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 101 | fi; 102 | 103 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 104 | if [ w${check_php_conf} = w ]; then 105 | echo -n "Can\'t find php in apache config add it? (y/n): " 106 | read -p "" PHP_CONF 107 | if [ w${PHP_CONF} = wy ]; then 108 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 109 | fi; 110 | fi; 111 | 112 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 113 | if [ x"${PHP_INDEX}" = x ]; then 114 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 115 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 116 | fi; 117 | 118 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 119 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 120 | } 121 | 122 | 123 | 124 | #******************************************* 125 | # 126 | #******************************************* 127 | _install_freeradius(){ 128 | 129 | if [ -d '/usr/local/freeradius' ]; then 130 | echo "Freeradius already installed"; 131 | return; 132 | fi; 133 | 134 | cd /usr/ports/net/freeradius2 && make WITH="MYSQL USER" WITHOUT="" BATCH=yes install 135 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 136 | 137 | RADIUS_ENABLED=`grep 'radiusd_enable' /etc/rc.conf` 138 | if [ x"${RADIUS_ENABLED}" = x"" ]; then 139 | echo "radiusd_enable=\"YES\"" >> /etc/rc.conf; 140 | fi; 141 | 142 | ln -s /usr/local/freeradius/sbin/radiusd /usr/sbin/radiusd 143 | 144 | service radiusd start 145 | 146 | cd ${CURRENT_DIR} 147 | } 148 | 149 | #******************************************* 150 | # 151 | #******************************************* 152 | _install_ipn(){ 153 | _install flow-tools; 154 | 155 | mkdir -p /usr/abills/var/log/ipn/ 156 | chown -R flowtools /usr/abills/var/log/ipn/ 157 | 158 | service flow_capture start; 159 | } 160 | 161 | #******************************************* 162 | # 163 | #******************************************* 164 | _install_apache(){ 165 | 166 | _install apache24 167 | 168 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 169 | 170 | LoadModule ssl_module libexec/apache24/mod_ssl.so 171 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 172 | LoadModule cgi_module libexec/apache24/mod_cgi.so 173 | 174 | [EOF_APACHE] 175 | 176 | apachectl -k restart 177 | 178 | } 179 | 180 | #******************************************* 181 | # 182 | #******************************************* 183 | post_install(){ 184 | 185 | cd /usr/abills/misc && ./perldeps.pl pkg -batch 186 | 187 | } 188 | -------------------------------------------------------------------------------- /alib.sh: -------------------------------------------------------------------------------- 1 | 2 | #ABillS Shell library 3 | # 4 | #********************************************************** 5 | # Get OS 6 | # OS_NAME, OS_VERSION, OS_NUM 7 | #********************************************************** 8 | 9 | ALIB_LOADED="Loaded"; 10 | 11 | #********************************************************** 12 | # Get OS 13 | #********************************************************** 14 | get_os () { 15 | 16 | OS=`uname -s` 17 | OS_VERSION=`uname -r` 18 | MACH=`uname -m` 19 | OS_NAME="" 20 | 21 | if [ "${OS}" = "SunOS" ] ; then 22 | OS=Solaris 23 | ARCH=`uname -p` 24 | OSSTR="${OS} ${OS_VERSION}(${ARCH} `uname -v`)" 25 | elif [ "${OS}" = "AIX" ] ; then 26 | OSSTR="${OS} `oslevel` (`oslevel -r`)" 27 | elif [ "${OS}" = "FreeBSD" ] ; then 28 | OS_NAME="FreeBSD"; 29 | #OS_VERSION=`uname -r | awk -F\. '{ print $1 }'` 30 | elif [ "${OS}" = "Linux" ] ; then 31 | #GetVersionFromFile 32 | KERNEL=`uname -r` 33 | if [ -f /etc/altlinux-release ]; then 34 | OS_NAME=`cat /etc/altlinux-release | awk '{ print $1 $2 }'` 35 | OS_VERSION=`cat /etc/altlinux-release | awk '{ print $3 }'` 36 | #RedHat CentOS 37 | elif [ -f /etc/redhat-release ] ; then 38 | #OS_NAME='RedHat' 39 | OS_NAME=`cat /etc/redhat-release | awk '{ print $1 }'` 40 | PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 41 | OS_VERSION=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 42 | elif [ -f /etc/SuSE-release ] ; then 43 | OS_NAME='openSUSE' 44 | #OS_NAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 45 | OS_VERSION=`cat /etc/SuSE-release | grep 'VERSION' | tr "\n" ' ' | sed s/.*=\ //` 46 | elif [ -f /etc/mandrake-release ] ; then 47 | OS_NAME='Mandrake' 48 | PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//` 49 | OS_VERSION=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//` 50 | # elif [ -f /etc/debian_version ] ; then 51 | # OS_NAME="Debian `cat /etc/debian_version`" 52 | # OS_VERSION=`cat /etc/issue | head -1 |awk '{ print $3 }'` 53 | elif [ -f /etc/slackware-version ]; then 54 | OS_NAME=`cat /etc/slackware-version | awk '{ print $1 }'` 55 | OS_VERSION=`cat /etc/slackware-version | awk '{ print $2 }'` 56 | elif [ -f /etc/gentoo-release ]; then 57 | OS_NAME=`cat /etc/os-release | grep "^NAME=" | awk -F= '{ print $2 }'` 58 | OS_VERSION=`cat /etc/gentoo-release` 59 | else 60 | #Debian 61 | OS_NAME=`cat /etc/issue| head -1 |awk '{ print $1 }'` 62 | OS_VERSION=`cat /etc/issue | head -1 |awk '{ print $3 }'` 63 | fi 64 | 65 | if [ -f /etc/UnitedLinux-release ] ; then 66 | OS_NAME="${OS_NAME}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]" 67 | fi 68 | 69 | if [ x"${OS_NAME}" = xUbuntu ]; then 70 | OS_VERSION=`cat /etc/issue|awk '{ print $2 }'` 71 | fi; 72 | #OSSTR="${OS} ${OS_NAME} ${OS_VERSION}(${PSUEDONAME} ${KERNEL} ${MACH})" 73 | fi 74 | 75 | } 76 | 77 | #********************************************************** 78 | # Anykey: Guess system package managers 79 | #********************************************************** 80 | guess_pac_man(){ 81 | #Predefined list of well-known package managers; 82 | LIST="yum apt-get pkg pacman"; 83 | 84 | for MANAGER in ${LIST}; do 85 | which ${MANAGER} && break; 86 | done 87 | 88 | if [ x'' != x${MANAGER} ]; then 89 | BUILD_OPTIONS=" ${MANAGER} -y install"; 90 | fi; 91 | echo "Package manager: ${MANAGER}"; 92 | } 93 | 94 | #********************************************************** 95 | # Anykey: Guess plugin to use 96 | #********************************************************** 97 | guess_plugin(){ 98 | get_os; 99 | #OS_Name 100 | PLUGIN_OS_NAME=`echo ${OS_NAME} | tr '[:upper:]' '[:lower:]'`; 101 | # echo ${PLUGIN_OS_NAME}; 102 | 103 | #OS Major Version 104 | PLUGIN_OS_VERSION=`echo ${OS_VERSION} | grep -o -e '^[0-9]*'`; 105 | # echo ${PLUGIN_OS_VERSION}; 106 | 107 | #OS Architecture 108 | PLUGIN_OS_ARCH='86'; 109 | ARCH64=`echo ${MACH} | grep -o -e '64'`; 110 | if [ ${ARCH64} ]; then 111 | PLUGIN_OS_ARCH='64'; 112 | fi 113 | 114 | #if file exists 115 | if [ -f "plugins/${PLUGIN_OS_NAME}_${PLUGIN_OS_VERSION}_x${PLUGIN_OS_ARCH}" ]; then 116 | 117 | PLUGIN_NAME="${PLUGIN_OS_NAME}_${PLUGIN_OS_VERSION}_x${PLUGIN_OS_ARCH}"; 118 | 119 | echo "Plugin guessed: ${PLUGIN_NAME}"; 120 | 121 | else 122 | echo "Plugin guess failed"; 123 | fi 124 | 125 | } 126 | 127 | #********************************************************** 128 | # Install programs 129 | #********************************************************** 130 | _install () { 131 | 132 | for pkg in $@; do 133 | if [ "${OS_NAME}" = "CentOS" ]; then 134 | test_program="rpm -q" 135 | BUILD_OPTIONS='yum -y install' 136 | elif [ "${OS}" = "FreeBSD" ]; then 137 | if [ "${BUILD_OPTIONS}" = "" ]; then 138 | BUILD_OPTIONS="pkg install -y" 139 | set ASSUME_ALWAYS_YES=YES 140 | fi; 141 | test_program="pkg info" 142 | else 143 | test_program="dpkg -s" 144 | fi; 145 | 146 | ${test_program} "${pkg}" > /dev/null 2>&1 147 | 148 | res=$? 149 | if [ "${BUILD_OPTIONS}" = "" ]; then 150 | if [ "${OS_NAME}" = "CentOS" ]; then 151 | BUILD_OPTIONS=" yum -y install "; 152 | else 153 | guess_pac_man; 154 | if [ x"${BUILD_OPTIONS}" = x"" ]; then 155 | echo "Not defined BUILD_OPTIONS params (Your system is currently not supported, or we can't found your package manager)"; 156 | echo "You can open new issue at https://github.com/nabat/AInstall/issues/new"; 157 | exit; 158 | else 159 | res=1; 160 | fi 161 | fi; 162 | fi; 163 | 164 | if [ "${res}" = 1 ]; then 165 | ${BUILD_OPTIONS} "${pkg}" 166 | echo "Pkg: ${BUILD_OPTIONS} ${pkg} ${res}"; 167 | elif [ "${res}" = 127 -o ${res} = 70 ]; then 168 | ${BUILD_OPTIONS} "${pkg}" 169 | echo "Pkg: ${BUILD_OPTIONS} ${pkg} ${res}"; 170 | else 171 | echo -n " ${pkg}" 172 | if [ "${res}" = 0 ]; then 173 | echo " Installed"; 174 | else 175 | echo " ${res}" 176 | fi; 177 | fi; 178 | done; 179 | 180 | } 181 | 182 | 183 | #********************************************************** 184 | # fetch [output_file] [input_url] 185 | #********************************************************** 186 | _fetch () { 187 | 188 | if [ "${OS}" = Linux ]; then 189 | #check wget 190 | CHECK_WGET=`which wget`; 191 | 192 | if [ "${CHECK_WGET}" = "" ]; then 193 | _install wget 194 | fi; 195 | 196 | WGET_OPTIONS="-q -O" 197 | if [ "${OS_NAME}" = "CentOS" ]; then 198 | WGET_OPTIONS="--no-check-certificate ${WGET_OPTIONS}" 199 | fi; 200 | 201 | FETCH="wget ${WGET_OPTIONS}" 202 | MD5="md5sum" 203 | else 204 | FETCH="fetch --no-verify-hostname --no-verify-peer -q -o " 205 | MD5="md5" 206 | fi; 207 | 208 | ${FETCH} $1 $2 209 | 210 | } 211 | -------------------------------------------------------------------------------- /plugins/freebsd_11_x64: -------------------------------------------------------------------------------- 1 | #OS freebsd 11 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install mysql56-server 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-JSON p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | #M fsbackup:FSBackup:_install_fsbackup 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim-console tmux bash git sudo net-snmp socat 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | if [ ! -f /usr/bin/perl ];then 42 | ln -s /usr/local/bin/perl /usr/bin/perl; 43 | fi; 44 | 45 | if [ ! -f /etc/crontab ];then 46 | touch /etc/crontab; 47 | fi; 48 | 49 | if [ ! -f /etc/make.conf ];then 50 | touch /etc/make.conf; 51 | fi; 52 | 53 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 54 | if [ x'${WITHOUT_X11}' = x'' ]; then 55 | echo 'WITHOUT="X11"' >> /etc/make.conf 56 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 57 | fi; 58 | 59 | echo >> /etc/rc.conf 60 | 61 | CURRENT_DIR=`pwd`; 62 | } 63 | 64 | 65 | #******************************************* 66 | # Install mailserver 67 | #******************************************* 68 | install_mail () { 69 | echo "Install mail server" 70 | 71 | BUILD_OPTIONS="&& make && make install" 72 | PORTS_LOCATION="/usr/ports/" 73 | 74 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 75 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 76 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 77 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 78 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 79 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 80 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 81 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 82 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 83 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 84 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 85 | 86 | if [ "${DEBUG}" != "" ]; then 87 | echo "CMD: ${cmd}"; 88 | fi; 89 | 90 | eval "${cmd}" 91 | 92 | exit; 93 | 94 | #Check apache php support 95 | check_apache=`pkg info | grep apache22` 96 | if [ "${check_apache}" = "" ]; then 97 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 98 | else 99 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 100 | fi; 101 | 102 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 103 | if [ w${check_php_conf} = w ]; then 104 | echo -n "Can\'t find php in apache config add it? (y/n): " 105 | read -p "" PHP_CONF 106 | if [ w${PHP_CONF} = wy ]; then 107 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 108 | fi; 109 | fi; 110 | 111 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 112 | if [ "${PHP_INDEX}" = "" ]; then 113 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 114 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 115 | fi; 116 | 117 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 118 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 119 | } 120 | 121 | 122 | #******************************************* 123 | # 124 | #******************************************* 125 | _install_freeradius(){ 126 | cd /usr/ports/net/freeradius3 && make WITH="MYSQL USER DHCP" WITHOUT="" BATCH=yes install 127 | 128 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 129 | 130 | cd ${CURRENT_DIR} 131 | } 132 | 133 | #******************************************* 134 | # 135 | #******************************************* 136 | _install_ipn(){ 137 | _install flow-tools; 138 | 139 | mkdir -p /usr/abills/var/log/ipn/ 140 | chown -R flowtools /usr/abills/var/log/ipn/ 141 | 142 | service flow_capture start; 143 | } 144 | 145 | #******************************************* 146 | # 147 | #******************************************* 148 | _install_apache(){ 149 | 150 | _install apache24 151 | 152 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 153 | 154 | LoadModule ssl_module libexec/apache24/mod_ssl.so 155 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 156 | LoadModule cgi_module libexec/apache24/mod_cgi.so 157 | 158 | [EOF_APACHE] 159 | } 160 | 161 | #******************************************* 162 | # 163 | #******************************************* 164 | _install_fsbackup() { 165 | 166 | cd ~ ; 167 | 168 | FSBACKUP_DIR="fsbackup-1.2pl2" 169 | FSBACKUP_FILE_NAME="${FSBACKUP_DIR}.tar.gz" 170 | 171 | FSBACKUP_URL="http://www.opennet.ru/dev/fsbackup/src/${FSBACKUP_FILE_NAME}" 172 | 173 | fetch "${FSBACKUP_URL}"; 174 | 175 | if [ !-f ${FSBACKUP_FILE_NAME} ];then 176 | echo "#############################################" 177 | echo "######### Can't load FSBackup ######" 178 | echo "#############################################" 179 | return 180 | fi 181 | 182 | tar zxvf ${FSBACKUP_FILE_NAME}; 183 | cd ${FSBACKUP_DIR}; 184 | ./install.pl; 185 | mkdir -p /usr/local/fsbackup/archive; 186 | 187 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 188 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 189 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 190 | 191 | check_fsbackup_cron=`grep create_backup /etc/crontab` 192 | if [ x"${check_fsbackup_cron}" = x ]; then 193 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 194 | fi; 195 | 196 | } 197 | 198 | #******************************************* 199 | # 200 | #******************************************* 201 | post_install(){ 202 | cd /usr/abills/misc && perl perldeps.pl pkg -batch 203 | } 204 | -------------------------------------------------------------------------------- /plugins/freebsd_12_x64: -------------------------------------------------------------------------------- 1 | #OS freebsd 12 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install_mysql 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-JSON p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | #M fsbackup:FSBackup:_install_fsbackup 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim tmux bash git sudo net-snmp socat 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | if [ ! -f /usr/bin/perl ];then 42 | ln -s /usr/local/bin/perl /usr/bin/perl; 43 | fi; 44 | 45 | if [ ! -f /etc/crontab ];then 46 | touch /etc/crontab; 47 | fi; 48 | 49 | if [ ! -f /etc/make.conf ];then 50 | touch /etc/make.conf; 51 | fi; 52 | 53 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 54 | if [ x'${WITHOUT_X11}' = x'' ]; then 55 | echo 'WITHOUT="X11"' >> /etc/make.conf 56 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 57 | fi; 58 | 59 | echo >> /etc/rc.conf 60 | 61 | CURRENT_DIR=`pwd`; 62 | } 63 | 64 | #********************************************************** 65 | # Install mysql, set empty password for root in mysql 66 | #********************************************************** 67 | _install_mysql(){ 68 | _install mysql57-server 69 | $RESTART_MYSQL onestart 70 | mysqladmin -u root --password=`tail -1 /root/.mysql_secret` -h localhost password "" 71 | 72 | echo 73 | echo "Set empty password for root in mysql" 74 | echo 75 | 76 | rm /root/.mysql_secret 77 | } 78 | 79 | #******************************************* 80 | # Install mailserver 81 | #******************************************* 82 | install_mail () { 83 | echo "Install mail server" 84 | 85 | BUILD_OPTIONS="&& make && make install" 86 | PORTS_LOCATION="/usr/ports/" 87 | 88 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 89 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 90 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 91 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 92 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 93 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 94 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 95 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 96 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 97 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 98 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 99 | 100 | if [ "${DEBUG}" != "" ]; then 101 | echo "CMD: ${cmd}"; 102 | fi; 103 | 104 | eval "${cmd}" 105 | 106 | exit; 107 | 108 | #Check apache php support 109 | check_apache=`pkg info | grep apache22` 110 | if [ "${check_apache}" = "" ]; then 111 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 112 | else 113 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 114 | fi; 115 | 116 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 117 | if [ w${check_php_conf} = w ]; then 118 | echo -n "Can\'t find php in apache config add it? (y/n): " 119 | read -p "" PHP_CONF 120 | if [ w${PHP_CONF} = wy ]; then 121 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 122 | fi; 123 | fi; 124 | 125 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 126 | if [ "${PHP_INDEX}" = "" ]; then 127 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 128 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 129 | fi; 130 | 131 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 132 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 133 | } 134 | 135 | 136 | #******************************************* 137 | # 138 | #******************************************* 139 | _install_freeradius(){ 140 | cd /usr/ports/net/freeradius3 && make WITH="MYSQL USER DHCP" WITHOUT="" BATCH=yes install 141 | 142 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 143 | 144 | cd ${CURRENT_DIR} 145 | } 146 | 147 | #******************************************* 148 | # 149 | #******************************************* 150 | _install_ipn(){ 151 | _install flow-tools; 152 | 153 | mkdir -p /usr/abills/var/log/ipn/ 154 | chown -R flowtools /usr/abills/var/log/ipn/ 155 | 156 | service flow_capture start; 157 | } 158 | 159 | #******************************************* 160 | # 161 | #******************************************* 162 | _install_apache(){ 163 | 164 | _install apache24 165 | 166 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 167 | 168 | LoadModule ssl_module libexec/apache24/mod_ssl.so 169 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 170 | LoadModule cgi_module libexec/apache24/mod_cgi.so 171 | 172 | [EOF_APACHE] 173 | } 174 | 175 | #******************************************* 176 | # 177 | #******************************************* 178 | _install_fsbackup() { 179 | 180 | cd ~ ; 181 | 182 | FSBACKUP_DIR="fsbackup-1.2pl2" 183 | FSBACKUP_FILE_NAME="${FSBACKUP_DIR}.tar.gz" 184 | 185 | FSBACKUP_URL="http://www.opennet.ru/dev/fsbackup/src/${FSBACKUP_FILE_NAME}" 186 | 187 | fetch "${FSBACKUP_URL}"; 188 | 189 | if [ !-f ${FSBACKUP_FILE_NAME} ];then 190 | echo "#############################################" 191 | echo "######### Can't load FSBackup ######" 192 | echo "#############################################" 193 | return 194 | fi 195 | 196 | tar zxvf ${FSBACKUP_FILE_NAME}; 197 | cd ${FSBACKUP_DIR}; 198 | ./install.pl; 199 | mkdir -p /usr/local/fsbackup/archive; 200 | 201 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 202 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 203 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 204 | 205 | check_fsbackup_cron=`grep create_backup /etc/crontab` 206 | if [ x"${check_fsbackup_cron}" = x ]; then 207 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 208 | fi; 209 | 210 | } 211 | 212 | #******************************************* 213 | # 214 | #******************************************* 215 | post_install(){ 216 | cd /usr/abills/misc && perl perldeps.pl pkg -batch 217 | } 218 | -------------------------------------------------------------------------------- /plugins/freebsd_13_x64: -------------------------------------------------------------------------------- 1 | #OS freebsd 13 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install_mysql 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-JSON p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | #M fsbackup:FSBackup:_install_fsbackup 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim tmux bash git sudo net-snmp socat 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | if [ ! -f /usr/bin/perl ];then 42 | ln -s /usr/local/bin/perl /usr/bin/perl; 43 | fi; 44 | 45 | if [ ! -f /etc/crontab ];then 46 | touch /etc/crontab; 47 | fi; 48 | 49 | if [ ! -f /etc/make.conf ];then 50 | touch /etc/make.conf; 51 | fi; 52 | 53 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 54 | if [ x'${WITHOUT_X11}' = x'' ]; then 55 | echo 'WITHOUT="X11"' >> /etc/make.conf 56 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 57 | fi; 58 | 59 | echo >> /etc/rc.conf 60 | 61 | CURRENT_DIR=`pwd`; 62 | } 63 | 64 | #********************************************************** 65 | # Install mysql, set empty password for root in mysql 66 | #********************************************************** 67 | _install_mysql(){ 68 | 69 | _install mysql80-server 70 | $RESTART_MYSQL onestart 71 | mysqladmin -u root --password=`tail -1 /root/.mysql_secret` -h localhost password "" 72 | 73 | echo 74 | echo "Set empty password for root in mysql" 75 | echo 76 | 77 | rm /root/.mysql_secret 78 | } 79 | 80 | #******************************************* 81 | # Install mailserver 82 | #******************************************* 83 | install_mail () { 84 | echo "Install mail server" 85 | 86 | BUILD_OPTIONS="&& make && make install" 87 | PORTS_LOCATION="/usr/ports/" 88 | 89 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 90 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 91 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 92 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 93 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 94 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 95 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 96 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 97 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 98 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 99 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 100 | 101 | if [ "${DEBUG}" != "" ]; then 102 | echo "CMD: ${cmd}"; 103 | fi; 104 | 105 | eval "${cmd}" 106 | 107 | exit; 108 | 109 | #Check apache php support 110 | check_apache=`pkg info | grep apache22` 111 | if [ "${check_apache}" = "" ]; then 112 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 113 | else 114 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 115 | fi; 116 | 117 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 118 | if [ w${check_php_conf} = w ]; then 119 | echo -n "Can\'t find php in apache config add it? (y/n): " 120 | read -p "" PHP_CONF 121 | if [ w${PHP_CONF} = wy ]; then 122 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 123 | fi; 124 | fi; 125 | 126 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 127 | if [ "${PHP_INDEX}" = "" ]; then 128 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 129 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 130 | fi; 131 | 132 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 133 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 134 | } 135 | 136 | 137 | #******************************************* 138 | # 139 | #******************************************* 140 | _install_freeradius(){ 141 | #Build port 142 | #cd /usr/ports/net/freeradius3 && make WITH="MYSQL USER DHCP" WITHOUT="" BATCH=yes install 143 | 144 | pkg install freeradius3 145 | pkg install freeradius3-mysql 146 | 147 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 148 | 149 | cd ${CURRENT_DIR} 150 | } 151 | 152 | #******************************************* 153 | # 154 | #******************************************* 155 | _install_ipn(){ 156 | _install flow-tools; 157 | 158 | mkdir -p /usr/abills/var/log/ipn/ 159 | chown -R flowtools /usr/abills/var/log/ipn/ 160 | 161 | service flow_capture start; 162 | } 163 | 164 | #******************************************* 165 | # 166 | #******************************************* 167 | _install_apache(){ 168 | 169 | _install apache24 170 | 171 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 172 | 173 | LoadModule ssl_module libexec/apache24/mod_ssl.so 174 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 175 | LoadModule cgi_module libexec/apache24/mod_cgi.so 176 | 177 | [EOF_APACHE] 178 | } 179 | 180 | #******************************************* 181 | # 182 | #******************************************* 183 | _install_fsbackup() { 184 | 185 | cd ~ ; 186 | 187 | FSBACKUP_DIR="fsbackup-1.2pl2" 188 | FSBACKUP_FILE_NAME="${FSBACKUP_DIR}.tar.gz" 189 | 190 | FSBACKUP_URL="http://www.opennet.ru/dev/fsbackup/src/${FSBACKUP_FILE_NAME}" 191 | 192 | fetch "${FSBACKUP_URL}"; 193 | 194 | if [ !-f ${FSBACKUP_FILE_NAME} ];then 195 | echo "#############################################" 196 | echo "######### Can't load FSBackup ######" 197 | echo "#############################################" 198 | return 199 | fi 200 | 201 | tar zxvf ${FSBACKUP_FILE_NAME}; 202 | cd ${FSBACKUP_DIR}; 203 | ./install.pl; 204 | mkdir -p /usr/local/fsbackup/archive; 205 | 206 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 207 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 208 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 209 | 210 | check_fsbackup_cron=`grep create_backup /etc/crontab` 211 | if [ x"${check_fsbackup_cron}" = x ]; then 212 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 213 | fi; 214 | 215 | } 216 | 217 | #******************************************* 218 | # 219 | #******************************************* 220 | post_install(){ 221 | cd /usr/abills/misc && perl perldeps.pl pkg -batch 222 | } 223 | -------------------------------------------------------------------------------- /plugins/freebsd_14_x64: -------------------------------------------------------------------------------- 1 | #OS freebsd 14 2 | #COMMENTS Freebsd comments 3 | #M update:upgrade:pkg upgrade -y 4 | #M mysql:MySQL:_install_mysql 5 | #M apache:apache:_install_apache 6 | #M perl_modules:Perl_modules:_install p5-JSON p5-DBI p5-DBD-mysql p5-Digest-MD4 p5-Digest-MD5 p5-PDF-API2 p5-Time-HiRes p5-XML-Simple p5-Spreadsheet-WriteExcel 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install isc-dhcp43-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M Mail:Mail_server:install_mail 11 | # MRTG= 12 | # IPN= 13 | #M fsbackup:FSBackup:_install_fsbackup 14 | #M build_kernel:Build_Kernel:freebsd_build_kernel 15 | # perl_speedy 16 | #M utils:Utils:_install vim tmux bash git sudo net-snmp socat 17 | 18 | # Variable 19 | 20 | YES="-y" 21 | BUILD_OPTIONS=" pkg install ${YES}" 22 | MYSQLDUMP=/usr/local/bin/mysqldump 23 | GZIP=/usr/bin/gzip 24 | 25 | WEB_SERVER_USER=www 26 | APACHE_CONF_DIR=/usr/local/etc/apache24/Includes/ 27 | RESTART_MYSQL=/usr/local/etc/rc.d/mysql-server 28 | RESTART_RADIUS=/usr/local/etc/rc.d/radiusd 29 | RESTART_APACHE=/usr/local/etc/rc.d/apache24 30 | RESTART_DHCP=/usr/local/etc/rc.d/isc-dhcpd 31 | PING=/sbin/ping 32 | 33 | #Services to check after installation 34 | PROCESS_LIST="mysql radiusd httpd flow-capture" 35 | 36 | 37 | #****************************************************************** 38 | # PRE INSTALL SECTION. Installing required packages 39 | #****************************************************************** 40 | pre_install () { 41 | if [ ! -f /usr/bin/perl ];then 42 | ln -s /usr/local/bin/perl /usr/bin/perl; 43 | fi; 44 | 45 | if [ ! -f /etc/crontab ];then 46 | touch /etc/crontab; 47 | fi; 48 | 49 | if [ ! -f /etc/make.conf ];then 50 | touch /etc/make.conf; 51 | fi; 52 | 53 | WITHOUT_X11=`grep 'WITHOUT="X11"' /etc/make.conf`; 54 | if [ x'${WITHOUT_X11}' = x'' ]; then 55 | echo 'WITHOUT="X11"' >> /etc/make.conf 56 | echo 'WITHOUT_GUI=yes' >> /etc/make.conf 57 | fi; 58 | 59 | echo >> /etc/rc.conf 60 | 61 | CURRENT_DIR=`pwd`; 62 | } 63 | 64 | #********************************************************** 65 | # Install mysql, set empty password for root in mysql 66 | #********************************************************** 67 | _install_mysql(){ 68 | 69 | _install mysql80-server 70 | $RESTART_MYSQL onestart 71 | mysqladmin -u root --password=`tail -1 /root/.mysql_secret` -h localhost password "" 72 | 73 | echo 74 | echo "Set empty password for root in mysql" 75 | echo 76 | 77 | rm /root/.mysql_secret 78 | } 79 | 80 | #******************************************* 81 | # Install mailserver 82 | #******************************************* 83 | install_mail () { 84 | echo "Install mail server" 85 | 86 | BUILD_OPTIONS="&& make && make install" 87 | PORTS_LOCATION="/usr/ports/" 88 | 89 | cmd="cd ${PORTS_LOCATION}/security/cyrus-sasl2 ${BUILD_OPTIONS};"; 90 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/postfix ${BUILD_OPTIONS};"; 91 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/maildrop && make WITH_AUTHLIB=yes MAILDROP_TRUSTED_USERS=vmail MAILDROP_SUID=1005 MAILDROP_SGID=1005 && make install;"; 92 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib-base ${BUILD_OPTIONS};" 93 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/courier-authlib ${BUILD_OPTIONS};" 94 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/courier-imap ${BUILD_OPTIONS} ;" 95 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/spamassassin/ ${BUILD_OPTIONS} ;" 96 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/clamav ${BUILD_OPTIONS};" 97 | cmd=${cmd}" cd ${PORTS_LOCATION}/security/amavisd-new ${BUILD_OPTIONS};" 98 | cmd=${cmd}" cd ${PORTS_LOCATION}/mail/squirrelmail ${BUILD_OPTIONS};" 99 | cmd=${cmd}" cd ${PORTS_LOCATION}/www/mod_php56 ${BUILD_OPTIONS};" 100 | 101 | if [ "${DEBUG}" != "" ]; then 102 | echo "CMD: ${cmd}"; 103 | fi; 104 | 105 | eval "${cmd}" 106 | 107 | exit; 108 | 109 | #Check apache php support 110 | check_apache=`pkg info | grep apache22` 111 | if [ "${check_apache}" = "" ]; then 112 | APACHE_CONFIG='/usr/local/etc/apache24/httpd.conf' 113 | else 114 | APACHE_CONFIG='/usr/local/etc/apache22/httpd.conf' 115 | fi; 116 | 117 | check_php_conf=`grep 'x-httpd-php' ${APACHE_CONFIG}` 118 | if [ w${check_php_conf} = w ]; then 119 | echo -n "Can\'t find php in apache config add it? (y/n): " 120 | read -p "" PHP_CONF 121 | if [ w${PHP_CONF} = wy ]; then 122 | echo "AddType application/x-httpd-php .php" >> ${APACHE_CONFIG} 123 | fi; 124 | fi; 125 | 126 | PHP_INDEX=`grep index.php ${APACHE_CONFIG}`; 127 | if [ "${PHP_INDEX}" = "" ]; then 128 | cp ${APACHE_CONFIG} ${APACHE_CONFIG}_bak 129 | cat ${APACHE_CONFIG}_bak | sed 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' > ${APACHE_CONFIG} 130 | fi; 131 | 132 | AUTOCONF_PROGRAMS="${AUTOCONF_PROGRAMS} postfix" 133 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} AMAVIS=1 CLAMAV=1" 134 | } 135 | 136 | 137 | #******************************************* 138 | # 139 | #******************************************* 140 | _install_freeradius(){ 141 | #Build port 142 | #cd /usr/ports/net/freeradius3 && make WITH="MYSQL USER DHCP" WITHOUT="" BATCH=yes install 143 | 144 | pkg install freeradius3 145 | pkg install freeradius3-mysql 146 | 147 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 148 | 149 | cd ${CURRENT_DIR} 150 | } 151 | 152 | #******************************************* 153 | # 154 | #******************************************* 155 | _install_ipn(){ 156 | _install flow-tools; 157 | 158 | mkdir -p /usr/abills/var/log/ipn/ 159 | chown -R flowtools /usr/abills/var/log/ipn/ 160 | 161 | service flow_capture start; 162 | } 163 | 164 | #******************************************* 165 | # 166 | #******************************************* 167 | _install_apache(){ 168 | 169 | _install apache24 170 | 171 | cat << '[EOF_APACHE]' > /usr/local/etc/apache24/modules.d/000_abills_modules.conf 172 | 173 | LoadModule ssl_module libexec/apache24/mod_ssl.so 174 | LoadModule rewrite_module libexec/apache24/mod_rewrite.so 175 | LoadModule cgi_module libexec/apache24/mod_cgi.so 176 | 177 | [EOF_APACHE] 178 | } 179 | 180 | #******************************************* 181 | # 182 | #******************************************* 183 | _install_fsbackup() { 184 | 185 | cd ~ ; 186 | 187 | FSBACKUP_DIR="fsbackup-1.2pl2" 188 | FSBACKUP_FILE_NAME="${FSBACKUP_DIR}.tar.gz" 189 | 190 | FSBACKUP_URL="http://www.opennet.ru/dev/fsbackup/src/${FSBACKUP_FILE_NAME}" 191 | 192 | fetch "${FSBACKUP_URL}"; 193 | 194 | if [ !-f ${FSBACKUP_FILE_NAME} ];then 195 | echo "#############################################" 196 | echo "######### Can't load FSBackup ######" 197 | echo "#############################################" 198 | return 199 | fi 200 | 201 | tar zxvf ${FSBACKUP_FILE_NAME}; 202 | cd ${FSBACKUP_DIR}; 203 | ./install.pl; 204 | mkdir -p /usr/local/fsbackup/archive; 205 | 206 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 207 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 208 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 209 | 210 | check_fsbackup_cron=`grep create_backup /etc/crontab` 211 | if [ x"${check_fsbackup_cron}" = x ]; then 212 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 213 | fi; 214 | 215 | } 216 | 217 | #******************************************* 218 | # 219 | #******************************************* 220 | post_install(){ 221 | cd /usr/abills/misc && perl perldeps.pl pkg -batch 222 | } 223 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /plugins/debian_8_x64: -------------------------------------------------------------------------------- 1 | #OS Debian_8_x64 2 | #COMMENTS Debian comments 3 | #M update:upgrade:apt-get update && apt-get upgrade 4 | #M mysql:MySQL:_install mariadb-server mariadb mariadb-client libmysqlclient-dev 5 | #M apache:apache:_install apache2 apache2-doc apache2-utils apache2-mpm-prefork libapache2-mod-perl2 6 | #M perl_modules:Perl_modules:_install libexpat1 ssl-cert cvs libdbi-perl libdbd-mysql-perl libdigest-md4-perl libdigest-sha-perl libcrypt-des-perl 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M DHCP:Dhcp_server:_install isc-dhcp-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSbackup:_install_fsbackup 13 | #M Mail:Mail_server:install_mail 14 | # perl_speedy 15 | #M utils:Utils:_install vim tmux bash git 16 | 17 | # Variable 18 | 19 | YES="-y" 20 | BUILD_OPTIONS=" apt-get ${YES} install " 21 | MYSQLDUMP=/usr/bin/mysqldump 22 | GZIP=/bin/gzip 23 | WEB_SERVER_USER=www-data 24 | APACHE_CONF_DIR=/etc/apache2/sites-enabled/ 25 | RESTART_MYSQL=/etc/init.d/mysql 26 | RESTART_RADIUS=/etc/init.d/radiusd 27 | RESTART_APACHE=/etc/init.d/apache2 28 | RESTART_DHCP=/etc/init.d/isc-dhcp 29 | PING=/bin/ping 30 | 31 | #Services to check after installation 32 | PROCESS_LIST="mysql radiusd apache2 flow-capture" 33 | 34 | #****************************************************************** 35 | # PRE INSTALL SECTION. Installing required packages 36 | #****************************************************************** 37 | pre_install () { 38 | 39 | apt-get update 40 | apt-get -y install dialog nano gcc sudo 41 | 42 | CURRENT_DIR=`pwd` 43 | } 44 | 45 | #******************************************* 46 | # Radius 47 | #******************************************* 48 | _install_freeradius() { 49 | apt-get -y install gcc 50 | apt-get -y install make 51 | 52 | if [ -d /usr/local/freeradius/ ]; then 53 | echo "Radius exists: /usr/local/freeradius/"; 54 | return 0 ; 55 | fi; 56 | 57 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 58 | 59 | for dir in ${PERL_LIB_DIRS}; do 60 | if [ "${DEBUG}" = 1 ]; then 61 | echo "ls ${dir}/libperl* | head -1" 62 | fi; 63 | 64 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 65 | if [ x"${PERL_LIB}" != x ]; then 66 | PERL_LIB_DIR=${dir} 67 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 68 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 69 | fi; 70 | fi; 71 | done; 72 | 73 | 74 | if [ x"${PERL_LIB_DIR}" = x ]; then 75 | echo "Perl lib not found"; 76 | exit; 77 | else 78 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 79 | fi; 80 | 81 | RADIUS_SERVER_USER="freerad" 82 | 83 | wget freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 84 | 85 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 86 | echo "Can\'t download freeradius. PLease download and install manual"; 87 | exit; 88 | fi; 89 | 90 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 91 | 92 | cd freeradius-server-${FREERADIUS_VERSION} 93 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp > 1 94 | echo "./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp " > configure_abills 95 | make && make install 96 | 97 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 98 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 99 | 100 | #Add user 101 | groupadd ${RADIUS_SERVER_USER} 102 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 103 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius/etc/raddb 104 | echo "_________________________________________________________________" 105 | echo " RADIUS SCRIPT AUTOSTART" 106 | echo "_________________________________________________________________" 107 | cat << 'EOF' > /etc/init.d/radiusd 108 | #!/bin/sh 109 | # Start/stop the FreeRADIUS daemon. 110 | 111 | ### BEGIN INIT INFO 112 | # Provides: radiusd 113 | # Required-Start: $remote_fs $network $syslog 114 | # Should-Start: $time mysql slapd postgresql samba krb5-kdc 115 | # Required-Stop: $remote_fs $syslog 116 | # Default-Start: 2 3 4 5 117 | # Default-Stop: 0 1 6 118 | # Short-Description: Radius Daemon 119 | # Description: Extensible, configurable radius daemon 120 | ### END INIT INFO 121 | 122 | set -e 123 | 124 | . /lib/lsb/init-functions 125 | 126 | PROG="radiusd" 127 | PROGRAM="/usr/sbin/radiusd" 128 | PIDFILE="/var/run/radiusd/radiusd.pid" 129 | DESCR="FreeRADIUS daemon" 130 | 131 | test -f $PROGRAM || exit 0 132 | 133 | # /var/run may be a tmpfs 134 | if [ ! -d /var/run/radiusd ]; then 135 | mkdir -p /var/run/radiusd 136 | chown freerad:freerad /var/run/radiusd 137 | fi 138 | 139 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 140 | 141 | ret=0 142 | 143 | case "$1" in 144 | start) 145 | log_daemon_msg "Starting $DESCR" "$PROG" 146 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM || ret=$? 147 | log_end_msg $ret 148 | exit $ret 149 | ;; 150 | stop) 151 | log_daemon_msg "Stopping $DESCR" "$PROG" 152 | if [ -f "$PIDFILE" ] ; then 153 | start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$? 154 | log_end_msg $ret 155 | else 156 | log_action_cont_msg "$PIDFILE not found" 157 | log_end_msg 0 158 | fi 159 | ;; 160 | restart|force-reload) 161 | $0 stop 162 | $0 start 163 | ;; 164 | *) 165 | echo "Usage: $0 start|stop|restart|force-reload" 166 | exit 1 167 | ;; 168 | esac 169 | 170 | exit 0 171 | EOF 172 | 173 | chmod +x /etc/init.d/radiusd 174 | update-rc.d radiusd defaults 175 | update-rc.d radiusd enable 176 | cd ${CURRENT_DIR} 177 | } 178 | 179 | 180 | #******************************************* 181 | # Flow-tools + Ipcad 182 | #******************************************* 183 | _install_ipn() { 184 | apt-get -y install flow-tools 185 | 186 | mkdir -p /usr/abills/var/log/ipn/ 187 | 188 | echo "-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996" > /etc/flow-tools/flow-capture.conf 189 | 190 | 191 | update-rc.d flow-capture defaults 192 | update-rc.d flow-capture enable 193 | 194 | ln -s `which flow-cat` /usr/local/bin/flow-cat 195 | ln -s `which flow-print` /usr/local/bin/flow-print 196 | 197 | echo '##################################################################################################' 198 | echo '########### FLOWTOOLS INSTALLED #############' 199 | echo '##################################################################################################' 200 | sleep 1; 201 | 202 | 203 | apt-get -y install libpcap-dev; 204 | 205 | echo '********************************************************************'; 206 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 207 | echo '********************************************************************'; 208 | 209 | # will be installed in /usr/ 210 | cd /usr/ 211 | 212 | #remove if already extracted 213 | if [ -d /usr/ipcad-3.7.3 ]; then 214 | rm -rf ipcad-3.7.3 215 | fi; 216 | 217 | # do not download if present 218 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 219 | echo "INFO: Already downloaded"; 220 | else 221 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 222 | fi; 223 | 224 | tar -xvzf ipcad-3.7.3.tar.gz 225 | cd ipcad-3.7.3 226 | 227 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 228 | LINE2_NUM=$(( LINE1_NUM + 2 )); 229 | 230 | sed -i "${LINE2_NUM}d" headers.h; 231 | sed -i "${LINE1_NUM}d" headers.h; 232 | 233 | echo 234 | 235 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 236 | echo "INFO: Error " 237 | else 238 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 239 | fi; 240 | 241 | 242 | sed -i "1i #include \"signal.h\"" main.c; 243 | 244 | echo 245 | 246 | sed -i "1i #include \"headers.h\"" pps.c; 247 | sed -i "1i #include \"signal.h\"" pps.c; 248 | 249 | echo "INFO: Added to pps.c" 250 | 251 | sed -i "1i #include \"signal.h\"" servers.h; 252 | 253 | echo "INFO: Added to servers.h" 254 | 255 | ./configure && make && make install 256 | 257 | if [ -d /var/ipcad/ ]; then 258 | echo "directory /var/ipcad/ exists"; 259 | else 260 | mkdir /var/ipcad/; 261 | fi; 262 | 263 | 264 | cat << 'EOF' > /usr/local/etc/ipcad.conf 265 | # Интерфейсы для сбора статистики 266 | interface eth0; 267 | # детализация по портам 268 | #capture-ports enable; 269 | 270 | # Агрегировать порты, уменьшает размер базы детализации 271 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 272 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 273 | #aggregate 150-1023 into 1023; /* General low range */ 274 | 275 | # Експортирование статистики на адрес 127.0.0.1 порт 9996 276 | netflow export destination 127.0.0.1 9996; 277 | netflow export version 5; # NetFlow export format version {1|5} 278 | netflow timeout active 30; # Timeout when flow is active, in minutes 279 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 280 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 281 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 282 | 283 | dumpfile = ipcad.dump; 284 | chroot = /var/ipcad/; 285 | pidfile = ipcad.pid; 286 | 287 | rsh enable at 127.0.0.1; 288 | memory_limit = 16m; 289 | 290 | EOF 291 | cd ${CURRENT_DIR} 292 | echo '##################################################################################################' 293 | echo '############# IPCAD INSTALLED ###############' 294 | echo '##################################################################################################' 295 | } 296 | 297 | #************************************ 298 | # rstat install 299 | #************************************ 300 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 301 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 302 | cd /usr/ 303 | wget ${RSTAT_URL} 304 | 305 | tar zxvf master.tar.gz ; 306 | cd rstat-master ; 307 | make install ; 308 | cd ${CURRENT_DIR} 309 | } 310 | 311 | #************************************ 312 | # MRTG install 313 | #************************************ 314 | _install_mrtg() { 315 | apt-get -y install mrtg snmp 316 | _install_rstat 317 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 318 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 319 | } 320 | 321 | #********************************************************** 322 | # FSBackup install 323 | #********************************************************** 324 | _install_fsbackup() { 325 | echo "FSBACKUP START INSTALL" 326 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 327 | 328 | wget ${url} 329 | 330 | tar zxvf fsbackup-1.2pl2.tar.gz; 331 | cd fsbackup-1.2pl2; 332 | ./install.pl; 333 | mkdir /usr/local/fsbackup/archive; 334 | 335 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 336 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 337 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 338 | 339 | check_fsbackup_cron=`grep create_backup /etc/crontab` 340 | if [ x"${check_fsbackup_cron}" = x ]; then 341 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 342 | fi; 343 | 344 | cd ${CURRENT_DIR} 345 | } 346 | 347 | #********************************************************** 348 | # ACCEL-PPPoE install 349 | #********************************************************** 350 | _install_accel_pppoe() { 351 | 352 | apt-get -y install bzip2 cmake libssl-dev libpcre3-dev 353 | 354 | echo 355 | echo "##############################################################" 356 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} ##" 357 | echo "##############################################################" 358 | echo 359 | cd /usr/ 360 | 361 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 362 | tar -xjf accel-ppp-1.7.4.tar.bz2 363 | cd accel-ppp-1.7.4 364 | mkdir build 365 | cd build 366 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/linux-headers-`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 367 | make 368 | make install 369 | 370 | cat << 'EOF1' > /etc/accel-ppp.conf 371 | [modules] 372 | #path=/usr/local/lib/accel-ppp 373 | log_file 374 | #log_tcp 375 | #log_pgsql 376 | pptp 377 | pppoe 378 | #l2tp 379 | auth_mschap_v2 380 | #auth_mschap_v1 381 | #auth_chap_md5 382 | #auth_pap 383 | radius 384 | #ippool 385 | sigchld 386 | pppd_compat 387 | shaper_tbf 388 | #chap-secrets 389 | 390 | [core] 391 | log-error=/var/log/accel-ppp/core.log 392 | thread-count=4 393 | 394 | [ppp] 395 | verbose=1 396 | min-mtu=1000 397 | mtu=1400 398 | mru=1400 399 | #ccp=0 400 | #sid-case=upper 401 | #check-ip=0 402 | #single-session=replace 403 | #mppe=require 404 | 405 | [lcp] 406 | echo-interval=30 407 | echo-failure=3 408 | 409 | [pptp] 410 | echo-interval=30 411 | verbose=1 412 | 413 | [pppoe] 414 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 415 | interface=eth1 416 | interface=vlan2 417 | interface=vlan3 418 | interface=vlan4 419 | #ac-name=xxx 420 | #service-name=yyy 421 | #pado-delay=0 422 | #pado-delay=0,100:100,200:200,-1:500 423 | #ifname-in-sid=called-sid 424 | #tr101=1 425 | verbose=1 426 | 427 | #[l2tp] 428 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 429 | #hello-interval=60 430 | #timeout=60 431 | #rtimeout=5 432 | #retransmit=5 433 | #host-name=accel-ppp 434 | #verbose=1 435 | 436 | [dns] 437 | dns1=10.0.0.10 438 | #dns2=172.16.1.1 439 | 440 | [radius] 441 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 442 | nas-identifier=accel-ppp 443 | nas-ip-address=127.0.0.1 444 | gw-ip-address=10.0.0.10 445 | auth-server=127.0.0.1:1812,secretpass 446 | acct-server=127.0.0.1:1813,secretpass 447 | dae-server=127.0.0.1:3799,secretpass 448 | verbose=1 449 | #timeout=3 450 | #max-try=3 451 | #acct-timeout=120 452 | #acct-delay-time=0 453 | 454 | [client-ip-range] 455 | disable 456 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 457 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 458 | 459 | #[ip-pool] 460 | #gw-ip-address=192.168.0.1 461 | #192.168.0.2-255 462 | #192.168.1.1-255 463 | #192.168.2.1-255 464 | #192.168.3.1-255 465 | #192.168.4.0/24 466 | 467 | [log] 468 | log-file=/var/log/accel-ppp/accel-ppp.log 469 | log-emerg=/var/log/accel-ppp/emerg.log 470 | log-fail-file=/var/log/accel-ppp/auth-fail.log 471 | #log-debug=/dev/stdout 472 | #log-tcp=127.0.0.1:3000 473 | copy=1 474 | #color=1 475 | #per-user-dir=per_user 476 | #per-session-dir=per_session 477 | #per-session=1 478 | level=3 479 | #log-tcp=127.0.0.1:3000 480 | 481 | #[log-pgsql] 482 | #conninfo=user=log 483 | #log-table=log 484 | 485 | [pppd-compat] 486 | #ip-pre-up=/etc/ppp/ip-pre-up 487 | #ip-up=/etc/ppp/ip-up 488 | #ip-down=/etc/ppp/ip-down 489 | #ip-change=/etc/ppp/ip-change 490 | radattr-prefix=/var/run/radattr 491 | verbose=1 492 | 493 | #[chap-secrets] 494 | #gw-ip-address=192.168.100.1 495 | #chap-secrets=/etc/ppp/chap-secrets 496 | 497 | [tbf] 498 | #attr=Filter-Id 499 | #down-burst-factor=0.1 500 | #up-burst-factor=1.0 501 | #latency=50 502 | attr-down=PPPD-Downstream-Speed-Limit 503 | attr-up=PPPD-Upstream-Speed-Limit 504 | 505 | 506 | [cli] 507 | telnet=127.0.0.1:2000 508 | #tcp=127.0.0.1:2001 509 | EOF1 510 | 511 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 512 | # Limit session traffic 513 | ATTRIBUTE Session-Octets-Limit 227 integer 514 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 515 | ATTRIBUTE Octets-Direction 228 integer 516 | # Connection Speed Limit 517 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 518 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 519 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 520 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 521 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 522 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 523 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 524 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 525 | ATTRIBUTE Acct-Interim-Interval 85 integer 526 | ATTRIBUTE Acct-Input-Gigawords 52 integer 527 | ATTRIBUTE Acct-Output-Gigawords 53 integer 528 | EOF2 529 | 530 | modprobe -r ip_gre 531 | 532 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 533 | 534 | echo 'pptp' >> /etc/modules 535 | echo 'pppoe' >> /etc/modules 536 | 537 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 538 | # Limit session traffic 539 | ATTRIBUTE Session-Octets-Limit 227 integer 540 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 541 | ATTRIBUTE Octets-Direction 228 integer 542 | # Connection Speed Limit 543 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 544 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 545 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 546 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 547 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 548 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 549 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 550 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 551 | ATTRIBUTE Acct-Interim-Interval 85 integer 552 | ATTRIBUTE Acct-Input-Gigawords 52 integer 553 | EOF3 554 | 555 | 556 | touch /etc/init.d/accel-ppp 557 | chmod +x /etc/init.d/accel-ppp 558 | 559 | cat << 'EOF4' >> /etc/init.d/accel-ppp 560 | #!/bin/sh 561 | # /etc/init.d/accel-pppd: set up the accel-ppp server 562 | ### BEGIN INIT INFO 563 | # Provides: accel-ppp 564 | # Required-Start: $networking 565 | # Required-Stop: $networking 566 | # Default-Start: 2 3 4 5 567 | # Default-Stop: 0 1 6 568 | ### END INIT INFO 569 | 570 | set -e 571 | 572 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin; 573 | ACCEL_PPTPD=`which accel-pppd` 574 | . /lib/lsb/init-functions 575 | 576 | if test -f /etc/default/accel-ppp; then 577 | . /etc/default/accel-ppp 578 | fi 579 | 580 | if [ -z $ACCEL_PPPTD_OPTS ]; then 581 | ACCEL_PPTPD_OPTS="-c /etc/accel-ppp.conf" 582 | fi 583 | 584 | case "$1" in 585 | start) 586 | log_daemon_msg "Starting accel-ppp server" "accel-pppd" 587 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 588 | log_end_msg 0 589 | else 590 | log_end_msg 1 591 | fi 592 | ;; 593 | restart) 594 | log_daemon_msg "Restarting accel-ppp server" "accel-pppd" 595 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 596 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 597 | log_end_msg 0 598 | else 599 | log_end_msg 1 600 | fi 601 | ;; 602 | 603 | stop) 604 | log_daemon_msg "Stopping accel-ppp server" "accel-pppd" 605 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 606 | log_end_msg 0 607 | ;; 608 | 609 | status) 610 | do_status 611 | ;; 612 | *) 613 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 614 | exit 1 615 | ;; 616 | esac 617 | 618 | exit 0 619 | EOF4 620 | update-rc.d accel-ppp defaults 621 | update-rc.d accel-ppp enable 622 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 623 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 624 | 625 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 626 | 627 | cd ${CURRENT_DIR} 628 | 629 | } 630 | 631 | #****************************************************************** 632 | # POST INSTALL 633 | #****************************************************************** 634 | post_install () { 635 | 636 | a2enmod rewrite; 637 | a2enmod ssl; 638 | a2enmod perl; 639 | a2enmod cgi; 640 | 641 | touch /etc/crontab 642 | 643 | cd /usr/abills/misc && ./perldeps.pl apt-get -batch 644 | 645 | echo "Plugin finished"; 646 | read -p "press Enter to continue..."; 647 | } 648 | -------------------------------------------------------------------------------- /plugins/debian_9_x64: -------------------------------------------------------------------------------- 1 | #OS Debian_9_x64 2 | #COMMENTS Debian comments 3 | #M update:upgrade:apt-get update && apt-get upgrade 4 | #M mysql:MySQL:_install mariadb-server mariadb mariadb-client 5 | #M apache:apache:_install apache2 apache2-doc apache2-utils apache2-mpm-prefork libapache2-mod-perl2 6 | #M perl_modules:Perl_modules:_install libexpat1 ssl-cert cvs libdbi-perl libdbd-mysql-perl libdigest-md4-perl libdigest-sha-perl libcrypt-des-perl 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M DHCP:Dhcp_server:_install isc-dhcp-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSbackup:_install_fsbackup 13 | #M Mail:Mail_server:install_mail 14 | # perl_speedy 15 | #M utils:Utils:_install vim tmux bash git snmp socat 16 | 17 | # Variable 18 | 19 | YES="-y" 20 | BUILD_OPTIONS=" apt-get ${YES} install " 21 | MYSQLDUMP=/usr/bin/mysqldump 22 | GZIP=/bin/gzip 23 | WEB_SERVER_USER=www-data 24 | APACHE_CONF_DIR=/etc/apache2/sites-enabled/ 25 | RESTART_MYSQL=/etc/init.d/mysql 26 | RESTART_RADIUS=/etc/init.d/radiusd 27 | RESTART_APACHE=/etc/init.d/apache2 28 | RESTART_DHCP=/etc/init.d/isc-dhcp 29 | PING=/bin/ping 30 | 31 | #Services to check after installation 32 | PROCESS_LIST="mysql radiusd apache2 flow-capture" 33 | 34 | #****************************************************************** 35 | # PRE INSTALL SECTION. Installing required packages 36 | #****************************************************************** 37 | pre_install () { 38 | 39 | apt-get update 40 | apt-get install -yq dialog nano gcc sudo 41 | 42 | CURRENT_DIR=`pwd` 43 | } 44 | 45 | #******************************************* 46 | # Radius 47 | #******************************************* 48 | _install_freeradius() { 49 | apt-get -y install gcc make libtalloc-dev libmariadb-dev libmariadbclient-dev libmariadbclient-dev-compat 50 | 51 | if [ -d /usr/local/freeradius/ ]; then 52 | echo "Radius exists: /usr/local/freeradius/"; 53 | return 0 ; 54 | fi; 55 | FREERADIUS_VERSION=3.0.17 56 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 57 | 58 | for dir in ${PERL_LIB_DIRS}; do 59 | if [ "${DEBUG}" = 1 ]; then 60 | echo "ls ${dir}/libperl* | head -1" 61 | fi; 62 | 63 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 64 | if [ x"${PERL_LIB}" != x ]; then 65 | PERL_LIB_DIR=${dir} 66 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 67 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 68 | fi; 69 | fi; 70 | done; 71 | 72 | 73 | if [ x"${PERL_LIB_DIR}" = x ]; then 74 | echo "Perl lib not found. Not building FreeRadius. Waiting 5 sec..."; 75 | sleep 5; 76 | return 77 | else 78 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 79 | fi; 80 | 81 | RADIUS_SERVER_USER="freerad" 82 | 83 | wget -O freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 84 | 85 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 86 | echo "Can\'t download freeradius. PLease download and install manual"; 87 | exit; 88 | fi; 89 | 90 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 91 | 92 | cd freeradius-server-${FREERADIUS_VERSION} 93 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes > 1 94 | echo "/configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes " > configure_abills 95 | make && make install 96 | 97 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 98 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 99 | 100 | #Add user 101 | groupadd ${RADIUS_SERVER_USER} 102 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 103 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius/etc/raddb 104 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 105 | echo "_________________________________________________________________" 106 | echo " RADIUS SCRIPT AUTOSTART" 107 | echo "_________________________________________________________________" 108 | cat << 'EOF' > /etc/init.d/radiusd 109 | #!/bin/sh 110 | # Start/stop the FreeRADIUS daemon. 111 | 112 | ### BEGIN INIT INFO 113 | # Provides: radiusd 114 | # Required-Start: $remote_fs $network $syslog 115 | # Should-Start: $time mysql slapd postgresql samba krb5-kdc 116 | # Required-Stop: $remote_fs $syslog 117 | # Default-Start: 2 3 4 5 118 | # Default-Stop: 0 1 6 119 | # Short-Description: Radius Daemon 120 | # Description: Extensible, configurable radius daemon 121 | ### END INIT INFO 122 | 123 | set -e 124 | 125 | . /lib/lsb/init-functions 126 | 127 | PROG="radiusd" 128 | PROGRAM="/usr/sbin/radiusd" 129 | PIDFILE="/usr/local/freeradius/var/run/radiusd/radiusd.pid" 130 | DESCR="FreeRADIUS daemon" 131 | 132 | test -f $PROGRAM || exit 0 133 | 134 | # /var/run may be a tmpfs 135 | if [ ! -d /var/run/radiusd ]; then 136 | mkdir -p /var/run/radiusd 137 | chown freerad:freerad /var/run/radiusd 138 | fi 139 | 140 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 141 | 142 | ret=0 143 | 144 | case "$1" in 145 | start) 146 | log_daemon_msg "Starting $DESCR" "$PROG" 147 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM || ret=$? 148 | log_end_msg $ret 149 | exit $ret 150 | ;; 151 | stop) 152 | log_daemon_msg "Stopping $DESCR" "$PROG" 153 | if [ -f "$PIDFILE" ] ; then 154 | start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$? 155 | log_end_msg $ret 156 | else 157 | log_action_cont_msg "$PIDFILE not found" 158 | log_end_msg 0 159 | fi 160 | ;; 161 | restart|force-reload) 162 | $0 stop 163 | $0 start 164 | ;; 165 | *) 166 | echo "Usage: $0 start|stop|restart|force-reload" 167 | exit 1 168 | ;; 169 | esac 170 | 171 | exit 0 172 | EOF 173 | 174 | chmod +x /etc/init.d/radiusd 175 | update-rc.d radiusd defaults 176 | update-rc.d radiusd enable 177 | service radiusd start 178 | #AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 179 | cd ${CURRENT_DIR} 180 | } 181 | 182 | 183 | #******************************************* 184 | # Flow-tools + Ipcad 185 | #******************************************* 186 | _install_ipn() { 187 | apt-get -y install flow-tools 188 | 189 | mkdir -p /usr/abills/var/log/ipn/ 190 | 191 | echo "-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996" > /etc/flow-tools/flow-capture.conf 192 | 193 | 194 | update-rc.d flow-capture defaults 195 | update-rc.d flow-capture enable 196 | 197 | ln -s `which flow-cat` /usr/local/bin/flow-cat 198 | ln -s `which flow-print` /usr/local/bin/flow-print 199 | 200 | echo '##################################################################################################' 201 | echo '########### FLOWTOOLS INSTALLED #############' 202 | echo '##################################################################################################' 203 | sleep 1; 204 | 205 | 206 | apt-get -y install libpcap-dev; 207 | 208 | echo '********************************************************************'; 209 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 210 | echo '********************************************************************'; 211 | 212 | # will be installed in /usr/ 213 | cd /usr/ 214 | 215 | #remove if already extracted 216 | if [ -d /usr/ipcad-3.7.3 ]; then 217 | rm -rf ipcad-3.7.3 218 | fi; 219 | 220 | # do not download if present 221 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 222 | echo "INFO: Already downloaded"; 223 | else 224 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 225 | fi; 226 | 227 | tar -xvzf ipcad-3.7.3.tar.gz 228 | cd ipcad-3.7.3 229 | 230 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 231 | LINE2_NUM=$(( LINE1_NUM + 2 )); 232 | 233 | sed -i "${LINE2_NUM}d" headers.h; 234 | sed -i "${LINE1_NUM}d" headers.h; 235 | 236 | echo 237 | 238 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 239 | echo "INFO: Error " 240 | else 241 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 242 | fi; 243 | 244 | 245 | sed -i "1i #include \"signal.h\"" main.c; 246 | 247 | echo 248 | 249 | sed -i "1i #include \"headers.h\"" pps.c; 250 | sed -i "1i #include \"signal.h\"" pps.c; 251 | 252 | echo "INFO: Added to pps.c" 253 | 254 | sed -i "1i #include \"signal.h\"" servers.h; 255 | 256 | echo "INFO: Added to servers.h" 257 | 258 | ./configure && make && make install 259 | 260 | if [ -d /var/ipcad/ ]; then 261 | echo "directory /var/ipcad/ exists"; 262 | else 263 | mkdir /var/ipcad/; 264 | fi; 265 | 266 | 267 | cat << 'EOF' > /usr/local/etc/ipcad.conf 268 | # Интерфейсы для сбора статистики 269 | interface eth0; 270 | # детализация по портам 271 | #capture-ports enable; 272 | 273 | # Агрегировать порты, уменьшает размер базы детализации 274 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 275 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 276 | #aggregate 150-1023 into 1023; /* General low range */ 277 | 278 | # Експортирование статистики на адрес 127.0.0.1 порт 9996 279 | netflow export destination 127.0.0.1 9996; 280 | netflow export version 5; # NetFlow export format version {1|5} 281 | netflow timeout active 30; # Timeout when flow is active, in minutes 282 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 283 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 284 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 285 | 286 | dumpfile = ipcad.dump; 287 | chroot = /var/ipcad/; 288 | pidfile = ipcad.pid; 289 | 290 | rsh enable at 127.0.0.1; 291 | memory_limit = 16m; 292 | 293 | EOF 294 | cd ${CURRENT_DIR} 295 | echo '##################################################################################################' 296 | echo '############# IPCAD INSTALLED ###############' 297 | echo '##################################################################################################' 298 | } 299 | 300 | #************************************ 301 | # rstat install 302 | #************************************ 303 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 304 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 305 | cd /usr/ 306 | wget ${RSTAT_URL} 307 | 308 | tar zxvf master.tar.gz ; 309 | cd rstat-master ; 310 | make install ; 311 | cd ${CURRENT_DIR} 312 | } 313 | 314 | #************************************ 315 | # MRTG install 316 | #************************************ 317 | _install_mrtg() { 318 | apt-get -y install mrtg snmp 319 | _install_rstat 320 | # indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 321 | # echo "*/5 * * * * root env LANG=C /usr/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg" >> /etc/crontab 322 | } 323 | 324 | #********************************************************** 325 | # FSBackup install 326 | #********************************************************** 327 | _install_fsbackup() { 328 | echo "FSBACKUP START INSTALL" 329 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 330 | 331 | wget ${url} 332 | 333 | tar zxvf fsbackup-1.2pl2.tar.gz; 334 | cd fsbackup-1.2pl2; 335 | ./install.pl; 336 | mkdir /usr/local/fsbackup/archive; 337 | 338 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 339 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 340 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 341 | 342 | check_fsbackup_cron=`grep create_backup /etc/crontab` 343 | if [ x"${check_fsbackup_cron}" = x ]; then 344 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 345 | fi; 346 | 347 | cd ${CURRENT_DIR} 348 | } 349 | 350 | #********************************************************** 351 | # ACCEL-PPPoE install 352 | #********************************************************** 353 | _install_accel_pppoe() { 354 | 355 | apt-get -y install bzip2 cmake libssl-dev libpcre3-dev 356 | 357 | echo 358 | echo "##############################################################" 359 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} ##" 360 | echo "##############################################################" 361 | echo 362 | cd /usr/ 363 | 364 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 365 | tar -xjf accel-ppp-1.7.4.tar.bz2 366 | cd accel-ppp-1.7.4 367 | mkdir build 368 | cd build 369 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/linux-headers-`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 370 | make 371 | make install 372 | 373 | cat << 'EOF1' > /etc/accel-ppp.conf 374 | [modules] 375 | #path=/usr/local/lib/accel-ppp 376 | log_file 377 | #log_tcp 378 | #log_pgsql 379 | pptp 380 | pppoe 381 | #l2tp 382 | auth_mschap_v2 383 | #auth_mschap_v1 384 | #auth_chap_md5 385 | #auth_pap 386 | radius 387 | #ippool 388 | sigchld 389 | pppd_compat 390 | shaper_tbf 391 | #chap-secrets 392 | 393 | [core] 394 | log-error=/var/log/accel-ppp/core.log 395 | thread-count=4 396 | 397 | [ppp] 398 | verbose=1 399 | min-mtu=1000 400 | mtu=1400 401 | mru=1400 402 | #ccp=0 403 | #sid-case=upper 404 | #check-ip=0 405 | #single-session=replace 406 | #mppe=require 407 | 408 | [lcp] 409 | echo-interval=30 410 | echo-failure=3 411 | 412 | [pptp] 413 | echo-interval=30 414 | verbose=1 415 | 416 | [pppoe] 417 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 418 | interface=eth1 419 | interface=vlan2 420 | interface=vlan3 421 | interface=vlan4 422 | #ac-name=xxx 423 | #service-name=yyy 424 | #pado-delay=0 425 | #pado-delay=0,100:100,200:200,-1:500 426 | #ifname-in-sid=called-sid 427 | #tr101=1 428 | verbose=1 429 | 430 | #[l2tp] 431 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 432 | #hello-interval=60 433 | #timeout=60 434 | #rtimeout=5 435 | #retransmit=5 436 | #host-name=accel-ppp 437 | #verbose=1 438 | 439 | [dns] 440 | dns1=10.0.0.10 441 | #dns2=172.16.1.1 442 | 443 | [radius] 444 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 445 | nas-identifier=accel-ppp 446 | nas-ip-address=127.0.0.1 447 | gw-ip-address=10.0.0.10 448 | auth-server=127.0.0.1:1812,secretpass 449 | acct-server=127.0.0.1:1813,secretpass 450 | dae-server=127.0.0.1:3799,secretpass 451 | verbose=1 452 | #timeout=3 453 | #max-try=3 454 | #acct-timeout=120 455 | #acct-delay-time=0 456 | 457 | [client-ip-range] 458 | disable 459 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 460 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 461 | 462 | #[ip-pool] 463 | #gw-ip-address=192.168.0.1 464 | #192.168.0.2-255 465 | #192.168.1.1-255 466 | #192.168.2.1-255 467 | #192.168.3.1-255 468 | #192.168.4.0/24 469 | 470 | [log] 471 | log-file=/var/log/accel-ppp/accel-ppp.log 472 | log-emerg=/var/log/accel-ppp/emerg.log 473 | log-fail-file=/var/log/accel-ppp/auth-fail.log 474 | #log-debug=/dev/stdout 475 | #log-tcp=127.0.0.1:3000 476 | copy=1 477 | #color=1 478 | #per-user-dir=per_user 479 | #per-session-dir=per_session 480 | #per-session=1 481 | level=3 482 | #log-tcp=127.0.0.1:3000 483 | 484 | #[log-pgsql] 485 | #conninfo=user=log 486 | #log-table=log 487 | 488 | [pppd-compat] 489 | #ip-pre-up=/etc/ppp/ip-pre-up 490 | #ip-up=/etc/ppp/ip-up 491 | #ip-down=/etc/ppp/ip-down 492 | #ip-change=/etc/ppp/ip-change 493 | radattr-prefix=/var/run/radattr 494 | verbose=1 495 | 496 | #[chap-secrets] 497 | #gw-ip-address=192.168.100.1 498 | #chap-secrets=/etc/ppp/chap-secrets 499 | 500 | [tbf] 501 | #attr=Filter-Id 502 | #down-burst-factor=0.1 503 | #up-burst-factor=1.0 504 | #latency=50 505 | attr-down=PPPD-Downstream-Speed-Limit 506 | attr-up=PPPD-Upstream-Speed-Limit 507 | 508 | 509 | [cli] 510 | telnet=127.0.0.1:2000 511 | #tcp=127.0.0.1:2001 512 | EOF1 513 | 514 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 515 | # Limit session traffic 516 | ATTRIBUTE Session-Octets-Limit 227 integer 517 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 518 | ATTRIBUTE Octets-Direction 228 integer 519 | # Connection Speed Limit 520 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 521 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 522 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 523 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 524 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 525 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 526 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 527 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 528 | ATTRIBUTE Acct-Interim-Interval 85 integer 529 | ATTRIBUTE Acct-Input-Gigawords 52 integer 530 | ATTRIBUTE Acct-Output-Gigawords 53 integer 531 | EOF2 532 | 533 | modprobe -r ip_gre 534 | 535 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 536 | 537 | echo 'pptp' >> /etc/modules 538 | echo 'pppoe' >> /etc/modules 539 | 540 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 541 | # Limit session traffic 542 | ATTRIBUTE Session-Octets-Limit 227 integer 543 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 544 | ATTRIBUTE Octets-Direction 228 integer 545 | # Connection Speed Limit 546 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 547 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 548 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 549 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 550 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 551 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 552 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 553 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 554 | ATTRIBUTE Acct-Interim-Interval 85 integer 555 | ATTRIBUTE Acct-Input-Gigawords 52 integer 556 | EOF3 557 | 558 | 559 | touch /etc/init.d/accel-ppp 560 | chmod +x /etc/init.d/accel-ppp 561 | 562 | cat << 'EOF4' >> /etc/init.d/accel-ppp 563 | #!/bin/sh 564 | # /etc/init.d/accel-pppd: set up the accel-ppp server 565 | ### BEGIN INIT INFO 566 | # Provides: accel-ppp 567 | # Required-Start: $networking 568 | # Required-Stop: $networking 569 | # Default-Start: 2 3 4 5 570 | # Default-Stop: 0 1 6 571 | ### END INIT INFO 572 | 573 | set -e 574 | 575 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin; 576 | ACCEL_PPTPD=`which accel-pppd` 577 | . /lib/lsb/init-functions 578 | 579 | if test -f /etc/default/accel-ppp; then 580 | . /etc/default/accel-ppp 581 | fi 582 | 583 | if [ -z $ACCEL_PPPTD_OPTS ]; then 584 | ACCEL_PPTPD_OPTS="-c /etc/accel-ppp.conf" 585 | fi 586 | 587 | case "$1" in 588 | start) 589 | log_daemon_msg "Starting accel-ppp server" "accel-pppd" 590 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 591 | log_end_msg 0 592 | else 593 | log_end_msg 1 594 | fi 595 | ;; 596 | restart) 597 | log_daemon_msg "Restarting accel-ppp server" "accel-pppd" 598 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 599 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 600 | log_end_msg 0 601 | else 602 | log_end_msg 1 603 | fi 604 | ;; 605 | 606 | stop) 607 | log_daemon_msg "Stopping accel-ppp server" "accel-pppd" 608 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 609 | log_end_msg 0 610 | ;; 611 | 612 | status) 613 | do_status 614 | ;; 615 | *) 616 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 617 | exit 1 618 | ;; 619 | esac 620 | 621 | exit 0 622 | EOF4 623 | update-rc.d accel-ppp defaults 624 | update-rc.d accel-ppp enable 625 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 626 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 627 | 628 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 629 | 630 | cd ${CURRENT_DIR} 631 | 632 | } 633 | 634 | #****************************************************************** 635 | # POST INSTALL 636 | #****************************************************************** 637 | post_install () { 638 | 639 | a2enmod rewrite; 640 | a2enmod ssl; 641 | a2enmod perl; 642 | a2enmod cgi; 643 | 644 | touch /etc/crontab 645 | 646 | cd /usr/abills/misc && ./perldeps.pl apt-get -batch 647 | 648 | echo "Plugin finished"; 649 | echo -n "press Enter to continue..."; 650 | read _; 651 | } 652 | -------------------------------------------------------------------------------- /plugins/centos_7_x64: -------------------------------------------------------------------------------- 1 | #OS CentOS 7_x64 2 | #COMMENTS CentOS comments 3 | #M update:Upgrade_system:yum -y update 4 | #M mysql:MySQL:_install_mysql 5 | #M apache:Apache2.4:_install_httpd 6 | #M perl_modules:Perl_modules:_install_perl_modules 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install_dhcp 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSBackup:_install_fsbackup 13 | #dM Mail:Mail_server:install_mail 14 | # MRTG= 15 | # fsbackup= 16 | # perl_speedy 17 | #M utils:Utils:_install_utils 18 | 19 | # Variables 20 | WEB_SERVER_USER=apache 21 | MYSQLDUMP=/bin/mysqldump 22 | GZIP=/bin/gzip 23 | APACHE_CONF_DIR=/etc/httpd/conf.d 24 | RESTART_MYSQL="service mysqld" 25 | RESTART_RADIUS="service radiusd " 26 | RESTART_APACHE="service httpd " 27 | PING=/bin/ping 28 | 29 | #Services to check after installation 30 | PROCESS_LIST="mysqld radiusd httpd flow-capture named" 31 | 32 | #******************************************* 33 | # Pre install 34 | #******************************************* 35 | pre_install() { 36 | yum -y install wget tmux bash nano gcc ca-certificates; 37 | _install_epel; 38 | 39 | CURRENT_DIR=`pwd` 40 | } 41 | 42 | #********************************************************* 43 | # Install MySQL 44 | #********************************************************* 45 | _install_mysql(){ 46 | # Install repository 47 | yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm 48 | percona-release setup ps57 49 | 50 | # Clear log before installation 51 | [ -f /var/log/mysqld.log ] && echo '' > /var/log/mysqld.log 52 | 53 | # Install server (+client) and devel package to compile Freeradius module 54 | yum -y install Percona-Server-server-57 Percona-Server-devel-57 55 | 56 | echo "Starting Percona to initialize /var/lib/mysql directory" 57 | systemctl start mysqld 58 | 59 | echo "Stop percona running in normal mode" 60 | systemctl stop mysqld 61 | 62 | echo "Starting Percona without password validate" 63 | sudo -u mysql /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid --validate-password=OFF 64 | 65 | echo "Grep generated password from mysqld.log" 66 | MYSQL_TEMPRORARY_ROOT_PASSWORD=`cat /var/log/mysqld.log | grep generated | awk '{print($11)}'` 67 | 68 | echo "Clear 'root'@'localhost' password" 69 | mysqladmin -u root --password="${MYSQL_TEMPRORARY_ROOT_PASSWORD}" -h localhost password "" 70 | 71 | echo "Stopping mysql without validate password" 72 | kill -2 `cat /var/run/mysqld/mysqld.pid` 73 | 74 | echo "Starting mysql in normal mode" 75 | systemctl start mysqld 76 | systemctl enable mysqld 77 | 78 | echo "Disabling special character password policy" 79 | mysql -e "SET GLOBAL validate_password_special_char_count=0;" 80 | } 81 | 82 | #********************************************************* 83 | # Install apache 84 | #********************************************************* 85 | _install_httpd(){ 86 | yum -y install httpd httpd-devel httpd-tools 87 | chkconfig httpd on 88 | service httpd start 89 | 90 | cat << '[EOF_APACHE]' > /etc/httpd/modules.d/000_abills_modules.conf 91 | LoadModule ssl_module modules/mod_ssl.so 92 | LoadModule rewrite_module modules/mod_rewrite.so 93 | LoadModule cgi_module modules/mod_cgi.so 94 | [EOF_APACHE] 95 | 96 | apachectl -k restart 97 | 98 | 99 | echo "######### Opening firewall ports ############" 100 | firewall-cmd --zone=public --add-port=9443/tcp --permanent 101 | firewall-cmd --reload 102 | echo "######### Disabling selinux ############" 103 | 104 | sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config 105 | 106 | } 107 | #********************************************************* 108 | # Install EPEL repository CentOS (RedHat) 109 | #********************************************************* 110 | _install_epel() { 111 | # RPM needs 'y' answer, so to automate installation, use yum 112 | yum -y install epel-release 113 | # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm 114 | # rpm -ivh epel-release-7-5.noarch.rpm 115 | 116 | } 117 | 118 | #********************************************************* 119 | # Install Perl modules 120 | #********************************************************* 121 | _install_perl_modules() { 122 | yum -y install expat-devel expat mod_ssl openssl openssl-devel perl-DBI perl-JSON perl-DBD-MySQL perl-Digest-MD5 perl-Digest-SHA1 perl-Time-HiRes perl-ExtUtils-Embed perl-DB_File perl-autodie perl-App-cpanminus perl-Time-Piece 123 | cpanm Devel::NYTProf Imager::QRCode autodie 124 | } 125 | 126 | #******************************************* 127 | # Radius 128 | #******************************************* 129 | _install_freeradius() { 130 | yum -y install gdbm gdbm-devel install perl-ExtUtils-Embed gcc libtalloc-devel 131 | 132 | if [ -d /usr/local/freeradius/ ]; then 133 | echo "Radius exists: /usr/local/freeradius/"; 134 | return 0 ; 135 | fi; 136 | 137 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 138 | 139 | for dir in ${PERL_LIB_DIRS}; do 140 | if [ "${DEBUG}" = 1 ]; then 141 | echo "ls ${dir}/libperl* | head -1" 142 | fi; 143 | 144 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 145 | if [ x"${PERL_LIB}" != x ]; then 146 | PERL_LIB_DIR=${dir} 147 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 148 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 149 | fi; 150 | fi; 151 | done; 152 | 153 | 154 | if [ x"${PERL_LIB_DIR}" = x ]; then 155 | echo "Perl lib not found"; 156 | exit; 157 | else 158 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 159 | fi; 160 | 161 | RADIUS_SERVER_USER="freerad" 162 | 163 | _fetch freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 164 | 165 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 166 | echo "Can\'t download freeradius. PLease download and install manual"; 167 | exit; 168 | fi; 169 | 170 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 171 | 172 | cd freeradius-server-${FREERADIUS_VERSION} 173 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp > 1 174 | #echo "./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp " > configure_abills 175 | make && make install 176 | 177 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 178 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 179 | 180 | firewall-cmd --permanent --zone=public --add-service=radius 181 | 182 | #Add user 183 | groupadd ${RADIUS_SERVER_USER} 184 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 185 | mkdir -p /usr/local/freeradius/var/log 186 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius 187 | 188 | cat << 'EOF' > /etc/systemd/system/radiusd.service 189 | [Unit] 190 | Description=FreeRADIUS Server 191 | After=network.target 192 | After=mysqld.service 193 | Requires=mysqld.service 194 | 195 | [Service] 196 | Type=forking 197 | 198 | PIDFile=/var/run/radiusd/radiusd.pid 199 | ExecStartPre=/usr/bin/touch /usr/local/freeradius/var/log/radius.log 200 | ExecStartPre=/usr/bin/chown freerad:freerad /usr/local/freeradius/var/log/radius.log 201 | ExecStartPre=/usr/bin/mkdir -p /var/run/radiusd 202 | ExecStartPre=/usr/bin/chown -R freerad:freerad /var/run/radiusd 203 | ExecStartPre=/usr/local/freeradius/sbin/radiusd -C 204 | 205 | ExecStart=/usr/local/freeradius/sbin/radiusd -d /usr/local/freeradius/etc/raddb 206 | 207 | ExecReload=/usr/local/freeradius/sbin/radiusd -C 208 | ExecReload=/bin/kill -HUP $MAINPID 209 | 210 | [Install] 211 | WantedBy=multi-user.target 212 | EOF 213 | 214 | # Change log file destination 215 | sed -i.bak -e 's/logdir\ \=\ \/var\/log/logdir\ \=\ \$\{prefix\}\/var\/log/' /usr/abills/misc/freeradius/linux/radiusd.conf 216 | 217 | chown freerad:freerad -R /usr/local/freeradius/var/log 218 | 219 | systemctl enable radiusd 220 | 221 | cd ${CURRENT_DIR} 222 | } 223 | 224 | #******************************************* 225 | # Dhcp server 226 | #******************************************* 227 | _install_dhcp() { 228 | yum -y install dhcp 229 | } 230 | 231 | #******************************************* 232 | # Utils 233 | #******************************************* 234 | _install_utils() { 235 | yum -y install vim tmux bash git 236 | } 237 | 238 | #******************************************* 239 | # Flow-tools + Ipcad 240 | #******************************************* 241 | _install_ipn() { 242 | yum install -y flow-tools 243 | 244 | mkdir -p /usr/abills/var/log/ipn/ 245 | 246 | echo 'OPTIONS="-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996"' > /etc/sysconfig/flow-capture 247 | 248 | 249 | chkconfig --add flow-capture 250 | chkconfig flow-capture on 251 | echo '##################################################################################################' 252 | echo 'FLOWTOOLS INSTALLED ##################################################################################################' 253 | echo '##################################################################################################' 254 | 255 | 256 | yum -y install libpcap libpcap-devel; 257 | 258 | 259 | echo '********************************************************************'; 260 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 261 | echo '********************************************************************'; 262 | 263 | # will be installed in /usr/ 264 | cd /usr/ 265 | 266 | #remove if already extracted 267 | if [ -d /usr/ipcad-3.7.3 ]; then 268 | rm -rf ipcad-3.7.3 269 | fi; 270 | 271 | # do not download if present 272 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 273 | echo "INFO: Already downloaded"; 274 | else 275 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 276 | fi; 277 | 278 | tar -xvzf ipcad-3.7.3.tar.gz 279 | cd ipcad-3.7.3 280 | 281 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 282 | LINE2_NUM=$(( LINE1_NUM + 2 )); 283 | 284 | sed -i "${LINE2_NUM}d" headers.h; 285 | sed -i "${LINE1_NUM}d" headers.h; 286 | 287 | echo 288 | 289 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 290 | echo "INFO: Error " 291 | else 292 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 293 | fi; 294 | 295 | 296 | sed -i "1i #include \"signal.h\"" main.c; 297 | 298 | echo 299 | 300 | sed -i "1i #include \"headers.h\"" pps.c; 301 | sed -i "1i #include \"signal.h\"" pps.c; 302 | 303 | echo "INFO: Added to pps.c" 304 | 305 | sed -i "1i #include \"signal.h\"" servers.h; 306 | 307 | echo "INFO: Added to servers.h" 308 | 309 | ./configure && make && make install 310 | 311 | if [ -d /var/ipcad/ ]; then 312 | echo "directory /var/ipcad/ exists"; 313 | else 314 | mkdir /var/ipcad/; 315 | fi; 316 | 317 | 318 | cat << 'EOF' > /usr/local/etc/ipcad.conf 319 | # Èíòåðôåéñû äëÿ ñáîðà ñòàòèñòèêè 320 | interface eth0; 321 | # äåòàëèçàöèÿ ïî ïîðòàì 322 | #capture-ports enable; 323 | 324 | # Àãðåãèðîâàòü ïîðòû, óìåíüøàåò ðàçìåð áàçû äåòàëèçàöèè 325 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 326 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 327 | #aggregate 150-1023 into 1023; /* General low range */ 328 | 329 | # Åêñïîðòèðîâàíèå ñòàòèñòèêè íà àäðåñ 127.0.0.1 ïîðò 9996 330 | netflow export destination 127.0.0.1 9996; 331 | netflow export version 5; # NetFlow export format version {1|5} 332 | netflow timeout active 30; # Timeout when flow is active, in minutes 333 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 334 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 335 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 336 | 337 | dumpfile = ipcad.dump; 338 | chroot = /var/ipcad/; 339 | pidfile = ipcad.pid; 340 | 341 | rsh enable at 127.0.0.1; 342 | memory_limit = 16m; 343 | 344 | EOF 345 | cd ${CURRENT_DIR} 346 | echo '##################################################################################################' 347 | echo 'IPCAD INSTALLED ##################################################################################################' 348 | echo '##################################################################################################' 349 | } 350 | 351 | #************************************ 352 | # rstat install 353 | #************************************ 354 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 355 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 356 | 357 | wget ${RSTAT_URL} 358 | 359 | tar zxvf master.tar.gz ; 360 | cd rstat-master ; 361 | make install ; 362 | cd ${CURRENT_DIR} 363 | } 364 | #************************************ 365 | # MRTG install 366 | #************************************ 367 | _install_mrtg() { 368 | yum -y install mrtg net-snmp net-snmp-utils net-tools 369 | _install_rstat 370 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 371 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 372 | } 373 | 374 | #********************************************************** 375 | # FSBackup install 376 | #********************************************************** 377 | _install_fsbackup() { 378 | echo "FSBACKUP START INSTALL" 379 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 380 | 381 | wget ${url} 382 | 383 | tar zxvf fsbackup-1.2pl2.tar.gz; 384 | cd fsbackup-1.2pl2; 385 | ./install.pl; 386 | mkdir /usr/local/fsbackup/archive; 387 | 388 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 389 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 390 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 391 | 392 | check_fsbackup_cron=`grep create_backup /etc/crontab` 393 | if [ x"${check_fsbackup_cron}" = x ]; then 394 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 395 | fi; 396 | 397 | cd ${CURRENT_DIR} 398 | } 399 | 400 | #********************************************************** 401 | # ACCEL-PPPoE install 402 | #********************************************************** 403 | _install_accel_pppoe() { 404 | 405 | yum -y install kernel-headers kernel-devel bzip2 cmake 406 | 407 | echo 408 | echo "#############################################" 409 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} " 410 | echo "#############################################" 411 | echo 412 | 413 | 414 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 415 | tar -xjf accel-ppp-1.7.4.tar.bz2 416 | cd accel-ppp-1.7.4 417 | mkdir build 418 | cd build 419 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/kernels/`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 420 | make 421 | make install 422 | 423 | cat << 'EOF1' > /etc/accel-ppp.conf 424 | [modules] 425 | #path=/usr/local/lib/accel-ppp 426 | log_file 427 | #log_tcp 428 | #log_pgsql 429 | pptp 430 | pppoe 431 | #l2tp 432 | auth_mschap_v2 433 | #auth_mschap_v1 434 | #auth_chap_md5 435 | #auth_pap 436 | radius 437 | #ippool 438 | sigchld 439 | pppd_compat 440 | shaper_tbf 441 | #chap-secrets 442 | 443 | [core] 444 | log-error=/var/log/accel-ppp/core.log 445 | thread-count=4 446 | 447 | [ppp] 448 | verbose=1 449 | min-mtu=1000 450 | mtu=1400 451 | mru=1400 452 | #ccp=0 453 | #sid-case=upper 454 | #check-ip=0 455 | #single-session=replace 456 | #mppe=require 457 | 458 | [lcp] 459 | echo-interval=30 460 | echo-failure=3 461 | 462 | [pptp] 463 | echo-interval=30 464 | verbose=1 465 | 466 | [pppoe] 467 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 468 | interface=eth1 469 | interface=vlan2 470 | interface=vlan3 471 | interface=vlan4 472 | #ac-name=xxx 473 | #service-name=yyy 474 | #pado-delay=0 475 | #pado-delay=0,100:100,200:200,-1:500 476 | #ifname-in-sid=called-sid 477 | #tr101=1 478 | verbose=1 479 | 480 | #[l2tp] 481 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 482 | #hello-interval=60 483 | #timeout=60 484 | #rtimeout=5 485 | #retransmit=5 486 | #host-name=accel-ppp 487 | #verbose=1 488 | 489 | [dns] 490 | dns1=10.0.0.10 491 | #dns2=172.16.1.1 492 | 493 | [radius] 494 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 495 | nas-identifier=accel-ppp 496 | nas-ip-address=127.0.0.1 497 | gw-ip-address=10.0.0.10 498 | auth-server=127.0.0.1:1812,secretpass 499 | acct-server=127.0.0.1:1813,secretpass 500 | dae-server=127.0.0.1:3799,secretpass 501 | verbose=1 502 | #timeout=3 503 | #max-try=3 504 | #acct-timeout=120 505 | #acct-delay-time=0 506 | 507 | [client-ip-range] 508 | disable 509 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 510 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 511 | 512 | #[ip-pool] 513 | #gw-ip-address=192.168.0.1 514 | #192.168.0.2-255 515 | #192.168.1.1-255 516 | #192.168.2.1-255 517 | #192.168.3.1-255 518 | #192.168.4.0/24 519 | 520 | [log] 521 | log-file=/var/log/accel-ppp/accel-ppp.log 522 | log-emerg=/var/log/accel-ppp/emerg.log 523 | log-fail-file=/var/log/accel-ppp/auth-fail.log 524 | #log-debug=/dev/stdout 525 | #log-tcp=127.0.0.1:3000 526 | copy=1 527 | #color=1 528 | #per-user-dir=per_user 529 | #per-session-dir=per_session 530 | #per-session=1 531 | level=3 532 | #log-tcp=127.0.0.1:3000 533 | 534 | #[log-pgsql] 535 | #conninfo=user=log 536 | #log-table=log 537 | 538 | [pppd-compat] 539 | #ip-pre-up=/etc/ppp/ip-pre-up 540 | #ip-up=/etc/ppp/ip-up 541 | #ip-down=/etc/ppp/ip-down 542 | #ip-change=/etc/ppp/ip-change 543 | radattr-prefix=/var/run/radattr 544 | verbose=1 545 | 546 | #[chap-secrets] 547 | #gw-ip-address=192.168.100.1 548 | #chap-secrets=/etc/ppp/chap-secrets 549 | 550 | [tbf] 551 | #attr=Filter-Id 552 | #down-burst-factor=0.1 553 | #up-burst-factor=1.0 554 | #latency=50 555 | attr-down=PPPD-Downstream-Speed-Limit 556 | attr-up=PPPD-Upstream-Speed-Limit 557 | 558 | 559 | [cli] 560 | telnet=127.0.0.1:2000 561 | #tcp=127.0.0.1:2001 562 | EOF1 563 | 564 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 565 | # Limit session traffic 566 | ATTRIBUTE Session-Octets-Limit 227 integer 567 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 568 | ATTRIBUTE Octets-Direction 228 integer 569 | # Connection Speed Limit 570 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 571 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 572 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 573 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 574 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 575 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 576 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 577 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 578 | ATTRIBUTE Acct-Interim-Interval 85 integer 579 | ATTRIBUTE Acct-Input-Gigawords 52 integer 580 | ATTRIBUTE Acct-Output-Gigawords 53 integer 581 | EOF2 582 | 583 | modprobe -r ip_gre 584 | 585 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 586 | 587 | echo 'pptp' >> /etc/modules 588 | echo 'pppoe' >> /etc/modules 589 | 590 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 591 | # Limit session traffic 592 | ATTRIBUTE Session-Octets-Limit 227 integer 593 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 594 | ATTRIBUTE Octets-Direction 228 integer 595 | # Connection Speed Limit 596 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 597 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 598 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 599 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 600 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 601 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 602 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 603 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 604 | ATTRIBUTE Acct-Interim-Interval 85 integer 605 | ATTRIBUTE Acct-Input-Gigawords 52 integer 606 | EOF3 607 | 608 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 609 | 610 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 611 | 612 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 613 | 614 | cd ${CURRENT_DIR} 615 | 616 | } 617 | 618 | #************************************ 619 | # Post install 620 | #************************************ 621 | post_install() { 622 | systemctl start mysqld 623 | 624 | systemctl restart radiusd.service 625 | 626 | service flow-capture start 627 | cd /usr/abills/misc && ./perldeps.pl rpm -batch 628 | echo " "; 629 | echo " "; 630 | echo "************************************************************"; 631 | echo "************************************************************"; 632 | echo "*************** Plugin finished *********************"; 633 | echo "**** You need to reboot the system after configuration ****"; 634 | echo "************************************************************"; 635 | echo "************************************************************"; 636 | echo " "; 637 | echo " "; 638 | read -p "press Enter to continue..."; 639 | } 640 | -------------------------------------------------------------------------------- /plugins/debian_10_x64: -------------------------------------------------------------------------------- 1 | #OS Debian_10_x64 2 | #COMMENTS Debian comments 3 | #M update:upgrade:_update 4 | #M mysql:MySQL:_install mariadb-server mariadb-client 5 | #M apache:apache:_install apache2 apache2-doc apache2-utils libapache2-mod-perl2 6 | #M perl_modules:Perl_modules:_install libexpat1 ssl-cert cvs libdbi-perl libdbd-mysql-perl libdigest-md4-perl libdigest-sha-perl libcrypt-des-perl libjson-perl 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M DHCP:Dhcp_server:_install isc-dhcp-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSbackup:_install_fsbackup 13 | #M Mail:Mail_server:install_mail 14 | # perl_speedy 15 | #M utils:Utils:_install vim tmux bash git tcpdump snmp socat 16 | 17 | # Variable 18 | 19 | YES="-y" 20 | BUILD_OPTIONS=" apt-get ${YES} install " 21 | MYSQLDUMP=/usr/bin/mysqldump 22 | GZIP=/bin/gzip 23 | WEB_SERVER_USER=www-data 24 | APACHE_CONF_DIR=/etc/apache2/sites-enabled/ 25 | RESTART_MYSQL=/etc/init.d/mysql 26 | RESTART_RADIUS=/etc/init.d/radiusd 27 | RESTART_APACHE=/etc/init.d/apache2 28 | RESTART_DHCP=/etc/init.d/isc-dhcp 29 | PING=/bin/ping 30 | PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 31 | 32 | #Services to check after installation 33 | PROCESS_LIST="mysql radiusd apache2 flow-capture" 34 | 35 | #****************************************************************** 36 | # PRE INSTALL SECTION. Installing required packages 37 | #****************************************************************** 38 | pre_install () { 39 | 40 | apt-get update 41 | apt-get install -yq dialog nano gcc sudo 42 | 43 | CURRENT_DIR=`pwd` 44 | } 45 | 46 | #******************************************* 47 | # Update and upgrade 48 | #******************************************* 49 | _update() { 50 | apt-get update && apt-get upgrade; 51 | } 52 | 53 | #******************************************* 54 | # Radius 55 | #******************************************* 56 | _install_freeradius() { 57 | apt-get -y install gcc make libtalloc-dev libmariadb-dev libmariadbclient-dev libmariadb-dev-compat 58 | 59 | if [ -d /usr/local/freeradius/ ]; then 60 | echo "Radius exists: /usr/local/freeradius/"; 61 | return 0 ; 62 | fi; 63 | FREERADIUS_VERSION=3.0.17 64 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 65 | 66 | for dir in ${PERL_LIB_DIRS}; do 67 | if [ "${DEBUG}" = 1 ]; then 68 | echo "ls ${dir}/libperl* | head -1" 69 | fi; 70 | 71 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 72 | if [ x"${PERL_LIB}" != x ]; then 73 | PERL_LIB_DIR=${dir} 74 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 75 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 76 | fi; 77 | fi; 78 | done; 79 | 80 | 81 | if [ x"${PERL_LIB_DIR}" = x ]; then 82 | echo "Perl lib not found. Not building FreeRadius. Waiting 5 sec..."; 83 | sleep 5; 84 | return 85 | else 86 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 87 | fi; 88 | 89 | RADIUS_SERVER_USER="freerad" 90 | 91 | wget -O freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 92 | 93 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 94 | echo "Can\'t download freeradius. PLease download and install manual"; 95 | exit; 96 | fi; 97 | 98 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 99 | 100 | cd freeradius-server-${FREERADIUS_VERSION} 101 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes > 1 102 | echo "/configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes " > configure_abills 103 | make && make install 104 | 105 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 106 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 107 | 108 | #Add user 109 | groupadd ${RADIUS_SERVER_USER} 110 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 111 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius/etc/raddb 112 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 113 | echo "_________________________________________________________________" 114 | echo " RADIUS SCRIPT AUTOSTART" 115 | echo "_________________________________________________________________" 116 | cat << 'EOF' > /etc/init.d/radiusd 117 | #!/bin/sh 118 | # Start/stop the FreeRADIUS daemon. 119 | 120 | ### BEGIN INIT INFO 121 | # Provides: radiusd 122 | # Required-Start: $remote_fs $network $syslog 123 | # Should-Start: $time mysql slapd postgresql samba krb5-kdc 124 | # Required-Stop: $remote_fs $syslog 125 | # Default-Start: 2 3 4 5 126 | # Default-Stop: 0 1 6 127 | # Short-Description: Radius Daemon 128 | # Description: Extensible, configurable radius daemon 129 | ### END INIT INFO 130 | 131 | set -e 132 | 133 | . /lib/lsb/init-functions 134 | 135 | PROG="radiusd" 136 | PROGRAM="/usr/sbin/radiusd" 137 | PIDFILE="/usr/local/freeradius/var/run/radiusd/radiusd.pid" 138 | DESCR="FreeRADIUS daemon" 139 | 140 | test -f $PROGRAM || exit 0 141 | 142 | # /var/run may be a tmpfs 143 | if [ ! -d /var/run/radiusd ]; then 144 | mkdir -p /var/run/radiusd 145 | chown freerad:freerad /var/run/radiusd 146 | fi 147 | 148 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 149 | 150 | ret=0 151 | 152 | case "$1" in 153 | start) 154 | log_daemon_msg "Starting $DESCR" "$PROG" 155 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM || ret=$? 156 | log_end_msg $ret 157 | exit $ret 158 | ;; 159 | stop) 160 | log_daemon_msg "Stopping $DESCR" "$PROG" 161 | if [ -f "$PIDFILE" ] ; then 162 | start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$? 163 | log_end_msg $ret 164 | else 165 | log_action_cont_msg "$PIDFILE not found" 166 | log_end_msg 0 167 | fi 168 | ;; 169 | restart|force-reload) 170 | $0 stop 171 | $0 start 172 | ;; 173 | *) 174 | echo "Usage: $0 start|stop|restart|force-reload" 175 | exit 1 176 | ;; 177 | esac 178 | 179 | exit 0 180 | EOF 181 | 182 | chmod +x /etc/init.d/radiusd 183 | update-rc.d radiusd defaults 184 | update-rc.d radiusd enable 185 | service radiusd start 186 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 187 | cd ${CURRENT_DIR} 188 | } 189 | 190 | 191 | #******************************************* 192 | # Flow-tools + Ipcad 193 | #******************************************* 194 | _install_ipn() { 195 | apt-get -y install flow-tools 196 | 197 | mkdir -p /usr/abills/var/log/ipn/ 198 | 199 | echo "-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996" > /etc/flow-tools/flow-capture.conf 200 | 201 | 202 | update-rc.d flow-capture defaults 203 | update-rc.d flow-capture enable 204 | 205 | ln -s `which flow-cat` /usr/local/bin/flow-cat 206 | ln -s `which flow-print` /usr/local/bin/flow-print 207 | 208 | echo '##################################################################################################' 209 | echo '########### FLOWTOOLS INSTALLED #############' 210 | echo '##################################################################################################' 211 | sleep 1; 212 | 213 | 214 | apt-get -y install libpcap-dev; 215 | 216 | echo '********************************************************************'; 217 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 218 | echo '********************************************************************'; 219 | 220 | # will be installed in /usr/ 221 | cd /usr/ 222 | 223 | #remove if already extracted 224 | if [ -d /usr/ipcad-3.7.3 ]; then 225 | rm -rf ipcad-3.7.3 226 | fi; 227 | 228 | # do not download if present 229 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 230 | echo "INFO: Already downloaded"; 231 | else 232 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 233 | fi; 234 | 235 | tar -xvzf ipcad-3.7.3.tar.gz 236 | cd ipcad-3.7.3 237 | 238 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 239 | LINE2_NUM=$(( LINE1_NUM + 2 )); 240 | 241 | sed -i "${LINE2_NUM}d" headers.h; 242 | sed -i "${LINE1_NUM}d" headers.h; 243 | 244 | echo 245 | 246 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 247 | echo "INFO: Error " 248 | else 249 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 250 | fi; 251 | 252 | 253 | sed -i "1i #include \"signal.h\"" main.c; 254 | 255 | echo 256 | 257 | sed -i "1i #include \"headers.h\"" pps.c; 258 | sed -i "1i #include \"signal.h\"" pps.c; 259 | 260 | echo "INFO: Added to pps.c" 261 | 262 | sed -i "1i #include \"signal.h\"" servers.h; 263 | 264 | echo "INFO: Added to servers.h" 265 | 266 | ./configure && make && make install 267 | 268 | if [ -d /var/ipcad/ ]; then 269 | echo "directory /var/ipcad/ exists"; 270 | else 271 | mkdir /var/ipcad/; 272 | fi; 273 | 274 | 275 | cat << 'EOF' > /usr/local/etc/ipcad.conf 276 | # Интерфейсы для сбора статистики 277 | interface eth0; 278 | # детализация по портам 279 | #capture-ports enable; 280 | 281 | # Агрегировать порты, уменьшает размер базы детализации 282 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 283 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 284 | #aggregate 150-1023 into 1023; /* General low range */ 285 | 286 | # Експортирование статистики на адрес 127.0.0.1 порт 9996 287 | netflow export destination 127.0.0.1 9996; 288 | netflow export version 5; # NetFlow export format version {1|5} 289 | netflow timeout active 30; # Timeout when flow is active, in minutes 290 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 291 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 292 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 293 | 294 | dumpfile = ipcad.dump; 295 | chroot = /var/ipcad/; 296 | pidfile = ipcad.pid; 297 | 298 | rsh enable at 127.0.0.1; 299 | memory_limit = 16m; 300 | 301 | EOF 302 | cd ${CURRENT_DIR} 303 | echo '##################################################################################################' 304 | echo '############# IPCAD INSTALLED ###############' 305 | echo '##################################################################################################' 306 | } 307 | 308 | #************************************ 309 | # rstat install 310 | #************************************ 311 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 312 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 313 | cd /usr/ 314 | wget ${RSTAT_URL} 315 | 316 | tar zxvf master.tar.gz ; 317 | cd rstat-master ; 318 | make install ; 319 | cd ${CURRENT_DIR} 320 | } 321 | 322 | #************************************ 323 | # MRTG install 324 | #************************************ 325 | _install_mrtg() { 326 | apt-get -y install mrtg snmp 327 | _install_rstat 328 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 329 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 330 | } 331 | 332 | #********************************************************** 333 | # FSBackup install 334 | #********************************************************** 335 | _install_fsbackup() { 336 | echo "FSBACKUP START INSTALL" 337 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 338 | 339 | wget ${url} 340 | 341 | tar zxvf fsbackup-1.2pl2.tar.gz; 342 | cd fsbackup-1.2pl2; 343 | ./install.pl; 344 | mkdir /usr/local/fsbackup/archive; 345 | 346 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 347 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 348 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 349 | 350 | check_fsbackup_cron=`grep create_backup /etc/crontab` 351 | if [ x"${check_fsbackup_cron}" = x ]; then 352 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 353 | fi; 354 | 355 | cd ${CURRENT_DIR} 356 | } 357 | 358 | #********************************************************** 359 | # ACCEL-PPPoE install 360 | #********************************************************** 361 | _install_accel_pppoe() { 362 | 363 | apt-get -y install bzip2 cmake libssl-dev libpcre3-dev 364 | 365 | echo 366 | echo "##############################################################" 367 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} ##" 368 | echo "##############################################################" 369 | echo 370 | cd /usr/ 371 | 372 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 373 | tar -xjf accel-ppp-1.7.4.tar.bz2 374 | cd accel-ppp-1.7.4 375 | mkdir build 376 | cd build 377 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/linux-headers-`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 378 | make 379 | make install 380 | 381 | cat << 'EOF1' > /etc/accel-ppp.conf 382 | [modules] 383 | #path=/usr/local/lib/accel-ppp 384 | log_file 385 | #log_tcp 386 | #log_pgsql 387 | pptp 388 | pppoe 389 | #l2tp 390 | auth_mschap_v2 391 | #auth_mschap_v1 392 | #auth_chap_md5 393 | #auth_pap 394 | radius 395 | #ippool 396 | sigchld 397 | pppd_compat 398 | shaper_tbf 399 | #chap-secrets 400 | 401 | [core] 402 | log-error=/var/log/accel-ppp/core.log 403 | thread-count=4 404 | 405 | [ppp] 406 | verbose=1 407 | min-mtu=1000 408 | mtu=1400 409 | mru=1400 410 | #ccp=0 411 | #sid-case=upper 412 | #check-ip=0 413 | #single-session=replace 414 | #mppe=require 415 | 416 | [lcp] 417 | echo-interval=30 418 | echo-failure=3 419 | 420 | [pptp] 421 | echo-interval=30 422 | verbose=1 423 | 424 | [pppoe] 425 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 426 | interface=eth1 427 | interface=vlan2 428 | interface=vlan3 429 | interface=vlan4 430 | #ac-name=xxx 431 | #service-name=yyy 432 | #pado-delay=0 433 | #pado-delay=0,100:100,200:200,-1:500 434 | #ifname-in-sid=called-sid 435 | #tr101=1 436 | verbose=1 437 | 438 | #[l2tp] 439 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 440 | #hello-interval=60 441 | #timeout=60 442 | #rtimeout=5 443 | #retransmit=5 444 | #host-name=accel-ppp 445 | #verbose=1 446 | 447 | [dns] 448 | dns1=10.0.0.10 449 | #dns2=172.16.1.1 450 | 451 | [radius] 452 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 453 | nas-identifier=accel-ppp 454 | nas-ip-address=127.0.0.1 455 | gw-ip-address=10.0.0.10 456 | auth-server=127.0.0.1:1812,secretpass 457 | acct-server=127.0.0.1:1813,secretpass 458 | dae-server=127.0.0.1:3799,secretpass 459 | verbose=1 460 | #timeout=3 461 | #max-try=3 462 | #acct-timeout=120 463 | #acct-delay-time=0 464 | 465 | [client-ip-range] 466 | disable 467 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 468 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 469 | 470 | #[ip-pool] 471 | #gw-ip-address=192.168.0.1 472 | #192.168.0.2-255 473 | #192.168.1.1-255 474 | #192.168.2.1-255 475 | #192.168.3.1-255 476 | #192.168.4.0/24 477 | 478 | [log] 479 | log-file=/var/log/accel-ppp/accel-ppp.log 480 | log-emerg=/var/log/accel-ppp/emerg.log 481 | log-fail-file=/var/log/accel-ppp/auth-fail.log 482 | #log-debug=/dev/stdout 483 | #log-tcp=127.0.0.1:3000 484 | copy=1 485 | #color=1 486 | #per-user-dir=per_user 487 | #per-session-dir=per_session 488 | #per-session=1 489 | level=3 490 | #log-tcp=127.0.0.1:3000 491 | 492 | #[log-pgsql] 493 | #conninfo=user=log 494 | #log-table=log 495 | 496 | [pppd-compat] 497 | #ip-pre-up=/etc/ppp/ip-pre-up 498 | #ip-up=/etc/ppp/ip-up 499 | #ip-down=/etc/ppp/ip-down 500 | #ip-change=/etc/ppp/ip-change 501 | radattr-prefix=/var/run/radattr 502 | verbose=1 503 | 504 | #[chap-secrets] 505 | #gw-ip-address=192.168.100.1 506 | #chap-secrets=/etc/ppp/chap-secrets 507 | 508 | [tbf] 509 | #attr=Filter-Id 510 | #down-burst-factor=0.1 511 | #up-burst-factor=1.0 512 | #latency=50 513 | attr-down=PPPD-Downstream-Speed-Limit 514 | attr-up=PPPD-Upstream-Speed-Limit 515 | 516 | 517 | [cli] 518 | telnet=127.0.0.1:2000 519 | #tcp=127.0.0.1:2001 520 | EOF1 521 | 522 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 523 | # Limit session traffic 524 | ATTRIBUTE Session-Octets-Limit 227 integer 525 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 526 | ATTRIBUTE Octets-Direction 228 integer 527 | # Connection Speed Limit 528 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 529 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 530 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 531 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 532 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 533 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 534 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 535 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 536 | ATTRIBUTE Acct-Interim-Interval 85 integer 537 | ATTRIBUTE Acct-Input-Gigawords 52 integer 538 | ATTRIBUTE Acct-Output-Gigawords 53 integer 539 | EOF2 540 | 541 | modprobe -r ip_gre 542 | 543 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 544 | 545 | echo 'pptp' >> /etc/modules 546 | echo 'pppoe' >> /etc/modules 547 | 548 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 549 | # Limit session traffic 550 | ATTRIBUTE Session-Octets-Limit 227 integer 551 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 552 | ATTRIBUTE Octets-Direction 228 integer 553 | # Connection Speed Limit 554 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 555 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 556 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 557 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 558 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 559 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 560 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 561 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 562 | ATTRIBUTE Acct-Interim-Interval 85 integer 563 | ATTRIBUTE Acct-Input-Gigawords 52 integer 564 | EOF3 565 | 566 | 567 | touch /etc/init.d/accel-ppp 568 | chmod +x /etc/init.d/accel-ppp 569 | 570 | cat << 'EOF4' >> /etc/init.d/accel-ppp 571 | #!/bin/sh 572 | # /etc/init.d/accel-pppd: set up the accel-ppp server 573 | ### BEGIN INIT INFO 574 | # Provides: accel-ppp 575 | # Required-Start: $networking 576 | # Required-Stop: $networking 577 | # Default-Start: 2 3 4 5 578 | # Default-Stop: 0 1 6 579 | ### END INIT INFO 580 | 581 | set -e 582 | 583 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin; 584 | ACCEL_PPTPD=`which accel-pppd` 585 | . /lib/lsb/init-functions 586 | 587 | if test -f /etc/default/accel-ppp; then 588 | . /etc/default/accel-ppp 589 | fi 590 | 591 | if [ -z $ACCEL_PPPTD_OPTS ]; then 592 | ACCEL_PPTPD_OPTS="-c /etc/accel-ppp.conf" 593 | fi 594 | 595 | case "$1" in 596 | start) 597 | log_daemon_msg "Starting accel-ppp server" "accel-pppd" 598 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 599 | log_end_msg 0 600 | else 601 | log_end_msg 1 602 | fi 603 | ;; 604 | restart) 605 | log_daemon_msg "Restarting accel-ppp server" "accel-pppd" 606 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 607 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 608 | log_end_msg 0 609 | else 610 | log_end_msg 1 611 | fi 612 | ;; 613 | 614 | stop) 615 | log_daemon_msg "Stopping accel-ppp server" "accel-pppd" 616 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 617 | log_end_msg 0 618 | ;; 619 | 620 | status) 621 | do_status 622 | ;; 623 | *) 624 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 625 | exit 1 626 | ;; 627 | esac 628 | 629 | exit 0 630 | EOF4 631 | update-rc.d accel-ppp defaults 632 | update-rc.d accel-ppp enable 633 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 634 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 635 | 636 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 637 | 638 | cd ${CURRENT_DIR} 639 | 640 | } 641 | 642 | #****************************************************************** 643 | # POST INSTALL 644 | #****************************************************************** 645 | post_install () { 646 | 647 | a2enmod rewrite; 648 | a2enmod ssl; 649 | a2enmod perl; 650 | a2enmod cgi; 651 | a2enmod headers; 652 | 653 | touch /etc/crontab 654 | 655 | cd /usr/abills/misc && ./perldeps.pl apt-get -batch 656 | 657 | echo "Plugin finished"; 658 | echo -n "press Enter to continue..."; 659 | read _; 660 | } 661 | -------------------------------------------------------------------------------- /plugins/debian_11_x64: -------------------------------------------------------------------------------- 1 | #OS Debian_11_x64 2 | #COMMENTS Debian comments 3 | #M update:upgrade:_update 4 | #M mysql:MySQL:_install mariadb-server mariadb-client 5 | #M apache:apache:_install apache2 apache2-doc apache2-utils libapache2-mod-perl2 6 | #M perl_modules:Perl_modules:_install libexpat1 ssl-cert cvs libdbi-perl libdbd-mysql-perl libdigest-md4-perl libdigest-sha-perl libcrypt-des-perl libjson-perl 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M DHCP:Dhcp_server:_install isc-dhcp-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSbackup:_install_fsbackup 13 | #M Mail:Mail_server:install_mail 14 | # perl_speedy 15 | #M utils:Utils:_install vim tmux bash git tcpdump snmp socat 16 | 17 | # Variable 18 | 19 | YES="-y" 20 | BUILD_OPTIONS=" apt-get ${YES} install " 21 | MYSQLDUMP=/usr/bin/mysqldump 22 | GZIP=/bin/gzip 23 | WEB_SERVER_USER=www-data 24 | APACHE_CONF_DIR=/etc/apache2/sites-enabled/ 25 | RESTART_MYSQL=/etc/init.d/mariadb 26 | RESTART_RADIUS=/etc/init.d/radiusd 27 | RESTART_APACHE=/etc/init.d/apache2 28 | RESTART_DHCP=/etc/init.d/isc-dhcp 29 | PING=/bin/ping 30 | PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 31 | 32 | #Services to check after installation 33 | PROCESS_LIST="mariadbd radiusd apache2 flow-capture" 34 | 35 | #****************************************************************** 36 | # PRE INSTALL SECTION. Installing required packages 37 | #****************************************************************** 38 | pre_install () { 39 | 40 | apt-get update 41 | apt-get install -yq dialog nano gcc sudo 42 | 43 | CURRENT_DIR=`pwd` 44 | } 45 | 46 | #******************************************* 47 | # Update and upgrade 48 | #******************************************* 49 | _update() { 50 | apt-get update && apt-get upgrade; 51 | } 52 | 53 | #******************************************* 54 | # Radius 55 | #******************************************* 56 | _install_freeradius() { 57 | apt-get -y install gcc make libtalloc-dev libmariadb-dev libmariadb-dev-compat 58 | 59 | if [ -d /usr/local/freeradius/ ]; then 60 | echo "Radius exists: /usr/local/freeradius/"; 61 | return 0 ; 62 | fi; 63 | 64 | FREERADIUS_VERSION=3.2.3 65 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 66 | 67 | for dir in ${PERL_LIB_DIRS}; do 68 | if [ "${DEBUG}" = 1 ]; then 69 | echo "ls ${dir}/libperl* | head -1" 70 | fi; 71 | 72 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 73 | if [ x"${PERL_LIB}" != x ]; then 74 | PERL_LIB_DIR=${dir} 75 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 76 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 77 | fi; 78 | fi; 79 | done; 80 | 81 | 82 | if [ x"${PERL_LIB_DIR}" = x ]; then 83 | echo "Perl lib not found. Not building FreeRadius. Waiting 5 sec..."; 84 | sleep 5; 85 | return 86 | else 87 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 88 | fi; 89 | 90 | RADIUS_SERVER_USER="freerad" 91 | 92 | wget -O freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 93 | 94 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 95 | echo "Can\'t download freeradius. PLease download and install manual"; 96 | exit; 97 | fi; 98 | 99 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 100 | 101 | cd freeradius-server-${FREERADIUS_VERSION} 102 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes > 1 103 | echo "/configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes " > configure_abills 104 | make && make install 105 | 106 | sleep 100; 107 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 108 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 109 | 110 | #Add user 111 | groupadd ${RADIUS_SERVER_USER} 112 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 113 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius/etc/raddb 114 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 115 | echo "_________________________________________________________________" 116 | echo " RADIUS SCRIPT AUTOSTART" 117 | echo "_________________________________________________________________" 118 | cat << 'EOF' > /etc/init.d/radiusd 119 | #!/bin/sh 120 | # Start/stop the FreeRADIUS daemon. 121 | 122 | ### BEGIN INIT INFO 123 | # Provides: radiusd 124 | # Required-Start: $remote_fs $network $syslog 125 | # Should-Start: $time mysql slapd postgresql samba krb5-kdc 126 | # Required-Stop: $remote_fs $syslog 127 | # Default-Start: 2 3 4 5 128 | # Default-Stop: 0 1 6 129 | # Short-Description: Radius Daemon 130 | # Description: Extensible, configurable radius daemon 131 | ### END INIT INFO 132 | 133 | set -e 134 | 135 | . /lib/lsb/init-functions 136 | 137 | PROG="radiusd" 138 | PROGRAM="/usr/sbin/radiusd" 139 | PIDFILE="/usr/local/freeradius/var/run/radiusd/radiusd.pid" 140 | DESCR="FreeRADIUS daemon" 141 | 142 | test -f $PROGRAM || exit 0 143 | 144 | # /var/run may be a tmpfs 145 | if [ ! -d /var/run/radiusd ]; then 146 | mkdir -p /var/run/radiusd 147 | chown freerad:freerad /var/run/radiusd 148 | fi 149 | 150 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 151 | 152 | ret=0 153 | 154 | case "$1" in 155 | start) 156 | log_daemon_msg "Starting $DESCR" "$PROG" 157 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM || ret=$? 158 | log_end_msg $ret 159 | exit $ret 160 | ;; 161 | stop) 162 | log_daemon_msg "Stopping $DESCR" "$PROG" 163 | if [ -f "$PIDFILE" ] ; then 164 | start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$? 165 | log_end_msg $ret 166 | else 167 | log_action_cont_msg "$PIDFILE not found" 168 | log_end_msg 0 169 | fi 170 | ;; 171 | restart|force-reload) 172 | $0 stop 173 | $0 start 174 | ;; 175 | *) 176 | echo "Usage: $0 start|stop|restart|force-reload" 177 | exit 1 178 | ;; 179 | esac 180 | 181 | exit 0 182 | EOF 183 | 184 | chmod +x /etc/init.d/radiusd 185 | update-rc.d radiusd defaults 186 | update-rc.d radiusd enable 187 | systemctl enable radiusd 188 | systemctl start radiusd 189 | # service radiusd start 190 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 191 | cd ${CURRENT_DIR} 192 | } 193 | 194 | 195 | #******************************************* 196 | # Flow-tools + Ipcad 197 | #******************************************* 198 | _install_ipn() { 199 | apt-get -y install flow-tools 200 | 201 | mkdir -p /usr/abills/var/log/ipn/ 202 | 203 | echo "-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996" > /etc/flow-tools/flow-capture.conf 204 | 205 | 206 | update-rc.d flow-capture defaults 207 | update-rc.d flow-capture enable 208 | 209 | ln -s `which flow-cat` /usr/local/bin/flow-cat 210 | ln -s `which flow-print` /usr/local/bin/flow-print 211 | 212 | echo '##################################################################################################' 213 | echo '########### FLOWTOOLS INSTALLED #############' 214 | echo '##################################################################################################' 215 | sleep 1; 216 | 217 | 218 | apt-get -y install libpcap-dev; 219 | 220 | echo '********************************************************************'; 221 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 222 | echo '********************************************************************'; 223 | 224 | # will be installed in /usr/ 225 | cd /usr/ 226 | 227 | #remove if already extracted 228 | if [ -d /usr/ipcad-3.7.3 ]; then 229 | rm -rf ipcad-3.7.3 230 | fi; 231 | 232 | # do not download if present 233 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 234 | echo "INFO: Already downloaded"; 235 | else 236 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 237 | fi; 238 | 239 | tar -xvzf ipcad-3.7.3.tar.gz 240 | cd ipcad-3.7.3 241 | 242 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 243 | LINE2_NUM=$(( LINE1_NUM + 2 )); 244 | 245 | sed -i "${LINE2_NUM}d" headers.h; 246 | sed -i "${LINE1_NUM}d" headers.h; 247 | 248 | echo 249 | 250 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 251 | echo "INFO: Error " 252 | else 253 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 254 | fi; 255 | 256 | 257 | sed -i "1i #include \"signal.h\"" main.c; 258 | 259 | echo 260 | 261 | sed -i "1i #include \"headers.h\"" pps.c; 262 | sed -i "1i #include \"signal.h\"" pps.c; 263 | 264 | echo "INFO: Added to pps.c" 265 | 266 | sed -i "1i #include \"signal.h\"" servers.h; 267 | 268 | echo "INFO: Added to servers.h" 269 | 270 | ./configure && make && make install 271 | 272 | if [ -d /var/ipcad/ ]; then 273 | echo "directory /var/ipcad/ exists"; 274 | else 275 | mkdir /var/ipcad/; 276 | fi; 277 | 278 | 279 | cat << 'EOF' > /usr/local/etc/ipcad.conf 280 | # Интерфейсы для сбора статистики 281 | interface eth0; 282 | # детализация по портам 283 | #capture-ports enable; 284 | 285 | # Агрегировать порты, уменьшает размер базы детализации 286 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 287 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 288 | #aggregate 150-1023 into 1023; /* General low range */ 289 | 290 | # Експортирование статистики на адрес 127.0.0.1 порт 9996 291 | netflow export destination 127.0.0.1 9996; 292 | netflow export version 5; # NetFlow export format version {1|5} 293 | netflow timeout active 30; # Timeout when flow is active, in minutes 294 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 295 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 296 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 297 | 298 | dumpfile = ipcad.dump; 299 | chroot = /var/ipcad/; 300 | pidfile = ipcad.pid; 301 | 302 | rsh enable at 127.0.0.1; 303 | memory_limit = 16m; 304 | 305 | EOF 306 | cd ${CURRENT_DIR} 307 | echo '##################################################################################################' 308 | echo '############# IPCAD INSTALLED ###############' 309 | echo '##################################################################################################' 310 | } 311 | 312 | #************************************ 313 | # rstat install 314 | #************************************ 315 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 316 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 317 | cd /usr/ 318 | wget ${RSTAT_URL} 319 | 320 | tar zxvf master.tar.gz ; 321 | cd rstat-master ; 322 | make install ; 323 | cd ${CURRENT_DIR} 324 | } 325 | 326 | #************************************ 327 | # MRTG install 328 | #************************************ 329 | _install_mrtg() { 330 | apt-get -y install mrtg snmp 331 | _install_rstat 332 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 333 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 334 | } 335 | 336 | #********************************************************** 337 | # FSBackup install 338 | #********************************************************** 339 | _install_fsbackup() { 340 | echo "FSBACKUP START INSTALL" 341 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 342 | 343 | wget ${url} 344 | 345 | tar zxvf fsbackup-1.2pl2.tar.gz; 346 | cd fsbackup-1.2pl2; 347 | ./install.pl; 348 | mkdir /usr/local/fsbackup/archive; 349 | 350 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 351 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 352 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 353 | 354 | check_fsbackup_cron=`grep create_backup /etc/crontab` 355 | if [ x"${check_fsbackup_cron}" = x ]; then 356 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 357 | fi; 358 | 359 | cd ${CURRENT_DIR} 360 | } 361 | 362 | #********************************************************** 363 | # ACCEL-PPPoE install 364 | #********************************************************** 365 | _install_accel_pppoe() { 366 | 367 | apt-get -y install bzip2 cmake libssl-dev libpcre3-dev 368 | 369 | echo 370 | echo "##############################################################" 371 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} ##" 372 | echo "##############################################################" 373 | echo 374 | cd /usr/ 375 | 376 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 377 | tar -xjf accel-ppp-1.7.4.tar.bz2 378 | cd accel-ppp-1.7.4 379 | mkdir build 380 | cd build 381 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/linux-headers-`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 382 | make 383 | make install 384 | 385 | cat << 'EOF1' > /etc/accel-ppp.conf 386 | [modules] 387 | #path=/usr/local/lib/accel-ppp 388 | log_file 389 | #log_tcp 390 | #log_pgsql 391 | pptp 392 | pppoe 393 | #l2tp 394 | auth_mschap_v2 395 | #auth_mschap_v1 396 | #auth_chap_md5 397 | #auth_pap 398 | radius 399 | #ippool 400 | sigchld 401 | pppd_compat 402 | shaper_tbf 403 | #chap-secrets 404 | 405 | [core] 406 | log-error=/var/log/accel-ppp/core.log 407 | thread-count=4 408 | 409 | [ppp] 410 | verbose=1 411 | min-mtu=1000 412 | mtu=1400 413 | mru=1400 414 | #ccp=0 415 | #sid-case=upper 416 | #check-ip=0 417 | #single-session=replace 418 | #mppe=require 419 | 420 | [lcp] 421 | echo-interval=30 422 | echo-failure=3 423 | 424 | [pptp] 425 | echo-interval=30 426 | verbose=1 427 | 428 | [pppoe] 429 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 430 | interface=eth1 431 | interface=vlan2 432 | interface=vlan3 433 | interface=vlan4 434 | #ac-name=xxx 435 | #service-name=yyy 436 | #pado-delay=0 437 | #pado-delay=0,100:100,200:200,-1:500 438 | #ifname-in-sid=called-sid 439 | #tr101=1 440 | verbose=1 441 | 442 | #[l2tp] 443 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 444 | #hello-interval=60 445 | #timeout=60 446 | #rtimeout=5 447 | #retransmit=5 448 | #host-name=accel-ppp 449 | #verbose=1 450 | 451 | [dns] 452 | dns1=10.0.0.10 453 | #dns2=172.16.1.1 454 | 455 | [radius] 456 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 457 | nas-identifier=accel-ppp 458 | nas-ip-address=127.0.0.1 459 | gw-ip-address=10.0.0.10 460 | auth-server=127.0.0.1:1812,secretpass 461 | acct-server=127.0.0.1:1813,secretpass 462 | dae-server=127.0.0.1:3799,secretpass 463 | verbose=1 464 | #timeout=3 465 | #max-try=3 466 | #acct-timeout=120 467 | #acct-delay-time=0 468 | 469 | [client-ip-range] 470 | disable 471 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 472 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 473 | 474 | #[ip-pool] 475 | #gw-ip-address=192.168.0.1 476 | #192.168.0.2-255 477 | #192.168.1.1-255 478 | #192.168.2.1-255 479 | #192.168.3.1-255 480 | #192.168.4.0/24 481 | 482 | [log] 483 | log-file=/var/log/accel-ppp/accel-ppp.log 484 | log-emerg=/var/log/accel-ppp/emerg.log 485 | log-fail-file=/var/log/accel-ppp/auth-fail.log 486 | #log-debug=/dev/stdout 487 | #log-tcp=127.0.0.1:3000 488 | copy=1 489 | #color=1 490 | #per-user-dir=per_user 491 | #per-session-dir=per_session 492 | #per-session=1 493 | level=3 494 | #log-tcp=127.0.0.1:3000 495 | 496 | #[log-pgsql] 497 | #conninfo=user=log 498 | #log-table=log 499 | 500 | [pppd-compat] 501 | #ip-pre-up=/etc/ppp/ip-pre-up 502 | #ip-up=/etc/ppp/ip-up 503 | #ip-down=/etc/ppp/ip-down 504 | #ip-change=/etc/ppp/ip-change 505 | radattr-prefix=/var/run/radattr 506 | verbose=1 507 | 508 | #[chap-secrets] 509 | #gw-ip-address=192.168.100.1 510 | #chap-secrets=/etc/ppp/chap-secrets 511 | 512 | [tbf] 513 | #attr=Filter-Id 514 | #down-burst-factor=0.1 515 | #up-burst-factor=1.0 516 | #latency=50 517 | attr-down=PPPD-Downstream-Speed-Limit 518 | attr-up=PPPD-Upstream-Speed-Limit 519 | 520 | 521 | [cli] 522 | telnet=127.0.0.1:2000 523 | #tcp=127.0.0.1:2001 524 | EOF1 525 | 526 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 527 | # Limit session traffic 528 | ATTRIBUTE Session-Octets-Limit 227 integer 529 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 530 | ATTRIBUTE Octets-Direction 228 integer 531 | # Connection Speed Limit 532 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 533 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 534 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 535 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 536 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 537 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 538 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 539 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 540 | ATTRIBUTE Acct-Interim-Interval 85 integer 541 | ATTRIBUTE Acct-Input-Gigawords 52 integer 542 | ATTRIBUTE Acct-Output-Gigawords 53 integer 543 | EOF2 544 | 545 | modprobe -r ip_gre 546 | 547 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 548 | 549 | echo 'pptp' >> /etc/modules 550 | echo 'pppoe' >> /etc/modules 551 | 552 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 553 | # Limit session traffic 554 | ATTRIBUTE Session-Octets-Limit 227 integer 555 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 556 | ATTRIBUTE Octets-Direction 228 integer 557 | # Connection Speed Limit 558 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 559 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 560 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 561 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 562 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 563 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 564 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 565 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 566 | ATTRIBUTE Acct-Interim-Interval 85 integer 567 | ATTRIBUTE Acct-Input-Gigawords 52 integer 568 | EOF3 569 | 570 | 571 | touch /etc/init.d/accel-ppp 572 | chmod +x /etc/init.d/accel-ppp 573 | 574 | cat << 'EOF4' >> /etc/init.d/accel-ppp 575 | #!/bin/sh 576 | # /etc/init.d/accel-pppd: set up the accel-ppp server 577 | ### BEGIN INIT INFO 578 | # Provides: accel-ppp 579 | # Required-Start: $networking 580 | # Required-Stop: $networking 581 | # Default-Start: 2 3 4 5 582 | # Default-Stop: 0 1 6 583 | ### END INIT INFO 584 | 585 | set -e 586 | 587 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin; 588 | ACCEL_PPTPD=`which accel-pppd` 589 | . /lib/lsb/init-functions 590 | 591 | if test -f /etc/default/accel-ppp; then 592 | . /etc/default/accel-ppp 593 | fi 594 | 595 | if [ -z $ACCEL_PPPTD_OPTS ]; then 596 | ACCEL_PPTPD_OPTS="-c /etc/accel-ppp.conf" 597 | fi 598 | 599 | case "$1" in 600 | start) 601 | log_daemon_msg "Starting accel-ppp server" "accel-pppd" 602 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 603 | log_end_msg 0 604 | else 605 | log_end_msg 1 606 | fi 607 | ;; 608 | restart) 609 | log_daemon_msg "Restarting accel-ppp server" "accel-pppd" 610 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 611 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 612 | log_end_msg 0 613 | else 614 | log_end_msg 1 615 | fi 616 | ;; 617 | 618 | stop) 619 | log_daemon_msg "Stopping accel-ppp server" "accel-pppd" 620 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 621 | log_end_msg 0 622 | ;; 623 | 624 | status) 625 | do_status 626 | ;; 627 | *) 628 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 629 | exit 1 630 | ;; 631 | esac 632 | 633 | exit 0 634 | EOF4 635 | update-rc.d accel-ppp defaults 636 | update-rc.d accel-ppp enable 637 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 638 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 639 | 640 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 641 | 642 | cd ${CURRENT_DIR} 643 | 644 | } 645 | 646 | #****************************************************************** 647 | # POST INSTALL 648 | #****************************************************************** 649 | post_install () { 650 | 651 | a2enmod rewrite; 652 | a2enmod ssl; 653 | a2enmod perl; 654 | a2enmod cgi; 655 | a2enmod headers; 656 | 657 | touch /etc/crontab 658 | 659 | cd /usr/abills/misc && ./perldeps.pl apt-get -batch 660 | 661 | echo "Plugin finished"; 662 | echo -n "press Enter to continue..."; 663 | read _; 664 | } 665 | -------------------------------------------------------------------------------- /plugins/debian_12_x64: -------------------------------------------------------------------------------- 1 | #OS Debian_11_x64 2 | #COMMENTS Debian comments 3 | #M update:upgrade:_update 4 | #M mysql:MySQL:_install mariadb-server mariadb-client 5 | #M apache:apache:_install apache2 apache2-doc apache2-utils libapache2-mod-perl2 6 | #M perl_modules:Perl_modules:_install libexpat1 ssl-cert cvs libdbi-perl libdbd-mysql-perl libdigest-md4-perl libdigest-sha-perl libcrypt-des-perl libjson-perl 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M DHCP:Dhcp_server:_install isc-dhcp-server 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSbackup:_install_fsbackup 13 | #M Mail:Mail_server:install_mail 14 | # perl_speedy 15 | #M utils:Utils:_install vim tmux bash git tcpdump snmp socat curl 16 | 17 | # Variable 18 | 19 | YES="-y" 20 | BUILD_OPTIONS=" apt-get ${YES} install " 21 | MYSQLDUMP=/usr/bin/mysqldump 22 | GZIP=/bin/gzip 23 | WEB_SERVER_USER=www-data 24 | APACHE_CONF_DIR=/etc/apache2/sites-enabled/ 25 | RESTART_MYSQL=/etc/init.d/mariadb 26 | RESTART_RADIUS=/etc/init.d/radiusd 27 | RESTART_APACHE=/etc/init.d/apache2 28 | RESTART_DHCP=/etc/init.d/isc-dhcp 29 | PING=/bin/ping 30 | PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 31 | 32 | #Services to check after installation 33 | PROCESS_LIST="mariadbd radiusd apache2" 34 | 35 | #****************************************************************** 36 | # PRE INSTALL SECTION. Installing required packages 37 | #****************************************************************** 38 | pre_install () { 39 | 40 | apt-get update 41 | apt-get install -yq dialog nano gcc sudo 42 | 43 | CURRENT_DIR=`pwd` 44 | } 45 | 46 | #******************************************* 47 | # Update and upgrade 48 | #******************************************* 49 | _update() { 50 | apt-get update && apt-get upgrade; 51 | } 52 | 53 | #******************************************* 54 | # Radius 55 | #******************************************* 56 | _install_freeradius() { 57 | apt-get -y install gcc make libtalloc-dev libmariadb-dev libmariadb-dev-compat 58 | 59 | if [ -d /usr/local/freeradius/ ]; then 60 | echo "Radius exists: /usr/local/freeradius/"; 61 | return 0 ; 62 | fi; 63 | 64 | if [ "${FREERADIUS_VERSION}" != "" ]; then 65 | FREERADIUS_VERSION=3.2.3 66 | fi; 67 | 68 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 69 | 70 | for dir in ${PERL_LIB_DIRS}; do 71 | if [ "${DEBUG}" = 1 ]; then 72 | echo "ls ${dir}/libperl* | head -1" 73 | fi; 74 | 75 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 76 | if [ x"${PERL_LIB}" != x ]; then 77 | PERL_LIB_DIR=${dir} 78 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 79 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 80 | fi; 81 | fi; 82 | done; 83 | 84 | 85 | if [ x"${PERL_LIB_DIR}" = x ]; then 86 | echo "Perl lib not found. Not building FreeRadius. Waiting 5 sec..."; 87 | sleep 5; 88 | return 89 | else 90 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 91 | fi; 92 | 93 | RADIUS_SERVER_USER="freerad" 94 | 95 | FREERADIUS_DOWNLOAD="https://www.freeradius.org/ftp/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz" 96 | wget -O freeradius-server-${FREERADIUS_VERSION}.tar.gz ${FREERADIUS_DOWNLOAD} 97 | 98 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 99 | echo "Can\'t download freeradius. PLease download and install manual"; 100 | exit; 101 | fi; 102 | 103 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 104 | 105 | cd freeradius-server-${FREERADIUS_VERSION} 106 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes > 1 107 | echo "/configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --with-openssl=no --with-dhcp=yes " > configure_abills 108 | make && make install 109 | 110 | sleep 100; 111 | 112 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 113 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 114 | 115 | #Add user 116 | groupadd ${RADIUS_SERVER_USER} 117 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 118 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius/etc/raddb 119 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 120 | echo "_________________________________________________________________" 121 | echo " RADIUS SCRIPT AUTOSTART" 122 | echo "_________________________________________________________________" 123 | cat << 'EOF' > /etc/init.d/radiusd 124 | #!/bin/sh 125 | # Start/stop the FreeRADIUS daemon. 126 | 127 | ### BEGIN INIT INFO 128 | # Provides: radiusd 129 | # Required-Start: $remote_fs $network $syslog 130 | # Should-Start: $time mysql slapd postgresql samba krb5-kdc 131 | # Required-Stop: $remote_fs $syslog 132 | # Default-Start: 2 3 4 5 133 | # Default-Stop: 0 1 6 134 | # Short-Description: Radius Daemon 135 | # Description: Extensible, configurable radius daemon 136 | ### END INIT INFO 137 | 138 | set -e 139 | 140 | . /lib/lsb/init-functions 141 | 142 | PROG="radiusd" 143 | PROGRAM="/usr/sbin/radiusd" 144 | PIDFILE="/usr/local/freeradius/var/run/radiusd/radiusd.pid" 145 | DESCR="FreeRADIUS daemon" 146 | 147 | test -f $PROGRAM || exit 0 148 | 149 | # /var/run may be a tmpfs 150 | if [ ! -d /var/run/radiusd ]; then 151 | mkdir -p /var/run/radiusd 152 | chown freerad:freerad /var/run/radiusd 153 | fi 154 | 155 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" 156 | 157 | ret=0 158 | 159 | case "$1" in 160 | start) 161 | log_daemon_msg "Starting $DESCR" "$PROG" 162 | start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $PROGRAM || ret=$? 163 | log_end_msg $ret 164 | exit $ret 165 | ;; 166 | stop) 167 | log_daemon_msg "Stopping $DESCR" "$PROG" 168 | if [ -f "$PIDFILE" ] ; then 169 | start-stop-daemon --stop --retry=TERM/30/KILL/5 --quiet --pidfile $PIDFILE || ret=$? 170 | log_end_msg $ret 171 | else 172 | log_action_cont_msg "$PIDFILE not found" 173 | log_end_msg 0 174 | fi 175 | ;; 176 | restart|force-reload) 177 | $0 stop 178 | $0 start 179 | ;; 180 | *) 181 | echo "Usage: $0 start|stop|restart|force-reload" 182 | exit 1 183 | ;; 184 | esac 185 | 186 | exit 0 187 | EOF 188 | 189 | chmod +x /etc/init.d/radiusd 190 | update-rc.d radiusd defaults 191 | update-rc.d radiusd enable 192 | systemctl enable radiusd 193 | systemctl start radiusd 194 | # service radiusd start 195 | AUTOCONF_PROGRAMS_FLAGS="${AUTOCONF_PROGRAMS_FLAGS} FREERADIUS=3" 196 | cd ${CURRENT_DIR} 197 | } 198 | 199 | 200 | #******************************************* 201 | # Flow-tools + Ipcad 202 | #******************************************* 203 | _install_ipn() { 204 | apt-get -y install flow-tools 205 | 206 | mkdir -p /usr/abills/var/log/ipn/ 207 | 208 | echo "-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996" > /etc/flow-tools/flow-capture.conf 209 | 210 | 211 | update-rc.d flow-capture defaults 212 | update-rc.d flow-capture enable 213 | 214 | ln -s `which flow-cat` /usr/local/bin/flow-cat 215 | ln -s `which flow-print` /usr/local/bin/flow-print 216 | 217 | echo '##################################################################################################' 218 | echo '########### FLOWTOOLS INSTALLED #############' 219 | echo '##################################################################################################' 220 | sleep 1; 221 | 222 | 223 | apt-get -y install libpcap-dev; 224 | 225 | echo '********************************************************************'; 226 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 227 | echo '********************************************************************'; 228 | 229 | # will be installed in /usr/ 230 | cd /usr/ 231 | 232 | #remove if already extracted 233 | if [ -d /usr/ipcad-3.7.3 ]; then 234 | rm -rf ipcad-3.7.3 235 | fi; 236 | 237 | # do not download if present 238 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 239 | echo "INFO: Already downloaded"; 240 | else 241 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 242 | fi; 243 | 244 | tar -xvzf ipcad-3.7.3.tar.gz 245 | cd ipcad-3.7.3 246 | 247 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 248 | LINE2_NUM=$(( LINE1_NUM + 2 )); 249 | 250 | sed -i "${LINE2_NUM}d" headers.h; 251 | sed -i "${LINE1_NUM}d" headers.h; 252 | 253 | echo 254 | 255 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 256 | echo "INFO: Error " 257 | else 258 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 259 | fi; 260 | 261 | 262 | sed -i "1i #include \"signal.h\"" main.c; 263 | 264 | echo 265 | 266 | sed -i "1i #include \"headers.h\"" pps.c; 267 | sed -i "1i #include \"signal.h\"" pps.c; 268 | 269 | echo "INFO: Added to pps.c" 270 | 271 | sed -i "1i #include \"signal.h\"" servers.h; 272 | 273 | echo "INFO: Added to servers.h" 274 | 275 | ./configure && make && make install 276 | 277 | if [ -d /var/ipcad/ ]; then 278 | echo "directory /var/ipcad/ exists"; 279 | else 280 | mkdir /var/ipcad/; 281 | fi; 282 | 283 | 284 | cat << 'EOF' > /usr/local/etc/ipcad.conf 285 | # Интерфейсы для сбора статистики 286 | interface eth0; 287 | # детализация по портам 288 | #capture-ports enable; 289 | 290 | # Агрегировать порты, уменьшает размер базы детализации 291 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 292 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 293 | #aggregate 150-1023 into 1023; /* General low range */ 294 | 295 | # Експортирование статистики на адрес 127.0.0.1 порт 9996 296 | netflow export destination 127.0.0.1 9996; 297 | netflow export version 5; # NetFlow export format version {1|5} 298 | netflow timeout active 30; # Timeout when flow is active, in minutes 299 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 300 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 301 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 302 | 303 | dumpfile = ipcad.dump; 304 | chroot = /var/ipcad/; 305 | pidfile = ipcad.pid; 306 | 307 | rsh enable at 127.0.0.1; 308 | memory_limit = 16m; 309 | 310 | EOF 311 | cd ${CURRENT_DIR} 312 | echo '##################################################################################################' 313 | echo '############# IPCAD INSTALLED ###############' 314 | echo '##################################################################################################' 315 | } 316 | 317 | #************************************ 318 | # rstat install 319 | #************************************ 320 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 321 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 322 | cd /usr/ 323 | wget ${RSTAT_URL} 324 | 325 | tar zxvf master.tar.gz ; 326 | cd rstat-master ; 327 | make install ; 328 | cd ${CURRENT_DIR} 329 | } 330 | 331 | #************************************ 332 | # MRTG install 333 | #************************************ 334 | _install_mrtg() { 335 | apt-get -y install mrtg snmp 336 | _install_rstat 337 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 338 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 339 | } 340 | 341 | #********************************************************** 342 | # FSBackup install 343 | #********************************************************** 344 | _install_fsbackup() { 345 | echo "FSBACKUP START INSTALL" 346 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 347 | 348 | wget ${url} 349 | 350 | tar zxvf fsbackup-1.2pl2.tar.gz; 351 | cd fsbackup-1.2pl2; 352 | ./install.pl; 353 | mkdir /usr/local/fsbackup/archive; 354 | 355 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 356 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 357 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 358 | 359 | check_fsbackup_cron=`grep create_backup /etc/crontab` 360 | if [ x"${check_fsbackup_cron}" = x ]; then 361 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 362 | fi; 363 | 364 | cd ${CURRENT_DIR} 365 | } 366 | 367 | #********************************************************** 368 | # ACCEL-PPPoE install 369 | #********************************************************** 370 | _install_accel_pppoe() { 371 | 372 | apt-get -y install bzip2 cmake libssl-dev libpcre3-dev 373 | 374 | echo 375 | echo "##############################################################" 376 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} ##" 377 | echo "##############################################################" 378 | echo 379 | cd /usr/ 380 | 381 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 382 | tar -xjf accel-ppp-1.7.4.tar.bz2 383 | cd accel-ppp-1.7.4 384 | mkdir build 385 | cd build 386 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/linux-headers-`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 387 | make 388 | make install 389 | 390 | cat << 'EOF1' > /etc/accel-ppp.conf 391 | [modules] 392 | #path=/usr/local/lib/accel-ppp 393 | log_file 394 | #log_tcp 395 | #log_pgsql 396 | pptp 397 | pppoe 398 | #l2tp 399 | auth_mschap_v2 400 | #auth_mschap_v1 401 | #auth_chap_md5 402 | #auth_pap 403 | radius 404 | #ippool 405 | sigchld 406 | pppd_compat 407 | shaper_tbf 408 | #chap-secrets 409 | 410 | [core] 411 | log-error=/var/log/accel-ppp/core.log 412 | thread-count=4 413 | 414 | [ppp] 415 | verbose=1 416 | min-mtu=1000 417 | mtu=1400 418 | mru=1400 419 | #ccp=0 420 | #sid-case=upper 421 | #check-ip=0 422 | #single-session=replace 423 | #mppe=require 424 | 425 | [lcp] 426 | echo-interval=30 427 | echo-failure=3 428 | 429 | [pptp] 430 | echo-interval=30 431 | verbose=1 432 | 433 | [pppoe] 434 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 435 | interface=eth1 436 | interface=vlan2 437 | interface=vlan3 438 | interface=vlan4 439 | #ac-name=xxx 440 | #service-name=yyy 441 | #pado-delay=0 442 | #pado-delay=0,100:100,200:200,-1:500 443 | #ifname-in-sid=called-sid 444 | #tr101=1 445 | verbose=1 446 | 447 | #[l2tp] 448 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 449 | #hello-interval=60 450 | #timeout=60 451 | #rtimeout=5 452 | #retransmit=5 453 | #host-name=accel-ppp 454 | #verbose=1 455 | 456 | [dns] 457 | dns1=10.0.0.10 458 | #dns2=172.16.1.1 459 | 460 | [radius] 461 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 462 | nas-identifier=accel-ppp 463 | nas-ip-address=127.0.0.1 464 | gw-ip-address=10.0.0.10 465 | auth-server=127.0.0.1:1812,secretpass 466 | acct-server=127.0.0.1:1813,secretpass 467 | dae-server=127.0.0.1:3799,secretpass 468 | verbose=1 469 | #timeout=3 470 | #max-try=3 471 | #acct-timeout=120 472 | #acct-delay-time=0 473 | 474 | [client-ip-range] 475 | disable 476 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 477 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 478 | 479 | #[ip-pool] 480 | #gw-ip-address=192.168.0.1 481 | #192.168.0.2-255 482 | #192.168.1.1-255 483 | #192.168.2.1-255 484 | #192.168.3.1-255 485 | #192.168.4.0/24 486 | 487 | [log] 488 | log-file=/var/log/accel-ppp/accel-ppp.log 489 | log-emerg=/var/log/accel-ppp/emerg.log 490 | log-fail-file=/var/log/accel-ppp/auth-fail.log 491 | #log-debug=/dev/stdout 492 | #log-tcp=127.0.0.1:3000 493 | copy=1 494 | #color=1 495 | #per-user-dir=per_user 496 | #per-session-dir=per_session 497 | #per-session=1 498 | level=3 499 | #log-tcp=127.0.0.1:3000 500 | 501 | #[log-pgsql] 502 | #conninfo=user=log 503 | #log-table=log 504 | 505 | [pppd-compat] 506 | #ip-pre-up=/etc/ppp/ip-pre-up 507 | #ip-up=/etc/ppp/ip-up 508 | #ip-down=/etc/ppp/ip-down 509 | #ip-change=/etc/ppp/ip-change 510 | radattr-prefix=/var/run/radattr 511 | verbose=1 512 | 513 | #[chap-secrets] 514 | #gw-ip-address=192.168.100.1 515 | #chap-secrets=/etc/ppp/chap-secrets 516 | 517 | [tbf] 518 | #attr=Filter-Id 519 | #down-burst-factor=0.1 520 | #up-burst-factor=1.0 521 | #latency=50 522 | attr-down=PPPD-Downstream-Speed-Limit 523 | attr-up=PPPD-Upstream-Speed-Limit 524 | 525 | 526 | [cli] 527 | telnet=127.0.0.1:2000 528 | #tcp=127.0.0.1:2001 529 | EOF1 530 | 531 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 532 | # Limit session traffic 533 | ATTRIBUTE Session-Octets-Limit 227 integer 534 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 535 | ATTRIBUTE Octets-Direction 228 integer 536 | # Connection Speed Limit 537 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 538 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 539 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 540 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 541 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 542 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 543 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 544 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 545 | ATTRIBUTE Acct-Interim-Interval 85 integer 546 | ATTRIBUTE Acct-Input-Gigawords 52 integer 547 | ATTRIBUTE Acct-Output-Gigawords 53 integer 548 | EOF2 549 | 550 | modprobe -r ip_gre 551 | 552 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 553 | 554 | echo 'pptp' >> /etc/modules 555 | echo 'pppoe' >> /etc/modules 556 | 557 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 558 | # Limit session traffic 559 | ATTRIBUTE Session-Octets-Limit 227 integer 560 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 561 | ATTRIBUTE Octets-Direction 228 integer 562 | # Connection Speed Limit 563 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 564 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 565 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 566 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 567 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 568 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 569 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 570 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 571 | ATTRIBUTE Acct-Interim-Interval 85 integer 572 | ATTRIBUTE Acct-Input-Gigawords 52 integer 573 | EOF3 574 | 575 | 576 | touch /etc/init.d/accel-ppp 577 | chmod +x /etc/init.d/accel-ppp 578 | 579 | cat << 'EOF4' >> /etc/init.d/accel-ppp 580 | #!/bin/sh 581 | # /etc/init.d/accel-pppd: set up the accel-ppp server 582 | ### BEGIN INIT INFO 583 | # Provides: accel-ppp 584 | # Required-Start: $networking 585 | # Required-Stop: $networking 586 | # Default-Start: 2 3 4 5 587 | # Default-Stop: 0 1 6 588 | ### END INIT INFO 589 | 590 | set -e 591 | 592 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin; 593 | ACCEL_PPTPD=`which accel-pppd` 594 | . /lib/lsb/init-functions 595 | 596 | if test -f /etc/default/accel-ppp; then 597 | . /etc/default/accel-ppp 598 | fi 599 | 600 | if [ -z $ACCEL_PPPTD_OPTS ]; then 601 | ACCEL_PPTPD_OPTS="-c /etc/accel-ppp.conf" 602 | fi 603 | 604 | case "$1" in 605 | start) 606 | log_daemon_msg "Starting accel-ppp server" "accel-pppd" 607 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 608 | log_end_msg 0 609 | else 610 | log_end_msg 1 611 | fi 612 | ;; 613 | restart) 614 | log_daemon_msg "Restarting accel-ppp server" "accel-pppd" 615 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 616 | if start-stop-daemon --start --quiet --oknodo --exec $ACCEL_PPTPD -- -d -p /var/run/accel-pppd.pid $ACCEL_PPTPD_OPTS; then 617 | log_end_msg 0 618 | else 619 | log_end_msg 1 620 | fi 621 | ;; 622 | 623 | stop) 624 | log_daemon_msg "Stopping accel-ppp server" "accel-pppd" 625 | start-stop-daemon --stop --quiet --oknodo --retry 180 --pidfile /var/run/accel-pppd.pid 626 | log_end_msg 0 627 | ;; 628 | 629 | status) 630 | do_status 631 | ;; 632 | *) 633 | log_success_msg "Usage: /etc/init.d/accel-ppp {start|stop|status|restart}" 634 | exit 1 635 | ;; 636 | esac 637 | 638 | exit 0 639 | EOF4 640 | update-rc.d accel-ppp defaults 641 | update-rc.d accel-ppp enable 642 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 643 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 644 | 645 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 646 | 647 | cd ${CURRENT_DIR} 648 | 649 | } 650 | 651 | #****************************************************************** 652 | # POST INSTALL 653 | #****************************************************************** 654 | post_install () { 655 | 656 | a2enmod rewrite; 657 | a2enmod ssl; 658 | a2enmod perl; 659 | a2enmod cgi; 660 | a2enmod headers; 661 | 662 | touch /etc/crontab 663 | 664 | cd /usr/abills/misc && ./perldeps.pl apt-get -batch 665 | 666 | echo "Plugin finished"; 667 | echo -n "press Enter to continue..."; 668 | read _; 669 | } 670 | -------------------------------------------------------------------------------- /plugins/centos_8_x64: -------------------------------------------------------------------------------- 1 | #OS CentOS 8_x64 2 | #COMMENTS CentOS comments 3 | #M update:Upgrade_system:yum -y update 4 | #M mysql:MySQL:_install_mysql 5 | #M apache:Apache2.4:_install_httpd 6 | #M perl_modules:Perl_modules:_install_perl_modules 7 | #M freeradius:Freeradius_Server:_install_freeradius 8 | #M dhcp:Dhcp_server:_install_dhcp 9 | #M flow-tools:Flow-tools,Ipcad:_install_ipn 10 | #M mrtg:Mrtg,Rstat:_install_mrtg 11 | #M accel_ppp:ACCEL-PPPoE:_install_accel_pppoe 12 | #M FSbackup:FSBackup:_install_fsbackup 13 | #dM Mail:Mail_server:install_mail 14 | # MRTG= 15 | # fsbackup= 16 | # perl_speedy 17 | #M utils:Utils:_install_utils 18 | 19 | # Variables 20 | WEB_SERVER_USER=apache 21 | MYSQLDUMP=/bin/mysqldump 22 | GZIP=/bin/gzip 23 | APACHE_CONF_DIR=/etc/httpd/conf.d 24 | RESTART_MYSQL="service mysqld" 25 | RESTART_RADIUS="service radiusd " 26 | RESTART_APACHE="service httpd " 27 | PING=/bin/ping 28 | 29 | #Services to check after installation 30 | PROCESS_LIST="mysqld radiusd httpd flow-capture named" 31 | 32 | #******************************************* 33 | # Pre install 34 | #******************************************* 35 | pre_install() { 36 | yum -y install wget tmux bash nano gcc ca-certificates; 37 | _install_epel; 38 | yum config-manager --set-enabled PowerTools; 39 | 40 | CURRENT_DIR=`pwd` 41 | } 42 | 43 | #********************************************************* 44 | # Install MySQL 45 | #********************************************************* 46 | _install_mysql(){ 47 | # Install repository 48 | dnf -y module disable mysql 49 | yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm 50 | percona-release setup ps57 51 | 52 | # Clear log before installation 53 | [ -f /var/log/mysqld.log ] && echo '' > /var/log/mysqld.log 54 | 55 | # Install server (+client) and devel package to compile Freeradius module 56 | yum -y install Percona-Server-server-57 Percona-Server-devel-57 57 | 58 | echo "Starting Percona to initialize /var/lib/mysql directory" 59 | systemctl start mysqld 60 | 61 | echo "Stop percona running in normal mode" 62 | systemctl stop mysqld 63 | 64 | echo "Starting Percona without password validate" 65 | sudo -u mysql /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid --validate-password=OFF 66 | 67 | echo "Grep generated password from mysqld.log" 68 | MYSQL_TEMPRORARY_ROOT_PASSWORD=`cat /var/log/mysqld.log | grep generated | awk '{print($11)}'` 69 | 70 | echo "Clear 'root'@'localhost' password" 71 | mysqladmin -u root --password="${MYSQL_TEMPRORARY_ROOT_PASSWORD}" -h localhost password "" 72 | 73 | echo "Stopping mysql without validate password" 74 | kill -15 `cat /var/run/mysqld/mysqld.pid` 75 | 76 | echo "Starting mysql in normal mode" 77 | systemctl start mysqld 78 | systemctl enable mysqld 79 | 80 | echo "Disabling special character password policy" 81 | mysql -e "SET GLOBAL validate_password_special_char_count=0;" 82 | } 83 | 84 | #********************************************************* 85 | # Install apache 86 | #********************************************************* 87 | _install_httpd(){ 88 | yum -y install httpd httpd-devel httpd-tools 89 | chkconfig httpd on 90 | service httpd start 91 | 92 | cat << '[EOF_APACHE]' > /etc/httpd/modules.d/000_abills_modules.conf 93 | LoadModule ssl_module modules/mod_ssl.so 94 | LoadModule rewrite_module modules/mod_rewrite.so 95 | LoadModule cgi_module modules/mod_cgi.so 96 | [EOF_APACHE] 97 | 98 | apachectl -k restart 99 | 100 | 101 | echo "######### Opening firewall ports ############" 102 | firewall-cmd --zone=public --add-port=9443/tcp --permanent 103 | firewall-cmd --reload 104 | echo "######### Disabling selinux ############" 105 | 106 | sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config 107 | 108 | } 109 | #********************************************************* 110 | # Install EPEL repository CentOS (RedHat) 111 | #********************************************************* 112 | _install_epel() { 113 | # RPM needs 'y' answer, so to automate installation, use yum 114 | yum -y install epel-release 115 | # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm 116 | # rpm -ivh epel-release-7-5.noarch.rpm 117 | 118 | } 119 | 120 | #********************************************************* 121 | # Install Perl modules 122 | #********************************************************* 123 | _install_perl_modules() { 124 | yum -y install expat-devel expat mod_ssl openssl openssl-devel perl-DBI perl-JSON perl-JSON-XS perl-DBD-MySQL perl-Digest-MD5 perl-Digest-SHA1 perl-Time-HiRes perl-ExtUtils-Embed perl-DB_File perl-autodie perl-App-cpanminus perl-Time-Piece perl-Authen-Captcha perl-Crypt-DES perl-Digest-MD4 perl-GD perl-Spreadsheet-WriteExcel perl-XML-Simple perl-LWP-Protocol-https perl-Text-CSV perl-AnyEvent perl-AnyEvent-HTTP 125 | cpanm Devel::NYTProf Imager::QRCode Crypt::OpenSSL::X509 Digest::MD4 PDF::API2 autodie 126 | } 127 | 128 | #******************************************* 129 | # Radius 130 | #******************************************* 131 | _install_freeradius() { 132 | yum -y install gdbm gdbm-devel perl-ExtUtils-Embed gcc libtalloc-devel 133 | 134 | if [ -d /usr/local/freeradius/ ]; then 135 | echo "Radius exists: /usr/local/freeradius/"; 136 | return 0 ; 137 | fi; 138 | 139 | PERL_LIB_DIRS="/usr/lib/ /usr/lib/i386-linux-gnu/ /usr/lib64/ /usr/lib/x86_64-linux-gnu/ /usr/lib64/perl5/CORE/ /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE/ /usr/lib/perl5/CORE/" 140 | 141 | for dir in ${PERL_LIB_DIRS}; do 142 | if [ "${DEBUG}" = 1 ]; then 143 | echo "ls ${dir}/libperl* | head -1" 144 | fi; 145 | 146 | PERL_LIB=`ls ${dir}/libperl* 2>/dev/null | head -1`; 147 | if [ x"${PERL_LIB}" != x ]; then 148 | PERL_LIB_DIR=${dir} 149 | if [ ! -f ${PERL_LIB_DIR}/libperl.so ]; then 150 | ln -s ${PERL_LIB} ${PERL_LIB_DIR}libperl.so 151 | fi; 152 | fi; 153 | done; 154 | 155 | 156 | if [ x"${PERL_LIB_DIR}" = x ]; then 157 | echo "Perl lib not found"; 158 | exit; 159 | else 160 | echo "Perl lib: ${PERL_LIB_DIR}libperl.so" 161 | fi; 162 | 163 | RADIUS_SERVER_USER="freerad" 164 | 165 | _fetch freeradius-server-${FREERADIUS_VERSION}.tar.gz ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${FREERADIUS_VERSION}.tar.gz 166 | 167 | if [ ! -f freeradius-server-${FREERADIUS_VERSION}.tar.gz ]; then 168 | echo "Can\'t download freeradius. PLease download and install manual"; 169 | exit; 170 | fi; 171 | 172 | tar zxvf freeradius-server-${FREERADIUS_VERSION}.tar.gz 173 | 174 | cd freeradius-server-${FREERADIUS_VERSION} 175 | ./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp > 1 176 | #echo "./configure --prefix=/usr/local/freeradius --with-rlm-perl-lib-dir=${PERL_LIB_DIR} --without-openssl --with-dhcp " > configure_abills 177 | make && make install 178 | 179 | ln -s /usr/local/freeradius/bin/* /usr/bin/ 180 | ln -s /usr/local/freeradius/sbin/* /usr/sbin/ 181 | 182 | firewall-cmd --permanent --zone=public --add-service=radius 183 | 184 | #Add user 185 | groupadd ${RADIUS_SERVER_USER} 186 | useradd -g ${RADIUS_SERVER_USER} -s /bash/bash ${RADIUS_SERVER_USER} 187 | mkdir -p /usr/local/freeradius/var/log 188 | chown -R ${RADIUS_SERVER_USER}:${RADIUS_SERVER_USER} /usr/local/freeradius 189 | echo '' > /usr/local/freeradius/etc/raddb/clients.conf 190 | cat << 'EOF' > /etc/systemd/system/radiusd.service 191 | [Unit] 192 | Description=FreeRADIUS Server 193 | After=network.target 194 | After=mysqld.service 195 | Requires=mysqld.service 196 | 197 | [Service] 198 | Type=forking 199 | 200 | #PIDFile=/var/run/radiusd/radiusd.pid 201 | ExecStartPre=/usr/bin/touch /usr/local/freeradius/var/log/radius.log 202 | ExecStartPre=/usr/bin/chown freerad:freerad /usr/local/freeradius/var/log/radius.log 203 | ExecStartPre=/usr/bin/mkdir -p /var/run/radiusd 204 | ExecStartPre=/usr/bin/chown -R freerad:freerad /var/run/radiusd 205 | ExecStartPre=/usr/local/freeradius/sbin/radiusd -C 206 | 207 | ExecStart=/usr/local/freeradius/sbin/radiusd -d /usr/local/freeradius/etc/raddb 208 | 209 | ExecReload=/usr/local/freeradius/sbin/radiusd -C 210 | ExecReload=/bin/kill -HUP $MAINPID 211 | 212 | [Install] 213 | WantedBy=multi-user.target 214 | EOF 215 | 216 | # Change log file destination 217 | sed -i.bak -e 's/logdir\ \=\ \/var\/log/logdir\ \=\ \$\{prefix\}\/var\/log/' /usr/abills/misc/freeradius/linux/radiusd.conf 218 | 219 | chown freerad:freerad -R /usr/local/freeradius/var/log 220 | 221 | systemctl enable radiusd 222 | 223 | cd ${CURRENT_DIR} 224 | } 225 | 226 | #******************************************* 227 | # Dhcp server 228 | #******************************************* 229 | _install_dhcp() { 230 | yum -y install dhcp 231 | } 232 | 233 | #******************************************* 234 | # Utils 235 | #******************************************* 236 | _install_utils() { 237 | yum -y install vim tmux bash git 238 | } 239 | 240 | #******************************************* 241 | # Flow-tools + Ipcad 242 | #******************************************* 243 | _install_ipn() { 244 | yum install -y flow-tools 245 | 246 | mkdir -p /usr/abills/var/log/ipn/ 247 | 248 | echo 'OPTIONS="-S 5 -n 287 -N 0 -d 5 -w /usr/abills/var/log/ipn/ 0/0/9996"' > /etc/sysconfig/flow-capture 249 | 250 | 251 | chkconfig --add flow-capture 252 | chkconfig flow-capture on 253 | echo '##################################################################################################' 254 | echo 'FLOWTOOLS INSTALLED ##################################################################################################' 255 | echo '##################################################################################################' 256 | 257 | 258 | yum -y install libpcap libpcap-devel; 259 | 260 | 261 | echo '********************************************************************'; 262 | echo '*** THIS SCRIPT APPLIES SOME FIXES TO BUILD IPCAD ***'; 263 | echo '********************************************************************'; 264 | 265 | # will be installed in /usr/ 266 | cd /usr/ 267 | 268 | #remove if already extracted 269 | if [ -d /usr/ipcad-3.7.3 ]; then 270 | rm -rf ipcad-3.7.3 271 | fi; 272 | 273 | # do not download if present 274 | if [ -f "ipcad-3.7.3.tar.gz" ]; then 275 | echo "INFO: Already downloaded"; 276 | else 277 | wget http://lionet.info/soft/ipcad-3.7.3.tar.gz 278 | fi; 279 | 280 | tar -xvzf ipcad-3.7.3.tar.gz 281 | cd ipcad-3.7.3 282 | 283 | LINE1_NUM=`grep -n 'HAVE_LINUX_NETLINK_H' headers.h | cut -d : -f 1` 284 | LINE2_NUM=$(( LINE1_NUM + 2 )); 285 | 286 | sed -i "${LINE2_NUM}d" headers.h; 287 | sed -i "${LINE1_NUM}d" headers.h; 288 | 289 | echo 290 | 291 | if [ `cat headers.h | grep 'HAVE_LINUX_NETLINK_H'` ]; then 292 | echo "INFO: Error " 293 | else 294 | echo "INFO: HAVE_LINUX_NETLINK_H Deleted"; 295 | fi; 296 | 297 | 298 | sed -i "1i #include \"signal.h\"" main.c; 299 | 300 | echo 301 | 302 | sed -i "1i #include \"headers.h\"" pps.c; 303 | sed -i "1i #include \"signal.h\"" pps.c; 304 | 305 | echo "INFO: Added to pps.c" 306 | 307 | sed -i "1i #include \"signal.h\"" servers.h; 308 | 309 | echo "INFO: Added to servers.h" 310 | 311 | ./configure && make && make install 312 | 313 | if [ -d /var/ipcad/ ]; then 314 | echo "directory /var/ipcad/ exists"; 315 | else 316 | mkdir /var/ipcad/; 317 | fi; 318 | 319 | 320 | cat << 'EOF' > /usr/local/etc/ipcad.conf 321 | # Èíòåðôåéñû äëÿ ñáîðà ñòàòèñòèêè 322 | interface eth0; 323 | # äåòàëèçàöèÿ ïî ïîðòàì 324 | #capture-ports enable; 325 | 326 | # Àãðåãèðîâàòü ïîðòû, óìåíüøàåò ðàçìåð áàçû äåòàëèçàöèè 327 | #aggregate 1024-65535 into 65535; /* Aggregate wildly */ 328 | #aggregate 3128-3128 into 3128; /* Protect these ports */ 329 | #aggregate 150-1023 into 1023; /* General low range */ 330 | 331 | # Åêñïîðòèðîâàíèå ñòàòèñòèêè íà àäðåñ 127.0.0.1 ïîðò 9996 332 | netflow export destination 127.0.0.1 9996; 333 | netflow export version 5; # NetFlow export format version {1|5} 334 | netflow timeout active 30; # Timeout when flow is active, in minutes 335 | netflow timeout inactive 15; # Flow inactivity timeout, in seconds 336 | netflow engine-type 73; # v5 engine_type; 73='I' for "IPCAD" 337 | netflow engine-id 1; # Useful to differentiate multiple ipcads. 338 | 339 | dumpfile = ipcad.dump; 340 | chroot = /var/ipcad/; 341 | pidfile = ipcad.pid; 342 | 343 | rsh enable at 127.0.0.1; 344 | memory_limit = 16m; 345 | 346 | EOF 347 | cd ${CURRENT_DIR} 348 | echo '##################################################################################################' 349 | echo 'IPCAD INSTALLED ##################################################################################################' 350 | echo '##################################################################################################' 351 | } 352 | 353 | #************************************ 354 | # rstat install 355 | #************************************ 356 | _install_rstat() { #TODO: use install_rstat() from install.sh instead? 357 | RSTAT_URL="https://github.com/nabat/rstat/archive/refs/heads/master.tar.gz"; 358 | 359 | wget ${RSTAT_URL} 360 | 361 | tar zxvf master.tar.gz ; 362 | cd rstat-master ; 363 | make install ; 364 | cd ${CURRENT_DIR} 365 | } 366 | #************************************ 367 | # MRTG install 368 | #************************************ 369 | _install_mrtg() { 370 | yum -y install mrtg net-snmp net-snmp-utils net-tools 371 | _install_rstat 372 | indexmaker /etc/mrtg/mrtg.cfg > /usr/abills/webreports/index.htm 373 | echo "*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" >> /etc/crontab 374 | } 375 | 376 | #********************************************************** 377 | # FSBackup install 378 | #********************************************************** 379 | _install_fsbackup() { 380 | echo "FSBACKUP START INSTALL" 381 | url="http://www.opennet.ru/dev/fsbackup/src/fsbackup-1.2pl2.tar.gz" 382 | 383 | wget ${url} 384 | 385 | tar zxvf fsbackup-1.2pl2.tar.gz; 386 | cd fsbackup-1.2pl2; 387 | ./install.pl; 388 | mkdir /usr/local/fsbackup/archive; 389 | 390 | echo "!/usr/local/fsbackup" >> /usr/local/fsbackup/cfg_example 391 | cp /usr/local/fsbackup/create_backup.sh /usr/local/fsbackup/create_backup.sh_back 392 | cat /usr/local/fsbackup/create_backup.sh_back | sed 's/config_files=\".*\"/config_files=\"cfg_example\"/' > /usr/local/fsbackup/create_backup.sh 393 | 394 | check_fsbackup_cron=`grep create_backup /etc/crontab` 395 | if [ x"${check_fsbackup_cron}" = x ]; then 396 | echo "18 4 * * * root /usr/local/fsbackup/create_backup.sh| mail -s \"`uname -n` backup report\" root" >> /etc/crontab 397 | fi; 398 | 399 | cd ${CURRENT_DIR} 400 | } 401 | 402 | #********************************************************** 403 | # ACCEL-PPPoE install 404 | #********************************************************** 405 | _install_accel_pppoe() { 406 | 407 | yum -y install kernel-headers kernel-devel bzip2 cmake 408 | 409 | echo 410 | echo "#############################################" 411 | echo "## Installing ACCEL-PPP ${ACCEL_PPPP_VERSION} " 412 | echo "#############################################" 413 | echo 414 | 415 | 416 | wget http://sourceforge.net/projects/accel-ppp/files/accel-ppp-1.7.4.tar.bz2 417 | tar -xjf accel-ppp-1.7.4.tar.bz2 418 | cd accel-ppp-1.7.4 419 | mkdir build 420 | cd build 421 | cmake -DBUILD_DRIVER=FALSE -DRADIUS=TRUE -DKDIR=/usr/src/kernels/`uname -r` -DCMAKE_INSTALL_PREFIX=/usr/local .. 422 | make 423 | make install 424 | 425 | cat << 'EOF1' > /etc/accel-ppp.conf 426 | [modules] 427 | #path=/usr/local/lib/accel-ppp 428 | log_file 429 | #log_tcp 430 | #log_pgsql 431 | pptp 432 | pppoe 433 | #l2tp 434 | auth_mschap_v2 435 | #auth_mschap_v1 436 | #auth_chap_md5 437 | #auth_pap 438 | radius 439 | #ippool 440 | sigchld 441 | pppd_compat 442 | shaper_tbf 443 | #chap-secrets 444 | 445 | [core] 446 | log-error=/var/log/accel-ppp/core.log 447 | thread-count=4 448 | 449 | [ppp] 450 | verbose=1 451 | min-mtu=1000 452 | mtu=1400 453 | mru=1400 454 | #ccp=0 455 | #sid-case=upper 456 | #check-ip=0 457 | #single-session=replace 458 | #mppe=require 459 | 460 | [lcp] 461 | echo-interval=30 462 | echo-failure=3 463 | 464 | [pptp] 465 | echo-interval=30 466 | verbose=1 467 | 468 | [pppoe] 469 | # ˆíòåðôåéñû íà êîòîðûõ çàïóùåí pppoe ñåðâåð ( äîëæíû áûòü ñîîòâåòñòâåííî ïîäíßòû èíòåðôåéñû) 470 | interface=eth1 471 | interface=vlan2 472 | interface=vlan3 473 | interface=vlan4 474 | #ac-name=xxx 475 | #service-name=yyy 476 | #pado-delay=0 477 | #pado-delay=0,100:100,200:200,-1:500 478 | #ifname-in-sid=called-sid 479 | #tr101=1 480 | verbose=1 481 | 482 | #[l2tp] 483 | #dictionary=/usr/local/share/accel-ppp/l2tp/dictionary 484 | #hello-interval=60 485 | #timeout=60 486 | #rtimeout=5 487 | #retransmit=5 488 | #host-name=accel-ppp 489 | #verbose=1 490 | 491 | [dns] 492 | dns1=10.0.0.10 493 | #dns2=172.16.1.1 494 | 495 | [radius] 496 | dictionary=/usr/local/share/accel-ppp/radius/dictionary 497 | nas-identifier=accel-ppp 498 | nas-ip-address=127.0.0.1 499 | gw-ip-address=10.0.0.10 500 | auth-server=127.0.0.1:1812,secretpass 501 | acct-server=127.0.0.1:1813,secretpass 502 | dae-server=127.0.0.1:3799,secretpass 503 | verbose=1 504 | #timeout=3 505 | #max-try=3 506 | #acct-timeout=120 507 | #acct-delay-time=0 508 | 509 | [client-ip-range] 510 | disable 511 | #10.0.0.0/8 # “êàçàòü äèàïàçîíû ðàçäàâàåìûå êëèåíòàì â (ïî DHCP èëè âðó÷íóþ). 512 | # ‚€†Ž: îíè íå äîëæíû ïåðåñåêàòñß ñ ïóëàìè PPPOE èëè PPTP ñåðâåðà äîñòóïà. 513 | 514 | #[ip-pool] 515 | #gw-ip-address=192.168.0.1 516 | #192.168.0.2-255 517 | #192.168.1.1-255 518 | #192.168.2.1-255 519 | #192.168.3.1-255 520 | #192.168.4.0/24 521 | 522 | [log] 523 | log-file=/var/log/accel-ppp/accel-ppp.log 524 | log-emerg=/var/log/accel-ppp/emerg.log 525 | log-fail-file=/var/log/accel-ppp/auth-fail.log 526 | #log-debug=/dev/stdout 527 | #log-tcp=127.0.0.1:3000 528 | copy=1 529 | #color=1 530 | #per-user-dir=per_user 531 | #per-session-dir=per_session 532 | #per-session=1 533 | level=3 534 | #log-tcp=127.0.0.1:3000 535 | 536 | #[log-pgsql] 537 | #conninfo=user=log 538 | #log-table=log 539 | 540 | [pppd-compat] 541 | #ip-pre-up=/etc/ppp/ip-pre-up 542 | #ip-up=/etc/ppp/ip-up 543 | #ip-down=/etc/ppp/ip-down 544 | #ip-change=/etc/ppp/ip-change 545 | radattr-prefix=/var/run/radattr 546 | verbose=1 547 | 548 | #[chap-secrets] 549 | #gw-ip-address=192.168.100.1 550 | #chap-secrets=/etc/ppp/chap-secrets 551 | 552 | [tbf] 553 | #attr=Filter-Id 554 | #down-burst-factor=0.1 555 | #up-burst-factor=1.0 556 | #latency=50 557 | attr-down=PPPD-Downstream-Speed-Limit 558 | attr-up=PPPD-Upstream-Speed-Limit 559 | 560 | 561 | [cli] 562 | telnet=127.0.0.1:2000 563 | #tcp=127.0.0.1:2001 564 | EOF1 565 | 566 | cat << 'EOF2' >> /usr/local/share/accel-ppp/radius/dictionary 567 | # Limit session traffic 568 | ATTRIBUTE Session-Octets-Limit 227 integer 569 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 570 | ATTRIBUTE Octets-Direction 228 integer 571 | # Connection Speed Limit 572 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 573 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 574 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 575 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 576 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 577 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 578 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 579 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 580 | ATTRIBUTE Acct-Interim-Interval 85 integer 581 | ATTRIBUTE Acct-Input-Gigawords 52 integer 582 | ATTRIBUTE Acct-Output-Gigawords 53 integer 583 | EOF2 584 | 585 | modprobe -r ip_gre 586 | 587 | echo 'blacklist ip_gre' >> /etc/modprobe.d/blacklist.conf 588 | 589 | echo 'pptp' >> /etc/modules 590 | echo 'pppoe' >> /etc/modules 591 | 592 | cat << 'EOF3' >> /usr/local/freeradius/etc/raddb/dictionary 593 | # Limit session traffic 594 | ATTRIBUTE Session-Octets-Limit 227 integer 595 | # What to assume as limit - 0 in+out, 1 in, 2 out, 3 max(in,out) 596 | ATTRIBUTE Octets-Direction 228 integer 597 | # Connection Speed Limit 598 | ATTRIBUTE PPPD-Upstream-Speed-Limit 230 integer 599 | ATTRIBUTE PPPD-Downstream-Speed-Limit 231 integer 600 | ATTRIBUTE PPPD-Upstream-Speed-Limit-1 232 integer 601 | ATTRIBUTE PPPD-Downstream-Speed-Limit-1 233 integer 602 | ATTRIBUTE PPPD-Upstream-Speed-Limit-2 234 integer 603 | ATTRIBUTE PPPD-Downstream-Speed-Limit-2 235 integer 604 | ATTRIBUTE PPPD-Upstream-Speed-Limit-3 236 integer 605 | ATTRIBUTE PPPD-Downstream-Speed-Limit-3 237 integer 606 | ATTRIBUTE Acct-Interim-Interval 85 integer 607 | ATTRIBUTE Acct-Input-Gigawords 52 integer 608 | EOF3 609 | 610 | #accel-pppd -p 'var/run/accel.pid' -c '/etc/accel-ppp.conf' 611 | 612 | sed -i 's/mpd5/accel_ppp/g' /usr/abills/db/abills.sql 613 | 614 | sed -i 's/127\.0\.0\.1\:5005/127\.0\.0\.1\:3799\:2001/g' /usr/abills/db/abills.sql 615 | 616 | cd ${CURRENT_DIR} 617 | 618 | } 619 | 620 | #************************************ 621 | # Post install 622 | #************************************ 623 | post_install() { 624 | systemctl start mysqld 625 | 626 | systemctl restart radiusd.service 627 | 628 | service flow-capture start 629 | cd /usr/abills/misc && ./perldeps.pl rpm -batch 630 | echo " "; 631 | echo " "; 632 | echo "************************************************************"; 633 | echo "************************************************************"; 634 | echo "*************** Plugin finished *********************"; 635 | echo "**** You need to reboot the system after configuration ****"; 636 | echo "************************************************************"; 637 | echo "************************************************************"; 638 | echo " "; 639 | echo " "; 640 | read -p "press Enter to continue..."; 641 | } 642 | --------------------------------------------------------------------------------