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

Device initialization fails: Error 400 #207

Open
msatpathy26 opened this issue Sep 19, 2020 · 0 comments
Open

Device initialization fails: Error 400 #207

msatpathy26 opened this issue Sep 19, 2020 · 0 comments

Comments

@msatpathy26
Copy link

With device provisioning enabled, starting aktualizr for the first time fails with the below error.
Never faced this issue with the earlier versions.

root@raspberrypi4:/var/rootdirs/home/root# aktualizr --loglevel 0 -c /var/sota/
Aktualizr version 2020.9-0-gd4811f900 starting
Reading config: "/var/sota/sota.toml"
Final configuration that will be used: 
[logger]
loglevel = 0

[p11]
module = ""
pass = ""
uptane_key_id = ""
tls_ca_id = ""
tls_pkey_id = ""
tls_clientcert_id = ""

[tls]
server = "https://ota-ce.uptanedemo.com:8443"
server_url_path = ""
ca_source = "file"
pkey_source = "file"
cert_source = "file"

[provision]
server = "https://ota-ce.uptanedemo.com:8443"
p12_password = ""
expiry_days = "36000"
provision_path = ""
device_id = ""
primary_ecu_serial = ""
primary_ecu_hardware_id = "raspberrypi4-1"
ecu_registration_endpoint = "https://ota-ce.uptanedemo.com:8443/director/ecus"
mode = "DeviceCred"

[uptane]
polling_sec = 10
director_server = "https://ota-ce.uptanedemo.com:8443/director"
repo_server = "https://ota-ce.uptanedemo.com:8443/repo"
key_source = "file"
key_type = "RSA2048"
force_install_completion = false
secondary_config_file = ""
secondary_preinstall_wait_sec = 600

[pacman]
type = "ostree"
os = ""
sysroot = ""
ostree_server = "https://ota-ce.uptanedemo.com:8443/treehub"
images_path = "/var/sota/images"
packages_file = "/usr/package.manifest"
fake_need_reboot = false

[storage]
type = "sqlite"
path = "/var/sota/"
sqldb_path = "sql.db"
uptane_metadata_path = "metadata"
uptane_private_key_path = "ecukey.der"
uptane_public_key_path = "ecukey.pub"
tls_cacert_path = "root.crt"
tls_pkey_path = "pkey.pem"
tls_clientcert_path = "client.pem"

[import]
base_path = "/var/sota/import"
uptane_private_key_path = ""
uptane_public_key_path = ""
tls_cacert_path = "/var/sota/import/root.crt"
tls_pkey_path = "/var/sota/import/pkey.pem"
tls_clientcert_path = "/var/sota/import/client.pem"

[telemetry]
report_network = true
report_config = true

[bootloader]
rollback_mode = "none"
reboot_sentinel_dir = "/var/run/aktualizr-session"
reboot_sentinel_name = "need_reboot"
reboot_command = "/sbin/reboot"

Current directory: /var/rootdirs/home/root
Bootstrap empty SQL storage
Bootstraping DB to version 25
No public key in db
client_cert not present in db
device_id not present in db
Unable to load previous device ID.
Successfully imported client certificate from "/var/sota/import/client.pem"
Successfully imported server CA certificate from "/var/sota/import/root.crt"
Successfully imported client TLS key from "/var/sota/import/pkey.pem"
No serial found in database for this ECU, defaulting to empty serial
Checking if device is provisioned...
device_id not present in db
No public key in db
post request body:{
        "ecus" : 
        [
                {
                        "clientKey" : 
                        {
                                "keytype" : "RSA",
                                "keyval" : 
                                {
                                        "public" : "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCyhmvqcauU6Qcs1Eg9z\nkJqT"
                                }
                        },
                        "ecu_serial" : "f092f93ef8c3005bdd96f175f8da716502a46abb8876dd23fe1970d2ef207b7c",
                        "hardware_identifier" : "raspberrypi4-1"
                }
        ],
        "primary_ecu_serial" : "f092f93ef8c3005bdd96f175f8da716502a46abb8876dd23fe1970d2ef207b7c"
}
*   Trying 34.121.161.13:8443...
* Connected to ota-ce.uptanedemo.com (34.121.161.13) port 8443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /tmp/aktualizr-f231-5d19-08a6-696e/8d30-e352-tls-ca
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=ota-gateway
*  start date: Sep 19 08:08:16 2020 GMT
*  expire date: Sep 17 08:08:16 2030 GMT
*  subjectAltName: host "ota-ce.uptanedemo.com" matched cert's "ota-ce.uptanedemo.com"
*  issuer: CN=ota-server-CA
*  SSL certificate verify ok.
> POST /director/ecus HTTP/1.1
Host: ota-ce.uptanedemo.com:8443
User-Agent: Aktualizr/2020.9-0-gd4811f900
Accept: */*
Content-Type: application/json
Content-Length: 732

* upload completely sent off: 732 out of 732 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Server: nginx/1.13.7
< Date: Sat, 19 Sep 2020 12:01:35 GMT
< Content-Type: application/json
< Content-Length: 223
< Connection: keep-alive
< x-ats-version: director-v2/eb75c8bd21b36e7809397cecf9fc652d611e49d3
< 
* Connection #0 to host ota-ce.uptanedemo.com left intact
response http code: 400
response: {"code":"invalid_entity","description":"public-key length is wrong: DownField(83220489075311465645208ed9a65d7d99b45f9d7ab807949ee0ad317c7da0}
Flushing report queue
Initializer error: Server error: Error registering device: 400 {"code":"invalid_entity","description":"public-key length is wrong: DownField(832204890}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant