Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds flags to amtinfo for displaying certs #195

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b6f4e41
feat: add local wifi config
tim-shockley Aug 2, 2023
be7631f
Merge branch 'main' into local-wifi-config
Walt-Intel Aug 3, 2023
6bea586
Merge branch 'main' into local-wifi-config
Walt-Intel Aug 3, 2023
eddd467
feat: normalized config file for wifi and 8021x
tim-shockley Aug 3, 2023
6fd7a37
feat: adds checks for wifi config file
Walt-Intel Aug 3, 2023
6547d9b
feat: implementation and test cases for EnableWifiOnAMT
tim-shockley Aug 7, 2023
56ef425
feat: WIP adds more unit tests
Walt-Intel Aug 7, 2023
b982086
feat: adds subcommand addwifisettings and tests
Walt-Intel Aug 10, 2023
1341f75
feat: refactored main flow
tim-shockley Aug 8, 2023
dfff4be
feat: adjusted flags for password and config file
tim-shockley Aug 11, 2023
8670e27
fix: added check in local/configure for profile name alphanum only
tim-shockley Aug 11, 2023
125ecf2
feat: local/configure unit test completed
tim-shockley Aug 14, 2023
c49f715
fix: flags configure addwifisettings subcommand
tim-shockley Aug 15, 2023
a997ec1
fix: added command line params from maintenance
tim-shockley Aug 15, 2023
13d9303
feat: Prunes wifi configs when new ones are added
Craig-Spencer-12 Aug 15, 2023
3edc372
wip
Craig-Spencer-12 Aug 15, 2023
3d2f77b
feat: check if ieee8021x struct is empty
Walt-Intel Aug 15, 2023
30f035f
Merge branch 'local-wifi-config' of https://github.com/open-amt-cloud…
Walt-Intel Aug 15, 2023
e819b46
feat: adds cli parameter tests WIP
Walt-Intel Aug 15, 2023
a3b1e6e
removes print statement
Craig-Spencer-12 Aug 16, 2023
6bd300e
Adds info statement
Craig-Spencer-12 Aug 16, 2023
bb6ccda
Unit tests for PruneWifiConfigs
Craig-Spencer-12 Aug 16, 2023
7cdee64
fix unit tests
Craig-Spencer-12 Aug 16, 2023
5bcb79d
feat: refactored verifiyConfig tests a bit
tim-shockley Aug 16, 2023
bafdfdb
Merge remote-tracking branch 'origin/main' into local-wifi-config
tim-shockley Aug 16, 2023
674f8d4
feat: adds -secret flag on command line, WIP read
Walt-Intel Aug 17, 2023
3ce6982
fix: refactored for consistency
tim-shockley Aug 17, 2023
935c5a1
fix: configFile param, secrets merged and prompted
tim-shockley Aug 17, 2023
892899c
fix: unit tests and configJson capability
tim-shockley Aug 17, 2023
f46cf43
feat: split up verification for 8021x and unit tests
tim-shockley Aug 18, 2023
e9e5feb
fix: logic hole for 8021x blank configs on command line
tim-shockley Aug 18, 2023
669db5a
feat: additional fixes and tests
tim-shockley Aug 21, 2023
ce38b48
initial commit
Walt-Intel Aug 23, 2023
c8bdfcd
Merge branch 'main' into list-certs
Walt-Intel Sep 1, 2023
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
23 changes: 23 additions & 0 deletions config-wifi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
wifiConfigs:
- profileName: 'exampleWifiWPA2' # friendly name (ex. Profile name)
ssid: 'exampleSSID'
priority: 1
authenticationMethod: 4
encryptionMethod: 4
pskPassphrase: 'example123!@#'
ieee8021xProfileName: ''
- profileName: 'exampleWifi8021x' # friendly name (ex. Profile name)
ssid: 'ssid'
priority: 2
authenticationMethod: 7
encryptionMethod: 4
pskPassphrase: ''
ieee8021xProfileName: 'exampleIeee8021xEAP-TLS'
ieee8021xConfigs:
- profileName: 'exampleIeee8021xEAP-TLS'
username: "exampleUserName"
password: "" # 8021x password if authenticationProtocol is PEAPv0/EAP-MSCHAPv2(2)
authenticationProtocol: 0 #8021x profile (ex. EAP-TLS(0))
clientCert: 'testCert'
caCert: 'testCert'
privateKey: 'testKey'
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module rpc
go 1.20

