dexter has uploaded this change for review.
eim_cfg: make the eimFqdn configurable
The eimFqdn is part of the EimConfigurationData which is
generated by the eIM and eventually programmed into eUICCs.
At the moment we generate the eimFqdn from the configured
ESipa IP address and port. This works well for local setups.
However, in a large productive setup, this approach will
be impractical. Let's therefore add an eim_fqdn variable
to the sys.config.
Related: SYS#8287
Change-Id: Idcee405b0a3096ce8fb1630816ad4353bebfe150
---
M config/sys.config
M priv/rest_api_info_schema.json
M src/eim_cfg.erl
M src/rest_handler.erl
4 files changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/19/43919/1
diff --git a/config/sys.config b/config/sys.config
index 81c438c..477d8b3 100644
--- a/config/sys.config
+++ b/config/sys.config
@@ -8,6 +8,7 @@
{rest_ip, {127, 0, 0, 1}},
{rest_port, 8080},
{eim_id, "eIM"},
+ {eim_fqdn, "127.0.0.1:8000"},
{es9p_ssl_disable, false},
{eim_cert, "sample_eim_cert_nist.crt"},
{eim_key, "sample_eim_cert_nist.key"},
diff --git a/priv/rest_api_info_schema.json b/priv/rest_api_info_schema.json
index b73addc..28f9ecb 100644
--- a/priv/rest_api_info_schema.json
+++ b/priv/rest_api_info_schema.json
@@ -20,6 +20,10 @@
"description": "eIM identifier (see also GSMA GSP.32)",
"type": "string"
},
+ "eimFqdn": {
+ "description": "eIM domain name, see also GSMA GSP.32)",
+ "type": "string"
+ },
"esipaIp": {
"description": "IP-Address where the ESipa interface is bound to",
"type": "string"
diff --git a/src/eim_cfg.erl b/src/eim_cfg.erl
index 4f15a42..d026eee 100644
--- a/src/eim_cfg.erl
+++ b/src/eim_cfg.erl
@@ -11,8 +11,7 @@
gen_eim_configuration_data(Style) ->
{ok, EimId} = application:get_env(onomondo_eim, eim_id),
- {ok, EsipaIp} = application:get_env(onomondo_eim, esipa_ip),
- {ok, EsipaPort} = application:get_env(onomondo_eim, esipa_port),
+ {ok, EimFqdn} = application:get_env(onomondo_eim, eim_fqdn),
{ok, EimCertPath} = utils:get_env_priv_file_path(onomondo_eim, eim_cert),
{ok, EimCertPem} = file:read_file(EimCertPath),
[{'Certificate', EimCertBer, not_encrypted}] = public_key:pem_decode(EimCertPem),
@@ -38,8 +37,6 @@
end,
% Generate eIM configuration
- EimFqdn = string:join([inet:ntoa(EsipaIp), io_lib:format(":~B", [EsipaPort])], ""),
- % Mandatory
EimConfigurationData = #{
eimId => EimId,
% Optional, but necessary to access the eIM
diff --git a/src/rest_handler.erl b/src/rest_handler.erl
index 1497456..a2ea7a2 100644
--- a/src/rest_handler.erl
+++ b/src/rest_handler.erl
@@ -196,6 +196,7 @@
{ok, Hostname} = inet:gethostname(),
{ok, Vsn} = application:get_key(onomondo_eim, vsn),
{ok, EimId} = application:get_env(onomondo_eim, eim_id),
+ {ok, EimFqdn} = application:get_env(onomondo_eim, eim_fqdn),
{ok, EsipaIp} = application:get_env(onomondo_eim, esipa_ip),
{ok, EsipaPort} = application:get_env(onomondo_eim, esipa_port),
{ok, EsipaSslCertPath} = utils:get_env_priv_file_path(onomondo_eim, esipa_ssl_cert),
@@ -218,6 +219,7 @@
{node, node()},
{vsn, list_to_binary(Vsn)},
{eimId, list_to_binary(EimId)},
+ {eimFqdn, list_to_binary(EimFqdn)},
{esipaIp, list_to_binary(inet:ntoa(EsipaIp))},
{esipaPort, EsipaPort},
{esipaSslCert, EsipaSslCertPem},
To view, visit change 43919. To unsubscribe, or for help writing mail filters, visit settings.