/go/mysqlbackup: mynetworks from the Command Line

/go/mynetworks sets Postfix's mynetworks list: the IP addresses and networks whose mail the server accepts without an SMTP login. This is how, for example, another server or an office network can send mail through this server without a username and password. It saves your list in GoAdmio's configuration database, writes it to the Postfix configuration, and restarts the mail server. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Trust one outside IP address
/go/mynetworks 203.0.113.10/32

Arguments

Argument Required Notes
"<networks>" No One or more IP addresses or networks, as a single quoted value. With no argument, the list is reset to localhost and the server’s own IP.

Network formats

Format Example
Single IPv4 address 203.0.113.10/32
IPv4 network 198.51.100.0/24
IPv6 address or network, in square brackets [2001:db8::1]/128, [2001:db8::]/64

Do not use quotation marks inside the list. The command does not check the values.

Examples

# One address
/go/mynetworks 203.0.113.10/32

# Several addresses and a network, in one quoted argument
/go/mynetworks "203.0.113.10/32 198.51.100.0/24"

# Same, separated by commas
/go/mynetworks "203.0.113.10/32,198.51.100.0/24"

# Reset to localhost and the server's own IP only
/go/mynetworks

# Check what is active
postconf mynetworks
sqlite3 /var/lib/sqlite/config.db "SELECT MyNetworks FROM Config;"

Output

The command prints nothing of its own. Any messages come from the tools it runs (sqlite3, postconf, and the mail restart). Every call is also appended to /var/log/go/mynetworks.log.

See the full reference at /go/mysqlbackup and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *