lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2026

  • 1 participants
  • 714 discussions
[M] Change in onomondo-eim[master]: contrib: improve script to re-generate the eIM certificate
by dexter 11 Nov '26

11 Nov '26
Attention is currently required from: dexter, jolly, laforge. Hello Jenkins Builder, jolly, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/onomondo-eim/+/43939?usp=email to look at the new patch set (#5). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder Change subject: contrib: improve script to re-generate the eIM certificate ...................................................................... contrib: improve script to re-generate the eIM certificate The eIM ships with a pre-generated eIM certificate and a script that can be used to re-generate the certificates. Let's apply some improvements and re-generate the certificates using the improved script. Related: SYS#8287 Change-Id: I0dc88c14492121fac955fc96b321fcf7ea326ae4 --- M contrib/make_eim_certificate.sh M priv/sample_eim_cert_brainpool.crt M priv/sample_eim_cert_brainpool.key M priv/sample_eim_cert_nist.crt M priv/sample_eim_cert_nist.key 5 files changed, 60 insertions(+), 36 deletions(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/39/43939/5 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43939?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I0dc88c14492121fac955fc96b321fcf7ea326ae4 Gerrit-Change-Number: 43939 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: Introduce eir testsuite
by pespin 11 Nov '26

11 Nov '26
Attention is currently required from: fixeria, osmith. pespin has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44063?usp=email ) Change subject: Introduce eir testsuite ...................................................................... Patch Set 1: (1 comment) Patchset: PS1: This testsuite require the open5gs-dbctl additions I submitted here (https://github.com/open5gs/open5gs/pull/5018) which is then copied too in the file in osmo-ttcn3-hacks.git/_testenv/data/scripts/open5gs-dbctl. -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44063?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I6aebeef821691569cc8da98dc2297394e8f098c4 Gerrit-Change-Number: 44063 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Wed, 11 Nov 2026 13:49:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[L] Change in osmo-ttcn3-hacks[master]: Introduce eir testsuite
by pespin 11 Nov '26

11 Nov '26
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44063?usp=email ) Change subject: Introduce eir testsuite ...................................................................... Introduce eir testsuite Related: SYS#7073 Change-Id: I6aebeef821691569cc8da98dc2297394e8f098c4 --- M Makefile M _testenv/data/scripts/open5gs-dbctl A eir/ConnHdlr.ttcn A eir/EIR_Tests.cfg A eir/EIR_Tests.default A eir/EIR_Tests.ttcn A eir/README.md A eir/create_test_subscribers.sh A eir/expected-results.xml A eir/gen_links.sh A eir/mongod.conf A eir/open5gs-eir.yaml A eir/regen_makefile.sh A eir/testenv.cfg A eir/testsrcdir.cfg A library/TS29511_N5g_eir_EquipmentIdentityCheck_Templates.ttcn 16 files changed, 778 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/63/44063/1 diff --git a/Makefile b/Makefile index df8319e..544cbaa 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ ccid \ dia2gsup \ eim \ + eir \ fr \ fr-net \ epdg \ diff --git a/_testenv/data/scripts/open5gs-dbctl b/_testenv/data/scripts/open5gs-dbctl index e7de1f1..707df15 100755 --- a/_testenv/data/scripts/open5gs-dbctl +++ b/_testenv/data/scripts/open5gs-dbctl @@ -29,7 +29,8 @@ echo " ambr_speed {imsi dl_value dl_unit ul_value ul_unit}: Change AMBR speed from a specific user and the unit values are \"[0=bps 1=Kbps 2=Mbps 3=Gbps 4=Tbps ]\"" echo " subscriber_status {imsi subscriber_status_val={0,1} operator_determined_barring={0..8}}: Change TS 29.272 values for Subscriber-Status (7.3.29) and Operator-Determined-Barring (7.3.30)" echo " lbo_roaming_allowed {imsi lbo_roaming_allowed={0,1}}: Change roaming type for a specific subscriber: 0 = LBO roaming (default), 1 = HR roaming" - + echo " eir add imei {imei status}: adds a PEI (IMEI) to the database with default values" + echo " eir add imei {imei status imsi}: adds a PEI (IMEI) to the database with default values and a SUPI for the UE" } while test $# -gt 0; do @@ -874,4 +875,44 @@ fi +if [ "$1" = "eir" ]; then + if [ "$#" -lt 5 ]; then + echo "open5gs-dbctl: incorrect number of args, see help" + exit 1 + fi + if [ "$2" = "add" ] && [ "$3" = "imei" ]; then + IMEI=$4 + STATUS=$5 + case "$STATUS" in + "WHITELISTED" | "BLACKLISTED" | "GREYLISTED") + ;; + *) + echo "open5gs-dbctl: incorrect status, format is (WHITELISTED|BLACKLISTED|GREYLISTED)" + exit 1 + ;; + esac + if [ "$#" -eq 6 ]; then + IMSI=$6 + mongosh --eval "db.eir.insertOne( + { + \"_id\": new ObjectId(), + \"pei\": \"imei-$IMEI\", + \"status\": \"$STATUS\", + \"supi\": \"imsi-$IMSI\" + } + );" $DB_URI + exit $? + else + mongosh --eval "db.eir.insertOne( + { + \"_id\": new ObjectId(), + \"pei\": \"imei-$IMEI\", + \"status\": \"$STATUS\" + } + );" $DB_URI + exit $? + fi + fi +fi + display_help diff --git a/eir/ConnHdlr.ttcn b/eir/ConnHdlr.ttcn new file mode 100644 index 0000000..d4616e5 --- /dev/null +++ b/eir/ConnHdlr.ttcn @@ -0,0 +1,182 @@ +/* EIR test suite in TTCN-3 (3GPP TS 29.511), ConnHdlr + * (C) 2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All rights reserved. + * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module ConnHdlr { + +import from TCCEncoding_Functions all; + +import from General_Types all; +import from Native_Functions all; +import from IPL4asp_Types all; +import from Misc_Helpers all; + +import from Osmocom_Types all; +import from GSM_Types all; + +import from HTTP2_Types all; +import from HTTP2_Templates all; +import from HTTP2_Functions all; +import from HTTP2_Msg all; +import from HTTP2_Adapter all; +import from HTTP2_Server_Emulation all; + +import from Prometheus_Checker all; + +import from TS29511_N5g_eir_EquipmentIdentityCheck all; +import from TS29511_N5g_eir_EquipmentIdentityCheck_Templates all; + +import from EIR_Tests all; + +const integer HTTP2_CONN_SCP := 0; + +/* These are a preset of path matches which can be applied through the entire lifecycle of the session: */ +function f_http2_server_path_match() +runs on ConnHdlr return charstring { + var charstring imsi_match := "*imei-" & g_pars.imei_str & "*"; + return imsi_match; +} + +type record ConnHdlrPars { + integer idx, + hexstring imsi, + charstring imsi_str, + hexstring imei, + charstring imei_str +} + +type component ConnHdlr extends HTTP2_CT, HTTP2_ConnHdlr, Prometheus_Checker_CT { + var ConnHdlrPars g_pars; +} + +type function void_fn() runs on ConnHdlr; + +function f_ConnHdlrPars(integer idx := 0) return ConnHdlrPars +{ + var hexstring imsi := f_concat_pad(lengthof(mp_imsi), substr(mp_imsi, 0, lengthof(mp_imsi) - 6), idx); + var charstring imsi_str := f_dec_TBCD(imsi_hex2oct(imsi)); + var hexstring imei := f_concat_pad(lengthof(mp_imei), substr(mp_imei, 0, lengthof(mp_imei) - 6), idx); + var charstring imei_str := f_dec_TBCD(imsi_hex2oct(imei)); + var template (value) ConnHdlrPars pars := { + idx := idx, + imsi := imsi, + imsi_str := imsi_str, + imei := imei, + imei_str := imei_str + }; + return valueof(pars); +} + +function f_ConnHdlr_init(void_fn fn, ConnHdlrPars pars) runs on ConnHdlr { + /* make parameters available via component variable */ + g_pars := pars; + + /* Setup */ + /* Register SCP HTTP2 sever, where IUT will send all SBI requests: */ + f_http2_server_emu_register(f_http2_server_path_match(), idx := HTTP2_CONN_SCP); + f_http2_adapter_init(); + + fn.apply(); + + /* Cleanup */ + f_http2_server_emu_unregister(f_http2_server_path_match(), idx := HTTP2_CONN_SCP); +} + +function f_http2_adapter_connect_eir(integer idx := 0) +runs on ConnHdlr { + f_http2_adapter_connect(mp_eir_hostname, mp_eir_sbi_port, mp_amf_local_ip, idx := idx); +} + +function f_http2_adapter_connect_send_eir(template (value) HTTP2_Msg http2_msg, integer idx := 0) +runs on ConnHdlr { + f_http2_adapter_connect_eir(idx := idx); + f_http2_adapter_send(http2_msg); +} + +/******************************************** + * SCP +/*******************************************/ +const charstring c_SCP_uri_hostport := mp_scp_local_ip & ":" & int2str(mp_scp_local_port); +const charstring c_SCP_uri_prefix := "http://" & c_SCP_uri_hostport; + +/*********************************************************************** + * N17 N5g-eir_EquipmentIdentityCheck (SBI): Emulated AMF, 3GPP TS 29.511 + ***********************************************************************/ +const charstring c_N5g_eir_uri_hostport := mp_eir_hostname & ":" & int2str(mp_eir_sbi_port); +const charstring c_N5g_eir_uri_prefix := "http://" & c_N5g_eir_uri_hostport; + +/* 3GPP TS 29.511 6.1.3.2 Resource: equipmentStatus (GET) */ +private function f_n17_prepare_get_equipment_status(EquipmentStatusParameters eq_status_param) +runs on ConnHdlr return HTTP2_Msg { + var charstring path; + var integer http2_idx; + var integer http2_stream_id; + var template (value) HTTP2_Msg http2_tx; + + path := c_N5g_eir_eic_path_equipment_status & + f_enc_EquipmentStatusParameters(eq_status_param); + + http2_idx := f_http2_adapter_find_free_idx(); + http2_stream_id := f_http2_adapter_next_stream_id(http2_idx); + http2_tx := ts_HTTP2_Msg(http2_idx, + http2_stream_id, + hb := { + pseudo_headers := ts_HTTP2_pseudo_headers_Req(method := "GET", + scheme := "http", + authority := c_N5g_eir_uri_hostport, + path := path), + headers := { + ts_HTTP2_Hdr_content_type("application/json"), + ts_HTTP2_Hdr_accept("application/json"), + ts_HTTP2_Hdr_user_agent("ttcn3-ausf"), + ts_HTTP2_Hdr_accept_encoding("gzip") + } + }, + body := omit); + return valueof(http2_tx); +} + +/* 3GPP TS 29.511 6.1.3.2 Resource: equipmentStatus (GET) */ +function f_n17_get_equipment_status(template (value) EquipmentStatusParameters eq_status_param, + template (present) EquipmentStatus status := ?, + boolean exp_found := true) +runs on ConnHdlr { + var HTTP2_Msg http2_tx; + var HTTP2_Msg http2_rx; + var template (present) HTTP2_Msg http2_exp_rx; + + http2_tx := f_n17_prepare_get_equipment_status(valueof(eq_status_param)); + f_http2_adapter_connect_send_eir(http2_tx, idx := http2_tx.conn_id); + + /* 3GPP TS 29.511 Table 6.1.3.2.3.1-3 */ + if (exp_found) { + http2_exp_rx := + tr_HTTP2_Msg(http2_tx.conn_id, + http2_tx.stream_id, + tr_HTTP2_header_block(pseudo_headers := tr_HTTP2_pseudo_headers_Resp(200)), + tr_HTTP2_Data_frame(stream_id := http2_tx.stream_id, + end_stream_flag := true, + data := decmatch tr_EirResponseData(status))); + } else { + http2_exp_rx := + tr_HTTP2_Msg(http2_tx.conn_id, + http2_tx.stream_id, + tr_HTTP2_header_block(pseudo_headers := tr_HTTP2_pseudo_headers_Resp(404)), + tr_HTTP2_Data_frame(stream_id := http2_tx.stream_id, + end_stream_flag := true, + data := ? /* TODO: Parse applications/problem+json cause=ERROR_EQUIPMENT_UNKNOWN*/)); + } + as_http2_adapter_receive(http2_rx, http2_exp_rx, idx := http2_tx.conn_id); + + f_http2_adapter_close(idx := http2_tx.conn_id); + setverdict(pass); +} + +} diff --git a/eir/EIR_Tests.cfg b/eir/EIR_Tests.cfg new file mode 100644 index 0000000..59369b8 --- /dev/null +++ b/eir/EIR_Tests.cfg @@ -0,0 +1,23 @@ +[ORDERED_INCLUDE] +# Common configuration, shared between test suites +"../Common.cfg" +# testsuite specific configuration, not expected to change +"./EIR_Tests.default" + +# Local configuration below + +[LOGGING] + +[TESTPORT_PARAMETERS] + +[MODULE_PARAMETERS] +EIR_Tests.mp_eir_hostname := "127.0.0.21"; +EIR_Tests.mp_eir_sbi_port := 7777; +EIR_Tests.mp_scp_local_ip := "127.0.0.200"; +EIR_Tests.mp_scp_local_port := 7777; +EIR_Tests.mp_amf_local_ip := "127.0.0.6"; + +[MAIN_CONTROLLER] + +[EXECUTE] +EIR_Tests.control diff --git a/eir/EIR_Tests.default b/eir/EIR_Tests.default new file mode 100644 index 0000000..b03f59e --- /dev/null +++ b/eir/EIR_Tests.default @@ -0,0 +1,12 @@ +[LOGGING] +FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC; + +[TESTPORT_PARAMETERS] +*.TCP.noDelay := "yes" // turn off nagle +*.HTTP.use_notification_ASPs := "yes" + +[MODULE_PARAMETERS] + +[MAIN_CONTROLLER] + +[EXECUTE] diff --git a/eir/EIR_Tests.ttcn b/eir/EIR_Tests.ttcn new file mode 100644 index 0000000..da0dd94 --- /dev/null +++ b/eir/EIR_Tests.ttcn @@ -0,0 +1,248 @@ +/* EIR test suite in TTCN-3 (3GPP TS 29.511) + * (C) 2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * All rights reserved. + * Author: Pau Espin Pedrol <pespin(a)sysmocom.de> + * + * Released under the terms of GNU General Public License, Version 2 or + * (at your option) any later version. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +module EIR_Tests { + +import from General_Types all; +import from Native_Functions all; +import from IPL4asp_Types all; +import from Misc_Helpers all; + +import from Osmocom_Types all; +import from GSM_Types all; + +import from TCCEncoding_Functions all; + +import from HTTP2_Adapter all; +import from HTTP2_Server_Emulation all; + +import from TS29511_N5g_eir_EquipmentIdentityCheck all; +import from TS29511_N5g_eir_EquipmentIdentityCheck_Templates all; + +import from ConnHdlr all; + +modulepar { + charstring mp_eir_hostname := "127.0.0.21"; + integer mp_eir_sbi_port := 7777; + + charstring mp_scp_local_ip := "127.0.0.200"; + integer mp_scp_local_port := 7777; + + /* IP address at which we listen for HTTP2/SBI to emulate a EIR in ttcn3 */ + charstring mp_amf_local_ip := "127.0.0.6"; + + HEX15n mp_imsi := '999700000000000'H; + HEX15n mp_imei := '490154203000000'H; +} + +type component MTC_CT extends HTTP2_CT, HTTP2_ConnHdlr { + /* emulated SCP */ + var HTTP2_Server_Emulation_CT vc_HTTP2_SRV_SCP; + + timer g_Tguard := 30.0; +} + +private function f_init_http2_srv(charstring id) runs on MTC_CT { + id := id & "-HTTP2SRV"; + + var Http2ServerEmulationCfg http2_srv_cfg := { + http2_bind_ip := mp_scp_local_ip, + http2_bind_port := mp_scp_local_port, + one_req_per_conn := false + }; + + vc_HTTP2_SRV_SCP := HTTP2_Server_Emulation_CT.create(id) alive; + vc_HTTP2_SRV_SCP.start(HTTP2_Server_Emulation.main(http2_srv_cfg)); + + connect(self:HTTP2_CONN_PROC[HTTP2_CONN_SCP], vc_HTTP2_SRV_SCP:CONN_PROC); +} + + +private function f_init(float t_guard := 30.0) runs on MTC_CT { + var charstring id := testcasename(); + + g_Tguard.start(t_guard); + activate(as_Tguard()); + + f_init_http2_srv(id); +} + +private function f_shutdown() runs on MTC_CT { + f_http2_server_close_conn_all(); + setverdict(pass); +} + +private function f_start_handler_create() +runs on MTC_CT return ConnHdlr +{ + var ConnHdlr vc_conn; + var charstring id := testcasename(); + + vc_conn := ConnHdlr.create(id); + + if (isbound(vc_HTTP2_SRV_SCP)) { + connect(vc_conn:HTTP2_CONN[HTTP2_CONN_SCP], vc_HTTP2_SRV_SCP:CONN); + connect(vc_conn:HTTP2_CONN_PROC[HTTP2_CONN_SCP], vc_HTTP2_SRV_SCP:CONN_PROC); + } + + return vc_conn; +} + +private function f_start_handler_run(ConnHdlr vc_conn, void_fn fn, ConnHdlrPars pars) runs on MTC_CT +{ + vc_conn.start(f_ConnHdlr_init(fn, pars)); +} + +/* start a connection handler with given parameters */ +private function f_start_handler(void_fn fn, ConnHdlrPars pars) +runs on MTC_CT return ConnHdlr { + var ConnHdlr vc_conn; + vc_conn := f_start_handler_create(); + f_start_handler_run(vc_conn, fn, pars); + return vc_conn; +} + +private altstep as_Tguard() runs on MTC_CT { + [] g_Tguard.timeout { + Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout"); + } +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_not_found() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, exp_found := false); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_not_found() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(10); /* suffix 10 doesn't exist in EIR DB */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_not_found), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_generic_found_whitelisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := WHITELISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_generic_found_whitelisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(0); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_generic_found_whitelisted), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_generic_found_blacklisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := BLACKLISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_generic_found_blacklisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(1); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_generic_found_blacklisted), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_generic_found_greylisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := GREYLISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_generic_found_greylisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(2); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_generic_found_greylisted), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_specific_supi_found_whitelisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := WHITELISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_specific_supi_found_whitelisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(3); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_specific_supi_found_whitelisted), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_specific_supi_found_blacklisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := BLACKLISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_specific_supi_found_blacklisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(4); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_specific_supi_found_blacklisted), pars); + vc_conn.done; + f_shutdown(); +} + +/* 3GPP TS 29.511 5.2.2.2.2 Procedure using CheckEquipmentIdentity Operation */ +private function f_TC_CheckQuipmentIdentity_imei_specific_supi_found_greylisted() runs on ConnHdlr { + var template (value) EquipmentStatusParameters query; + query := ts_EquipmentStatusParameters(pei := ts_Pei_IMEI(g_pars.imei_str), + supi := ts_Supi_IMSI(g_pars.imsi_str)); + f_n17_get_equipment_status(eq_status_param := query, status := GREYLISTED); + setverdict(pass); +} +testcase TC_CheckQuipmentIdentity_imei_specific_supi_found_greylisted() runs on MTC_CT { + var ConnHdlr vc_conn; + var ConnHdlrPars pars := f_ConnHdlrPars(5); /* idx: see create_test_subscribers.sh */ + f_init(); + vc_conn := f_start_handler(refers(f_TC_CheckQuipmentIdentity_imei_specific_supi_found_greylisted), pars); + vc_conn.done; + f_shutdown(); +} + +control { + execute( TC_CheckQuipmentIdentity_imei_not_found() ); + execute( TC_CheckQuipmentIdentity_imei_generic_found_whitelisted() ); + execute( TC_CheckQuipmentIdentity_imei_generic_found_blacklisted() ); + execute( TC_CheckQuipmentIdentity_imei_generic_found_greylisted() ); + execute( TC_CheckQuipmentIdentity_imei_specific_supi_found_whitelisted() ); + execute( TC_CheckQuipmentIdentity_imei_specific_supi_found_blacklisted() ); + execute( TC_CheckQuipmentIdentity_imei_specific_supi_found_greylisted() ); +} + +} diff --git a/eir/README.md b/eir/README.md new file mode 100644 index 0000000..fe75e29 --- /dev/null +++ b/eir/README.md @@ -0,0 +1,14 @@ +# EIR_Tests.ttcn + +* external interfaces + * N17: SBI (emulates AMF) + +{% dot eir_tests.svg +digraph G { + rankdir=LR; + ATS [label="ATS\nEIR_Tests.ttcn"]; + UDM [label="AMF\open5gs-eird",shape="box"]; + + ATS -> UDM [label="N17"]; +} +%} diff --git a/eir/create_test_subscribers.sh b/eir/create_test_subscribers.sh new file mode 100755 index 0000000..ee0d6c6 --- /dev/null +++ b/eir/create_test_subscribers.sh @@ -0,0 +1,15 @@ +#!/bin/sh -ex +DB_URI="mongodb://127.0.0.103/open5gs" +DBCTL_CMD="open5gs-dbctl --db_uri=$DB_URI" + +# mongod needs some time to bootstrap... +while ! mongosh --quiet $DB_URI</dev/null; do + sleep 1 +done + +$DBCTL_CMD eir add imei "490154203000000" "WHITELISTED" # "999700000000000" No IMSI +$DBCTL_CMD eir add imei "490154203000001" "BLACKLISTED" # "999700000000001" No IMSI +$DBCTL_CMD eir add imei "490154203000002" "GREYLISTED" # "999700000000002" No IMSI +$DBCTL_CMD eir add imei "490154203000003" "WHITELISTED" "999700000000003" +$DBCTL_CMD eir add imei "490154203000004" "BLACKLISTED" "999700000000004" +$DBCTL_CMD eir add imei "490154203000005" "GREYLISTED" "999700000000005" diff --git a/eir/expected-results.xml b/eir/expected-results.xml new file mode 100644 index 0000000..6f0b1a0 --- /dev/null +++ b/eir/expected-results.xml @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<testsuite name='Titan' tests='7' failures='0' errors='0' skipped='0' inconc='0' time='MASKED'> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_not_found' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_generic_found_whitelisted' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_generic_found_blacklisted' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_generic_found_greylisted' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_specific_supi_found_whitelisted' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_specific_supi_found_blacklisted' time='MASKED'/> + <testcase classname='EIR_Tests' name='TC_CheckQuipmentIdentity_imei_specific_supi_found_greylisted' time='MASKED'/> +</testsuite> diff --git a/eir/gen_links.sh b/eir/gen_links.sh new file mode 100755 index 0000000..a6de4b8 --- /dev/null +++ b/eir/gen_links.sh @@ -0,0 +1,52 @@ +#!/bin/bash -e + +BASEDIR=../deps + +. ../_buildsystem/gen_links.inc.sh + +DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src +FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h" +FILES+=" TCCEncoding_Functions.ttcn TCCEncoding.cc " # GSM 7-bit coding +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src +FILES="Socket_API_Definitions.ttcn" +gen_links $DIR $FILES + +# Required by MGCP and IPA +DIR=$BASEDIR/titan.TestPorts.IPL4asp/src +FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh" +gen_links $DIR $FILES + +# Needed by HTTP_Adapter (Prometheus_Checker.ttcn metrics): +DIR=$BASEDIR/titan.TestPorts.Common_Components.Abstract_Socket/src +FILES="Abstract_Socket.cc Abstract_Socket.hh " +gen_links $DIR $FILES + +# Needed by HTTP_Adapter (Prometheus_Checker.ttcn metrics): +DIR=$BASEDIR/titan.TestPorts.HTTPmsg/src +FILES="HTTPmsg_MessageLen.ttcn HTTPmsg_MessageLen_Function.cc HTTPmsg_PT.cc HTTPmsg_PT.hh HTTPmsg_PortType.ttcn HTTPmsg_Types.ttcn " +gen_links $DIR $FILES + +# Needed by HTTP2_Adapter: +DIR=$BASEDIR/titan.ProtocolModules.HTTP2/src +FILES="HTTP2_EncDec.cc HTTP2_Types.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/titan.ProtocolModules.JSON_v07_2006/src +FILES="JSON_Generic_Null_Def.asn JSON_Generic.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/osmo-ttcn3-openapi-generator/openapi-specs/3GPP_5GC_Rel19/ttcn3 +FILES="TS29511_N5g_eir_EquipmentIdentityCheck.ttcn " +gen_links $DIR $FILES + +DIR=../library +FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn IPCP_Templates.ttcn " +FILES+="SCTP_Templates.ttcn " +FILES+="HTTP2_CodecPort.ttcn HTTP2_CodecPort_CtrlFunct.ttcn HTTP2_CodecPort_CtrlFunctDef.cc HTTP2_Templates.ttcn HTTP2_Functions.ttcn HTTP2_Msg.ttcn HTTP2_Adapter.ttcn HTTP2_Server_Emulation.ttcn " +FILES+="HTTP_Adapter.ttcn Prometheus_Checker.ttcn " +FILES+="TS29511_N5g_eir_EquipmentIdentityCheck_Templates.ttcn " +gen_links $DIR $FILES + +gen_links_finish diff --git a/eir/mongod.conf b/eir/mongod.conf new file mode 100644 index 0000000..ff648f4 --- /dev/null +++ b/eir/mongod.conf @@ -0,0 +1,45 @@ +# mongod.conf + +# for documentation of all options, see: +# http://docs.mongodb.org/manual/reference/configuration-options/ + +# Where and how to store data. +storage: + dbPath: db +# journal: +# enabled: true +# engine: +# mmapv1: +# wiredTiger: + +# where to write logging data. +# systemLog: +# destination: file +# logAppend: true +# path: /data/mongod.log + +# network interfaces +net: + port: 27017 + bindIp: 127.0.0.103 + + +# how the process runs +processManagement: + timeZoneInfo: /usr/share/zoneinfo + +#security: + +#operationProfiling: + +#replication: + +#sharding: + +## Enterprise-Only Options: + +#auditLog: + +#snmp: + + diff --git a/eir/open5gs-eir.yaml b/eir/open5gs-eir.yaml new file mode 100644 index 0000000..efbef3a --- /dev/null +++ b/eir/open5gs-eir.yaml @@ -0,0 +1,18 @@ +db_uri: mongodb://127.0.0.103/open5gs +logger: + level: debug + +global: + max: + ue: 1024 + +eir: + sbi: + server: + - address: 127.0.0.21 + port: 7777 + client: +# nrf: +# - uri: http://127.0.0.10:7777 + scp: + - uri: http://127.0.0.200:7777 diff --git a/eir/regen_makefile.sh b/eir/regen_makefile.sh new file mode 100755 index 0000000..9ed4246 --- /dev/null +++ b/eir/regen_makefile.sh @@ -0,0 +1,23 @@ +#!/bin/sh -e + +NAME=EIR_Tests + +FILES=" + *.asn + *.ttcn + Abstract_Socket.cc + HTTPmsg_MessageLen_Function.cc + HTTPmsg_PT.cc + HTTP2_EncDec.cc + HTTP2_CodecPort_CtrlFunctDef.cc + IPL4asp_PT.cc + IPL4asp_discovery.cc + Native_FunctionDefs.cc + TCCConversion.cc + TCCEncoding.cc + TCCInterface.cc +" + +. ../_buildsystem/regen_makefile.inc.sh + +sed -i -e 's/^LINUX_LIBS = -lxml2 -lsctp/LINUX_LIBS = -lxml2 -lsctp -lgnutls/' Makefile diff --git a/eir/testenv.cfg b/eir/testenv.cfg new file mode 100644 index 0000000..6a41e9d --- /dev/null +++ b/eir/testenv.cfg @@ -0,0 +1,20 @@ +[testsuite] +program=EIR_Tests +config=EIR_Tests.cfg + +[db] +prepare=mkdir db +clean=rm -rf db +program=mongod --config mongod.conf +setup=create_test_subscribers.sh +copy=mongod.conf +make=no +package=no + + +[eir] +program=open5gs-eird -c open5gs-eir.yaml +make=open5gs +package=open5gs-eir +copy=open5gs-eir.yaml + diff --git a/eir/testsrcdir.cfg b/eir/testsrcdir.cfg new file mode 100644 index 0000000..7f19289 --- /dev/null +++ b/eir/testsrcdir.cfg @@ -0,0 +1,2 @@ +[testsrcdir] +max_jobs_per_gb_ram=0.3 diff --git a/library/TS29511_N5g_eir_EquipmentIdentityCheck_Templates.ttcn b/library/TS29511_N5g_eir_EquipmentIdentityCheck_Templates.ttcn new file mode 100644 index 0000000..52c6230 --- /dev/null +++ b/library/TS29511_N5g_eir_EquipmentIdentityCheck_Templates.ttcn @@ -0,0 +1,71 @@ +module TS29511_N5g_eir_EquipmentIdentityCheck_Templates { + +import from TS29511_N5g_eir_EquipmentIdentityCheck all; + +const charstring c_N5g_eir_eic_path_api_prefix := "/n5g-eir-eic/v1"; + +/* 6.1.3.2 Resource: equipmentStatus */ +const charstring c_N5g_eir_eic_path_equipment_status +:= c_N5g_eir_eic_path_api_prefix & "/equipment-status"; + +/* Table 6.1.3.2.3.1-1: URI query parameters supported by the GET method on this resource */ +type set EquipmentStatusParameters { + Pei pei, + Supi supi optional, + Gpsi gpsi optional, + SupportedFeatures supported_features optional +}; + +template (value) EquipmentStatusParameters +ts_EquipmentStatusParameters(template (value) Pei pei, + template (omit) Supi supi := omit, + template (omit) Gpsi gpsi := omit, + template (omit) SupportedFeatures supported_features := omit) := { + pei := pei, + supi := supi, + gpsi := gpsi, + supported_features := supported_features +} + +function f_enc_EquipmentStatusParameters(EquipmentStatusParameters val) return charstring +{ + var charstring enc := "?pei=" & val.pei; + if (ispresent(val.supi)) { + enc := enc & "&supi=" & val.supi; + } + if (ispresent(val.gpsi)) { + enc := enc & "&gpsi=" & val.gpsi; + } + if (ispresent(val.supported_features)) { + enc := enc & "&supported-features=" & val.supported_features; + } + return enc; +} + +template (present) EirResponseData +tr_EirResponseData(template (present) EquipmentStatus status := ?) := { + status := status +} + +template (value) Pei +ts_Pei_IMEI(template (value) charstring imei) +:= "imei-" & valueof(imei); + +template (value) Pei +ts_Pei_IMEISV(template (value) charstring imei) +:= "imeisv-" & valueof(imei); + +template (value) Pei +ts_Pei_MAC(template (value) charstring mac, + template (value) charstring untrusted := "-untrusted") +:= "mac-" & valueof(mac) & valueof(untrusted); + +template (value) Pei +ts_Pei_EUI(template (value) charstring eui) +:= "eui-" & valueof(eui); + +template (value) Pei +ts_Supi_IMSI(template (value) charstring imsi) +:= "imsi-" & valueof(imsi); + +} -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44063?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I6aebeef821691569cc8da98dc2297394e8f098c4 Gerrit-Change-Number: 44063 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de>
1 0
0 0
[XS] Change in onomondo-eim[master]: eim_cfg: set eimIdType to eimIdTypeProprietary
by dexter 11 Nov '26

