From 93a81c0bbfc86e95d084d34a38f84ea23797bfad Mon Sep 17 00:00:00 2001 From: Monocots Date: Mon, 24 Jun 2019 16:02:22 +0000 Subject: [PATCH] Instal sgsn, script to gen sgsn config --- modules/rhizo_base/manifests/openbsc.pp | 14 ++++++ .../templates/make_sgsn_acl_config.erb | 44 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 modules/rhizo_base/templates/make_sgsn_acl_config.erb diff --git a/modules/rhizo_base/manifests/openbsc.pp b/modules/rhizo_base/manifests/openbsc.pp index 6dab58f..09f6854 100644 --- a/modules/rhizo_base/manifests/openbsc.pp +++ b/modules/rhizo_base/manifests/openbsc.pp @@ -31,6 +31,8 @@ class rhizo_base::openbsc { $smpp_password = $rhizo_base::smpp_password $mncc_codec = $rhizo_base::mncc_codec $gprs = $rhizo_base::gprs + $vpn_ip_address = hiera('rhizo::vpn_ip_address') + $ggsn_ip_address = hiera('rhizo::ggsn_ip_address') package { [ 'osmocom-nitb' ]: ensure => '1.2.0', @@ -42,6 +44,7 @@ class rhizo_base::openbsc { package { [ 'osmo-bsc-meas-utils' ]: ensure => 'installed' } + if $mncc_codec == "AMR" { $phys_chan = "TCH/H" } else { @@ -66,6 +69,17 @@ class rhizo_base::openbsc { } } + if ($gprs == "active") { + file { '/etc/osmocom/make_sgsn_acl_config': + content => template('rhizo_base/make_sgsn_acl_config.erb'), + mode => "0750", + } + package { [ 'osmo-sgsn' ]: + ensure => 'installed', + require => Class['rhizo_base::apt'], + } + } + exec { 'hlr_pragma_wal': command => '/usr/bin/sqlite3 /var/lib/osmocom/hlr.sqlite3 "PRAGMA journal_mode=wal;"', diff --git a/modules/rhizo_base/templates/make_sgsn_acl_config.erb b/modules/rhizo_base/templates/make_sgsn_acl_config.erb new file mode 100644 index 0000000..d320b3d --- /dev/null +++ b/modules/rhizo_base/templates/make_sgsn_acl_config.erb @@ -0,0 +1,44 @@ +#!/bin/bash +cat << EOF +! +! Osmocom SGSN configuration +! +! +log stderr + logging level set-all fatal + logging print category 1 + logging print file basename last + logging print level 1 + logging print extended-timestamp 1 + logging level gprs error + logging level mm error + logging level llc error +line vty + no login +! +sgsn + gtp local-ip <%= @vpn_ip_address %> + ggsn 0 remote-ip <%= @ggsn_ip_address %> + ggsn 0 gtp-version 1 + ggsn 0 echo-interval 60 + auth-policy acl-only +EOF +echo "SELECT imsi from subscriber where authorized=1 ORDER BY imsi;" | sudo /usr/bin/sqlite3 /var/lib/osmocom/hlr.sqlite3 | grep "^[0-9].*" | sed 's/\(.*\)/ imsi-acl add \1/' +cat << EOF + gsup remote-ip 127.0.0.1 + gsup remote-port 4222 +! +ns + timer tns-block 3 + timer tns-block-retries 3 + timer tns-reset 3 + timer tns-reset-retries 3 + timer tns-test 30 + timer tns-alive 3 + timer tns-alive-retries 10 + encapsulation udp local-port 23000 + encapsulation framerelay-gre enabled 0 +! +bssgp +! +EOF