madflojo / efs2 Goto Github PK
View Code? Open in Web Editor NEWA dead-simple configuration management tool powered by stupid shell scripts.
Home Page: https://efs2.sh/
License: MIT License
A dead-simple configuration management tool powered by stupid shell scripts.
Home Page: https://efs2.sh/
License: MIT License
It would be an advantage to have a configuration file where you could write the default in, so you don't have to always give the parameters.
In the HOME directory, look in the .config folder for an efs2
with a file named config.yml.
The structure could be as follows:
verbose: false
ssh_key: ~/.ssh/id_dsa
ssh_port: 2000
ssh_user: root
Maybe it is possible to adjust config/config.go
so that it first searches for the config file, and then reads the parameters of the input from the terminal.
With passphrase on key:
efs2 -i /Users/hbokh/.ssh/id_rsa -v -u root hostname.home
Unable to setup SSH client configuration - Unable to read private key file - ssh: cannot decode encrypted private keys
With empty passphrase on key (host was down hence the other errors):
efs2 -i /Users/hbokh/.ssh/id_rsa_nopassphrase -v -u root hostname.home
linux008.internal:22: Executing task 0 - RUN CMD apt-get update
linux008.internal:22: Error connecting to host - dial tcp 192.168.1.1:22: getsockopt: operation timed out
linux008.internal:22: Error executing command - dial tcp 192.168.1.1:22: getsockopt: operation timed out
Since I only use passphrased keys, this is somewhat of a showstopper for me... Can this be fixed?
The installation of Efs2 should be as easy as possible. For Mac OS, that means getting into the Brew list of installable programs.
Brew has custom taps that can be used to package and distribute Efs2.
https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap
Probably need another issue like this for Linux.
I've a fleet os Raspberry Pi's and smaller less well known devices (Odroid). First boot or first SSH connection of these things oftent goes into an interactive session for initial setup. Completing that workflow before attaching Efs2 for proper post boot setup is a need.
Dialog is a thing that people use. Automating it is a frequent question on Stack Overflow (etc) - https://superuser.com/questions/1041735/automating-dialog - one of the answers links to https://stackoverflow.com/questions/3804577/have-bash-script-answer-interactive-prompts. This seems limited though.
There's https://pypi.org/project/webssh/ which could be used with Selenium (I'm co-creator of v1 back in 2004) to do any timing sensitive navigation of DOM representation of the terminal, and complete that setup.
With that, you'd launch wssh
in the background, open selenlium-webdriver, do the needed one-time setup, exit, kill the wssh process.
Then you'd go back in with Efs2 to o the rest (reset default passwords, packages, etc)
Question: Is this the right approach or does Efs2 have a different way?
Some little devices have something closer to cloud-init for setup, but there's huge variance for the different OSs that can be used.
Currently, only single-line shell commands are supported.
This works:
RUN this command does stuff
This doesn't:
RUN this command \
does stuff
When using multi-line commands, Efs2 should detect the \
and adjust the commands appropriately.
--passwd is part of the CLI. At face value it suggests that it is for the remote account's password, but it is actually for the passphrase of the SSH private key locally.
I would think this would be better as --passphrase or --pki-passphrase
PUT command enhanced like so for new optional way:
PUT """ blah
blah
blah ...""" /etc/nginx/nginx.conf 0644
In some cases items to be PUT on the target vm are short/clear and inlining them might boost the quick learning of the Es2file.
Bookmarking https://github.com/edrevo/dockerfile-plus cos it is interesting and overlaps
An exchange for people wanting to read and contribute to Efs2file scripts that purport to do something useful that others may want to copy.
Some directory structure:
components/
nginx/
static-content/
Efs2file
readme.md
sinatra/
hello-world/
Efs2file
readme.md
applications/
plex-server
default-setup/
Efs2file
readme.md
The Nginx example of the main README could also exist in this directory structure.
Efs2 doesn't purport to provide a language that adapts to apk/apt/rpm differences, so that might need to be codified in the file or directory naming:
applications/
plex-server
default-setup-debian8-and-lower/
Efs2file
readme.md
default-setup-debian9-and-above/
Efs2file
readme.md
After I discovered efs2 shortly I wondered how one could execute arbitrary scripts or programs remotely. Sure you, can
PUT script.sh /tmp/script.sh 0700
RUN /tmp/script.sh; rm /tmp/script.sh
But that seemed not very userfriendly to me.
Then I discovered in that there were once RUN CMD and RUN SCRIPT commands. Now there is only RUN (which is the same as RUN CMD I think). RUN SCRIPT is still there, but undocumented.
Keep RUN SCRIPT and document it.
Suggested Improvement: For security reasons mktemp(1) should be used to create the temporary script on the target.
say, the following works:
RUN CMD cd elasticsearch-6.2.3 && sudo sysctl -w vm.max_map_count=262144
but this will NOT:
RUN CMD cd elasticsearch-6.2.3 && ./bin/elasticsearch -d -p pid
or RUN CMD cd elasticsearch-6.2.3 && ./bin/elasticsearch -d -p pid
but it's a common sense to combine and run like this.
we can parse this line and send to server, I don't think this is difficult, but I am not a gopher so I can't make my hand dirty, hope this can be done in the near future.
:)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.