11 Nov '26
dexter has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43949?usp=email ) Change subject: eim_cfg: set eimIdType to eimIdTypeProprietary ...................................................................... eim_cfg: set eimIdType to eimIdTypeProprietary In our implementation of the eIM and IPAd, we commonly use an arbitrary string as eimId. This means this for now it is ok to hard-code the eimIdType to eimIdTypeProprietary. We can make it configurable later if needed. Change-Id: I24c174e52fdd4f8df9c6ccfe82eea9a06dadb6f3 Related: SYS#8287 --- M src/eim_cfg.erl 1 file changed, 2 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified dexter: Looks good to me, approved jolly: Looks good to me, but someone else must approve diff --git a/src/eim_cfg.erl b/src/eim_cfg.erl index 1104853..b4754d7 100644 --- a/src/eim_cfg.erl +++ b/src/eim_cfg.erl @@ -51,6 +51,8 @@ eimId => EimId, % Optional, but necessary to access the eIM eimFqdn => EimFqdn, + % Optional: in this eIM implementation we use an arbitrary string (proprietary). + eimIdType => eimIdTypeProprietary, % Mandatory counterValue => CounterValue, % Optional: instruct the eUICC to calculate an association token -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43949?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I24c174e52fdd4f8df9c6ccfe82eea9a06dadb6f3 Gerrit-Change-Number: 43949 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[XS] Change in onomondo-eim[master]: eim_cfg: set eimIdType to eimIdTypeProprietary
by dexter 11 Nov '26

