Re: Using outside values in a Portfile tcl
> > other strings such as ‘macportshost’ instead of ‘host’ would make it a lot > > easier to find where they have been used so you know what to change It’s already trivially easy to find, and only appears in four configuration files anyway. As you can see in the Portfile, these variables are just used for sed substitutions of strings like @HOST@ in the template files. Searching the port files shows you exactly where these appear: find /opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/mail/mail-server/files/ -type f -exec fgrep -l @HOST@ {} ';' | wc -l 4 Again, I recommend focusing on the actual configuration of the deployed mail server, not the MacPorts example configuration, unless you see something wrong or insecure with the example configuration. >> > obviously, my system isn’t called host.domain.tld or the relayhost >> > mymailrelay.tld. >> >> Please refer to `port notes mail-server`: >> >> “Users must reconfigure this installation for their own system, network, and >> security model specifics by editing all necessary files and checking file >> permissions.”
Re: Using outside values in a Portfile tcl
Agreed, but then using other strings such as ‘macportshost’ instead of ‘host’ would make it a lot easier to find where they have been used so you know what to change. Host domain and tld are so generic it makes it more difficult to discern what has been the result of basic config. Gerben Wierda Chess and the Art of Enterprise Architecture Mastering ArchiMate Architecture for Real Enterprises at InfoWorld On Slippery Ice at EAPJ On 21 Sep 2019, at 02:45, Steven Smith wrote: > > obviously, my system isn’t called host.domain.tld or the relayhost > > mymailrelay.tld. > > Please refer to `port notes mail-server`: > > “Users must reconfigure this installation for their own system, network, and > security model specifics by editing all necessary files and checking file > permissions.” > > A deployed mail server will require many changes to the example working > configuration provided in the mail-server port: TLS, DKIM, DNS, SPF, DMARC, > possibly a mail relay, and more. Use the MacPorts configuration as a working > basis to start from and edit the configuration for your own deployment. Users > must reconfigure the mail-server installation for their own system, network, > and security model specifics by editing all necessary files and checking file > permissions. > > Also, these settings are changes in mail-server’s post-activate block to use > the current network settings of the installation. See: > https://github.com/macports/macports-ports/blob/022f7da78c0cbab9492c60680569cf0483f2e48f/mail/mail-server/Portfile#L328-L342 > > Bottom line: don’t waste time trying to coerce a Portfile to automatically > configure your deployed mail server when there’s a zillion other settings > you’ll have to take care of yourself anyway. > >> On Sep 20, 2019, at 11:37, Gerben Wierda wrote: >> >> The mail-server Portfile has this in it: >> >> # Network configuration >> # hard-coded examples >> set host host >> set domain domain >> set tld tld >> set fullhost ${host}.${domain}.${tld} >> set domaintld${domain}.${tld} >> set HOST[string toupper ${host}] >> set DOMAIN [string toupper ${domain}] >> set TLD [string toupper ${tld}] >> set FULLHOST [string toupper ${fullhost}] >> set DOMAINTLD [string toupper ${domaintld}] >> set relayhost mymailrelay.tld >> >> Now, obviously, my system isn’t called host.domain.tld or the relayhost >> mymailrelay.tld. >> >> Is there a way I can influence these variables from the ‘outside’, so by >> using envrionment variables or by providing them in some way with the 'port >> install’ command? >> >> Gerben Wierda >> Chess and the Art of Enterprise Architecture >> Mastering ArchiMate >> Architecture for Real Enterprises at InfoWorld >> On Slippery Ice at EAPJ >>
Re: Using outside values in a Portfile tcl
> obviously, my system isn’t called host.domain.tld or the relayhost > mymailrelay.tld. Please refer to `port notes mail-server`: “Users must reconfigure this installation for their own system, network, and security model specifics by editing all necessary files and checking file permissions.” A deployed mail server will require many changes to the example working configuration provided in the mail-server port: TLS, DKIM, DNS, SPF, DMARC, possibly a mail relay, and more. Use the MacPorts configuration as a working basis to start from and edit the configuration for your own deployment. Users must reconfigure the mail-server installation for their own system, network, and security model specifics by editing all necessary files and checking file permissions. Also, these settings are changes in mail-server’s post-activate block to use the current network settings of the installation. See: https://github.com/macports/macports-ports/blob/022f7da78c0cbab9492c60680569cf0483f2e48f/mail/mail-server/Portfile#L328-L342 Bottom line: don’t waste time trying to coerce a Portfile to automatically configure your deployed mail server when there’s a zillion other settings you’ll have to take care of yourself anyway. > On Sep 20, 2019, at 11:37, Gerben Wierda wrote: > > The mail-server Portfile has this in it: > > # Network configuration > # hard-coded examples > set host host > set domaindomain > set tld tld > set fullhost ${host}.${domain}.${tld} > set domaintld ${domain}.${tld} > set HOST[string toupper ${host}] > set DOMAIN[string toupper ${domain}] > set TLD [string toupper ${tld}] > set FULLHOST [string toupper ${fullhost}] > set DOMAINTLD [string toupper ${domaintld}] > set relayhost mymailrelay.tld > > Now, obviously, my system isn’t called host.domain.tld or the relayhost > mymailrelay.tld. > > Is there a way I can influence these variables from the ‘outside’, so by > using envrionment variables or by providing them in some way with the 'port > install’ command? > > Gerben Wierda > Chess and the Art of Enterprise Architecture > Mastering ArchiMate > Architecture for Real Enterprises at InfoWorld > On Slippery Ice at EAPJ >
Re: Using outside values in a Portfile tcl
On Sep 20, 2019, at 10:37, Gerben Wierda wrote: > The mail-server Portfile has this in it: > > # Network configuration > # hard-coded examples > set host host > set domaindomain > set tld tld > set fullhost ${host}.${domain}.${tld} > set domaintld ${domain}.${tld} > set HOST[string toupper ${host}] > set DOMAIN[string toupper ${domain}] > set TLD [string toupper ${tld}] > set FULLHOST [string toupper ${fullhost}] > set DOMAINTLD [string toupper ${domaintld}] > set relayhost mymailrelay.tld > > Now, obviously, my system isn’t called host.domain.tld or the relayhost > mymailrelay.tld. > > Is there a way I can influence these variables from the ‘outside’, so by > using envrionment variables or by providing them in some way with the 'port > install’ command? The way that's written, no. It sets the variables. It does not allow specifying them from the outside. You could run: sudo port install mail-server host=example.com but it would have no effect. The portfile would overwrite any values set from outside the portfile. To support what you're proposing, the portfile would need to check whether each/any of those variables are already set before setting them. We don't usually allow ports to accept customization via variables like this. If we wanted to support it, then at least the port would have to make sure that it disabled the use of any precompiled archives (by clearing the archive_sites variable) so that it did not download an archive from our server that would know nothing about the variable changes you make on the command line.