Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
No hardcoded passwords.
  - If for some reason the cmdLine json doesn't contain the password key, which is almost impossible to happen,
    we generate a password based on other unique data per VPC
  • Loading branch information
wilderrodrigues committed Feb 10, 2015
commit 4a012dd3091a81c1272cafcb7118a84815d77805
13 changes: 12 additions & 1 deletion systemvm/patches/debian/config/opt/cloud/bin/cs/CsDatabag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import hashlib
from merge import DataBag


Expand Down Expand Up @@ -131,4 +132,14 @@ def get_router_id(self):
def get_router_password(self):
if "router_password" in self.idata():
return self.idata()['router_password']
return "k3ep@liv3D"

'''
Generate a password based on the router id just to avoid hard-coded passwd.
Remark: if for some reason 1 router gets configured, the other one will have a different password.
This is slightly difficult to happen, but if it does, destroy the router with the password generated with the
code below and restart the VPC with out the clean up option.
'''
passwd = "%s-%s" % (self.get_vpccidr, self.get_router_id())
md5 = hashlib.md5()
md5.update(passwd)
return md5.hexdigest()