11 Nov '26
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43949?usp=email ) Change subject: eim_cfg: set eimIdType to eimIdTypeProprietary ...................................................................... Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43949?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I24c174e52fdd4f8df9c6ccfe82eea9a06dadb6f3 Gerrit-Change-Number: 43949 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Wed, 11 Nov 2026 13:19:54 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in onomondo-eim[master]: contrib: improve script to re-generate the eIM certificate
by dexter 11 Nov '26

11 Nov '26
Attention is currently required from: dexter, jolly, laforge. Hello Jenkins Builder, jolly, laforge, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/onomondo-eim/+/43939?usp=email to look at the new patch set (#4). The following approvals got outdated and were removed: Code-Review+1 by jolly, Code-Review+1 by laforge, Verified+1 by Jenkins Builder Change subject: contrib: improve script to re-generate the eIM certificate ...................................................................... contrib: improve script to re-generate the eIM certificate The eIM ships with a pre-generated eIM certificate and a script that can be used to re-generate the certificates. Let's apply some improvements and re-generate the certificates using the improved script. Related: SYS#8287 Change-Id: I0dc88c14492121fac955fc96b321fcf7ea326ae4 --- M contrib/make_eim_certificate.sh M priv/sample_eim_cert_brainpool.crt M priv/sample_eim_cert_brainpool.key M priv/sample_eim_cert_nist.crt M priv/sample_eim_cert_nist.key 5 files changed, 60 insertions(+), 36 deletions(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/39/43939/4 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43939?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I0dc88c14492121fac955fc96b321fcf7ea326ae4 Gerrit-Change-Number: 43939 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: jolly <andreas(a)eversberg.eu> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[S] Change in onomondo-eim[master]: eim_cfg: insert eIM ESipa SSL CA-certificate into eIM configuration
by dexter 11 Nov '26

11 Nov '26
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/onomondo-eim/+/44062?usp=email ) Change subject: eim_cfg: insert eIM ESipa SSL CA-certificate into eIM configuration ...................................................................... eim_cfg: insert eIM ESipa SSL CA-certificate into eIM configuration The EimConfigurationData prvides a field to pin a CA-certificate that allows the IPAd to validate the SSL certificate used on the ESipa interface. If the ESipa SSL certificate is valid, the IPAd can be sure that it is talking to the its trusted eIM and not to some malicious entity. Change-Id: I4f985902b5f9ad88075b16151d38dd5382f17668 Related: SYS#8287 --- M config/sys.config M config/sys.dev.config M src/crypto_utils.erl M src/eim_cfg.erl M src/onomondo_eim_app.erl 5 files changed, 42 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/onomondo-eim refs/changes/62/44062/1 diff --git a/config/sys.config b/config/sys.config index 6e8c2d2..8253e80 100644 --- a/config/sys.config +++ b/config/sys.config @@ -3,6 +3,7 @@ {esipa_ip, {127, 0, 0, 1}}, {esipa_port, 8000}, {esipa_ssl_disable, false}, + {esipa_ssl_ca_cert, "sample_esipa_ssl_ca_cert_nist.crt"}, {esipa_ssl_cert, "sample_esipa_ssl_cert_nist.crt"}, {esipa_ssl_key, "sample_esipa_ssl_cert_nist.key"}, {rest_ip, {127, 0, 0, 1}}, diff --git a/config/sys.dev.config b/config/sys.dev.config index 4e702f5..9a963f9 100644 --- a/config/sys.dev.config +++ b/config/sys.dev.config @@ -3,6 +3,7 @@ {esipa_ip, {127, 0, 0, 1}}, {esipa_port, 8000}, {esipa_ssl_disable, true}, + {esipa_ssl_ca_cert, "sample_esipa_ssl_ca_cert_nist.crt"}, {esipa_ssl_cert, "sample_esipa_ssl_cert_nist.crt"}, {esipa_ssl_key, "sample_esipa_ssl_cert_nist.key"}, {rest_ip, {127, 0, 0, 1}}, diff --git a/src/crypto_utils.erl b/src/crypto_utils.erl index ee7e6d3..b2bced5 100644 --- a/src/crypto_utils.erl +++ b/src/crypto_utils.erl @@ -12,7 +12,8 @@ verify_euiccPackageErrorSigned/2, store_euicc_pubkey_from_authenticateResponseOk/2, store_euicc_pubkey_from_ipaEuiccDataResponse/2, - test_eim_certificate/0 + test_eim_certificate/0, + test_esipa_ssl_certificate/0 ]). %Convert from DER encoded signature format to plain format (see also BSI TR03111 5.2.1) @@ -355,3 +356,26 @@ true -> ok end. + +% Make sure the configured ESipa SSL certificate is valid against the provided CA certificate. This is to confirm that +% the CA certificate, which is provided in the eIM configuration (REST API) matches to the sub certificate used on the +% ESipa interface. +test_esipa_ssl_certificate() -> + {ok, EsipaSslCaCertPath} = utils:get_env_priv_file_path(onomondo_eim, esipa_ssl_ca_cert), + {ok, EsipaSslCaCertPem} = file:read_file(EsipaSslCaCertPath), + [{'Certificate', EsipaSslCaCertBer, not_encrypted}] = public_key:pem_decode(EsipaSslCaCertPem), + {ok, EsipaSslCaCert} = 'PKIX1Explicit88':decode('Certificate', EsipaSslCaCertBer), + + {ok, EsipaSslCertPath} = utils:get_env_priv_file_path(onomondo_eim, esipa_ssl_cert), + {ok, EsipaSslCertPem} = file:read_file(EsipaSslCertPath), + [{'Certificate', EsipaSslCertBer, not_encrypted}] = public_key:pem_decode(EsipaSslCertPem), + {ok, EsipaSslCert} = 'PKIX1Explicit88':decode('Certificate', EsipaSslCertBer), + Result = verify_cert(EsipaSslCaCert, EsipaSslCert), + case Result of + ok -> + ok; + _ -> + throw( + "eIM ESipa SSL certificate not valid against CA certificate, check certificates (sys.config)!~n" + ) + end. diff --git a/src/eim_cfg.erl b/src/eim_cfg.erl index b4754d7..54cb278 100644 --- a/src/eim_cfg.erl +++ b/src/eim_cfg.erl @@ -37,6 +37,15 @@ EimCertSubjectPublicKeyInfo. +% Load the trustedCertificateTls from the configured ESipa SSL certificate (see sys.config). +get_trustedCertificateTls() -> + % Load ESipa SSL certificate and extract public key. + {ok, EimCertPath} = utils:get_env_priv_file_path(onomondo_eim, esipa_ssl_ca_cert), + {ok, EimCertPem} = file:read_file(EimCertPath), + [{'Certificate', EimCertBer, not_encrypted}] = public_key:pem_decode(EimCertPem), + {ok, EimCert} = 'PKIX1Explicit88':decode('Certificate', EimCertBer), + EimCert. + % Generate an encoded eIM configuration string, which can be used to program the eIM configuration into an eUICC, % either via ES10b:AddInitialEim or ESep:addEim (eUICC package, eCO). The Format parameter selects how the output data % shall be formatted. Two formats are possible: request: AddInitialEimRequest, single: EimConfigurationData @@ -45,6 +54,7 @@ {ok, EimFqdn} = application:get_env(onomondo_eim, eim_fqdn), EimCertSubjectPublicKeyInfo = get_eimPublicKey_from_eim_cert(), {ok, CounterValue} = application:get_env(onomondo_eim, counter_value), + EsipaSslCaCert = get_trustedCertificateTls(), % Generate eIM configuration EimConfigurationData = #{ @@ -59,6 +69,8 @@ associationToken => -1, % Mandatory eimPublicKeyData => {eimPublicKey, EimCertSubjectPublicKeyInfo}, + % Optional: Pin the ESipa SSL/TLS certificate of the eIM. The certificate is identified by its public key + trustedPublicKeyDataTls => {trustedCertificateTls, EsipaSslCaCert}, % This eIM implementation currently only supports ESipa via HTTPs where the only supported eIM Package % transfer procedure is the eIM Package Retrieval procedure (see also SGP.32, section 3.1.1.1. eimSupportedProtocol => [eimRetrieveHttps], diff --git a/src/onomondo_eim_app.erl b/src/onomondo_eim_app.erl index 227c938..acdfefb 100644 --- a/src/onomondo_eim_app.erl +++ b/src/onomondo_eim_app.erl @@ -107,6 +107,9 @@ % Ensure that the key material that is used for signing PSMOs and eCOs is correctly configured and valid. crypto_utils:test_eim_certificate(), + % Ensure that the SSL/TLS certificate used on the ESipa interface is valid against its CA certificate + crypto_utils:test_esipa_ssl_certificate(), + % Startup database ok = mnesia_db:init(), -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/44062?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: I4f985902b5f9ad88075b16151d38dd5382f17668 Gerrit-Change-Number: 44062 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[M] Change in onomondo-eim[master]: onomondo_eim_app: check eIM certificate on startup
by dexter 11 Nov '26

