Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.
Resource icon

Scripted installation of Nextcloud 19 in iocage jail 2018-03-23

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE

peter_cd.cn

Member
Joined
Feb 9, 2018
Messages
32
@deltavlokkies The logs show that Caddy is doing all the right things. Like I suggested in my earlier post and your response confirms it, you need to meet the Let's Encrypt prerequisites in the README for this resource in order to enable TLS encryption. Running the script is straightforward; meeting those prerequisites is where all the hard work is. I recommend you work your way slowly through those prerequisites and raise questions in this discussion area as you come up against obstacles.

You might like to start by describing the path between the Nextcloud jail and your DNS hosting provider for cloud.vlokkiebox.nl e.g.
  1. Who is your hosting provider and have you configured the external DNS?
  2. Are you a home user? Does your ISP provide you with a static or dynamic IP address?
  3. Is your router capable of handling split-horizon DNS? Have you configured the internal DNS?
  4. Is your edge router subject to double-NAT? e.g. if your ISP supplies you with Carrier-Grade NAT, there is a possibility that you will not be able to get TLS encryption working unless you acquire (most likely at an additional, recurring cost) a static IP address from them.
  5. At what point in the prerequisites are you currently stuck at? etc
Hi, I've heard about this scripted for so long. Since 2019-10-15 to be exact. That's when I paid for a domain for three years last time via HostGator.com. Last attempt was a manul process posted on the forum which I got things working locally, but can't Let's Encrpt to work and bring in public access.

This time(1 year later now) I want to redo the installation with this script. Not sure how can I finish all the prerequisties. Is there a good guide somewhere? To answer some of the above questions:

1. hosting provider for external DNS. Is that HostGator.com? because I brought a domain from them.
2. Home user. My ISP gives dynamic IP address. I notice my IP changes if I have a power outage and my modem restarted. (CentruyLink Fiberoptic)
3. Split DNS. Yes my router can based on this https://www.snbforums.com/threads/how-to-do-split-dns-with-unbound-sort-of.64458/.
4. Double-NAT, can someone confirm this one? I think it is yes, becasue I do have A small box, called an optical network terminal (Ont) connect to my edge router.
5. All I have is a paid Domain(3 years) from hostgator.com

My question is where do I start? Is it even possible for me to have self-hosted next cloud?
 

Basil Hendroff

Neophyte Sage
Joined
Jan 4, 2014
Messages
1,310
1. hosting provider for external DNS. Is that HostGator.com? because I brought a domain from them.
You own the domain, so you can control it's DNS records. However, Caddy, which danb35's script uses for the webserver and reverse proxy functions, only supports a handful of hosting providers of which HostGator is not one. This isn't an issue though. The key is to have one of the supported DNS providers manage the DNS records on behalf of HostGator. This will require you to alter the nameservers for HostGator. Cloudflare is well supported, so, the most straightforward approach is to follow danb35's advice at https://github.com/danb35/freenas-iocage-nextcloud and set up Cloudflare as your hosting provider.

4. Double-NAT, can someone confirm this one? I think it is yes, becasue I do have A small box, called an optical network terminal (Ont) connect to my edge router
This one's the showstopper in a sense. In a worst-case scenario, if you are double-NATed, you may have no choice but to purchase (usually at a monthly recurrent cost) a fixed external IP address. To see where you sit on the spectrum of possibilities, refer to the section Common Problems in this Plex guide https://support.plex.tv/articles/200931138-troubleshooting-remote-access/.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877

cellardoor

Junior Member
Joined
Jul 21, 2017
Messages
19
Gandi.net

I like to confirm that the gandi plugin is working for me.
I had to load the plugin with DNS_PLUGIN=gandi
and set my token DNS_TOKEN="some numbers and letters".
Than i have to comment out the first block in the Caddyfile
with staging AND email.

Thanks for the script danb35
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877
Glad it was helpful. Did you need to comment out that first block in order to get the cert at all? I wouldn't expect you'd need to comment out the email in any event.
 

cellardoor

Junior Member
Joined
Jul 21, 2017
Messages
19
Glad it was helpful. Did you need to comment out that first block in order to get the cert at all? I wouldn't expect you'd need to comment out the email in any event.
Hi. Happy X-mas.

I had to comment out the E-mail because it was impossible to connect correctly and recieve a cert.
With the E-Mail gandis live-dns api gives me an error in the caddy log.
Again thank you for the script
 

Rikkard

Member
Joined
Dec 2, 2014
Messages
26
Worked perfect.
standalone cert
host:xxxx.duckdns.org, update ip with cronjob on truenas,
/usr/local/bin/curl https://duckdns.org/update/mysite/token
opened port 80 and 443 on router (which is a adsl modem), forwarded to jail ip.

don't see what would be better if a bought a domain? except my webadress isnt pretty.

Everything worked perfect got cert from lets encrypt, but error on webinterface, I tested a lot first time,started out with selfsigned cert, everything worked except web through wan,then tested lets encrypt and everything worked except web interface..., checked all logs, nothing showed any errors, only deleted jail and some **** config data must have followed when I reinstalled like 15 times changing the config file a little at a time and I could not contact nextcloud at all from web interface, or I got ssl error,internal server error. Caddy worked, everything worked,could not find any faults anywhere. Deleted everything, including datasets and did a clean install and after that web interface started working,both tfrom within LAN and from outside. Thanks a lot for this script,I should hace choosen standalone from beginning and been up and running in 5 minutes, start like caddy,used to apache which is lot more work to get going. So what was wrong during first reinstalls? any clues? I'm fast so didn't save any data, which I should have.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877
error on webinterface
If you shared what the error was, I might have an idea of what happened. As it is, not really, other than the likely cert error with the default testing cert.
some **** config data must have followed when I reinstalled like 15 times
Yes, it does. All the data--the database, nextcloud's own config file, all the user files--are stored outside the jail. If the script sees that data there (specifically, the database and the config file), it assumes you're reinstalling.
 

Rikkard

Member
Joined
Dec 2, 2014
Messages
26
Error-code was
SSL_ERROR_INTERNAL_ERROR_ALERT

Still got it if I try to reach 192.168.1.4, so I thought it was something with the cert. I believe first time I installed I wrote
HOST = "192.168.1.4"
and this was still there somehow. But I got the certs from lets encrypt. I tried to find the error
 

Rikkard

Member
Joined
Dec 2, 2014
Messages
26
SSL_ERROR_INTERNAL_ERROR_ALERT

The page you are trying to view cannot be displayed because the authenticity of the received data cannot be verified.
Contact the website owner and inform them about this problem. (translated from swedish, so perhaps not native "english-firefox" error text
 

InGenetic

Member
Joined
Dec 18, 2013
Messages
132
hi all, and mr.danb35 ,

my nextcloud was error , no one can access ,
if i try to access from mobile there's an error like the attached file

here are some errors regarding your setup.

  • It was not possible to execute the cron job via CLI. The following technical errors have appeared:
    • PHP module HASH Message Digest Framework not installed. Please ask your server administrator to install the module.
please advice how to fix it

i’ve just upgrade my nextcloud to latest version 20.
i’m running nextcloud on my Freenas Jail : Version: FreeNAS-11.3-U1

Regards,

Please help ..
 

Attachments

Last edited:

InGenetic

Member
Joined
Dec 18, 2013
Messages
132
hi all, and mr.danb35 ,

my nextcloud was error , no one can access ,
if i try to access from mobile there's an error like the attached file

here are some errors regarding your setup.

  • It was not possible to execute the cron job via CLI. The following technical errors have appeared:
    • PHP module HASH Message Digest Framework not installed. Please ask your server administrator to install the module.
please advice how to fix it

Regards,

Please help ..
As i remember, i've just installed bcmath, theres notification on my nextcloud before, about bcmath, so in iocage freenas, i run pkg install bcmath, and after that,my nextcloud error, like above
 

InGenetic

Member
Joined
Dec 18, 2013
Messages
132
As i remember, i've just installed bcmath, theres notification on my nextcloud before, about bcmath, so in iocage freenas, i run pkg install bcmath, and after that,my nextcloud error, like above
and here's nextcloud error log :

2021/01/03 02:44:55 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('c72ebbdc1e8b553...', 'SPQ0lwSpkJpdWLk...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'SPQ0lwSpkJpdWLk...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:45:56 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('0219bfb73971071...', 'IOz3qWFBel+qv75...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'IOz3qWFBel+qv75...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:46:56 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('f4c0c8d94acfd06...', 's4mRHCth6/3KEDp...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 's4mRHCth6/3KEDp...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:47:56 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('17771bc37326ed7...', 'Hnd81nwHlafNqhL...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'Hnd81nwHlafNqhL...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:48:56 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('aaff48129b76d04...', 'qqCO5eB1LBd5YSL...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'qqCO5eB1LBd5YSL...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:49:57 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('e1d491dc9b37b47...', 'B0K5F44a4iU04bV...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'B0K5F44a4iU04bV...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:50:57 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('385c709bebf41c3...', '3TjzZXjv8qxp/Lx...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', '3TjzZXjv8qxp/Lx...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:51:57 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('d65aa57e1e8112f...', '4BmUFXDXuzBToKD...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', '4BmUFXDXuzBToKD...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:52:58 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('dd3e879c5be1886...', '6tYgtjM/2QCgX2A...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', '6tYgtjM/2QCgX2A...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:53:58 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('f3fe5940ab80b6f...', 'SfmaQJXErsdmDsN...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'SfmaQJXErsdmDsN...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:54:58 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('005653983e83d76...', '+ykmWTsJrsrD11R...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', '+ykmWTsJrsrD11R...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:55:58 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('2e7d3d5244a71fb...', 'p5usljIngJR/v6w...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'p5usljIngJR/v6w...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:56:59 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('241fc0397c0b381...', 'rqU3wdXkwpFFbmJ...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'rqU3wdXkwpFFbmJ...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
2021/01/03 02:57:59 [ERROR 0 /index.php/] PHP message: PHP Fatal error: Uncaught Error: Call to undefined function OC\Security\hash() in /usr/local/www/nextcloud/lib/private/Security/Crypto.php:76
Stack trace:
#0 /usr/local/www/nextcloud/lib/private/Security/Crypto.php(100): OC\Security\Crypto->calculateHMAC('f1ac9af9094e49b...', 'utgfq6N4kiDjr1k...')
#1 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(180): OC\Security\Crypto->encrypt('{"LAST_ACTIVITY...', 'utgfq6N4kiDjr1k...')
#2 /usr/local/www/nextcloud/lib/private/Session/CryptoSessionData.php(74): OC\Session\CryptoSessionData->close()
#3 [internal function]: OC\Session\CryptoSessionData->__destruct()
#4 {main}
thrown in /usr/local/www/nextcloud/lib/private/Security/Crypto.php on line 76
 

InGenetic

Member
Joined
Dec 18, 2013
Messages
132
here my php module installed :

pkg: unknown command: -

For more information on available commands and options see 'pkg help'.
root@nextcloud:~ # php -m
[PHP Modules]
apcu
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gmp
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
memcache
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
posix
redis
Reflection
session
SimpleXML
SPL
standard
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877

InGenetic

Member
Joined
Dec 18, 2013
Messages
132
You say you just upgraded to Nextcloud 20; when did you create this jail?
on march 2020 , following your script, but today i've just upgraded to nextcloud version 20, when i build nextcloud , at that time nextcloud version was 18

as i remember i run this command on my freenas jail before it's broken :

pkg install php74-bcmath ,
and now if i run : pkg -m , on my freenas jail : shown like below :
pkg: unknown command: -
For more information on available commands and options see ‘pkg help’.
root@nextcloud:~ # php -m
[PHP Modules]
apcu
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gmp
iconv
imagick
imap
intl
json
ldap
libxml
mbstring
memcache
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
posix
redis
Reflection
session
SimpleXML
SPL
standard
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877
What's the output of php -v from inside the jail?
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,877
Maybe the hash package wasn't required with Nextcloud 18. pkg install php73-hash.
 
Top