Skip to content

Commit 69b54ad

Browse files
authored
XSI-2093: CA-422229: Host should not register all IPs to DNS server (#6811)
Fixes: cba2f1d During fix the localhost name issue, An problem was found Hosts in a pool can not resovle each other with static IP Thus, an enhancement is applied to push host name and IPs to DNS, This pushed all IPs of the host into DNS server, including the storage interface. This commit just revert the DNS change. Regarding the resovle issue with static IP, it better goes to somewhere else like network event hook, or system deamon, if we do care about it and want a fix.
2 parents ff34a8a + 2a34053 commit 69b54ad

File tree

2 files changed

+1
-62
lines changed

2 files changed

+1
-62
lines changed

ocaml/xapi/extauth_plugin_ADwinbind.ml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,59 +1238,6 @@ module ConfigHosts = struct
12381238
|> write_string_to_file path
12391239
end
12401240

1241-
module DNSSync = struct
1242-
let task_name = "Sync hostname with DNS"
1243-
1244-
type t = Register | Unregister
1245-
1246-
let handle op hostname netbios_name domain =
1247-
(* By default, hostname should equal to netbios_name, just register it to DNS server*)
1248-
try
1249-
let ops =
1250-
match op with Register -> "register" | Unregister -> "unregister"
1251-
in
1252-
let netbios_fqdn = Printf.sprintf "%s.%s" netbios_name domain in
1253-
let args = ["ads"; "dns"] @ [ops] @ ["--machine-pass"] in
1254-
Helpers.call_script net_cmd (args @ [netbios_fqdn]) |> ignore ;
1255-
if hostname <> netbios_name then
1256-
let hostname_fqdn = Printf.sprintf "%s.%s" hostname domain in
1257-
(* netbios_name is compressed, op on extra hostname *)
1258-
Helpers.call_script net_cmd (args @ [hostname_fqdn]) |> ignore
1259-
with e ->
1260-
debug "Register/unregister with DNS failed %s" (ExnHelper.string_of_exn e)
1261-
1262-
let register hostname netbios_name domain =
1263-
handle Register hostname netbios_name domain
1264-
1265-
let unregister hostname netbios_name domain =
1266-
handle Unregister hostname netbios_name domain
1267-
1268-
let sync () =
1269-
Server_helpers.exec_with_new_task "sync hostname with DNS"
1270-
@@ fun __context ->
1271-
let host = Helpers.get_localhost ~__context in
1272-
let service_name =
1273-
Db.Host.get_external_auth_service_name ~__context ~self:host
1274-
in
1275-
let netbios_name =
1276-
Db.Host.get_external_auth_configuration ~__context ~self:host
1277-
|> fun config -> List.assoc_opt "netbios_name" config
1278-
in
1279-
let hostname = Db.Host.get_hostname ~__context ~self:host in
1280-
match netbios_name with
1281-
| Some netbios ->
1282-
register hostname netbios service_name
1283-
| None ->
1284-
debug "Netbios name is none, skip sync hostname to DNS"
1285-
1286-
let trigger_sync ~start =
1287-
debug "Trigger task: %s" task_name ;
1288-
Scheduler.add_to_queue task_name
1289-
(Scheduler.Periodic !Xapi_globs.winbind_dns_sync_interval) start sync
1290-
1291-
let stop_sync () = Scheduler.remove_from_queue task_name
1292-
end
1293-
12941241
let build_netbios_name ~config_params =
12951242
let key = "netbios-name" in
12961243
match List.assoc_opt key config_params with
@@ -1657,7 +1604,6 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
16571604
[get_localhost_name ()]
16581605
in
16591606
(* Trigger right now *)
1660-
DNSSync.trigger_sync ~start:0. ;
16611607
Winbind.set_machine_account_encryption_type netbios_name ;
16621608
debug "Succeed to join domain %s" service_name
16631609
with
@@ -1697,12 +1643,9 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
16971643
let user = List.assoc_opt "user" config_params in
16981644
let pass = List.assoc_opt "pass" config_params in
16991645
let {service_name; netbios_name; _} = get_domain_info_from_db () in
1700-
DNSSync.stop_sync () ;
17011646
( match netbios_name with
17021647
| Some netbios ->
1703-
ConfigHosts.leave ~domain:service_name ~name:netbios ;
1704-
let hostname = get_localhost_name () in
1705-
DNSSync.unregister hostname netbios service_name
1648+
ConfigHosts.leave ~domain:service_name ~name:netbios
17061649
| _ ->
17071650
()
17081651
) ;
@@ -1731,7 +1674,6 @@ module AuthADWinbind : Auth_signature.AUTH_MODULE = struct
17311674
RotateMachinePassword.trigger_rotate ~start:5. ;
17321675
Winbind.check_ready_to_serve ~timeout:300. ;
17331676
Winbind.flush_cache () ;
1734-
DNSSync.trigger_sync ~start:5. ;
17351677

17361678
let {service_name; netbios_name; _} = get_domain_info_from_db () in
17371679
match netbios_name with

ocaml/xapi/xapi_globs.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,6 @@ let winbind_cache_time = ref 60
10511051

10521052
let winbind_machine_pwd_timeout = ref (2. *. 7. *. 24. *. 3600.)
10531053

1054-
let winbind_dns_sync_interval = ref 3600.
1055-
10561054
let winbind_update_closest_kdc_interval = ref (3600. *. 22.)
10571055
(* every 22 hours *)
10581056

@@ -1270,7 +1268,6 @@ let xapi_globs_spec =
12701268
; ("winbind_debug_level", Int winbind_debug_level)
12711269
; ("winbind_cache_time", Int winbind_cache_time)
12721270
; ("winbind_machine_pwd_timeout", Float winbind_machine_pwd_timeout)
1273-
; ("winbind_dns_sync_interval", Float winbind_dns_sync_interval)
12741271
; ( "winbind_update_closest_kdc_interval"
12751272
, Float winbind_update_closest_kdc_interval
12761273
)

0 commit comments

Comments
 (0)