ufw allow postgresql

Shell
sudo ufw allow 5432
Source

Also in Shell: