Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | Minio: Installation and CertBot enhancements + new globals function #1522

Merged
merged 5 commits into from
Feb 20, 2018

Conversation

MichaIng
Copy link
Owner

@MichaIng MichaIng commented Feb 17, 2018

  • Should not be the case, but installation failed on my test system due to missing /usr/local/bin/. Create now on demand.
  • Do not "add" Minio defaults to existing defaults file, causing doubled entries. Preserving existing config file now.
  • Enhance security during Minio cert copy.
  • Introduce new dietpi-globals function to carefully add setting to config file.
  • As result of experiments and shellcheck.net, <check> && <command> || <command> does not necessarily work as "if then else", thus should be replaced by if <check>; then <command> else, respectively the new [ PRESERVE=1 ] G_CONFIG_INJECT <setting_pattern> <setting_value_string> <file_name> [ <after_line_pattern> ].

+ DietPi-Software | Minio: Tiny installation enhancements
@MichaIng MichaIng added this to the v6.2 milestone Feb 17, 2018
@MichaIng MichaIng self-assigned this Feb 17, 2018
+ DietPi-Globals | Add G_CONFIG_INJECT to carefully change/add settings to config files, respecting/replacing old/commented values.
@MichaIng MichaIng changed the title DietPi-Software | Minio: Tiny installation enhancements DietPi-Software | Minio: Installation and CertBot enhancements + new globals function Feb 18, 2018
+ Tiny, as "<if> && <then> || <else>" does not necessarily work like if, then, else.
+ DietPi-LetsEncrypt | Minio: Enhanced security during cert copy
@MichaIng MichaIng requested a review from Fourdee February 18, 2018 00:28
@MichaIng
Copy link
Owner Author

MichaIng commented Feb 18, 2018

@Fourdee
Ready to merge from my side.

There is still work left on Minio, but need some time/ideas for this until v6.3:

  • Documentation on DietPi forum is still missing:
    • Default access: <local_IP>:9000
    • One has to adjust the Minio config file to set login key and secret. There might be default values, but at least I couldn't find them.
  • We could add 'dietpi' 'dietpi123' (8 digits at least for secret) or something as default.
  • Via dietpi-letsencrypt we set Minio to listen to port 443, which breaks other webservers, at least if configured for HTTPS as well. We could leave port 9000, even for HTTPS (basically works), but I have no idea about this Amazon S3 or something, that seems to be used in combination with Minio, might expect Minio HTTPS on port 443. For this reason, without further knowledge, I will leave it as advised by Minio docs.
  • If we do stay with Minio 443, we need to warn users on parallel webserver + Minio installation, that both cannot be configured to use HTTPS, at least not without manual Minio port adjustment.

+ whoopsie
@Fourdee
Copy link
Collaborator

Fourdee commented Feb 18, 2018

@MichaIng

G_CONFIG_INJECT

Great idea, i've been thinking of doing this for a while, you beat me to it 👍

The only reason I havn't done this is due to the following:

  • Sometimes we need to check for spaces at start/end of pattern (eg: dpkg --get-selections), else we have a chance of incorrect pattern match, because of this, I found it quicker (and more specific) to simply create the sed match as needed per item.
  • Sometimes we need to check for 1st item in line, others not the case (same as above).
  • I believe you'll need to export/define 4 variables, as the current $1 $2 etc, will ignore the string and only detect spaces
root@DietPi:~# echo -e "test 1" "test 2" | awk '{print $2}'
1

Maybe we would need something like?

FP_FILE='/etc/somefile'
INPUT_STRING='alsa = 1'
OUTPUT_STRING='alsa = 500;'
FIRST_ITEM_ON_LINE=1 #(^)
SPACE_BEFORE=0 #[[:space:]]
SPACE_AFTER=1 #[[:space:]]

#Then
G_DO_IT

I'll nudge this to v6.3, believe we need to assess this in more depth?

@Fourdee Fourdee modified the milestones: v6.2, v6.3 Feb 18, 2018
@MichaIng
Copy link
Owner Author

MichaIng commented Feb 18, 2018

@Fourdee
For now I just planned this for config files with known settings strings (so no awk necessary usually). There it makes sense to carefully check for existing setting and commented setting as well (to put it to right position in file and prevent doubled entries (even just on commented + one uncommented at end of file).

If somehow we want to inject outputs of dpkg --get-selections and others, this currently should work as G_CONFIG_INJECT 'package_name =' "package name = $(dpkg --get-selections | grep -m1 'linux-image' | awk '{print $1}')" "$filename", as variables/outputs will be expended before handled within function. Or to be sure first assign (local) setting="package_name = $(dpkg --get-selections | grep -m1 'linux-image' | awk '{print $1}')" and give "$setting" as second argument.

Yeah, but as it is not yet tested too intense (just tried around with several constellations of prefer-family = ... with and/or without comments, in /etc/wgetrc, 'MINIO_OPTS="--address :...' in /etc/default/minio another test file. For that reason I put it under "DEV" functions for now 😉.

Could be added, as I tested intense for the 2 places implemented in PR and as PR enhances Minio+CertBot a bit. But nothing critical indeed, so v6.3 would be good as well. I leave this to you 🙂.

@Fourdee Fourdee modified the milestone: v6.3 Feb 18, 2018
@Fourdee
Copy link
Collaborator

Fourdee commented Feb 20, 2018

@MichaIng

For that reason I put it under "DEV" functions for now

Ah, i see. Yep thats fine. Ok lets get this merged, we can always tweak the new global at a later date if needed.

Copy link
Collaborator

@Fourdee Fourdee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Fourdee Fourdee merged commit adf4fca into testing Feb 20, 2018
@Fourdee
Copy link
Collaborator

Fourdee commented Feb 20, 2018

@MichaIng

Legend, many thanks 👍

@MichaIng MichaIng deleted the minio branch February 20, 2018 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants