Skip to content

Instantly share code, notes, and snippets.

@msimerson
Created December 8, 2016 22:04
Show Gist options
  • Save msimerson/858d154a7c8e5ea2b28c6d8196da3f07 to your computer and use it in GitHub Desktop.
Save msimerson/858d154a7c8e5ea2b28c6d8196da3f07 to your computer and use it in GitHub Desktop.
# ./provision-squirrelmail.sh
loading mail-toaster.conf
mysql enabled
toaster host: jails.tnpi.net
email domain: theartfarm.com
shell: /bin/sh
safe name: stage
zroot/jails/base-10.3-RELEASE@p14 snapshot exists
*** stage cleanup ***
service jail stop stage
Stopping jails:.
jail -r stage
stage: removed
zroot/data/squirrelmail filesystem exists
*** stage jail filesystem setup ***
zfs clone zroot/jails/base-10.3-RELEASE@p14 zroot/jails/stage
sysrc -R /jails/stage hostname=squirrelmail
hostname: base -> squirrelmail
*** creating data volume ***
zroot/data/squirrelmail filesystem exists
zroot/data/squirrelmail filesystem exists
mkdir -p /jails/stage/data
mount_nullfs /data/squirrelmail /jails/stage/data
mount /jails/stage/usr/ports
mount /jails/stage/var/cache/pkg
*** stage jail stage startup ***
Setting hostname: squirrelmail.
Starting syslogd.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib
32-bit compatibility ldconfig path: /usr/lib32
Clearing /tmp (X related).
Starting cron.
Thu Dec 8 14:03:37 PST 2016
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
*** installing PHP ***
pkg -j stage install -y php56 php56-fileinfo php56-mcrypt php56-exif php56-openssl
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 9 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
php56: 5.6.28
php56-fileinfo: 5.6.28
php56-mcrypt: 5.6.28
php56-exif: 5.6.28
php56-openssl: 5.6.28
libxml2: 2.9.4
pcre: 8.39
libltdl: 2.4.6
libmcrypt: 2.5.8_3
Number of packages to be installed: 9
The process will require 30 MiB more space.
[squirrelmail] [1/9] Installing libxml2-2.9.4...
[squirrelmail] [1/9] Extracting libxml2-2.9.4: 100%
[squirrelmail] [2/9] Installing pcre-8.39...
[squirrelmail] [2/9] Extracting pcre-8.39: 100%
[squirrelmail] [3/9] Installing php56-5.6.28...
[squirrelmail] [3/9] Extracting php56-5.6.28: 100%
[squirrelmail] [4/9] Installing libltdl-2.4.6...
[squirrelmail] [4/9] Extracting libltdl-2.4.6: 100%
[squirrelmail] [5/9] Installing libmcrypt-2.5.8_3...
[squirrelmail] [5/9] Extracting libmcrypt-2.5.8_3: 100%
[squirrelmail] [6/9] Installing php56-fileinfo-5.6.28...
[squirrelmail] [6/9] Extracting php56-fileinfo-5.6.28: 100%
[squirrelmail] [7/9] Installing php56-mcrypt-5.6.28...
[squirrelmail] [7/9] Extracting php56-mcrypt-5.6.28: 100%
[squirrelmail] [8/9] Installing php56-exif-5.6.28...
[squirrelmail] [8/9] Extracting php56-exif-5.6.28: 100%
[squirrelmail] [9/9] Installing php56-openssl-5.6.28...
[squirrelmail] [9/9] Extracting php56-openssl-5.6.28: 100%
Message from libmcrypt-2.5.8_3:
===> NOTICE:
The libmcrypt port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from php56-fileinfo-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-fileinfo.ini
configuration file to automatically load the installed extension:
extension=fileinfo.so
****************************************************************************
Message from php56-mcrypt-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-mcrypt.ini
configuration file to automatically load the installed extension:
extension=mcrypt.so
****************************************************************************
Message from php56-exif-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-exif.ini
configuration file to automatically load the installed extension:
extension=exif.so
****************************************************************************
Message from php56-openssl-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-openssl.ini
configuration file to automatically load the installed extension:
extension=openssl.so
****************************************************************************
pkg -j stage install -y nginx
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
nginx: 1.10.1_2,2
openssl: 1.0.2j_1,1
Number of packages to be installed: 2
The process will require 12 MiB more space.
[squirrelmail] [1/2] Installing openssl-1.0.2j_1,1...
[squirrelmail] [1/2] Extracting openssl-1.0.2j_1,1: 100%
ldconfig: warning: ldconfig: No such file or directory
[squirrelmail] [2/2] Installing nginx-1.10.1_2,2...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
[squirrelmail] [2/2] Extracting nginx-1.10.1_2,2: 100%
Message from openssl-1.0.2j_1,1:
Copy /usr/local/openssl/openssl.cnf.sample to /usr/local/openssl/openssl.cnf
and edit it to fit your needs.
Message from nginx-1.10.1_2,2:
===================================================================
Recent version of the NGINX introduces dynamic modules support. In
FreeBSD ports tree this feature was enabled by default with the DSO
knob. Several vendor's and third-party modules have been converted
to dynamic modules. Unset the DSO knob builds an NGINX without
dynamic modules support.
To load a module at runtime, include the new `load_module'
directive in the main context, specifying the path to the shared
object file for the module, enclosed in quotation marks. When you
reload the configuration or restart NGINX, the module is loaded in.
It is possible to specify a path relative to the source directory,
or a full path, please see
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/ and
http://nginx.org/en/docs/ngx_core_module.html#load_module for
details.
Default path for the NGINX dynamic modules is
/usr/local/libexec/nginx.
===================================================================
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- nginx.conf-dist 2016-11-03 05:11:28.000000000 -0700
|+++ nginx.conf 2016-12-07 16:23:22.184892048 -0800
--------------------------
Patching file nginx.conf using Plan A...
Hunk #1 succeeded at 41.
Hunk #2 succeeded at 78.
done
*** installing squirrelmail ***
pkg -j stage install -y squirrelmail squirrelmail-sasql-plugin squirrelmail-quota_usage-plugin
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 14 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
squirrelmail: 20160216
squirrelmail-sasql-plugin: 3.2.0_3
squirrelmail-quota_usage-plugin: 1.3.1_3
php56-session: 5.6.28
php56-xml: 5.6.28
php56-hash: 5.6.28
perl5: 5.20.3_15
php56-mbstring: 5.6.28
oniguruma5: 5.9.6_1
php56-gettext: 5.6.28
pear-DB: 1.9.2,1
pear: 1.10.1
php56-zlib: 5.6.28
squirrelmail-compatibility-plugin: 2.0.16_1
Number of packages to be installed: 14
The process will require 60 MiB more space.
[squirrelmail] [1/14] Installing oniguruma5-5.9.6_1...
[squirrelmail] [1/14] Extracting oniguruma5-5.9.6_1: 100%
[squirrelmail] [2/14] Installing php56-session-5.6.28...
[squirrelmail] [2/14] Extracting php56-session-5.6.28: 100%
[squirrelmail] [3/14] Installing php56-xml-5.6.28...
[squirrelmail] [3/14] Extracting php56-xml-5.6.28: 100%
[squirrelmail] [4/14] Installing php56-hash-5.6.28...
[squirrelmail] [4/14] Extracting php56-hash-5.6.28: 100%
[squirrelmail] [5/14] Installing perl5-5.20.3_15...
[squirrelmail] [5/14] Extracting perl5-5.20.3_15: 100%
[squirrelmail] [6/14] Installing php56-mbstring-5.6.28...
[squirrelmail] [6/14] Extracting php56-mbstring-5.6.28: 100%
[squirrelmail] [7/14] Installing php56-gettext-5.6.28...
[squirrelmail] [7/14] Extracting php56-gettext-5.6.28: 100%
[squirrelmail] [8/14] Installing php56-zlib-5.6.28...
[squirrelmail] [8/14] Extracting php56-zlib-5.6.28: 100%
[squirrelmail] [9/14] Installing squirrelmail-20160216...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
[squirrelmail] [9/14] Extracting squirrelmail-20160216: 100%
[squirrelmail] [10/14] Installing pear-1.10.1...
[squirrelmail] [10/14] Extracting pear-1.10.1: 100%
[squirrelmail] [11/14] Installing pear-DB-1.9.2,1...
[squirrelmail] [11/14] Extracting pear-DB-1.9.2,1: 100%
install ok: channel://pear.php.net/DB-1.9.2
[squirrelmail] [12/14] Installing squirrelmail-compatibility-plugin-2.0.16_1...
[squirrelmail] [12/14] Extracting squirrelmail-compatibility-plugin-2.0.16_1: 100%
Activating plugin compatibility
Data saved in config.php
[squirrelmail] [13/14] Installing squirrelmail-sasql-plugin-3.2.0_3...
[squirrelmail] [13/14] Extracting squirrelmail-sasql-plugin-3.2.0_3: 100%
Activating plugin sasql
Data saved in config.php
Activating plugin sasql
Data saved in config.php
[squirrelmail] [14/14] Installing squirrelmail-quota_usage-plugin-1.3.1_3...
[squirrelmail] [14/14] Extracting squirrelmail-quota_usage-plugin-1.3.1_3: 100%
Activating plugin quota_usage
Data saved in config.php
Activating plugin quota_usage
Data saved in config.php
Message from php56-session-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-18-session.ini
configuration file to automatically load the installed extension:
extension=session.so
****************************************************************************
Message from php56-xml-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-xml.ini
configuration file to automatically load the installed extension:
extension=xml.so
****************************************************************************
Message from php56-hash-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-hash.ini
configuration file to automatically load the installed extension:
extension=hash.so
****************************************************************************
Message from perl5-5.20.3_15:
The /usr/bin/perl symlink has been removed starting with Perl 5.20.
For shebangs, you should either use:
#!/usr/local/bin/perl
or
#!/usr/bin/env perl
The first one will only work if you have a /usr/local/bin/perl,
the second will work as long as perl is in PATH.
Message from php56-mbstring-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-mbstring.ini
configuration file to automatically load the installed extension:
extension=mbstring.so
****************************************************************************
Message from php56-gettext-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-gettext.ini
configuration file to automatically load the installed extension:
extension=gettext.so
****************************************************************************
Message from php56-zlib-5.6.28:
****************************************************************************
The following line has been added to your /usr/local/etc/php/ext-20-zlib.ini
configuration file to automatically load the installed extension:
extension=zlib.so
****************************************************************************
Message from squirrelmail-20160216:
To activate SquirrelMail, you must complete the following steps:
1) Set up a VirtualHost or an alias in httpd.conf that points to
/usr/local/www/squirrelmail
2) Make sure the following is set in your php.ini:
file_uploads = On
3) Configure your installation.
SQUIRRELMAIL WILL NOT WORK UNTIL THIS HAS BEEN DONE.
cd /usr/local/www/squirrelmail && ./configure
4) It is best practice to change the data/user preference directory
(under General Options) to somewhere outside of
/usr/local/www/squirrelmail.
Message from pear-1.10.1:
===> NOTICE:
The pear port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from pear-DB-1.9.2,1:
===> NOTICE:
The pear-DB port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from squirrelmail-compatibility-plugin-2.0.16_1:
===> NOTICE:
The squirrelmail-compatibility-plugin port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from squirrelmail-sasql-plugin-3.2.0_3:
=============================================================
Before using the sasql plugin, you must copy the file
/usr/local/www/squirrelmail/plugins/sasql/config.php.sample
to
/usr/local/www/squirrelmail/plugins/sasql/config.php
and edit the configuration to meet your needs.
=============================================================
===> NOTICE:
The squirrelmail-sasql-plugin port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
Message from squirrelmail-quota_usage-plugin-1.3.1_3:
=============================================================
Before using the quota_usage plugin, you must copy the file
/usr/local/www/squirrelmail/plugins/quota_usage/config.php.sample
to
/usr/local/www/squirrelmail/plugins/quota_usage/config.php
and edit the configuration to meet your needs.
=============================================================
===> NOTICE:
The squirrelmail-quota_usage-plugin port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:
https://bugs.freebsd.org/bugzilla
More information about port maintainership is available at:
https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
preserving existing squirrelmail mysql password:
$signout_page = 'https://jails.tnpi.net/';
$domain = 'theartfarm.com';
$smtpServerAddress = '172.16.15.9';
$smtpPort = 465;
$use_smtp_tls = true;
// PHP 5.6 enables verify_peer by default, which is good but in this context,
// unnecessary. Setting smtp_stream_options *should* disable that, but doesn't.
// Leave squirrelmail disabled until squirrelmail gets this sorted out.
$smtp_stream_options = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'verify_depth' => 3,
'cafile' => '/etc/ssl/cert.pem',
// 'allow_self_signed' => true,
],
];
$smtp_auth_mech = 'login';
$imapServerAddress = '172.16.15.15';
$imap_server_type = 'dovecot';
$use_imap_tls = false;
$data_dir = '/data/data';
$attachment_dir = '/data/attach';
// $check_referrer = 'theartfarm.com';
$check_mail_mechanism = 'advanced';
*** starting PHP ***
sysrc -R /jails/stage php_fpm_enable=YES
php_fpm_enable: -> YES
jexec stage service php-fpm start
Performing sanity check on php-fpm configuration:
[08-Dec-2016 14:03:50] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful
Starting php_fpm.
*** starting nginx ***
sysrc -R /jails/stage nginx_enable=YES
nginx_enable: -> YES
jexec stage service nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
*** testing squirrelmail httpd ***
checking for port 80 listener in staged jail
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
www nginx 29033 6 tcp4 172.16.15.254:80 *:*
root nginx 29032 6 tcp4 172.16.15.254:80 *:*
*** testing squirrelmail php ***
checking for port 9000 listener in staged jail
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
www php-fpm 28960 0 tcp4 172.16.15.254:9000 *:*
www php-fpm 28959 0 tcp4 172.16.15.254:9000 *:*
root php-fpm 28958 7 tcp4 172.16.15.254:9000 *:*
it worked
*** promoting jail squirrelmail ***
service jail stop stage
Stopping jails: stage.
jail -r stage
stage: removed
nameserver 172.16.15.3
umount /jails/stage/dev
unmount /jails/stage/usr/ports
unmount /jails/stage/var/cache/pkg
zroot/data/squirrelmail filesystem exists
/data/squirrelmail on /jails/stage/data (nullfs, local)
unmount data fs /jails/stage/data
zfs rename zroot/jails/stage zroot/jails/squirrelmail.ready
service jail stop squirrelmail
Stopping jails: squirrelmail.
jail -r squirrelmail
zroot/data/squirrelmail filesystem exists
zroot/jails/squirrelmail.last filesystem exists
zfs destroy zroot/jails/squirrelmail.last
zroot/jails/squirrelmail filesystem exists
zfs rename zroot/jails/squirrelmail zroot/jails/squirrelmail.last
zfs rename zroot/jails/squirrelmail.ready zroot/jails/squirrelmail
*** squirrelmail already in /etc/jail.conf ***
*** service jail start squirrelmail ***
Starting jails: squirrelmail.
Success! A new 'squirrelmail' jail is provisioned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment