There is a HTTPS server with self-signed certificate on IP A and a https client on IP B. The server only allow access from IP B in IPTABLES. The client access server with the correct domain name and IP(defined in local host file).
Is this a safe pattern? I want to use this pattern for remote procedure call between two hosts with public IP. Is there any security problems. Can it prevent man-in-middle attack?