Merge branch 'master' of ssh://git.fedorahosted.org/git/fedora-infrastructure
Conflicts: fas/TODO
This commit is contained in:
commit
61fea46311
4 changed files with 58 additions and 3 deletions
4
fas/TODO
4
fas/TODO
|
@ -1,4 +1,6 @@
|
||||||
Things to Fix in FAS2 before declaring it done:
|
Things to Fix in FAS2 before declaring it done:
|
||||||
|
|
||||||
|
* fasClient.py: Proper logging
|
||||||
|
|
||||||
Nice-to-have things:
|
Nice-to-have things:
|
||||||
* Easy searching within groups (and sponsor/admin interface)
|
* fas/group.py: Easy searching within groups (and sponsor/admin interface)
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
[global]
|
[global]
|
||||||
|
; url - Location to fas server
|
||||||
url = http://localhost:8088/accounts/
|
url = http://localhost:8088/accounts/
|
||||||
|
|
||||||
|
; temp - Location to generate files while user creation process is happening
|
||||||
temp = /var/db
|
temp = /var/db
|
||||||
|
|
||||||
|
; login - username to contact fas
|
||||||
login = admin
|
login = admin
|
||||||
|
|
||||||
|
; password - password for login name
|
||||||
password = admin
|
password = admin
|
||||||
|
|
||||||
[host]
|
[host]
|
||||||
|
@ -22,8 +29,15 @@ restricted_groups = sysadmin
|
||||||
ssh_restricted_groups =
|
ssh_restricted_groups =
|
||||||
|
|
||||||
[users]
|
[users]
|
||||||
# default user info
|
; default shell given to people in [host] groups
|
||||||
shell = /bin/bash
|
shell = /bin/bash
|
||||||
|
|
||||||
|
; home - the location for fas user home dirs
|
||||||
home = /home/fedora
|
home = /home/fedora
|
||||||
|
|
||||||
|
; home_backup_dir - Location home dirs should get moved to when a user is
|
||||||
|
; deleted this location should be tmpwatched
|
||||||
|
home_backup_dir = /tmp/fedora
|
||||||
|
|
||||||
ssh_restricted_app =
|
ssh_restricted_app =
|
||||||
restricted_shell = /sbin/nologin
|
restricted_shell = /sbin/nologin
|
||||||
|
|
|
@ -65,6 +65,11 @@ parser.add_option('--nohome',
|
||||||
default = False,
|
default = False,
|
||||||
action = 'store_true',
|
action = 'store_true',
|
||||||
help = _('Do not create home dirs'))
|
help = _('Do not create home dirs'))
|
||||||
|
parser.add_option('--nossh',
|
||||||
|
dest = 'no_ssh_keys',
|
||||||
|
default = False,
|
||||||
|
action = 'store_true',
|
||||||
|
help = _('Do not create ssh keys'))
|
||||||
|
|
||||||
parser.add_option('-s', '--server',
|
parser.add_option('-s', '--server',
|
||||||
dest = 'FAS_URL',
|
dest = 'FAS_URL',
|
||||||
|
@ -271,6 +276,37 @@ class MakeShellAccounts(BaseClient):
|
||||||
copytree('/etc/skel/', home_dir)
|
copytree('/etc/skel/', home_dir)
|
||||||
os.path.walk(home_dir, _chown, [person['id'], person['id']])
|
os.path.walk(home_dir, _chown, [person['id'], person['id']])
|
||||||
|
|
||||||
|
def remove_stale_homedirs(self):
|
||||||
|
''' Remove homedirs of users that no longer have access '''
|
||||||
|
home_base = config.get('users', 'home')
|
||||||
|
try:
|
||||||
|
home_backup_dir = config.get('users', 'home_backup_dir')
|
||||||
|
except ConfigParser.NoOptionError:
|
||||||
|
home_backup_dir = '/var/tmp/'
|
||||||
|
users = os.listdir(home_base)
|
||||||
|
for user in users:
|
||||||
|
if not self.valid_user(user):
|
||||||
|
if not os.path.exists(home_backup_dir):
|
||||||
|
os.makedirs(home_backup_dir)
|
||||||
|
syslog.syslog('Backed up %s to %s' % (user, home_backup_dir))
|
||||||
|
move(os.path.join(home_base, user), os.path.join(home_backup_dir, user))
|
||||||
|
|
||||||
|
def create_ssh_keys(self):
|
||||||
|
''' Create ssh keys '''
|
||||||
|
home_base = config.get('users', 'home')
|
||||||
|
for person in self.people:
|
||||||
|
username = person['username']
|
||||||
|
if self.valid_user(username):
|
||||||
|
ssh_dir = os.path.join(home_base, username, '.ssh')
|
||||||
|
if person['ssh_key']:
|
||||||
|
if not os.path.exists(ssh_dir):
|
||||||
|
os.makedirs(ssh_dir, mode=0700)
|
||||||
|
f = open(os.path.join(ssh_dir, 'authorized_keys'), 'w')
|
||||||
|
f.write(person['ssh_key'])
|
||||||
|
f.close()
|
||||||
|
os.chmod(os.path.join(ssh_dir, 'authorized_keys'), 0600)
|
||||||
|
os.path.walk(ssh_dir, _chown, [person['id'], person['id']])
|
||||||
|
|
||||||
def enable():
|
def enable():
|
||||||
temp = tempfile.mkdtemp('-tmp', 'fas-', config.get('global', 'temp'))
|
temp = tempfile.mkdtemp('-tmp', 'fas-', config.get('global', 'temp'))
|
||||||
|
|
||||||
|
@ -334,6 +370,9 @@ if __name__ == '__main__':
|
||||||
fas.install_shadow_db()
|
fas.install_shadow_db()
|
||||||
if not opts.no_home_dirs:
|
if not opts.no_home_dirs:
|
||||||
fas.create_homedirs()
|
fas.create_homedirs()
|
||||||
|
fas.remove_stale_homedirs()
|
||||||
|
if not opts.no_ssh_keys:
|
||||||
|
fas.create_ssh_keys()
|
||||||
fas.rm_tempdir()
|
fas.rm_tempdir()
|
||||||
if not (opts.install or opts.enable or opts.disable):
|
if not (opts.install or opts.enable or opts.disable):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
|
@ -355,7 +355,7 @@ forward to working with you!
|
||||||
turbomail.enqueue(message)
|
turbomail.enqueue(message)
|
||||||
person.password = newpass['hash']
|
person.password = newpass['hash']
|
||||||
turbogears.flash(_('Your password has been emailed to you. Please log in with it and change your password'))
|
turbogears.flash(_('Your password has been emailed to you. Please log in with it and change your password'))
|
||||||
turbogears.redirect('/login')
|
turbogears.redirect('/user/changepass')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
turbogears.flash(_("The username '%s' already Exists. Please choose a different username.") % username)
|
turbogears.flash(_("The username '%s' already Exists. Please choose a different username.") % username)
|
||||||
turbogears.redirect('/user/new')
|
turbogears.redirect('/user/new')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue