Question about how to limit the connection to openfire server

Hello
The vpn server address is 192.168.10.10
And the openfire server address is 192.168.10.20
I entered the following command in openfire server
sudo ufw allow from 192.168.10.10 to any port *** proto tcp
that instead of the star, I put the required ports of openfire
After this, I could not connect to the openfire server in the mode without vpn. But after I run vpn, I was able to connect to openfire.
Did I do the steps correctly?

If you have any other suggestion, please let me know so that I can increase the security
Thanks