mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-10-14 21:34:26 +00:00
[GH-ISSUE #2958] XRay/VLESS server config regenerated inconsistently on every settings interaction — Reality silently dropped, keys rotate, flow+security mismatch causes silent connection failure #1353
Open
opened 2026-10-13 20:40:49 +00:00 by bsakaguchi
·
3 comments
No Branch/Tag specified
dev
feat/api-tests
fix/show-locked-xray-settings-page-for-servers-without-write-access
fix/serialize-log-record-writes-and-pin-log-date-format-locale
fix/libagw-review-fixes
feat/otp-login
fix/ios-xray-ipv6-leak
fix/macos-xray-ipv6-leak
feat/add-support-include-split-tunnel
fix/win-xray-app-split-tunneling
fix/bug-when-saving-after-canceling
fix/xray-reconnect-crash
fix/share-empty-config-on-ssh-timeout
fix/ssh-credentials-input
fix/updater-verify-signature
fix/async-ssh-threading
fix/xray-check-inet-and-liveness-monitor
fix/selfhosted-server-installations
feat/add-support-ikev2-macos
fix/icons-different-color-themes
feat/add_support_arm_windows
feat/add-deep-link
feat/fixed-push-notifications-on-VPN-connect-disconnect-2
feat/implement-QR-code-generation-and-scanning
feat/file-password-protection
feature/add-local-proxy
feat/add-support-split-tunnel-macos
feat/tests
fix/android-register-unacknowledged-purchase
fix/share_on_linux
mirroring-to-outside
feat_copy_docker_configs
feat/self-diagnostics-log
feat/amnezia-free-vless-switch
fix/conan_build_android_on_win
fix/linux-reconnect-dns-reliability
fix/windows-connection-stability
fix/linux-reconnect-refactoring
fix/ios-groupidentifier-order
feat/xray-subscription-link
fix/minor-fixes
fix/xray-config-inplace-edit
feat/amnezia-sdk-typed-api
feat/amnezia-sdk-integration
feat/force-update-native
refactor/marketplace-update-popup
feat/force-update
fix/valnurability_dev
chore-xcode-version
fix/empty-i1-i5
build_qt_6_10_1
master
feat/protocol-selection
fix/openvpn_install
feat/locations_change
feat/locations_change_rework
feature/local-proxy-integration
fix/filepicker_atv
fix_valnurability
fix/macos-ne-codesign-4.8.19.0
temp-branch-for-testing
fix/rebased_4_8_19_linux_fix_error
feat/proxy-storage-cache
fix/zeroed-params
fix/killswitch-blocknets-linux
update/translation_RU
fix/self_hosted_reinstall_error
feat/selfhosted-dns
fix/agp_version_up
feat/switch_to_alive_protocol
feat/support_multipeer
server_scripts_update
fix/extended-vless-configuration
chore/apple-ci-cd-macos-versions
feat/add-telemt
fix/android_keystore_read_error
feat/add-mtproxy
chore/bump-qt-version
fix/make_dbus_async
feature/dns
rebase/apple-tv-target-on-conan
fix/outbound_freedom_xray_with_dns_fix
feat/apk_support
feat/fallback-proxy
feat/apple-tv-target
fix/dns_reconnection_issue
feat/fixed-push-notifications-on-VPN-connect-disconnect
fix/linux-firewall
docker-regional-locks
appstore-review-popup
feat/storekit2
fix/uninstall-split-tunnelling-driver
revert-2376-chore/license-file
support_16kb_android
bump_version
feat_add_review_android
bugfix/translation-absence-on-subscription-key-page
feat/location-separation-by-region
bugfix/text-moving-when-resing-window
fix_backup
feature/add-purchase-android
bugfix/moved-text-while-resizing-window
bugfix/incorrect-killswitch-restore-from-backup
fix/backup-exclude-secondary-api-configs
feat/proxy-fields-for-dev-console
bugfix/ovpn-ios-fix
bugfix/linux-bundle-libraries
fix/xray-app-split-win
fix/upload-to-s3
chore/add-release-date-upload
feat_add_webview_support
feature/configuration-transfer-through-qr
feat/bot-key-unlink-device
fix/ad-link-lang-support
fix/qsecuresettings-with-android
feat/add-support-arm64-win
spanish-translations
fix/context-menu
feat/add-system-dns-support
fix/qt6-9-support
fix/qt6_9_support
bugfix/strict-killswitch-ui
android-7
chore/minor-bugfixes
feature/awg-net-fix-macos-wakeup
fixbug/ios18
bugfix/ios-ne-crash
fix/linux-tray-quit-button
cryptpad-support
bugfix/disable-linux-killswitch
fix/minor-ui-fixes
feature/setup-guid-tun2socks
feature/linux-ipsec
feature/ipsec-linux
refactoring/server-config-in-classes
feature/macos-ipsec
fix/ui-fixes-after-merge-with-d20ed4a
chore/focus_control_after_qt_6.9_migration
feature/integrate-xray-as-a-library
maxos-awg-fix
feature/add-new-awg-docker-image
chore/update-3rd-prebuild
feature/test-news
fix/api-conf-files
bugfix/split-tunneling-with-api-config
bugfix/ios-awg-new-fields
feature/special-handshake-2
feat/xray-api-support
fix/desktop-entry
bugfix/shadowsocks-cipher-setting-not-changing
feature/update-tap
bugfix/openvpn_import_fix
feature/ability-to-change-port-after-installing-xray
bugfix/strict-mode-ovpn
bugfix/win-ipv6-ovpn
bugfix/subnet-adress-setting
exception-podman-docker
bugfix/fix-listviewtype-scrolling
bugfix/win-disabled-ipv6
bugfix/win-ipv6-disabled-ovpn
feature/killswitch-strict-mode
feature/awg-network-check
feature/empty-split-tunneling-list
feature/support-info
chore/update-go-version
checking-Linux-version
update_server_scripts
bugfix/button-selection-easy-setup-page
feature/old-api-proxy
patch/user-checking
fix/correcting-version
support-podman
support_podman
user-checking-patch
feature/check-docker-version
feature/allowed-dns-list
without_lsof
chore/error-body
Update-amneziavpn_ru_RU
shiroow-patch-8
shiroow-patch-7
shiroow-patch-6
shiroow-patch-5
shiroow-patch-4
shiroow-patch-3
shiroow-patch-2
shiroow-patch-1
check_sudo_permissions
feature/euphoria
add_next_octet_to_ip_settings
bugfix/mobile-controllers-init
euphoria
bugfix/android-crush
feature/macox-network-extension
bugfix/pre-release-hotfixes
bugfix/ipsec-pfs
chore/ios-site-links
checking_sudo_permissions
feature/android-tv
improve_navigation_cpp
bugfix/linux-firewall-install
fixbug/wireguard-handshake-time
ReadmeRu_full
feature/xray-user-management
feature/subscription-end-date
chore/clang-format
feature/ru-in-readme
chore/increased-api-timeout
chore/deploy-workflow
bugfix/services-list-scroll
wheel_group_suppor
chore/bump-xcode-version
fixbug/mac-network-extension
feature/android-gpb
feature/page-home-drawer-country-selection
checking-sudo-users
bugfix/service-info-from-response
fixbug/build-macos-ne-2
android-qt-6.7.3
fixbug/build-macos-ne
bugfix/wg-windows-log-folder
feature/psk-key-api-request
bugfix/user-management-qml-warnings
fix/macos-network-extension
fixbug/macos-NE-build
bugfix/fixed-isDevEnv-initialization
bugfix/revert-ios-ovpn
feature/tun2socksSrv
fix/disable_singleapp
feature/awg-wg-name-resolving
feature/disable-dhcp
bugfix/allowed-ips-old-configs
feature/goodbyedpi
feature/add-exception-log
refactoring/remove-ipv6-from-default-routes
refactoring/singleapplication-submodule
macos-dirty-build
test/gateway
Update-amneziavpn_fa_IR.ts
bugfix/ipsec-win
fix/xray-custom-port
improve-tab-navigation
test-win-11
feature/android-tv-remote-control-support
KsZnak-patch-1
feature/awg-wg-qr
bugfix/fix-loopback-splittunel
fix/setup_host_firewall
feature/android-xray
feature/openvpn-pass
feature/connection-string
fix/clickable-errors
bugfix/api_1100_fix
feature/graphview
testsvg
feature/update-win-awg
feature/open-as-amnezia
feature/update-mozilla-upstream
bugfix/qr-code-cutting
feature/native-wg-psk
test/awg-centos
bugfix/hide_error
feature/add-uninstaller-checkbox
bugfix/cancel-button-on-install-page
bugfix/anchors-page-home-warning
awg-udptlspipe
button-focus-fix
revert-677-fix/logger
bugfix/Revert_PR_596
bugfix/allowed-ips-api-configs
bugfix/on-escape-pressed
feature/auto-scroll-for-server-selection-list
fix/ui-fixes
translations/update_fa_IR.ts
feature/new-awg-docker-container
bugfix/awg_ipv6_fix
feature/tab-navigation
fix/username-no-autocapitalization
sure
refactoring/servers-model-cleanup
feature/wg-mtu-setup-ios
3rd_adaptation_to_diff_OS
sudo_not_found
test/docker-ce
bugfix/double_clear_server_from_amnezia
fix/android
client/3rd-prebuilt
revert-559-KsZnak-translation-ru-ex
KsZnak-translation-ru-ex
KsZnak-br1
KsZnak-text-change
feature/api-awg
feature/error-code-output
feature/win_x32_builds
text/debug-output
feature/ovpn3-desktop-cli
bugfix/secureqsettings-deadlock
refactoring/change-settings-when-connected
files_check
ArchLinux-support
second_adaptation_to_diff_os
sudo
refactoring/android-build
adaptation_to_different_os
feature/online_installer_for_v4
update_to_r2
bugfix/return-after-installation
feature/custom_drawer_component
bugfix/split-tunneling
bugfix/existing-awg-container
revert-370-feature/custom_drawer_component
bugfix/adapted_awg_questiondrawer
bugfix/updated_drawer_height_pageserverdata
bugfix/translated_new_source_strings_to_chinese
feature/split-tunneling-config
feature/accessibility-support
branch_connectivity_change_fix
feature/ikev2_android
android_ss_transport
bugfix/macos_fixes
feature/nextcloud-support
feature/macos_network_extension
android_pt_transport_source
feature/ios-openvpn3-pluggable-transport-Cloak
bugfix/cloak_for_desktops_fix
arm-build-macos
fix-macos-build-brew
bugfix/ios-build-openvpnadapter-from-source
feature/download-native-wireguard-config-on-connect
feature/v2ray-container
bugfix/dpkg-busy-checking-stuck
feature/online-installer
dev-killswitch
dev-netadapters
5.0.3.0
5.0.2.1
5.0.2.0
5.0.1.5
5.0.0.5
5.0.0.2
4.8.21.0
4.8.19.0
4.8.18.0
4.8.17.0
4.8.16.0
4.8.15.4
4.8.15.0
4.8.14.5
4.8.14.1
4.8.12.9
4.8.12.8
4.8.12.7
4.8.12.6
4.8.11.4
4.8.11.3
4.8.11.2
4.8.11.1
4.8.11.0
4.8.10.0
4.8.9.2
4.8.9.1
4.8.9.0
4.8.8.3
4.8.8.2
4.8.8.1
4.8.7.2
4.8.7.1
4.8.7.0
4.8.6.0
4.8.5.0
4.8.4.5
4.8.4.4
4.8.4.3
4.8.4.2
4.8.4.1
4.8.4.0
4.8.3.2
4.8.3.1
4.8.2.3
4.8.1.9
4.8.1.0
4.8.0.5
4.7.0.0
4.6.0.3
4.6.0.1
4.5.3.0
4.5.0.0
4.4.0.0
4.3.0.0
4.2.1.0
4.2.0.1
4.1.2.0_cloak_pt_experimental
4.1.0.1
4.0.8
3.1.0
3.0.8
3.0.7
3.0.5
2.1.2
2.1.0
2.0.10
2.0.9
2.0.8
2.0.7
2.0.6
2.0.5
2.0.1
2.0
1.9.1
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
No labels
pull-request
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amnezia-client#1353
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @K0T1KMEW on GitHub (Aug 7, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2958
Summary
On a self-hosted AmneziaVPN server, interacting with XRay protocol settings in the client (even without intentionally changing anything) causes the server-side XRay config to be regenerated from scratch rather than edited in place. Across repeated tests on the same server, this produced at least three different, inconsistent outcomes — including one combination that connects but never passes traffic, and one that fails to connect immediately. This makes XRay effectively unusable for any setup with more than one client device, since managing multiple devices requires touching the server config, which is precisely what triggers the regression.
Environment
amnezia-xrayDocker container (alongside separateamnezia-awg/amnezia-awg2containers for AmneziaWG, unaffected by this bug)What we observed, condensed from a full day of testing
Config regeneration on every touch. Every time the XRay protocol settings were opened/saved on either device (Windows or Android) for the same server,
/opt/amnezia/xray/server.jsoninside the container was rewritten with a brand-newprivateKey. This happened even when no field was intentionally changed. This is the same root cause as #1225 (editing an existing XRay connection is not supported — any change effectively recreates it).securityfield is inconsistent across regenerations. Checked directly on the server after each client interaction:"security": "reality"with a full, validrealitySettingsblock (privateKey, dest, serverNames, shortIds) — Reality correctly configured."security": ""— Reality silently absent, while the client UI still displayed "Reality" as the active/selected setting for that server, with no error or warning shown to the user.flow) and saving again — no deliberate attempt to disable Reality was made.flow+security: noneis a silently broken combination. When testing with an independent client (v2rayNG on Android, using a hand-builtvless://link derived directly from the server's actualserver.json) to rule out client-side bugs:flow=xtls-rprx-vision+security=none→ connection fails immediately ("no internet" — fast failure, not a hang).flowset) +security=none→ connects and works normally, full speed.This suggests the server is willing to accept and serve a
clients[]entry combiningflow: xtls-rprx-visionwith nosecurity/Reality at all, which is a nonsensical combination (XTLS-Vision expects a TLS layer underneath), but the client silently generates such configs without validation.UI shows "connected but hangs forever" vs "connection fails fast" as different symptoms of different broken states, which made this hard to diagnose without directly inspecting the server-side JSON — the client gives no indication of which underlying state it is in.
Example configs captured (keys redacted)
Working (independent client,
security: none, no flow):<uuid-2>(no flow) connects and works.<uuid-1>(flow set) fails immediately with this samesecurity: "".Also observed on the same server, a few interactions earlier (Reality present):
This state also worked when tested immediately after being generated — but was silently replaced by a
security: ""state after the next unrelated settings interaction, with no user action targeting Reality specifically.Separately observed on a different self-hosted server (same account, same 5.0.0.5 client): Windows tun2socks routing/DNS issue. Not certain if related, noting for completeness — on Windows, after connecting via XRay,
tun2interface comes up but occasionally the default route isn't installed (empty gateway inipconfig), and separately, DNS (UDP/53) does not appear to be proxied through tun2socks even when TCP works (confirmed vianetstat/nslookup— TCP connections established fine, butnslookupthrough the tunnel times out). This may be a separate bug from the config-regeneration issue above.Expected behavior
privateKeyor silently changesecurity/Reality state unless the user explicitly changes that setting (same scope as #1225).security: ""— this is a UI/state desync that hides the real problem from the user.clients[]entry withflow: xtls-rprx-visionwhensecurityis notreality/tls, since this combination cannot work — client-side validation should prevent this, or clearly warn.Current workaround
Manually editing
/opt/amnezia/xray/server.jsoninside theamnezia-xraycontainer via SSH (adding/removing UUIDs inclients[]directly, fixingrealitySettingsby hand when needed), and afterward never opening the XRay protocol settings UI again on any linked device, since doing so risks silently reverting the manual configuration. Each client device is given a hand-builtvless://link matching the current server state, imported via a third-party client (v2rayNG/v2rayN) rather than relying on the Amnezia app's own config generation/sync for XRay specifically.Related issues
@vkamn commented on GitHub (Aug 14, 2026):
Is this issue still present in the current dev branch?
@Ingwar77 commented on GitHub (Sep 2, 2026):
Adding a corroborating report from a separate self-hosted deployment — same environment class as the original report (self-hosted, Ubuntu 24.04,
amnezia-xrayin its own Docker container, separate fromamnezia-awg2).I haven't captured a direct before/after diff of the privateKey (didn't want to risk destabilizing a working production setup to reproduce it), but the observed symptoms line up with this issue:
amnezia-xraycontainer's ID has changed between sessions without any manual container-level action on our end — consistent with the client silently redeploying backend state.None of this pinpoints the exact internal cause, but it does suggest the config-regeneration/state-desync behavior described here isn't isolated to one deployment.
@HeisLuka commented on GitHub (Sep 9, 2026):
I checked this against current
dev.The answer is: the original issue is partially fixed, but the underlying destructive-update problem is not completely gone.
There have been several meaningful changes since this report was opened.
What appears fixed
1. Simply opening/saving unchanged settings should no longer trigger an update
Current
PageProtocolXraySettings.qmlonly shows the Save button when:and
XrayConfigModel::hasUnsavedChanges()compares the current server settings with the original configuration.So the original:
path no longer appears to be intentionally reachable.
That is an important improvement.
2.
flow=xtls-rprx-visionwithout a secure transport is now sanitizedCurrent XRay configurator has:
which only keeps
flowwhen the transport is raw and security is either:Otherwise the effective flow is empty.
So the specifically reported state:
is no longer generated through this path.
3. The old XRay update implementation has changed substantially
Current
applyServerSettingsToRemote()reads the existingserver.jsonfirst and works from that object instead of blindly generating a new server document.It preserves the existing
clients[]list and either updates their effective flow or appends a new client.Also, commit
667d98f7(#2975) explicitly removed:mergeStreamSettingsForServerInbound()update;So I would not describe current
devas “XRay is regenerated on every settings interaction” anymore.That part of this issue is stale.
What still concerns me
The remaining problem is the boundary between a normal configuration edit and an identity-destructive reinstall.
The current XRay setup script still generates fresh state:
every time that setup path runs.
And
InstallController::setupContainer()is still a container setup/rebuild path which eventually calls the XRay setup/config generation logic.Therefore, for any server-settings change which
InstallControllerclassifies as requiring a reinstall, the important question becomes:If it creates a new identity, then the multi-client failure mode from this issue still exists, just with a narrower trigger than originally reported.
The UI itself still warns before saving XRay settings:
which also suggests that at least some current update operations are intentionally destructive.
I think the invariant should be stronger
Routine server configuration changes should preserve:
unless the user explicitly requests identity/key rotation.
Conceptually:
A container rebuild should not automatically imply cryptographic identity rotation.
If rebuilding the image is necessary for some server-setting changes, the existing identity could be read before replacement and migrated into the new generation.
Failure handling is also important
The current model should ideally behave transactionally:
If validation/restart/readback fails, the old working configuration should remain recoverable rather than leaving the stored client state ahead of the actual server state.
Regression cases
I would use at least:
Open/close XRay settings without changes:
Change only
flow:Change ordinary transport/security parameters:
Existing multi-client server:
clients[]entry.Invalid
flow/security/transportcombination:Failed candidate/restart:
Explicit “rotate/regenerate credentials” operation:
So for the maintainer question “is this still present on current dev?” I would classify it as:
partially fixed.
The unconditional/no-op regeneration and the reported invalid flow/security combination appear addressed, but XRay server identity still needs an explicit preservation contract across any update path that performs a container reinstall.