11 Nov '26
dexter has submitted this change. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43938?usp=email ) Change subject: onomondo_eim_app: check eIM certificate on startup ...................................................................... onomondo_eim_app: check eIM certificate on startup The public key from the eIM certificate is used to generate the eIM configuration, which is queried by REST-API users to provision the eIM configuration into new and existing eUICCs. The related private key is then used to sign eCOs and PSMOs which are sent to remote eUICCs. Since the provisioning of invalid key material may lead to catastrophic failures, let's implement a check ensures that the configured key material is correctly configured and valid. Related: SYS#8287 Change-Id: Ib4463ef29bc39c4c11a7c78c2135ec28ba6a2e1f --- M src/crypto_utils.erl M src/onomondo_eim_app.erl 2 files changed, 59 insertions(+), 26 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve jolly: Looks good to me, but someone else must approve dexter: Looks good to me, approved diff --git a/src/crypto_utils.erl b/src/crypto_utils.erl index d07b931..ee7e6d3 100644 --- a/src/crypto_utils.erl +++ b/src/crypto_utils.erl @@ -11,7 +11,8 @@ verify_euiccPackageResultSigned/2, verify_euiccPackageErrorSigned/2, store_euicc_pubkey_from_authenticateResponseOk/2, - store_euicc_pubkey_from_ipaEuiccDataResponse/2 + store_euicc_pubkey_from_ipaEuiccDataResponse/2, + test_eim_certificate/0 ]). %Convert from DER encoded signature format to plain format (see also BSI TR03111 5.2.1) @@ -36,6 +37,18 @@ AssociationTokenLength = utils:integer_to_bytes(byte_size(AssociationTokenBinary)), utils:join_binary_list([<<132>>, AssociationTokenLength, AssociationTokenBinary]). +sign_with_private_eim_key(MsgToBeSigned) -> + % Load private key from eIM certificate + {ok, EimKeyPath} = utils:get_env_priv_file_path(onomondo_eim, eim_key), + {ok, EimKeyPem} = file:read_file(EimKeyPath), + [EimKeyPemEntry] = public_key:pem_decode(EimKeyPem), + EimKeyECPrivateKey = public_key:pem_entry_decode(EimKeyPemEntry), + + % Sign message + % We use SHA-256 as signature hash/digest, see also GSMA SGP.22, section 2.6.5 and + % https://www.erlang.org/doc/apps/public_key/public_key#sign/4 + der_to_plain(public_key:sign(MsgToBeSigned, sha256, EimKeyECPrivateKey)). + sign_euiccPackageSigned(EuiccPackageSigned, EidValue) -> % Read the AssociationToken {ok, AssociationToken} = mnesia_db_euicc:state_get(EidValue, associationToken), @@ -48,16 +61,8 @@ EuiccPackageSignedEnc, enc_association_token(AssociationToken) ]), - % Load private key from eIM certificate - {ok, EimKeyPath} = utils:get_env_priv_file_path(onomondo_eim, eim_key), - {ok, EimKeyPem} = file:read_file(EimKeyPath), - [EimKeyPemEntry] = public_key:pem_decode(EimKeyPem), - EimKeyECPrivateKey = public_key:pem_entry_decode(EimKeyPemEntry), - % Sign message - % We use SHA-256 as signature hash/digest, see also GSMA SGP.22, section 2.6.5 and - % https://www.erlang.org/doc/apps/public_key/public_key#sign/4 - der_to_plain(public_key:sign(MsgToBeSigned, sha256, EimKeyECPrivateKey)). + sign_with_private_eim_key(MsgToBeSigned). verify_signature(Message, Signature, EidValue) -> DERSignature = plain_to_der(Signature), @@ -164,11 +169,7 @@ ok end. -pubkey_from_cert(Cert) -> - TbsCertificate = maps:get(tbsCertificate, Cert), - SubjectPublicKeyInfo = maps:get(subjectPublicKeyInfo, TbsCertificate), - Algorithm = maps:get(algorithm, SubjectPublicKeyInfo), - SubjectPublicKey = maps:get(subjectPublicKey, SubjectPublicKeyInfo), +namedCurve_from_algorithm(Algorithm) -> BrainpoolP256r1 = #{ algorithm => {1, 2, 840, 10045, 2, 1}, parameters => <<6, 9, 43, 36, 3, 3, 2, 8, 1, 1, 7>> @@ -177,17 +178,23 @@ algorithm => {1, 2, 840, 10045, 2, 1}, parameters => <<6, 8, 42, 134, 72, 206, 61, 3, 1, 7>> }, - NamedCurve = - case Algorithm of - Prime256v1 -> - {1, 2, 840, 10045, 3, 1, 7}; - BrainpoolP256r1 -> - {1, 3, 36, 3, 3, 2, 8, 1, 1, 7}; - _ -> - throw( - "Incorrect root CI certificate, only BrainpoolP256r1 or Prime256v1 may be used!" - ) - end, + case Algorithm of + Prime256v1 -> + {1, 2, 840, 10045, 3, 1, 7}; + BrainpoolP256r1 -> + {1, 3, 36, 3, 3, 2, 8, 1, 1, 7}; + _ -> + throw( + "Incorrect root CI certificate, only BrainpoolP256r1 or Prime256v1 may be used!" + ) + end. + +pubkey_from_cert(Cert) -> + TbsCertificate = maps:get(tbsCertificate, Cert), + SubjectPublicKeyInfo = maps:get(subjectPublicKeyInfo, TbsCertificate), + Algorithm = maps:get(algorithm, SubjectPublicKeyInfo), + SubjectPublicKey = maps:get(subjectPublicKey, SubjectPublicKeyInfo), + NamedCurve = namedCurve_from_algorithm(Algorithm), {{'ECPoint', SubjectPublicKey}, {namedCurve, NamedCurve}}. verify_cert(TrustedCert, VerifyCert) -> @@ -325,3 +332,26 @@ % There is already a public key stored for this eUICC ok end. + +% Make sure that the key material (eIM certificate) for signing eUICC packages is correctly configured and valid. +test_eim_certificate() -> + % Sign an arbitrary message using the eIM private key + Message = list_to_binary("The quick brown fox jumps over the lazy dog."), + Signature = sign_with_private_eim_key(Message), + DERSignature = plain_to_der(Signature), + + % Retrieve the eIM public key from the eIM certificate and verify the signature of the message we have signed above. + EimCertSubjectPublicKeyInfo = eim_cfg:get_eimPublicKey_from_eim_cert(), + Algorithm = maps:get(algorithm, EimCertSubjectPublicKeyInfo), + SubjectPublicKey = maps:get(subjectPublicKey, EimCertSubjectPublicKeyInfo), + NamedCurve = namedCurve_from_algorithm(Algorithm), + ECPublicKey = {{'ECPoint', SubjectPublicKey}, {namedCurve, NamedCurve}}, + Result = public_key:verify(Message, sha256, DERSignature, ECPublicKey), + case Result of + false -> + throw( + "eIM certificate (eUICC package signing) unuseable, check key material and algorithm (sys.config)!~n" + ); + true -> + ok + end. diff --git a/src/onomondo_eim_app.erl b/src/onomondo_eim_app.erl index 688f83a..227c938 100644 --- a/src/onomondo_eim_app.erl +++ b/src/onomondo_eim_app.erl @@ -104,6 +104,9 @@ % effective than fumbling with string format arguments. logger:notice("eIM! version: ~s~n", [Vsn]), + % Ensure that the key material that is used for signing PSMOs and eCOs is correctly configured and valid. + crypto_utils:test_eim_certificate(), + % Startup database ok = mnesia_db:init(), -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43938?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: Ib4463ef29bc39c4c11a7c78c2135ec28ba6a2e1f Gerrit-Change-Number: 43938 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in onomondo-eim[master]: onomondo_eim_app: check eIM certificate on startup
by dexter 11 Nov '26

