Skip to content

Commit

Permalink
Get subscription credentials from the cluster
Browse files Browse the repository at this point in the history
The credentials are used to authenticate on the phones' remote
provisioning server.
  • Loading branch information
Amygos committed Feb 13, 2024
1 parent 6f350f9 commit 2b3f941
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
2 changes: 0 additions & 2 deletions imageroot/actions/configure-module/20setenvs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ def getFromRequest(request, var_name, env_name, default = ""):
# NETHVOICE_HOST_LOCAL_NETWORKS should be a jason containing local networks [{"network":"192.168.5.0","netmask":"255.255.255.0","gateway":"192.168.5.1"}]
getFromRequest(request, 'nethvoice_host_local_networks', 'NETHVOICE_HOST_LOCAL_NETWORKS', '{[]}')
getFromRequest(request, 'nethvoice_host', 'NETHVOICE_HOST', '')
getFromRequest(request, 'subscription_systemid', 'SUBSCRIPTION_SYSTEMID', '')
getFromRequest(request, 'subscription_secret', 'SUBSCRIPTION_SECRET', '')
getFromRequest(request, 'nethcti_prefix', 'NETHCTI_PREFIX', '')
getFromRequest(request, 'nethcti_autoc2c', 'NETHCTI_AUTOC2C', 'enabled')
getFromRequest(request, 'nethcti_trunks_events', 'NETHCTI_TRUNKS_EVENTS', 'enabled')
Expand Down
20 changes: 20 additions & 0 deletions imageroot/actions/configure-module/21subscription
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/python

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

import agent


rdb = agent.redis_connect(privileged=False)

subscription = rdb.hgetall('cluster/subscription')

#check if the subscription hash table exists
if subscription:
#get the subscription secret
agent.set_env("SUBSCRIPTION_SECRET", subscription['auth_token'])
#get subscription ID
agent.set_env("SUBSCRIPTION_SYSTEMID", subscription['system_id'])
1 change: 1 addition & 0 deletions imageroot/events/subscription-changed/10subscription
10 changes: 10 additions & 0 deletions imageroot/events/subscription-changed/80sevice_restart
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

#
# Copyright (C) 2023 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

# If the control reaches this step, the service can be enabled and started

systemctl --user restart freepbx.service flexisip.service

0 comments on commit 2b3f941

Please sign in to comment.