Azure / Azure/azure-linux-extensions

Deploy LinuxDiagnostics using ARM calculated SAS fails

Đang mở
#653 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
333
Fork
278
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
4

Mô tả

I am unable to deploy the LinuxDiagnotics extension using ARM templates because the SAS token generated by the `listAccountSas()` function in ARM generates expiry date stamps in a format that MdsTime does not support.

My `/var/log/azure/Microsoft.Azure.Diagnostics.LinuxDiagnostic/3.0.113/extension.log` contains the following (note the factional part of the datestamp):

```
2018/09/25 16:09:14 Parse reported these messages:
2018/09/25 16:09:14 /var/lib/waagent/Microsoft.Azure.Diagnostics.LinuxDiagnostic
-3.0.113/xmlCfg.xml(3) Error: Storage credential validation for table storage fa
iled: MdsTime(): expected: RFC3339 date; Actual: decoded='2020-09-19T03:23:47.00
00000Z', original: '2020-09-19T03%3A23%3A47.0000000Z'
```

The simplified ARM template that generates the token is the following,

```
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"requestContent": {
"type": "object",
"defaultValue": {
"signedServices": "b",
"signedResourceType": "c",
"signedPermission": "r",
"signedExpiry": "2020-09-19T03:23:47Z",
"signedResourceTypes": "s"
}
}
},
"outputs": {
"accountSAS": {
"type": "object",
"value": "[listAccountSas(resourceId('Microsoft.Storage/storageAccounts', 'mystorage'), '2018-02-01', parameters('requestContent'))]"
}
}
}
```

MdsTime parses the timestamp on the following line,

[/Diagnostic/mdsd/mdsdutil/MdsTime.cc](https://github.com/Azure/azure-linux-extensions/blob/b72b251930fc0d62a65a01cf45b8ee5f0f1532d2/Diagnostic/mdsd/mdsdutil/MdsTime.cc#L17)
```
strptime(decoded.c_str(), "%Y-%m-%dT%TZ", &tm);
```

Where as I understand `%T` is short for `%H:%M:%S` where `%S` is

> %S The second (0–60; 60 may occur for leap seconds; earlier also 61 was allowed).

Which does not include the fractional part.

What gives? I cannot simply remove the fractional part from the stamp since it's signed by the storage account access key, but I cannot change the date signed by the function either since it is added by `listAccountSas()`.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với /Diagnostic/mdsd/mdsdutil/MdsTime.cc tại lệnh gọi strptime được tham chiếu và so sánh định dạng mà nó chấp nhận với dấu thời gian phân số được hiển thị trong extension.log. Tái tạo giá trị SAS được tạo bằng mẫu ARM được cung cấp và kiểm tra đường dẫn phân tích cú pháp của LinuxDiagnostic. Hoàn tất khi dấu thời gian đã ký do listAccountSas() tạo ra được chấp nhận mà không làm mất hiệu lực thông tin xác thực SAS.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
azure, cpp
Lĩnh vực
backend, cloud
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.