11 Nov '26
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/onomondo-eim/+/43938?usp=email ) Change subject: onomondo_eim_app: check eIM certificate on startup ...................................................................... Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/onomondo-eim/+/43938?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: onomondo-eim Gerrit-Branch: master Gerrit-Change-Id: Ib4463ef29bc39c4c11a7c78c2135ec28ba6a2e1f Gerrit-Change-Number: 43938 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: jolly <andreas(a)eversberg.eu> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Wed, 11 Nov 2026 12:52:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[S] Change in osmo-ci[master]: jobs/ttcn3: add sepp
by osmith 11 Nov '26

11 Nov '26
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/44061?usp=email ) Change subject: jobs/ttcn3: add sepp ...................................................................... jobs/ttcn3: add sepp Change-Id: If31d52515f9deb2f6b759ff99e50f0c8ad8a60cb --- M jobs/ttcn3-testsuites-testenv.yml 1 file changed, 17 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/jobs/ttcn3-testsuites-testenv.yml b/jobs/ttcn3-testsuites-testenv.yml index 8c1a105..f12cd9b 100644 --- a/jobs/ttcn3-testsuites-testenv.yml +++ b/jobs/ttcn3-testsuites-testenv.yml @@ -281,6 +281,12 @@ timer: H 11 * * * email: jenkins-notifications(a)lists.osmocom.org acetcom(a)gmail.com + - ttcn3-sepp-test-ogs: + testsuite: sepp + args: -b osmocom:nightly + timer: H 11 * * * + email: jenkins-notifications(a)lists.osmocom.org acetcom(a)gmail.com + # --------------------------------------------- # Debian latest # --------------------------------------------- @@ -527,6 +533,11 @@ args: -b osmocom:latest timer: H 13 * * * + - ttcn3-sepp-test-ogs-latest: + testsuite: sepp + args: -b osmocom:latest + timer: H 13 * * * + # --------------------------------------------- # Debian nightly + io_uring (OS#6357) # --------------------------------------------- @@ -781,6 +792,12 @@ timer: H 18 * * * email: jenkins-notifications(a)lists.osmocom.org acetcom(a)gmail.com + - ttcn3-sepp-test-ogs-asan: + testsuite: sepp + args: -b osmocom:nightly:asan + timer: H 18 * * * + email: jenkins-notifications(a)lists.osmocom.org acetcom(a)gmail.com + # --------------------------------------------- # Build from source with osmo-dev (for programs # where we don't have binary packages in OBS) -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/44061?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: If31d52515f9deb2f6b759ff99e50f0c8ad8a60cb Gerrit-Change-Number: 44061 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • ...
  • 72
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.