mynetworks
Replace Postfix's trusted network list (
mynetworks) with localhost, this server's IP, and the networks you specify, then restart the mail server
- Command:
/go/mynetworks - Category: Mail
- Required option: None (arguments are the extra trusted networks to add)
- Output: None of its own; only
postconfor/go/mail restart's output on error - Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also
Overview
/go/mynetworks sets Postfix's mynetworks parameter — the list of IP ranges Postfix treats as trusted, which are generally allowed to relay mail through the server without authenticating. It always includes localhost (127.0.0.0/8, [::1]/128) and this server's own public IPv4 address, plus whatever extra networks you pass as arguments.
[!WARNING]
mynetworkscontrols who can relay mail through this server without logging in. Adding a network you don't fully control (a shared range, a broad CIDR, or a typo'd one that's broader than intended) can turn the server into an open relay — a serious misconfiguration that gets servers blacklisted. Only add networks you trust completely, and double-check the CIDR before running this.
[!NOTE] Each run replaces the whole custom part of the list, it does not add to it. If you previously added a network with this command and now run it again with a different (or no) argument, the earlier one is dropped unless you include it again.
The call is appended to /var/log/go/mynetworks.log.
Quick start
# Trust an office network in addition to localhost and this server's own IP
/go/mynetworks 203.0.113.0/24
Syntax
/go/mynetworks [network ...]
| Form | Behavior |
|---|---|
/go/mynetworks |
Sets mynetworks to just localhost and this server's own IP — clears any previously added custom networks. |
/go/mynetworks <network> [network ...] |
Same, plus every network listed, space-separated. |
There is no read-only mode; running the command with no arguments doesn't show the current value, it resets it.
Options
| Argument | Notes |
|---|---|
<network> |
An IP, CIDR range, or whatever syntax Postfix's mynetworks accepts, as one shell argument per network. Not validated — a malformed value is written to Postfix's configuration as-is. |
Output
The command prints nothing on success. Check the result yourself:
postconf mynetworks
Errors from postconf or from /go/mail restart (presumed to restart Postfix, based on context) print to the terminal, but the script doesn't stop or report a summary either way.
Examples
# Localhost and this server's own IP only (the default, no extra trust)
/go/mynetworks
# Trust one additional network
/go/mynetworks 203.0.113.0/24
# Trust several networks at once — must all be given together
/go/mynetworks 203.0.113.0/24 198.51.100.0/24
# Check the result
postconf mynetworks
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| A network you added earlier is gone | Each run replaces the whole list; it doesn't append to the previous one. | Include every network you want, every time you run the command. |
| Postfix won't restart after running this | A malformed network argument produced an invalid mynetworks value. |
Check postconf mynetworks and postfix check for a syntax problem, then run the command again with a corrected value. |
| Your server starts relaying mail for addresses you didn't expect | An added network is broader than intended, or trusted when it shouldn't be. | Review postconf mynetworks and remove the network by running the command again without it. |
| The server's own IP is missing from the list | The curl lookup to checkip.amazonaws.com failed (no outbound access, or the service was unreachable). |
Check outbound network access, then run the command again. |
Details
What it does
- Looks up this server's public IPv4 address with a call to
checkip.amazonaws.com. - Saves the raw arguments (joined with spaces) to GoAdmio's
Configtable, in theMyNetworkscolumn. - Sets Postfix's
mynetworksto127.0.0.0/8 [::1]/128 <server-ip> <your arguments>. - Runs
/go/mail restart(presumed to restart Postfix, and possibly Dovecot, though this command's own source wasn't available to confirm).
Known issues
- No validation of the network values. Anything you pass is written directly into Postfix's live configuration; a typo can produce an invalid
mynetworksand potentially keep Postfix from restarting cleanly. - Arguments go unquoted into a SQL statement.
UPDATE Config set MyNetworks='$@'would break, or worse, if an argument contained a single quote. - The
UPDATEhas noWHEREclause, relying onConfigonly ever having one row. - No confirmation message, and no check that
postconfor the mail restart actually succeeded.
See also
| Command | Description |
|---|---|
postfwd |
Build the Postfwd rate-limiting rules |
installmail |
Install and configure webmail services (Postfix and Dovecot) |
mail |
Create an email address in GoAdmio via the command line |
checksmtp |
Check the SMTP port and SSL certificate |
smtp |
Manage the SMTP port: block, unblock, and change it |