Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Simple ruby gem to copy and reindex ElasticSearch index, copying index settings and mapping(s).
Progress and time estimation is displayed during the scrolling process.
Refer to script's help:
$ ./es-reindex.rb -h
Script to copy particular ES index including its (re)creation w/options set
and mapping copied.
Usage:
./es-reindex [options] [source_url/]<index> [destination_url/]<index>
- -r - remove the index in the new location first
- -f - specify frame size to be obtained with one fetch during scrolling
- -u - update existing documents (default: only create non-existing)
- -nm - don't copy mappings and settings
- optional source/destination urls default to http://127.0.0.1:9200
You can also use it as a PORO:
# Options:
# remove: same as -r
# frame: same as -f
# update: same as -u cli option
options = {
remove: true,
update: true
}
ESReindex.copy! 'http://my_server/index', 'http://my_server/index_copy', options
If you want to reindex the destination from the source without copying the mappings/settings from the source, you can do it as such:
ESReindex.reindex! 'http://my_server/index', 'http://my_server/index_copy',
mappings: -> { set_of_mappings },
settings: -> { set_of_settings}
If using the .reindex!
method, you MUST pass valid mappings/settings in via the options.
There also a set of callbacks you can use:
ESReindex.copy! 'http://my_server/index', 'http://my_server/index_copy',
before_create: -> { do_something }, # Runs before the (re)creation of the destination index
after_create: -> { do_something_else }, # Runs after the (re)creation of the destinatino index
before_each: ->doc { use_the doc }, # Runs before each document is copied
after_each: ->doc { foo_bar doc }, # Runs after each document is copied
after_copy: -> { finish_thing } # Runs after everything is copied over
You can also use the :if
or :unless
callbacks to prevent the copy/reindexing from occuring if conditions are (un)met. The source client and destination client are passed in:
ESReindex.copy! 'http://my_server/index', 'http://my_server/index_copy',
if: ->(sclient,dclient) { Time.now.hour > 20 }, # Only copy the indexes if it's after 8pm
unless: ->(sclient,dclient) { Time.now.strftime("%A") == "Friday" } # Never copy on Fridays
For a more practical example, see the reindex integration specs.
The full changelog is available here.
Original script:
Developed by Mojo Lingo.
es-reindex the gem is copyright (c)2014 Mojo Lingo, and released under the terms of the MIT license. See the LICENSE file for the gory details.
es-reindex is copyright (c)2012 Jiri Nemecek, and released under the terms of the MIT license. See the LICENSE file for the gory details.
FAQs
Unknown package
We found that es-reindex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.