Skip to content

Commit 76021da

Browse files
committed
feat: adds support for E2E TLS connection between AMT and RPS#
1 parent 1335ad4 commit 76021da

File tree

13 files changed

+402
-30
lines changed

13 files changed

+402
-30
lines changed

src/DataProcessor.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export class DataProcessor {
7979
await this.handleConnectionReset(clientMsg, clientId)
8080
break
8181
}
82+
case ClientMethods.PORT_SWITCH_ACK: {
83+
await this.handlePortSwitchAck(clientMsg, clientId)
84+
break
85+
}
8286
default: {
8387
const uuid = clientMsg.payload.uuid ? clientMsg.payload.uuid : devices[clientId].ClientData.payload.uuid
8488
throw new RPSError(`Device ${uuid} Not a supported method received from AMT device`)
@@ -253,6 +257,15 @@ export class DataProcessor {
253257
}
254258
}
255259

260+
async handlePortSwitchAck(clientMsg: ClientMsg, clientId: string): Promise<void> {
261+
const clientObj = devices[clientId]
262+
this.logger.info(`PORT_SWITCH_ACK received from rpc-go for device ${clientObj?.uuid}`)
263+
264+
if (clientObj?.pendingPromise != null && clientObj.resolve != null) {
265+
clientObj.resolve('port_switch_ack')
266+
}
267+
}
268+
256269
async handleConnectionReset(clientMsg: ClientMsg, clientId: string): Promise<void> {
257270
const clientObj = devices[clientId]
258271
this.logger.warn(`CONNECTION RESET from rpc-go`)

src/Validator.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ export class Validator implements IValidator {
8080
this.logger.info(`Device ${payload.uuid} has TLS enforced - enabling TLS tunnel mode`)
8181
}
8282
}
83+
// Extract secure activation flag from payload
84+
if (msg.payload.secure === true) {
85+
clientObj.secureActivation = true
86+
this.logger.info(`Device ${payload.uuid} requested secure activation`)
87+
}
8388
// Check for client requested action and profile activation
8489
const profile: AMTConfiguration | null = await this.configurator.profileManager.getAmtProfile(
8590
payload.profile,

src/interfaces/ISecretManagerService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export interface DeviceCredentials {
99
AMT_PASSWORD: string | null
1010
MPS_PASSWORD?: string // only required for CIRA
1111
MEBX_PASSWORD?: string | null
12+
TLS_ROOT_CERTIFICATE?: string
13+
TLS_ISSUED_CERTIFICATE?: string
1214
version?: string
1315
}
1416

src/models/RCS.Config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ export interface ClientObject {
126126
resolve: (value: unknown) => void
127127
reject: (value: unknown) => void
128128
tlsEnforced?: boolean
129+
secureActivation?: boolean
129130
tlsTunnelManager?: TLSTunnelManager
130131
tlsTunnelNeedsReset?: boolean
131132
tlsTunnelSessionId?: string // Current TLS session ID for filtering stale data
@@ -200,6 +201,9 @@ export interface TLSConfigFlow {
200201
commitLocalTLS?: boolean
201202
getTimeSynch?: boolean
202203
setTimeSynch?: boolean
204+
rootCertPEM?: string
205+
rootCertKey?: any
206+
issuedCertPEM?: string
203207
}
204208

205209
export interface mpsServer {
@@ -240,6 +244,7 @@ export interface Payload {
240244
client: string
241245
profile?: any
242246
tlsEnforced?: boolean
247+
secure?: boolean
243248
}
244249

245250
export interface ConnectionObject {
@@ -271,7 +276,9 @@ export enum ClientMethods {
271276
HEARTBEAT = 'heartbeat_response',
272277
MAINTENANCE = 'maintenance',
273278
TLS_DATA = 'tls_data',
274-
CONNECTION_RESET = 'connection_reset'
279+
CONNECTION_RESET = 'connection_reset',
280+
PORT_SWITCH = 'port_switch',
281+
PORT_SWITCH_ACK = 'port_switch_ack'
275282
}
276283

277284
export interface apiResponse {

src/stateMachines/activation.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ describe('Activation State Machine', () => {
133133
canActivate: true,
134134
shbcCCMComplete: false,
135135
shbcACMComplete: false,
136+
secureCCMComplete: false,
136137
message: '',
137138
clientId,
138139
xmlMessage: '',

0 commit comments

Comments
 (0)