ci: cram: adjust to Device.Security changes

Reflect tr181-security new startup order

Insert the cram test CA bundle into defaults rather than extensions, not
to conflict with the already existing CA bundle.
The existing CA bundle is indexed at 1, so index this one at 2.
Soon this should be replaced with aliases.

References: PCF-1323
Signed-off-by: Piotr Nakraszewicz <piotr.nakraszewicz@consult.red>
This commit is contained in:
Piotr Nakraszewicz 2026-03-10 10:02:37 +00:00 committed by Hela Saadani
parent 9941ead323
commit d7119330e0
8 changed files with 23 additions and 21 deletions

View File

@ -727,7 +727,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_START_ORDER=30
CONFIG_SAH_AMX_TR181_ROUTING_STOP_ORDER=10
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_SYSLOG=y

View File

@ -1,6 +1,7 @@
Create R alias:
$ alias R="${CRAM_REMOTE_COMMAND:-}"
$ alias C="${CRAM_REMOTE_COPY:-}"
Backup the state of the system:
@ -12,7 +13,8 @@ Backup the state of the system:
Copy over testing certificates:
$ R "mkdir -p /etc/config/autocert"
$ scp ${CI_PROJECT_DIR}/.gitlab/certs/tr181-security/autocert/* "root@${TARGET_LAN_IP}:/etc/config/autocert/"
$ C ${CI_PROJECT_DIR}/.gitlab/certs/tr181-security/autocert/* "root@${TARGET_LAN_IP}:/etc/config/autocert/"
Warning: Permanently added '*' (*) to the list of known hosts* (glob)
Restart tr181-security service:
@ -82,16 +84,16 @@ Check that the first certificate is not present anymore:
Check that CABundle are presents:
$ R "echo '%populate{object Security{object CABundle{instance add(){parameter Enable=1; parameter Name=cram; parameter CAFileURI=\"/tmp/server-cert.crt\";}}}}' > /etc/amx/tr181-security/extensions/01_cram_periodic_transfer.odl" ; sleep 1
$ R "echo '%populate{object Security{object CABundle{instance add(){parameter Enable=1; parameter Name=cram; parameter CAFileURI=\"/tmp/server-cert.crt\";}}}}' > /etc/amx/tr181-security/defaults.d/01_cram_periodic_transfer.odl" ; sleep 1
$ R '/etc/init.d/tr181-security restart'
$ R 'ba-cli Security.CABundleNumberOfEntries?' | grep -v '>'
Security.CABundleNumberOfEntries=1
Security.CABundleNumberOfEntries=2
Check CABundle RPC:
$ R "ba-cli 'Security.CABundle.1.CAFile()'" | grep -v '>'
Security.CABundle.1.CAFile() returned
$ R "ba-cli 'Security.CABundle.2.CAFile()'" | grep -v '>'
Security.CABundle.2.CAFile() returned
[
"",
{
@ -99,8 +101,8 @@ Check CABundle RPC:
}
]
$ R "ba-cli 'Security.CABundle.1.CADir()'" | grep -v '>'
Security.CABundle.1.CADir() returned
$ R "ba-cli 'Security.CABundle.2.CADir()'" | grep -v '>'
Security.CABundle.2.CADir() returned
[
"",
{
@ -108,9 +110,9 @@ Check CABundle RPC:
}
]
$ R "ba-cli 'Security.CABundle.1.CADirURI=/tmp'" >/dev/null
$ R "ba-cli 'Security.CABundle.1.CADir()'" | grep -v '>'
Security.CABundle.1.CADir() returned
$ R "ba-cli 'Security.CABundle.2.CADirURI=/tmp'" >/dev/null
$ R "ba-cli 'Security.CABundle.2.CADir()'" | grep -v '>'
Security.CABundle.2.CADir() returned
[
"",
{
@ -121,10 +123,10 @@ Check CABundle RPC:
Restore the state of the system:
$ R 'rm -rf /etc/amx/tr181-security/extensions/01_cram_periodic_transfer.odl'
$ R 'rm -rf /etc/amx/tr181-security/defaults.d/01_cram_periodic_transfer.odl'
$ R '/etc/init.d/tr181-security restart'
$ R "rm -rf /etc/config/autocert"
$ R "mv /etc/config/autocert.bak /etc/config/autocert"
$ R "rm -rf /usr/share/ca-certificates"
$ R "mv /usr/share/ca-certificates.bak /usr/share/ca-certificates"
$ R "/etc/init.d/tr181-security restart" > /dev/null 2>&1 ; sleep .5
$ R "/etc/init.d/tr181-security restart" > /dev/null 2>&1 ; sleep .5

View File

@ -152,10 +152,10 @@ Check PeriodicFileTransfer over HTTPS:
$ servefile_pid="$!"
$ sleep 2
$ R "openssl s_client -connect \"$SERVER_IP:8181\" -showcerts < /dev/null 2> /dev/null | openssl x509 -outform PEM > /tmp/server-cert.crt"; sleep 1
$ R "echo '%populate{object Security{object CABundle{instance add(){parameter Enable=1; parameter CAFileURI=\"/tmp/server-cert.crt\";}}}}' > /etc/amx/tr181-security/extensions/01_cram_periodic_transfer.odl" ; sleep 1
$ R "echo '%populate{object Security{object CABundle{instance add(){parameter Enable=1; parameter CAFileURI=\"/tmp/server-cert.crt\";}}}}' > /etc/amx/tr181-security/defaults.d/01_cram_periodic_transfer.odl" ; sleep 1
$ R '/etc/init.d/tr181-security restart'; sleep 1
$ R 'ba-cli "Device.PeriodicFileTransfer.Profile.cram-Profile-1.Protocol=HTTPS"' > /dev/null; sleep 1
$ R 'ba-cli "Device.PeriodicFileTransfer.Profile.cram-Profile-1.HTTP.CABundle=Device.Security.CABundle.1"' > /dev/null; sleep 1
$ R 'ba-cli "Device.PeriodicFileTransfer.Profile.cram-Profile-1.HTTP.CABundle=Device.Security.CABundle.2"' > /dev/null; sleep 1
$ R "ba-cli 'Device.PeriodicFileTransfer.Profile.cram-Profile-1.HTTP.URL=\"https://$SERVER_IP:8181\"'" > /dev/null; sleep 1
$ R 'ba-cli "Device.PeriodicFileTransfer.Transfer.cram-Transfer-1.ForceTransfer()"' | grep -v '>' ; sleep 1
Device.PeriodicFileTransfer.Transfer.cram-Transfer-1.ForceTransfer() returned
@ -211,7 +211,7 @@ Check PeriodicFileTransfer error code reporting for various failure scenarios:
Cleanup test instances:
$ R 'rm -rf /etc/amx/tr181-security/extensions/01_cram_periodic_transfer.odl'
$ R 'rm -rf /etc/amx/tr181-security/defaults.d/01_cram_periodic_transfer.odl'
$ R '/etc/init.d/tr181-security restart'
$ R 'rm /tmp/server-cert.crt'
$ rm -rf /tmp/130-periodicfileuploads/*

View File

@ -1051,7 +1051,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_START_ORDER=30
CONFIG_SAH_AMX_TR181_ROUTING_STOP_ORDER=10
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_SYSLOG=y

View File

@ -680,7 +680,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_GROUP="tr181_app"
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_USER="tr181_app"
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_TEMPERATURE=y

View File

@ -699,7 +699,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_GROUP="tr181_app"
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_USER="tr181_app"
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_TEMPERATURE=y

View File

@ -953,7 +953,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_GROUP="tr181_app"
CONFIG_SAH_AMX_TR181_ROUTING_RUN_AS_USER="tr181_app"
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_TEMPERATURE=y

View File

@ -828,7 +828,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_ROUTING_START_ORDER=30
CONFIG_SAH_AMX_TR181_ROUTING_STOP_ORDER=10
CONFIG_SAH_AMX_TR181_SECURITY=y
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=61
CONFIG_SAH_AMX_TR181_SECURITY_ORDER=21
CONFIG_SAH_AMX_TR181_SFP=y
CONFIG_SAH_AMX_TR181_SFP_ORDER=30
CONFIG_SAH_AMX_TR181_SYSLOG=y