The main problem is that when you configure what Google Workspace calls an outbound gateway you can't provide any "advanced" authentication.
The only mechanism available for the outbound gateway, your mail relay, are IP-based access controls.
That means that you must configure Postfix accept and forward email from all Google Workspace mail server IP addresses.
That requires you to retrieve (and possibly regularly update) the list of IP-addresses used by Google for e-mail forwarding according to the procedure here: https://support.google.com/a/answer/60764
retrieve the SPF records for the domain _spf.google.com:
nslookup -q=TXT _spf.google.com 8.8.8.8
This returns a list of the domains included in Google's SPF record, such as:
_netblocks.google.com, _netblocks2.google.com, _netblocks3.google.com
Look up the DNS records associated with those domains, one at a time:
nslookup -q=TXT _netblocks.google.com 8.8.8.8
nslookup -q=TXT _netblocks2.google.com 8.8.8.8
nslookup -q=TXT _netblocks3.google.com 8.8.8.8
That should result in something like:
on-authoritative answer:
_netblocks3.google.com text = "v=spf1 ip4:172.217.0.0/19 ip4:172.217.32.0/20 ip4:172.217.128.0/19 ip4:172.217.160.0/20 ip4:172.217.192.0/19 ip4:172.253.56.0/21 ip4:172.253.112.0/20 ip4:108.177.96.0/19 ip4:35.191.0.0/16 ip4:130.211.0.0/22 ~all"
And that are the IP-address ranges you will need to grant access to the relay functionality.
Yes, that will be a great many IP-address ranges and addresses.
No, in contrast to what the comments on your other post suggested, that doesn't make your server an open relay.
For postfix that typically means adding them to your mynetworks =
entry in main.cf
and using the default or other appropriate smtpd_relay_restrictions
:
mynetworks = 127.0.0.0/8 81.171.2.0/24 [::1]/128 [fe80::]/64 172.217.0.0/19 172.217.32.0/20 ... etc. etc.
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
Enforcing that mails are only relayed/forwarded when they have your own domains example.com and example.co.uk set as the sender / From: requires an additional refinement:
Set up a an access map
#/etc/postfix/access
example.com OK
example.co.uk OK
run postmap /etc/postfix/access
and add check_sender_access hash:/etc/postfix/access
to the smtpd_relay_restrictions
in
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, check_sender_access hash:/etc/postfix/access, defer_unauth_destination