Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ CREATE TABLE IF NOT EXISTS profiles(
sol_enabled BOOLEAN NULL,
tls_signing_authority varchar(40) NULL,
ieee8021x_profile_name citext,
uefi_wifi_sync_enabled BOOLEAN NULL,
FOREIGN KEY (ieee8021x_profile_name,tenant_id) REFERENCES ieee8021xconfigs(profile_name,tenant_id),
PRIMARY KEY (profile_name, tenant_id)
);
Expand Down
48 changes: 29 additions & 19 deletions src/data/postgres/tables/profiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ describe('profiles tests', () => {
kvmEnabled: true,
solEnabled: true,
tlsSigningAuthority: null,
ieee8021xProfileName: null
ieee8021xProfileName: null,
uefiWifiSyncEnabled: true
} as any
db = new PostgresDb('')
profilesTable = new ProfilesTable(db)
Expand Down Expand Up @@ -131,6 +132,7 @@ describe('profiles tests', () => {
COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs",
ip_sync_enabled as "ipSyncEnabled",
local_wifi_sync_enabled as "localWifiSyncEnabled",
uefi_wifi_sync_enabled as "uefiWifiSyncEnabled",
COALESCE(json_agg(json_build_object('name',pc.proxy_config_name, 'priority', pc.priority)) FILTER (WHERE pc.proxy_config_name IS NOT NULL), '[]') AS "proxyConfigs"
FROM profiles p
LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id
Expand Down Expand Up @@ -191,6 +193,7 @@ describe('profiles tests', () => {
COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs",
ip_sync_enabled as "ipSyncEnabled",
local_wifi_sync_enabled as "localWifiSyncEnabled",
uefi_wifi_sync_enabled as "uefiWifiSyncEnabled",
COALESCE(json_agg(json_build_object('name',pc.proxy_config_name, 'priority', pc.priority)) FILTER (WHERE pc.proxy_config_name IS NOT NULL), '[]') AS "proxyConfigs"
FROM profiles p
LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id
Expand Down Expand Up @@ -311,8 +314,8 @@ describe('profiles tests', () => {
mebx_password, generate_random_mebx_password,
tags, dhcp_enabled, tls_mode,
user_consent, ider_enabled, kvm_enabled, sol_enabled,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled, uefi_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)`,
[
amtConfig.profileName,
amtConfig.activation,
Expand All @@ -332,7 +335,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand Down Expand Up @@ -361,8 +365,8 @@ describe('profiles tests', () => {
mebx_password, generate_random_mebx_password,
tags, dhcp_enabled, tls_mode,
user_consent, ider_enabled, kvm_enabled, sol_enabled,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled, uefi_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)`,
[
amtConfig.profileName,
amtConfig.activation,
Expand All @@ -382,7 +386,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand Down Expand Up @@ -424,7 +429,7 @@ describe('profiles tests', () => {
tags=$8, dhcp_enabled=$9, tls_mode=$10, user_consent=$13,
ider_enabled=$14, kvm_enabled=$15, sol_enabled=$16,
tls_signing_authority=$17, ieee8021x_profile_name=$18,
ip_sync_enabled=$19, local_wifi_sync_enabled=$20
ip_sync_enabled=$19, local_wifi_sync_enabled=$20, uefi_wifi_sync_enabled=$21
WHERE profile_name=$1 and tenant_id = $11 and xmin = $12`,
[
amtConfig.profileName,
Expand All @@ -446,7 +451,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand All @@ -469,7 +475,7 @@ describe('profiles tests', () => {
tags=$8, dhcp_enabled=$9, tls_mode=$10, user_consent=$13,
ider_enabled=$14, kvm_enabled=$15, sol_enabled=$16,
tls_signing_authority=$17, ieee8021x_profile_name=$18,
ip_sync_enabled=$19, local_wifi_sync_enabled=$20
ip_sync_enabled=$19, local_wifi_sync_enabled=$20, uefi_wifi_sync_enabled=$21
WHERE profile_name=$1 and tenant_id = $11 and xmin = $12`,
[
amtConfig.profileName,
Expand All @@ -491,7 +497,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand Down Expand Up @@ -545,8 +552,8 @@ describe('profiles tests', () => {
mebx_password, generate_random_mebx_password,
tags, dhcp_enabled, tls_mode,
user_consent, ider_enabled, kvm_enabled, sol_enabled,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled, uefi_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)`,
[
amtConfig.profileName,
amtConfig.activation,
Expand All @@ -566,7 +573,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand Down Expand Up @@ -595,8 +603,8 @@ describe('profiles tests', () => {
mebx_password, generate_random_mebx_password,
tags, dhcp_enabled, tls_mode,
user_consent, ider_enabled, kvm_enabled, sol_enabled,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled, uefi_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)`,
[
amtConfig.profileName,
amtConfig.activation,
Expand All @@ -616,7 +624,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand All @@ -639,7 +648,7 @@ describe('profiles tests', () => {
tags=$8, dhcp_enabled=$9, tls_mode=$10, user_consent=$13,
ider_enabled=$14, kvm_enabled=$15, sol_enabled=$16,
tls_signing_authority=$17, ieee8021x_profile_name=$18,
ip_sync_enabled=$19, local_wifi_sync_enabled=$20
ip_sync_enabled=$19, local_wifi_sync_enabled=$20, uefi_wifi_sync_enabled=$21
WHERE profile_name=$1 and tenant_id = $11 and xmin = $12`,
[
amtConfig.profileName,
Expand All @@ -661,7 +670,8 @@ describe('profiles tests', () => {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
})
Expand Down
14 changes: 9 additions & 5 deletions src/data/postgres/tables/profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class ProfilesTable implements IProfilesTable {
COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs",
ip_sync_enabled as "ipSyncEnabled",
local_wifi_sync_enabled as "localWifiSyncEnabled",
uefi_wifi_sync_enabled as "uefiWifiSyncEnabled",
COALESCE(json_agg(json_build_object('name',pc.proxy_config_name, 'priority', pc.priority)) FILTER (WHERE pc.proxy_config_name IS NOT NULL), '[]') AS "proxyConfigs"
FROM profiles p
LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id
Expand Down Expand Up @@ -143,6 +144,7 @@ export class ProfilesTable implements IProfilesTable {
COALESCE(json_agg(json_build_object('profileName',wc.wireless_profile_name, 'priority', wc.priority)) FILTER (WHERE wc.wireless_profile_name IS NOT NULL), '[]') AS "wifiConfigs",
ip_sync_enabled as "ipSyncEnabled",
local_wifi_sync_enabled as "localWifiSyncEnabled",
uefi_wifi_sync_enabled as "uefiWifiSyncEnabled",
COALESCE(json_agg(json_build_object('name',pc.proxy_config_name, 'priority', pc.priority)) FILTER (WHERE pc.proxy_config_name IS NOT NULL), '[]') AS "proxyConfigs"
FROM profiles p
LEFT JOIN profiles_wirelessconfigs wc ON wc.profile_name = p.profile_name AND wc.tenant_id = p.tenant_id
Expand Down Expand Up @@ -231,8 +233,8 @@ export class ProfilesTable implements IProfilesTable {
mebx_password, generate_random_mebx_password,
tags, dhcp_enabled, tls_mode,
user_consent, ider_enabled, kvm_enabled, sol_enabled,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)`,
tenant_id, tls_signing_authority, ieee8021x_profile_name, ip_sync_enabled, local_wifi_sync_enabled, uefi_wifi_sync_enabled)
values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)`,
[
amtConfig.profileName,
amtConfig.activation,
Expand All @@ -252,7 +254,8 @@ export class ProfilesTable implements IProfilesTable {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)

Expand Down Expand Up @@ -314,7 +317,7 @@ export class ProfilesTable implements IProfilesTable {
tags=$8, dhcp_enabled=$9, tls_mode=$10, user_consent=$13,
ider_enabled=$14, kvm_enabled=$15, sol_enabled=$16,
tls_signing_authority=$17, ieee8021x_profile_name=$18,
ip_sync_enabled=$19, local_wifi_sync_enabled=$20
ip_sync_enabled=$19, local_wifi_sync_enabled=$20, uefi_wifi_sync_enabled=$21
WHERE profile_name=$1 and tenant_id = $11 and xmin = $12`,
[
amtConfig.profileName,
Expand All @@ -336,7 +339,8 @@ export class ProfilesTable implements IProfilesTable {
amtConfig.tlsSigningAuthority,
amtConfig.ieee8021xProfileName,
amtConfig.ipSyncEnabled,
amtConfig.localWifiSyncEnabled
amtConfig.localWifiSyncEnabled,
amtConfig.uefiWifiSyncEnabled
]
)
if (results.rowCount && results.rowCount > 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export class AMTConfiguration {
ieee8021xProfileName?: string
ieee8021xProfileObject?: Ieee8021xConfig | null
version?: string
uefiWifiSyncEnabled?: boolean
}

export interface TLSCerts {
Expand Down Expand Up @@ -317,6 +318,7 @@ export interface ExportConfiguration {
}
wireless: {
wifiSyncEnabled: boolean
uefiWifiSyncEnabled: boolean
profiles: ExportWifiConfig[]
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/routes/admin/profiles/amtProfileValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export const amtProfileValidator = (): ValidationChain[] => [
.optional({ nullable: true })
.isBoolean()
.withMessage('localWifiSyncEnabled must be a boolean'),
check('uefiWifiSyncEnabled')
.optional({ nullable: true })
.isBoolean()
.withMessage('uefiWifiSyncEnabled must be a boolean'),
check('wifiConfigs')
.optional({ nullable: true })
.isArray()
Expand Down Expand Up @@ -329,6 +333,10 @@ export const profileUpdateValidator = (): any => [
.optional({ nullable: true })
.isBoolean()
.withMessage('localWifiSyncEnabled must be a boolean'),
check('uefiWifiSyncEnabled')
.optional({ nullable: true })
.isBoolean()
.withMessage('uefiWifiSyncEnabled must be a boolean'),
check('wifiConfigs')
.optional({ nullable: true })
.isArray()
Expand Down
1 change: 1 addition & 0 deletions src/routes/admin/profiles/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export const getUpdatedData = async (newConfig: any, oldConfig: AMTConfiguration
amtConfig.dhcpEnabled = newConfig.dhcpEnabled ?? oldConfig.dhcpEnabled
amtConfig.ipSyncEnabled = newConfig.ipSyncEnabled ?? oldConfig.ipSyncEnabled
amtConfig.localWifiSyncEnabled = newConfig.localWifiSyncEnabled ?? oldConfig.localWifiSyncEnabled
amtConfig.uefiWifiSyncEnabled = newConfig.uefiWifiSyncEnabled ?? oldConfig.uefiWifiSyncEnabled
amtConfig.tenantId = newConfig.tenantId ?? oldConfig.tenantId
amtConfig.tlsMode = newConfig.tlsMode
amtConfig.userConsent = newConfig.userConsent ?? oldConfig.userConsent
Expand Down
1 change: 1 addition & 0 deletions src/routes/admin/profiles/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export async function exportProfile(req: Request, res: Response): Promise<void>
},
wireless: {
wifiSyncEnabled: result.localWifiSyncEnabled ?? false,
uefiWifiSyncEnabled: result.uefiWifiSyncEnabled ?? false,
profiles: wirelessProfiles
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/stateMachines/networkConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class NetworkConfiguration {
if (profile?.wifiConfigs != null) {
if (
context.wifiSettings?.MACAddress != null &&
(profile.wifiConfigs.length > 0 || profile.localWifiSyncEnabled)
(profile.wifiConfigs.length > 0 || profile.localWifiSyncEnabled || profile.uefiWifiSyncEnabled)
) {
return true
}
Expand Down
19 changes: 17 additions & 2 deletions src/stateMachines/wifiNetworkConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe('WiFi Network Configuration', () => {
dhcpEnabled: true,
ipSyncEnabled: true,
localWifiSyncEnabled: true,
uefiWifiSyncEnabled: true,
wifiConfigs: [
{
priority: 1,
Expand All @@ -146,13 +147,27 @@ describe('WiFi Network Configuration', () => {
getWifiPortConfigurationService: fromPromise(
async ({ input }) =>
await Promise.resolve({
Envelope: { Body: { AMT_WiFiPortConfigurationService: { localProfileSynchronizationEnabled: 0 } } }
Envelope: {
Body: {
AMT_WiFiPortConfigurationService: {
localProfileSynchronizationEnabled: 0,
UEFIWiFiProfileShareEnabled: 0
}
}
}
})
),
putWifiPortConfigurationService: fromPromise(
async ({ input }) =>
await Promise.resolve({
Envelope: { Body: { AMT_WiFiPortConfigurationService: { localProfileSynchronizationEnabled: 3 } } }
Envelope: {
Body: {
AMT_WiFiPortConfigurationService: {
localProfileSynchronizationEnabled: 3,
UEFIWiFiProfileShareEnabled: 0
}
}
}
})
),
updateWifiPort: fromPromise(async ({ input }) => await Promise.resolve({ clientId })),
Expand Down
11 changes: 10 additions & 1 deletion src/stateMachines/wifiNetworkConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface WiFiConfigContext extends CommonContext {
profilesAdded?: string
profilesFailed?: string
onlyLocalWifiSyncEnabled?: boolean
uefiWifiSyncEnabled?: boolean
amt?: AMT.Messages
cim?: CIM.Messages
}
Expand Down Expand Up @@ -181,6 +182,13 @@ export class WiFiConfiguration {
wifiPortConfigurationService.localProfileSynchronizationEnabled = 3
}

if (input.amtProfile?.uefiWifiSyncEnabled === true) {
// Enable UEFI WiFi Profile Synchronization
wifiPortConfigurationService.UEFIWiFiProfileShareEnabled = 1
} else {
wifiPortConfigurationService.UEFIWiFiProfileShareEnabled = 0
}

input.xmlMessage = input.amt?.WiFiPortConfigurationService.Put(wifiPortConfigurationService)
return await invokeWsmanCall(input, 2)
}
Expand Down Expand Up @@ -270,7 +278,8 @@ export class WiFiConfiguration {
isWiFiProfilesExist: ({ context }) =>
context.amtProfile?.wifiConfigs != null ? context.amtProfile.wifiConfigs.length > 0 : false,
isLocalProfileSynchronizationNotEnabled: ({ context }) =>
context.message.Envelope.Body.AMT_WiFiPortConfigurationService.localProfileSynchronizationEnabled === 0,
context.message.Envelope.Body.AMT_WiFiPortConfigurationService.localProfileSynchronizationEnabled === 0 &&
context.message.Envelope.Body.AMT_WiFiPortConfigurationService.UEFIWiFiProfileShareEnabled === 0,
isTrustedRootCertifcateExists: ({ context }) => {
const res = devices[context.clientId].trustedRootCertificateResponse
const cert = devices[context.clientId].trustedRootCertificate
Expand Down
Loading