initial commit
Cette révision appartient à :
révision
9fd17928e2
|
@ -0,0 +1,51 @@
|
|||
masspass
|
||||
===
|
||||
Copyright (c) 2013, Bret R. Human
|
||||
All rights reserved.
|
||||
|
||||
Further documentation can be found at
|
||||
https://psi.cynicaloptimist.me/Caffarius/masspass/
|
||||
Happy modding! -Bret
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
the documentation link and note, this list of conditions, and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. All advertising materials mentioning features or use of this
|
||||
software must display the following acknowledgment:
|
||||
"Built using software developed by Cynical Optimist - https://cynicaloptimist.me
|
||||
Ask what we can build for you at info@cynicaloptimist.me"
|
||||
|
||||
4. The names "Cynical Optimist" and "Bret R. Human" and the software name listed
|
||||
at the top of this document, or the domain "cynicaloptimist.me" or any
|
||||
affiliated service must not be used to endorse or promote products derived
|
||||
from this software without prior written permission. For written permission,
|
||||
contact info@cynicaloptimist.me.
|
||||
|
||||
5. Products derived from this software may not be called the software name
|
||||
listed at the top of this document nor may "Cynical Optimist" or the software
|
||||
name listed at the top of this document appear in their names without prior
|
||||
written permission of Bret R. Human.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"Built using software developed by Cynical Optimist - https://cynicaloptimist.me
|
||||
Ask what we can build for you at info@cynicaloptimist.me"
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,3 @@
|
|||
# masspass
|
||||
|
||||
Quickly change user's password on a list of servers.
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/bash
|
||||
## Copyright © 2013 Bret Human
|
||||
## https://cynicaloptimist.me/
|
||||
##
|
||||
## Documentation at:
|
||||
## https://psi.cynicaloptimist.me/Caffarius/masspass
|
||||
##
|
||||
## For questions or comments write:
|
||||
## info@cynicaloptimist.me
|
||||
#
|
||||
# Uses Expect to massively update root passwords.
|
||||
#
|
||||
# Prereq: Install freaking expect or run it from a server
|
||||
# that already has it.
|
||||
#
|
||||
# You need three additional files. "meh" will have the new
|
||||
# root password to update to. "rmeh" will have the current
|
||||
# root password in it. "serverList.txt" is a list of all
|
||||
# the servers you want updated (one server per line).
|
||||
#
|
||||
# If you don't have an ssh key in your ~/.ssh folder this
|
||||
# is going to be a loooooooooooooooooooooooooooooooooooooo
|
||||
# ooooooooooooooooooooooooooooooooooooong process for you.
|
||||
|
||||
# Username that will login to aaaaaaaaaall the servers.
|
||||
# Yours will do just fine.
|
||||
|
||||
ohYou="foo"
|
||||
|
||||
|
||||
# Your shell may not be my shell. What's the last character
|
||||
# that is output before you can enter a command?
|
||||
# Ex:
|
||||
# root@server#
|
||||
# So "#" in this example is the value we're looking for.
|
||||
|
||||
shellPrompt=">"
|
||||
|
||||
|
||||
# We use flat files with passwords because it can be
|
||||
# secured with chmod and doesn't leave our two biggest
|
||||
# passwords on every clustered server's log files.
|
||||
|
||||
# v File with the new root password you want.
|
||||
meh=`more meh`
|
||||
chmod 400 meh
|
||||
|
||||
|
||||
# v File with the current root password in it.
|
||||
rmeh=`more rmeh`
|
||||
chmod 400 rmeh
|
||||
|
||||
|
||||
# File containing a list of servers to hit:
|
||||
list="~/serverList"
|
||||
|
||||
|
||||
# Use expect to, errr, expect things. Then do things!
|
||||
while read thisHereServer; do
|
||||
expect -c "
|
||||
spawn ssh -o StrictHostKeyChecking=no -o CheckHostIP=no $ohYou@$thisHereServer
|
||||
expect \"$shellPrompt\"
|
||||
send \"ssu\n\"
|
||||
expect \"$shellPrompt\"
|
||||
send \"passwd root\n\"
|
||||
expect \"assword:\"
|
||||
send \"$meh\n\"
|
||||
expect \"assword:\"
|
||||
send \"$meh\n\"
|
||||
expect \"$shellPrompt\"
|
||||
send \"exit\n\""
|
||||
done < $list
|
||||
|
||||
|
||||
# Cleanup
|
||||
rm meh
|
||||
rm rmeh
|
Chargement…
Référencer dans un nouveau ticket