Github repository for FreeNAS scripts, including disk burnin and rsync support

Github repository for FreeNAS scripts, including disk burnin and rsync support

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Hello, I've been using your scripts for some time, and one that is very useful is the save config! That saved me one or two times. Thank You. One thing that is missing in this script is the saving of the password seed, like in the save config from the GUI interface. That is very useful now with the cloud sync and also with ths SSH key (that I always have to re-import, probably because of this). When I save the config from the GUI, it creates a TAR file with the database and the password seed. Can this be replicated in the batch?

Hi, I myself have been thinking about this addition with another config backup script, the file is at /data/pwenc_secret, however the question is. Do you want this file being emailed to you, which means the password seed leaves your box and goes via the public internet email systems.

Part of me is OK with this, and part of me isn't.....

Just my views.

Jonathan
 

Soloam

Contributor
Joined
Feb 14, 2014
Messages
196
I'm not emailing the config files, the files are being send to a new folder, then I send them by scp to a external location. I understand, but my main concern is to have a problem with my freenas, and not having the seed to uncrypt my cloud sync backups!
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hello, I've been using your scripts for some time, and one that is very useful is the save config! That saved me one or two times. Thank You. One thing that is missing in this script is the saving of the password seed, like in the save config from the GUI interface. That is very useful now with the cloud sync and also with ths SSH key (that I always have to re-import, probably because of this). When I save the config from the GUI, it creates a TAR file with the database and the password seed. Can this be replicated in the batch?

Thank You
Glad to hear these scripts have been usefull to you!

That's a great question! I'll look into it when I have some spare time. I don't remember ever having to use one of my saved config files, and I was under the impression that they contain the passwords. I'll test this theory to find out for certain, and go forward from there.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478

Mr. Slumber

Contributor
Joined
Mar 10, 2019
Messages
182
Thanks for your update Spearfoot!

I'm getting the
Code:
Failed to send email: string payload expected: <class 'list'>
error when using a script of yours. Maybe this is helpful for "bug-hunting".

Thanks again for your work and the scripts! :)
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Spearfoot updated Github repository for FreeNAS scripts, including disk burnin with a new update entry:

Email functionality restored on FreeNAS 11.3-RELEASE

Email was 'broken' for the smart_report.sh and zpool_report.sh scripts on the new FreeNAS 11.3-RELEASE, which it turns out is more fussy than earlier versions were about MIME encoding.

I've modified the code to accommodate the more stringent requirements by adding proper MIME boundaries and have tested on FreeNAS versions 11.2-U8, 11.3-RELEASE, and 11.3-U1.

Please let me know if you have any problems with the updated scripts.

Read the rest of this update entry...
 

Mr. Slumber

Contributor
Joined
Mar 10, 2019
Messages
182
Please let me know if you have any problems with the updated scripts.

Just tried and... wow, it works like a charm (again) @11.3-U1! Thank you very much Spearfoot! :)
 

JohnnyGrey

Dabbler
Joined
Jul 1, 2017
Messages
45
Please let me know if you have any problems with the updated scripts.

I was apparently using a much older version of this, from a user named Biduleohm. That script originally worked great, but stopped working with 11.3. I ended up getting it to work with some trial and error, but the mono-spaced formatting was lost.

I swapped to this, and all is well! (Aside from a drive I have to pull and RMA tomorrow lol)

Quick question, for any who care. Is it all possible to specifically disable text-wrapping? Viewing the email report on my desktop is fantastic, but I occasionally want to read it on my iPhone, and it wraps the text, making it unreadable. I understand this is more of a "first world problem." Is this specific to iOS? I tried lowering the font size to 8 in the script, and it helped, but that poses other readability problems.

And thanks to you for updating this script! I'm about to take a look at the rest of the repo and nab anything useful :)
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I was apparently using a much older version of this, from a user named Biduleohm. That script originally worked great, but stopped working with 11.3. I ended up getting it to work with some trial and error, but the mono-spaced formatting was lost.

I swapped to this, and all is well! (Aside from a drive I have to pull and RMA tomorrow lol)

Quick question, for any who care. Is it all possible to specifically disable text-wrapping? Viewing the email report on my desktop is fantastic, but I occasionally want to read it on my iPhone, and it wraps the text, making it unreadable. I understand this is more of a "first world problem." Is this specific to iOS? I tried lowering the font size to 8 in the script, and it helped, but that poses other readability problems.

And thanks to you for updating this script! I'm about to take a look at the rest of the repo and nab anything useful :)
Hmmm... I tried to force fixed-width whitespace handling, per a GitHub user suggestion, by using this html in the scripts:
Code:
<pre style=\"font-size:14px; white-space:pre\">
Make sure the scripts you pulled from GitHub contain this code. There may be other, better ways to force html parsers not to wrap text that I don't know of. I'm not an html expert and am open to suggestions.
 

JohnnyGrey

Dabbler
Joined
Jul 1, 2017
Messages
45
Hmmm... I tried to force fixed-width whitespace handling, per a GitHub user suggestion, by using this html in the scripts:
Code:
<pre style=\"font-size:14px; white-space:pre\">
Make sure the scripts you pulled from GitHub contain this code. There may be other, better ways to force html parsers not to wrap text that I don't know of. I'm not an html expert and am open to suggestions.

I honestly have no idea! It's likely a limitation on Apple's Mail app on iOS. While I do love my iPhone, I will be the first to admit that the mail App is severely lacking.

Attached is how a recent report looks on my iPhone. Keep in mind this is the one where I manually reduced the font size to 8px in an attempt to prevent this. What's odd is there are lines after the "Summary" that are much longer than the summary, yet the summary itself is being word-wrapped much earlier in the lines.

Nonetheless, I appreciate your response. I have zero knowledge of coding, other than what I can figure out on-the-fly with Google research.
 

Attachments

  • IMG_3872.PNG
    IMG_3872.PNG
    341.7 KB · Views: 535

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
I honestly have no idea! It's likely a limitation on Apple's Mail app on iOS. While I do love my iPhone, I will be the first to admit that the mail App is severely lacking.

Attached is how a recent report looks on my iPhone. Keep in mind this is the one where I manually reduced the font size to 8px in an attempt to prevent this. What's odd is there are lines after the "Summary" that are much longer than the summary, yet the summary itself is being word-wrapped much earlier in the lines.

Nonetheless, I appreciate your response. I have zero knowledge of coding, other than what I can figure out on-the-fly with Google research.
How does it look when you flip your phone over and view it in landscape mode?
 

JohnnyGrey

Dabbler
Joined
Jul 1, 2017
Messages
45
How does it look when you flip your phone over and view it in landscape mode?

Still a mess, although the linebreaks aren't in the same spot. I've tried experimenting with the code by adding
Code:
<div style="width:200px;overflow:visible"></div>
tags into the script, along with changing the width in those tags. I've also tried copying the smart_report.tmp output into an HTML Viewer website, and if I change those tags, along with the white-space type, it behaves exactly how it should. Something behind the scenes i is just going wonky. I changed the script email to my gmail account, and checked it in that app, and although it also word-wraps, it's much more predictable, and is at the edge of the screen. The iOS mail app is word-wrapping in wierd places.

It's no big deal, it's just a quality of life thing lol. I may just try and dissect your code and just use the summary portion, and try and format it for mobile viewing. If I stay within a certain character limit, I can even use it with pushover. (not that it wouldn't work otherwise, but pushover will just truncate the email/message)
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478

Wolfeman0101

Patron
Joined
Jun 14, 2012
Messages
428
So how do I grab all the scripts using git and update them? Sorry I know it's probably a dumb question.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
So how do I grab all the scripts using git and update them? Sorry I know it's probably a dumb question.
You can navigate to the 'Overview' at the top of this page, where the basic resource documentation lives. The link to the GitHub repository is available there. For your convenience, I've also included it below.

When you get to the GitHub repository, press the 'Clone' button and select 'Download ZIP'. This will give you all of the scripts in a zipfile. Extract them and upload them to the appropriate directory on your FreeNAS server. Or if you know how to use git and have it installed on your system, you can use that instead.

Most need to be edited to work on your particular system -- email addresses and directory names and such.

They need to be owned by user root, group wheel, and they need to be executable, so you may need to run chmod +x on them.

Be sure to use an editor that won't dork up the line endings: Window's notepad is notorious for doing this. Linux/FreeBSD/UNIX expect a single line-feed as the end-of-line character; Windows/DOS use a carriage-return/line-feed pair. This difference causes no end of trouble when transporting files between the two operating system environments.

I don't intend to seem patronizing if you already know all this stuff.;)

 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,456
Or if you know how to use git and have it installed on your system,
git is installed on Freenas by default, and it does preserve permissions (assuming they're set properly in the repo in the first place), so a git clone https://github.com/Spearfoot/FreeNAS-scripts would seem the simplest thing to do.
Be sure to use an editor that won't dork up the line endings
...so best to edit the files directly on the FreeNAS box. nano is pretty easy to use, and once again ships with FreeNAS by default.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478

Dice

Wizard
Joined
Dec 11, 2015
Messages
1,410
Trying out the email-configuration-script, I wanted to verify the unpacking of the encoded file.
The suggested command from the github generated errors, google-fu ensued.

The github resource:
"NOTE: Be sure to use a version of OpenSSL matching that used by FreeNAS. FreeNAS version 11.2U8, for example, uses OpenSSL version 1.0.2q-freebsd."

Turns out that matters. However, on my system (5.7.6-arch1-1), the version in used is openssl 1.1.1.g-2
Due to updates, the string for unpacking suggested in the github does no longer work on the most recent version.

Non functional command from the github:
Code:
openssl enc -d -aes-256-cbc -md sha512 -pass file:[passphrase_file] -in [encrypted_file] -out [unencrypted_file]

Functional command:
Code:
openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 10 -pass file:[passphrase_file] -in [encrypted_file] -out [unencrypted_file]


Cheers
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Trying out the email-configuration-script, I wanted to verify the unpacking of the encoded file.
The suggested command from the github generated errors, google-fu ensued.

The github resource:
"NOTE: Be sure to use a version of OpenSSL matching that used by FreeNAS. FreeNAS version 11.2U8, for example, uses OpenSSL version 1.0.2q-freebsd."

Turns out that matters. However, on my system (5.7.6-arch1-1), the version in used is openssl 1.1.1.g-2
Due to updates, the string for unpacking suggested in the github does no longer work on the most recent version.

Non functional command from the github:
Code:
openssl enc -d -aes-256-cbc -md sha512 -pass file:[passphrase_file] -in [encrypted_file] -out [unencrypted_file]

Functional command:
Code:
openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 10 -pass file:[passphrase_file] -in [encrypted_file] -out [unencrypted_file]


Cheers
Yes, FreeNAS (and FreeBSD as well) seem to be lagging behind the rest of the world when it comes to using more recent versions of OpenSSL. I think I mentioned that in the repository documentation.

The command I specified on GitHub works on FreeNAS, but almost certainly will not work in other OpenSSL environments. I may add yours as an example. Thanks!
 
Top