没有TLS的Android P:network-security-config:cleartextTrafficPermitted不适用于IP(仅域) [英] Android P without TLS: network-security-config: cleartextTrafficPermitted not possible for IP (only domain)
问题描述
我正在尝试使用HTTP服务器连接到嵌入式设备,该服务器在android<上可以正常工作P(直到我设置 targetSdkVersion 28
),因为发生了默认情况下启用网络TLS .
I'm trying to connect to an embedded device with an HTTP-server which works fine on android < P (until I set targetSdkVersion 28
) because there was a change that Network TLS enabled by default.
有一种方法可以退出明文流量,但是似乎仅适用于域,而不适用于IP地址.
There is a way to Opt out of cleartext traffic but it seems that this is only possible for domains and not IP addresses.
我试图在清单中使用IP而不是域来设置 android:networkSecurityConfig
,但这不起作用:
I've tried to set a android:networkSecurityConfig
in the Manifest with the IP instead of the domain but this didn't work:
<network-security-config>
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">172.16.33.1</domain>
</domain-config>
</network-security-config>
将此设置为< base-config cleartextTrafficPermitted ="false">
也不起作用.
Setting this as a <base-config cleartextTrafficPermitted="false">
does not work either.
因此,似乎没有办法在没有域的情况下使非TLS通信正常工作.但是,因为这是本地网络中的嵌入式设备,所以我们没有域(我们只知道IP).
So it seems that there is no way to get non-TLS communication working when not having a domain. But because this is an embedded device in the local network we do not have a domain (we only know the IP).
对于所有无法通信的嵌入式设备来说,这似乎是一个主要问题.另外,新应用和对现有应用的更新需要达到API级别[2020年11月28日]" (从2018年11月开始使用API 26,并且每年都在提高).
This seems like a major problem for all kind of embedded devices which would not be able to communicate anymore. Plus, "new apps and updates to existing apps require to target API level [28 in November 2020]" (starting in November 2018 with API 26 and advancing each year).
有什么想法使之成为可能吗?
Any ideas how to make this possible?
推荐答案
它与IP地址的< base-config cleartextTrafficPermitted ="true">
一起使用.
It's working with <base-config cleartextTrafficPermitted="true">
for IP addresses.
(当然,它也必须是 true
而不是 false
).
(Of course it also needs to be true
not false
).
这篇关于没有TLS的Android P:network-security-config:cleartextTrafficPermitted不适用于IP(仅域)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!