Skip to content

Commit

Permalink
feat: local wifi configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-shockley committed Sep 5, 2023
1 parent 09fdd03 commit 7c07122
Show file tree
Hide file tree
Showing 17 changed files with 2,542 additions and 567 deletions.
45 changes: 34 additions & 11 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,38 @@
ieee801xConfig:
name: 'test' # friendly name (ex. Profile name)
authenticationMethod: 5 # wifi authentication method
encryptionMethod: 4 # wifi encryption method
clientCert: 'test'
caCert: 'test'
privateKey: 'test'
ssid: 'ssid' # wifi ssd
username: "test" # 8021x username
authenticationProtocol: 0 #8021x profile (ex. EAP-TLS(0))
priority: 1
acmactivate:
amtPassword: 'test'
provisioningCert: 'your provisioning certificate'
provisioningCertPwd: 'test'
wifiConfigs:
- profileName: 'exampleWifiWPA2' # friendly name
ssid: 'exampleSSID'
priority: 1
authenticationMethod: 6
encryptionMethod: 4
pskPassphrase: 'example123!@#' # pskPassphrase can be provided in this file or a seoarate secrets file
ieee8021xProfileName: ''
- profileName: 'exampleWifiWPA' # friendly name
ssid: 'exampleSSID'
priority: 2
authenticationMethod: 4
encryptionMethod: 4
pskPassphrase: '' # pskPassphrase can be provided in this file or a seoarate secrets file
ieee8021xProfileName: ''
- profileName: 'exampleWifi8021xTLS' # friendly name
ssid: 'ssid'
priority: 2
authenticationMethod: 7
encryptionMethod: 4
pskPassphrase: ''
ieee8021xProfileName: 'exampleIeee8021xEAP-TLS'
ieee8021xConfigs:
- profileName: 'exampleIeee8021xEAP-TLS'
username: "exampleUserName"
authenticationProtocol: 0 #8021x profile (ex. EAP-TLS(0))
clientCert: 'testClientCertString'
caCert: 'testCaCertString'
privateKey: '' # private key can be provided in this file or a seoarate secrets file
- profileName: 'exampleIeee8021xMSCHAPv2'
username: "exampleUserName"
password: "" # password can be provided in this file or a separate secrets file
authenticationProtocol: 2 #8021x profile (ex. EAP-TLS(0))
caCert: 'testCaCertString'
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_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestHandleActivateCommandLocal(t *testing.T) {
},
"should fail if acm and local config file error": {
cmdLine: "./rpc activate -local -acm -config ./nofilehere.txt",
wantResult: utils.IncorrectCommandLineParameters,
wantResult: utils.FailedReadingConfiguration,
},
"should fail if acm and ACM Settings not specified": {
cmdLine: "./rpc activate -local -acm",
Expand Down
Loading

0 comments on commit 7c07122

Please sign in to comment.