Below is the file 'client/plugins/opensshconfig.py' from this revision. You can also download the file.


import os
from phonehome import urgency

sshd_config_locations = ('/etc/ssh/sshd_config', '/etc/sshd_config')

def run():
    results = []
    def find_sshd_config():
	for loc in sshd_config_locations:
	    if os.access(loc, os.R_OK):
		return loc
	return None
    sshd_config_file = find_sshd_config()
    if sshd_config_file is None:
	results.append((urgency['info'], 'Could not find SSH daemon config, OpenSSH not installed?'))
	return results
    for line in open(sshd_config_file):
	line = line.strip().lower()
	fields = [t for t in line.split(' ') if t]
	if len(fields) != 2:
	    continue
	key, value = fields
	if key == 'permitrootlogin':
	    if value == 'yes':
		results.append((urgency['alert'], "Root may log in using a password."))
    return results