// uncomment if developing with go-wsman-messages locally
// replace github.com/open-amt-cloud-toolkit/go-wsman-messages => ../go-wsman-messages
replace github.com/open-amt-cloud-toolkit/go-wsman-messages => ../go-wsman-messages

require (
github.com/gorilla/websocket v1.5.0
Expand Down
1 change: 1 addition & 0 deletions internal/amt/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ func (amt AMTCommand) GetDNSSuffix() (string, error) {
}

func (amt AMTCommand) GetCertificateHashes() ([]CertHashEntry, error) {
// TODO: process flag -system and -user
err := amt.PTHI.Open(false)
amtEntryList := []CertHashEntry{}
if err != nil {
Expand Down
37 changes: 28 additions & 9 deletions internal/config/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,41 @@ package config

type (
Config struct {
Password string
IEEE8021XSettings `yaml:"ieee801xConfig"`
ACMSettings `yaml:"acmactivate"`
Password string `yaml:"password"`
WifiConfigs `yaml:"wifiConfigs"`
Ieee8021xConfigs `yaml:"ieee8021xConfigs"`
ACMSettings `yaml:"acmactivate"`
}
IEEE8021XSettings struct {
Name string `yaml:"name"`
AuthenticationMethod int `yaml:"authenticationMethod"`
EncryptionMethod int `yaml:"encryptionMethod"`
SSID string `yaml:"ssid"`
WifiConfigs []WifiConfig
WifiConfig struct {
ProfileName string `yaml:"profileName"`
SSID string `yaml:"ssid"`
Priority int `yaml:"priority"`
AuthenticationMethod int `yaml:"authenticationMethod"`
EncryptionMethod int `yaml:"encryptionMethod"`
PskPassphrase string `yaml:"pskPassphrase"`
Ieee8021xProfileName string `yaml:"ieee8021xProfileName"`
}
SecretConfig struct {
Secrets []Secret `yaml:"secrets"`
}
Secret struct {
ProfileName string `yaml:"profileName"`
PskPassphrase string `yaml:"pskPassphrase"`
PrivateKey string `yaml:"privateKey"`
Password string `yaml:"password"`
}
Ieee8021xConfigs []Ieee8021xConfig
Ieee8021xConfig struct {
ProfileName string `yaml:"profileName"`
Username string `yaml:"username"`
Password string `yaml:"password"`
AuthenticationProtocol int `yaml:"authenticationProtocol"`
Priority int `yaml:"priority"`
ClientCert string `yaml:"clientCert"`
CACert string `yaml:"caCert"`
PrivateKey string `yaml:"privateKey"`
}

ACMSettings struct {
AMTPassword string `yaml:"amtPassword"`
ProvisioningCert string `yaml:"provisioningCert"`
Expand Down
2 changes: 1 addition & 1 deletion internal/flags/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (f *Flags) handleActivateCommand() int {
return nil
})
// for local activation in ACM mode need a few more items
f.amtActivateCommand.StringVar(&f.configContent, "config", "", "specify a config file ")
f.amtActivateCommand.StringVar(&f.configContent, "configFile", "", "specify a config file ")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.AMTPassword, "amtPassword", "", "amt password")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.ProvisioningCert, "provisioningCert", "", "provisioning certificate")
f.amtActivateCommand.StringVar(&f.LocalConfig.ACMSettings.ProvisioningCertPwd, "provisioningCertPwd", "", "provisioning certificate password")
Expand Down
6 changes: 3 additions & 3 deletions internal/flags/activate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ func TestHandleActivateCommandLocal(t *testing.T) {
wantResult: utils.MissingOrIncorrectPassword,
},
"should fail if acm and local config file error": {
cmdLine: "./rpc activate -local -acm -config ./nofilehere.txt",
wantResult: utils.IncorrectCommandLineParameters,
cmdLine: "./rpc activate -local -acm -configFile ./nofilehere.txt",
wantResult: utils.FailedReadingConfiguration,
},
"should fail if acm and ACM Settings not specified": {
cmdLine: "./rpc activate -local -acm",
wantResult: utils.IncorrectCommandLineParameters,
},
"should pass if acm with example config file": {
cmdLine: "./rpc activate -local -acm -config ../../config.yaml",
cmdLine: "./rpc activate -local -acm -configFile ../../config.yaml",
wantResult: utils.Success,
},
"should pass wif acm and ACM Settings specified": {
Expand Down
Loading
Loading