NTLM auth not functional in Ubuntu-22.04 image
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- docker, powershell, ubuntu
- Lĩnh vực
- authentication, devops, operating-systems
Hướng nghiên cứu
Bắt đầu bằng cách chạy lệnh Docker của Ubuntu 22.04 và các bước PSWSMan và Install-WSMan được liệt kê để tái hiện lỗi NTLM. So sánh cấu hình OpenSSL của image với script được cung cấp, sau đó xác minh rằng image hỗ trợ Enter-PSSession với Negotiate mà không chỉnh sửa thủ công /etc/ssl/openssl.cnf hoặc khởi động lại PowerShell.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest image.
- Search the existing issues.
- Verified that this is not a Known Issue
- Verified this is not an issues in the underlying windows container that should be reported to Windows Feedback Hub
Steps to reproduce
docker run --rm -it mcr.microsoft.com/powershell:lts-7.2-ubuntu-22.04 bash
root@container:/# pwsh -nop -c "& { Install-Module -Name 'PSWSMan' -AcceptLicense -Force -Scope AllUsers}"
root@container:/# pwsh -nop -c "& { Install-WSMan }"
root@container:/# pwsh
PS /> Enter-PSSession -ComputerName myserver -Credential (Get-Credential) -Authentication Negotiate
PowerShell credential request
Enter your credentials.
User: domain\myusername
Password for user domain\myusername: ***************
Enter-PSSession: Connecting to remote server myserver failed with the following error message : acquiring creds with username only failed No credentials were supplied, or the credentials were unavailable or inaccessible SPNEGO cannot find mechanisms to negotiate For more information, see the about_Remote_Troubleshooting Help topic.
Expected behavior
docker run --rm -it mcr.microsoft.com/powershell:lts-7.2-ubuntu-22.04 bash
root@container:/# pwsh -nop -c "& { Install-Module -Name 'PSWSMan' -AcceptLicense -Force -Scope AllUsers}"
root@container:/# pwsh -nop -c "& { Install-WSMan }"
root@container:/# pwsh
PS /> Enter-PSSession -ComputerName myserver -Credential (Get-Credential) -Authentication Negotiate
PowerShell credential request
Enter your credentials.
User: domain\myusername
Password for user domain\myusername: ***************
[myserver]: PS C:\Users\myusername\Documents>
### Actual behavior
```console
docker run --rm -it mcr.microsoft.com/powershell:lts-7.2-ubuntu-22.04 bash
root@container:/# pwsh -nop -c "& { Install-Module -Name 'PSWSMan' -AcceptLicense -Force -Scope AllUsers}"
root@container:/# pwsh -nop -c "& { Install-WSMan }"
root@container:/# pwsh
PS /> Enter-PSSession -ComputerName myserver -Credential (Get-Credential) -Authentication Negotiate
PowerShell credential request
Enter your credentials.
User: domain\myusername
Password for user domain\myusername: ***************
Enter-PSSession: Connecting to remote server myserver failed with the following error message : acquiring creds with username only failed No credentials were supplied, or the credentials were unavailable or inaccessible SPNEGO cannot find mechanisms to negotiate For more information, see the about_Remote_Troubleshooting Help topic.
NOTE
Running the following pwsh script in the container and restarting pwsh resolves the issue.
<#
.SYNOPSIS Enables support for legacy protocols in openssl which is needed for WinRM NTLM auth on Ubuntu 22.04
#>
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
Write-Host 'Enabling OpenSSL Legacy protocols...'
$opensslcnf = '/etc/ssl/openssl.cnf'
if (-not (Test-Path $opensslcnf)) { throw "Unable to find file: $opensslcnf" }
$content = Get-Content -Path $opensslcnf -Raw
$replacements = @(
[PSCustomObject]@{
regex = '\[provider_sect\]\s*\ndefault\s*=\s*default_sect\s*\n'
newText = "[provider_sect]`ndefault = default_sect`nlegacy = legacy_sect`n"
},
[PSCustomObject]@{
regex = '\[default_sect\]\s*\n\s*(#)*\s*activate\s*=\s*1\s*\n'
newText = "[default_sect]`nactivate = 1`n[legacy_sect]`nactivate = 1`n"
}
)
foreach ($replacement in $replacements) {
if (-not ($content -match $replacement.regex)) {
throw "Unable to find regex match for pattern: $($replacement.regex)"
}
$content = $content -replace $replacement.regex,$replacement.newText
}
$content | Out-File -Path '/etc/ssl/openssl.cnf' -NoNewline -Force
### Error details
```console
See above
Environment data
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 4174,
"digest": "sha256:905358640d7b3e6b9e228ebfdcf362f5011103df2e5233a67261f9ac604ef256"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 30446577,
"digest": "sha256:3dd181f9be599de628e1bc6d868d517125e07f968824bcf7b7ed8d28ad1026b1"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 100805825,
"digest": "sha256:499091a85d98e22bacb4f4df74202b35b75d6acb7f5e84cec0aa3df496f1b4cd"
}
]
}
Visuals
No response
- Ngôn ngữ chính
- Dockerfile
- Star
- 449
- Fork
- 158
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PowerShell/PowerShell-Docker
-
Git Đang mởIssue-Enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
PowerShell/PowerShell-Docker#857 ·
-
Container images not deprecated Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PowerShell/PowerShell-Docker#856 · 2 bình luận · 1 reaction ·
-
Issue-Enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
PowerShell/PowerShell-Docker#854 ·
-
Issue-Enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
PowerShell/PowerShell-Docker#853 · 6 bình luận · 17 reaction ·
-
Issue-Enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
PowerShell/PowerShell-Docker#851 · 2 bình luận · 2 reaction ·
Tất cả issue của PowerShell/PowerShell-Docker
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
canonical/paas-charm#368 · 1 bình luận ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
palladius/rails8-app-on-gcp#142 ·
-
addition to tracking list Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
StevenBlack/hosts#3256 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
corsairdev/corsair#1764 ·
-
oblt-aw/detector/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100