├── telegraf.conf
├── README.md
└── homer_installer.sh
/telegraf.conf:
--------------------------------------------------------------------------------
1 | # Configuration for influxdb server to send metrics to
2 | [[outputs.influxdb]]
3 | urls = ["http://127.0.0.1:8086/"] # required
4 | database = "homer" # required
5 | timeout = "5s"
6 | ## HTTP Basic Auth
7 | # username = "telegraf"
8 | # password = "metricsmetricsmetricsmetrics"
9 |
10 | # # Generic socket listener capable of handling multiple socket types.
11 | [[inputs.prometheus]]
12 | urls = ["http://localhost:9096/metrics"]
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # __HOMER 7__ Installer
4 | This document provides guidance and details to get HOMER 7 installed stand-alone using scripts or packages
5 |
6 | WARNING: Homer is rock-solid, while the installers and packages are experimental. Use at your own risk!
For a reliable and fine-tuned setup please carefully review each element and/or contact support@sipcapture.org for professional assistance.
7 |
8 | Available Methods:
9 |
10 | * [BASH Installer](https://github.com/sipcapture/homer-installer#page_with_curl-bash-installer)
11 | * [DOCKER Containers](https://github.com/sipcapture/homer7-docker)
12 |
13 | 
14 |
15 | ## :page_with_curl: Bash Installer
16 | The baseline installer expects a Vanilla OS and will install and configure:
17 | * HOMER-APP 7.7
18 | * HEPLIFY-SERVER 1.x
19 | * PostgreSQL 13
20 |
21 |
22 | Supported OS:
23 | * Debian 10, 11
24 | * CentOS 8, 9
25 |
26 | ### Run & Install:
27 | Make sure the script is executed as root on a netinstall vanilla server. Execute the following command and follow the interactive prompts to install:
28 |
29 | For Debian
30 | ```
31 | apt-get install libluajit-5.1-common libluajit-5.1-dev lsb-release wget curl git
32 | ```
33 |
34 | For CentOS
35 | ```
36 | yum install redhat-lsb-core wget curl git
37 | ```
38 |
39 | If you would like to install influxdb and chronograf:
40 | ```
41 | cd /usr/src
42 | wget https://raw.githubusercontent.com/sipcapture/homer-installer/master/telegraf.conf
43 | ```
44 |
45 | Fianlly, download and run the Homer Installer script:
46 | ```
47 | cd /usr/src
48 | wget https://github.com/sipcapture/homer-installer/raw/master/homer_installer.sh
49 | chmod +x homer_installer.sh
50 | ./homer_installer.sh
51 | ```
52 |
53 | ### Notes:
54 | CentOS
55 | * Ensure that the 'redhat-lsb-core' package is installed prior to running the installer.
56 |
57 | 
58 |
59 | ### Developers
60 | Contributors and Contributions to our project are always welcome! If you intend to participate and help us improve HOMER by sending patches, we kindly ask you to sign a standard [CLA (Contributor License Agreement)](http://cla.qxip.net) which enables us to distribute your code alongside the project without restrictions present or future. It doesn’t require you to assign to us any copyright you have, the ownership of which remains in full with you. Developers can coordinate with the existing team via the [homer-dev](http://groups.google.com/group/homer-dev) mailing list. If you'd like to join our internal team and volounteer to help with the project's many needs, feel free to contact us anytime!
61 |
62 |
63 | ### License & Copyright
64 |
65 | *Homer components are released under GNU AGPLv3 license*
66 |
67 | *Captagent is released under GNU GPLv3 license*
68 |
69 | *(C) 2008-2020 [SIPCAPTURE](http://sipcapture.org) & [QXIP BV](http://qxip.net)*
70 |
71 | ----------
72 |
73 | ##### If you use HOMER in production, please consider supporting the project with a [Donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donation%40sipcapture%2eorg&lc=US&item_name=SIPCAPTURE&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)
74 |
75 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=donation%40sipcapture%2eorg&lc=US&item_name=SIPCAPTURE&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest)
76 |
--------------------------------------------------------------------------------
/homer_installer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # --------------------------------------------------------------------------------
4 | # HOMER/SipCapture automated installation script for Debian/CentOs/OpenSUSE (BETA)
5 | # --------------------------------------------------------------------------------
6 | # This script is only intended as a quickstart to test and get familiar with HOMER.
7 | # It is not suitable for high-traffic nodes, complex capture scenarios, clusters.
8 | # The HOW-TO should be ALWAYS followed for a fully controlled, manual installation!
9 | # --------------------------------------------------------------------------------
10 | #
11 | # Copyright notice:
12 | #
13 | # (c) 2011-2020 QXIP BV, Amsterdam NL
14 | # (c) 2011-2016 Lorenzo Mangani
15 | # (c) 2011-2016 Alexandr Dubovikov
16 | #
17 | # All rights reserved
18 | #
19 | # This script is part of the HOMER project (http://sipcapture.org)
20 | # The HOMER project is free software; you can redistribute it and/or
21 | # modify it under the terms of the GNU Affero General Public License as
22 | # published by the Free Software Foundation; either version 3 of
23 | # the License, or (at your option) any later version.
24 | #
25 | # You should have received a copy of the GNU Affero General Public License
26 | # along with this program. If not, see
27 | #
28 | # This script is distributed in the hope that it will be useful,
29 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
30 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 | # GNU Affero General Public License for more details.
32 | #
33 | # This copyright notice MUST APPEAR in all copies of the script!
34 | #
35 |
36 | #####################################################################
37 | # #
38 | # WARNING: THIS SCRIPT IS NOW UPDATED TO SUPPORT HOMER 5.x #
39 | # PLEASE USE WITH CAUTION AND HELP US BY REPORTING BUGS! #
40 | # #
41 | #####################################################################
42 |
43 | [[ "$TRACE" ]] && { set -x; set -o functrace; }
44 |
45 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
46 |
47 | logfile="/tmp/$(basename $0).$$.log"
48 | exec > >(tee -ia $logfile)
49 | exec 2> >(tee -ia $logfile >&2)
50 |
51 | trap 'exit 1' TERM
52 | my_pid=$$
53 |
54 |
55 | # HOMER Options, defaults
56 | DB_USER="homer_user"
57 | DB_PASS=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g')
58 | DB_HOST="localhost"
59 | LISTEN_PORT="9060"
60 | CHRONOGRAF_LISTEN_PORT="8888"
61 | INSTALL_INFLUXDB=""
62 |
63 | OS=`uname -s`
64 | HOME_DIR=$HOME
65 | CURRENT_DIR=`pwd`
66 | ARCH=`uname -m`
67 |
68 | #### NO CHANGES BELOW THIS LINE!
69 |
70 | VERSION=7.7
71 | SETUP_ENTRYPOINT=""
72 | OS=""
73 | DISTRO=""
74 | DISTRO_VERSION=""
75 |
76 | ######################################################################
77 | #
78 | # Start of function definitions
79 | #
80 | ######################################################################
81 | is_root_user() {
82 | # Function to check that the effective user id of the user running
83 | # the script is indeed that of the root user (0)
84 |
85 | if [[ $EUID != 0 ]]; then
86 | return 1
87 | fi
88 | return 0
89 | }
90 |
91 | have_commands() {
92 | # Function to check if we can find the command(s) passed to us
93 | # in the systems PATH
94 | local cmd_list="$1"
95 | local -a not_found=()
96 |
97 | for cmd in $cmd_list; do
98 | command -v $cmd >/dev/null 2>&1 || not_found+=("$cmd")
99 | done
100 |
101 | if [[ ${#not_found[@]} == 0 ]]; then
102 | # All commands found
103 | return 0
104 | else
105 | # Something not found
106 | return 1
107 | fi
108 | }
109 |
110 | locate_cmd() {
111 | # Function to return the full path to the cammnd passed to us
112 | # Make sure it exists on the system first or else this exits
113 | # the script execution
114 | local cmd="$1"
115 | local valid_cmd=""
116 | # valid_cmd=$(hash -t $cmd 2>/dev/null)
117 | valid_cmd=$(command -v $cmd 2>/dev/null)
118 | if [[ ! -z "$valid_cmd" ]]; then
119 | echo "$valid_cmd"
120 | else
121 | echo "HALT: Please install package for command '$cmd'"
122 | /bin/kill -s TERM $my_pid
123 | fi
124 | return 0
125 | }
126 |
127 | is_supported_os() {
128 | # Function to see if the OS is a supported type, the 1st
129 | # parameter passed should be the OS type to check. The bash
130 | # shell has a built in variable "OSTYPE" which should be
131 | # sufficient for a start
132 |
133 | local os_type=$1
134 |
135 | case "$os_type" in
136 | linux* ) OS="Linux"
137 | minimal_command_list="lsb_release wget curl git"
138 | if ! have_commands "$minimal_command_list"; then
139 | echo "ERROR: You need the following minimal set of commands installed:"
140 | echo ""
141 | echo " $minimal_command_list"
142 | echo ""
143 | exit 1
144 | fi
145 | detect_linux_distribution # Supported OS, Check if supported distro.
146 | return ;;
147 | * ) return 1 ;; # Unsupported OS
148 | esac
149 | }
150 |
151 | detect_linux_distribution() {
152 | # Function to see if a specific linux distribution is supported by this script
153 | # If it is supported then the global variable SETUP_ENTRYPOINT is set to the
154 | # function to be executed for the system setup
155 |
156 | local cmd_lsb_release=$(locate_cmd "lsb_release")
157 | local distro_name=$($cmd_lsb_release -si)
158 | local distro_version=$($cmd_lsb_release -sr)
159 | DISTRO="$distro_name"
160 | DISTRO_VERSION="$distro_version"
161 |
162 | case "$distro_name" in
163 | Debian ) case "$distro_version" in
164 | 10* | 11* | 12* | 13* ) SETUP_ENTRYPOINT="setup_debian"
165 | return 0 ;; # Suported Distribution
166 | * ) return 1 ;; # Unsupported Distribution
167 | esac
168 | ;;
169 | CentOS ) case "$distro_version" in
170 | 7* ) SETUP_ENTRYPOINT="setup_centos_7"
171 | return 0 ;; # Suported Distribution
172 | * ) return 1 ;; # Unsupported Distribution
173 | esac
174 | ;;
175 | * ) return 1 ;; # Unsupported Distribution
176 | esac
177 | }
178 |
179 | check_status() {
180 | # Function to check and do something with the return code of some command
181 |
182 | local return_code="$1"
183 |
184 | if [[ $return_code != 0 ]]; then
185 | echo "HALT: Return code of command was '$return_code', aborting."
186 | echo "Please check the log above and correct the issue."
187 | exit 1
188 | fi
189 | }
190 |
191 | banner_start() {
192 | # This is the banner displayed at the start of script execution
193 |
194 | clear;
195 | echo "**************************************************************"
196 | echo " "
197 | echo " ,;;;;;, HOMER SIP CAPTURE (http://sipcapture.org) "
198 | echo " ;;;;;;;;;. Single-Node Auto-Installer (beta $VERSION)"
199 | echo " ;;;;;;;;;;;;; "
200 | echo " ;;;; ;;; ;;;; <--------------- INVITE --------------- "
201 | echo " ;;;; ;;; ;;;; --------------- 200 OK ---------------> "
202 | echo " ;;;; ... ;;;; "
203 | echo " ;;;; ;;;; WARNING: This installer is intended for "
204 | echo " ;;;; ;;; ;;;; dedicated/vanilla OS setups without any "
205 | echo " ,;;; ;;; ;;;; customization and with default settings "
206 | echo " ;;;;;;;;;;;;; "
207 | echo " :;;;;;;;;;; THIS SCRIPT IS PROVIDED AS-IS, USE AT "
208 | echo " ^;;;;;;;^ YOUR *OWN* RISK, REVIEW LICENSE & DOCS "
209 | echo " "
210 | echo "**************************************************************"
211 | echo;
212 | }
213 |
214 | banner_end() {
215 | # This is the banner displayed at the end of script execution
216 |
217 | local cmd_ip=$(locate_cmd "ip")
218 | local cmd_head=$(locate_cmd "head")
219 | local cmd_awk=$(locate_cmd "awk")
220 |
221 | local my_primary_ip=$($cmd_ip route get 8.8.8.8 | $cmd_head -1 | grep -Po '(\d+\.){3}\d+' | tail -n1)
222 |
223 | echo "*************************************************************"
224 | echo " ,;;;;, "
225 | echo " ;;;;;;;;. Congratulations! HOMER has been installed!"
226 | echo " ;;;;;;;;;;;; "
227 | echo " ;;;; ;; ;;;; <--------------- INVITE --------------- "
228 | echo " ;;;; ;; ;;;; --------------- 200 OK ---------------> "
229 | echo " ;;;; .. ;;;; "
230 | echo " ;;;; ;;;; Your system should be now ready to rock!"
231 | echo " ;;;; ;; ;;;; Please verify/complete the configuration "
232 | echo " ,;;; ;; ;;;; files generated by the installer below. "
233 | echo " ;;;;;;;;;;;; "
234 | echo " :;;;;;;;;; THIS SCRIPT IS PROVIDED AS-IS, USE AT "
235 | echo " ;;;;;;;; YOUR *OWN* RISK, REVIEW LICENSE & DOCS "
236 | echo " "
237 | echo "*************************************************************"
238 | echo
239 | echo " * Configuration Files:"
240 | echo " '/usr/local/homer/etc/webapp_config.json'"
241 | echo " '/etc/heplify-server.toml'"
242 | echo
243 | echo " * Start/stop HOMER Application Server:"
244 | echo " 'systemctl start|stop homer-app'"
245 | echo
246 | echo " * Start/stop HOMER SIP Capture Server:"
247 | echo " 'systemctl start|stop heplify-server'"
248 | echo
249 | echo " * Start/stop HOMER SIP Capture Agent:"
250 | echo " 'systemctl start|stop heplify'"
251 | echo
252 | echo " * Access HOMER UI:"
253 | echo " http://$my_primary_ip:9080"
254 | echo " [default: admin/sipcapture]"
255 | echo
256 | echo " * Send HEP/EEP Encapsulated Packets to:"
257 | echo " hep://$my_primary_ip:$LISTEN_PORT"
258 | echo
259 | echo " * Prometheus Metrics URL:"
260 | echo " http://$my_primary_ip:9096/metrics"
261 | echo
262 | # Commenting out Influx and Chronograf
263 | # if [[ "$INSTALL_INFLUXDB" =~ y|yes|Y|Yes|YES ]] ; then
264 | # echo " * Access InfluxDB UI:"
265 | # echo " http://$my_primary_ip:$CHRONOGRAF_LISTEN_PORT"
266 | # echo
267 | # fi
268 | echo
269 | echo "**************************************************************"
270 | echo
271 | echo " IMPORTANT: Do not forget to send Homer node some traffic! ;) "
272 | echo " For our capture agents, visit http://github.com/sipcapture "
273 | echo " For more help and information visit: http://sipcapture.org "
274 | echo
275 | echo "**************************************************************"
276 | echo " Installer Log saved to: $logfile "
277 | echo
278 | }
279 |
280 | start_app() {
281 | # This is the main app
282 |
283 | banner_start
284 |
285 | if ! is_root_user; then
286 | echo "ERROR: You must be the root user. Exiting..." 2>&1
287 | echo 2>&1
288 | exit 1
289 | fi
290 |
291 | if ! is_supported_os "$OSTYPE"; then
292 | echo "ERROR:"
293 | echo "Sorry, this Installer does not support your OS yet!"
294 | echo "Please follow instructions in the HOW-TO for manual installation & setup"
295 | echo "available at http://sipcapture.org"
296 | echo
297 | exit 1
298 | else
299 | unalias cp 2>/dev/null
300 | $SETUP_ENTRYPOINT
301 | banner_end
302 | fi
303 | exit 0
304 | }
305 |
306 | create_postgres_user_database(){
307 | cwd=$(pwd)
308 | cd /tmp
309 | sudo -u postgres psql -c "CREATE DATABASE homer_config;"
310 | sudo -u postgres psql -c "CREATE DATABASE homer_data;"
311 | sudo -u postgres psql -c "CREATE ROLE ${DB_USER} WITH SUPERUSER LOGIN PASSWORD '$DB_PASS';"
312 | sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE homer_config to homer_user;"
313 | sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE homer_data to homer_user;"
314 | cd $cwd
315 | }
316 |
317 | install_homer(){
318 |
319 | local cmd_curl=$(locate_cmd "curl")
320 | local cmd_sed=$(locate_cmd "sed")
321 | echo "Installing Homer-App"
322 | if [ -f /etc/debian_version ]; then
323 | local cmd_apt_get=$(locate_cmd "apt-get")
324 | $cmd_curl -s https://packagecloud.io/install/repositories/qxip/sipcapture/script.deb.sh?any=true | sudo bash
325 | $cmd_apt_get install homer-app heplify-server -y
326 | else
327 | local cmd_yum=$(locate_cmd "yum")
328 | $cmd_curl -s https://packagecloud.io/install/repositories/qxip/sipcapture/script.rpm.sh?any=true | sudo bash
329 | $cmd_yum install homer-app heplify-server -y
330 | fi
331 |
332 | $cmd_sed -i -e "s/homer_user/$DB_USER/g" /usr/local/homer/etc/webapp_config.json
333 | $cmd_sed -i -e "s/homer_password/$DB_PASS/g" /usr/local/homer/etc/webapp_config.json
334 |
335 | local cmd_homerapp=$(locate_cmd "homer-app")
336 | $cmd_homerapp -create-table-db-config
337 | $cmd_homerapp -populate-table-db-config
338 |
339 | $cmd_sed -i -e "s/DBUser\s*=\s*\"postgres\"/DBUser = \"$DB_USER\"/g" /etc/heplify-server.toml
340 | $cmd_sed -i -e "s/DBPass\s*=\s*\"\"/DBPass = \"$DB_PASS\"/g" /etc/heplify-server.toml
341 | $cmd_sed -i -e "s/PromAddr\s*=\s*\"\"/PromAddr = \"0.0.0.0:9096\"/g" /etc/heplify-server.toml
342 | $cmd_sed -i -e "s/HEPTLSAddr = \"0.0.0.0:9060\"/HEPTLSAddr = \"0.0.0.0:9061\"/g" /etc/heplify-server.toml
343 | $cmd_sed -i -e "s/HEPTCPAddr = \"\"/HEPTCPAddr = \"0.0.0.0:9060\"/g" /etc/heplify-server.toml
344 |
345 | sudo systemctl enable homer-app
346 | sudo systemctl restart homer-app
347 | sudo systemctl status homer-app
348 |
349 | sudo systemctl enable heplify-server
350 | sudo systemctl restart heplify-server
351 | sudo systemctl status heplify-server
352 |
353 | }
354 |
355 | setup_influxdb(){
356 |
357 | if [ -f /etc/redhat-release ]; then
358 | echo "RPM Platform detected!"
359 |
360 | cat <