Changeset 344 for trunk/packages/sipb-xen-console
- Timestamp:
- Mar 30, 2008, 5:09:46 AM (17 years ago)
- Location:
- trunk/packages/sipb-xen-console
- Files:
-
- 5 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-console/debian/changelog
r335 r344 1 sipb-xen-console (2) unstable; urgency=low 2 3 * Actually functional release. 4 5 -- SIPB Xen Project <sipb-xen@mit.edu> Sun, 30 Mar 2008 05:07:43 -0400 6 1 7 sipb-xen-console (1) unstable; urgency=low 2 8 -
trunk/packages/sipb-xen-console/debian/control.in
r335 r344 10 10 Provides: ${diverted-files} 11 11 Conflicts: ${diverted-files} 12 Depends: ${shlibs:Depends}, ${misc:Depends}, fuse-utils, libnss-pgsql1, openssh-client, openssh-server, python-fuse, sipb-xen-database-common12 Depends: ${shlibs:Depends}, ${misc:Depends}, daemon, fuse-utils, libnss-pgsql1, nscd, openssh-client, openssh-server, python-fuse, sipb-xen-database-common 13 13 Description: SIPB Xen serial console server 14 14 This package should be installed on sipb-xen-console -
trunk/packages/sipb-xen-console/debian/rules
r335 r344 4 4 DEB_DIVERT_EXTENSION = .sipb-xen 5 5 DEB_DIVERT_FILES_sipb-xen-console += \ 6 /etc/nsswitch.conf 6 /etc/nscd.conf \ 7 /etc/nsswitch.conf \ 8 /etc/pam.d/ssh \ 7 9 /etc/ssh/ssh_config 8 10 -
trunk/packages/sipb-xen-console/debian/sipb-xen-console.init
r335 r344 64 64 # Many daemons don't delete their pidfiles when they exit. 65 65 rm -f $PIDFILE 66 umount "$DAEMON_ARGS" 66 67 return "$RETVAL" 67 68 } -
trunk/packages/sipb-xen-console/files/etc/nss-pgsql.conf
r335 r344 6 6 database = sipb_xen 7 7 login = sipb-xen 8 #passwd = foo9 #passwdtable = machines10 #grouptable = machines11 # you can use anything postgres accepts as table expression12 #groupmembertable = accounts JOIN usergroups ON accounts.uid=usergroups.uid JOIN groups ON usergroups.gid=groups.gid13 8 14 querypasswd = SELECT name, 'moo', 1000 as uid, 1000, '', '/vmhome/'|| name, '/usr/local/bin/sipb-xen-consolesh' FROM machines15 querygroup = SELECT name, NULL, 1000 as gid FROM machines16 querymembers = SELECT name FROM machines WHERE 1000 = %d17 queryids = SELECT 1000 AS gid FROM machines LIMIT 0;9 querypasswd = SELECT name, NULL, machine_id + 1000 as uid, machine_id + 1000 as gid, '', '/consolefs/'|| name, '/usr/bin/sipb-xen-consolesh' FROM machines 10 querygroup = SELECT name, NULL, machine_id + 1000 as gid FROM machines 11 querymembers = SELECT name FROM machines WHERE 1000 + machine_id = %d 12 queryids = SELECT 1000 + machine_id AS gid FROM machines LIMIT 0 18 13 19 14 passwd_name = name 20 passwd_uid = uid15 passwd_uid = 1000 + machine_id 21 16 22 17 group_name = name 23 group_gid = gid18 group_gid = 1000 + machine_id -
trunk/packages/sipb-xen-console/files/etc/nsswitch.conf.sipb-xen
r335 r344 6 6 7 7 passwd: compat pgsql 8 group: compat 8 group: compat pgsql 9 9 shadow: compat 10 10 -
trunk/packages/sipb-xen-console/files/etc/ssh/ssh_config.sipb-xen
r335 r344 18 18 19 19 Host * 20 Se tEnv VM_NAME20 SendEnv VM_NAME 21 21 # ForwardAgent no 22 22 # ForwardX11 no -
trunk/packages/sipb-xen-console/files/usr/bin/sipb-xen-consolefs
r335 r344 11 11 # - note: these must be returned as negatives 12 12 13 import sipb_xen_database 14 13 15 fuse.fuse_python_api = (0, 2) 14 16 15 machines = ['moo17', 'remus']16 17 realpath = "/home/machines/" 17 uid = 100018 18 19 19 def dirFromList(list): … … 48 48 self.st_dev = 0 49 49 self.st_nlink = 0 50 self.st_uid = uid50 self.st_uid = 0 51 51 self.st_gid = 0 52 52 self.st_size = 0 … … 64 64 def __init__(self, *args, **kw): 65 65 Fuse.__init__(self, *args, **kw) 66 self.lasttime = time() 67 self.allow_other = 1 66 68 print 'Init complete.' 67 69 68 70 def mirrorPath(self, path): 69 71 return realpath + "/".join(getParts(path)[1:]) 72 73 def getMachines(self): 74 if time() - self.lasttime > 15: 75 self.lasttime = time() 76 sipb_xen_database.clear_cache() 77 return [machine.name for machine in sipb_xen_database.Machine.select()] 78 79 def getUid(self, machine_name): 80 return sipb_xen_database.Machine.get_by(name=machine_name).machine_id + 1000 81 82 def getK5login(self, machine_name): 83 machine = sipb_xen_database.Machine.get_by(name=machine_name) 84 users = [acl.user for acl in machine.acl] 85 return "\n".join(map(self.userToPrinc, users) + ['']) 86 87 def userToPrinc(self, user): 88 if '@' in user: 89 (princ, realm) = user.split('@') 90 else: 91 princ = user 92 realm = "ATHENA.MIT.EDU" 93 94 return princ.replace('.', '/') + realm 70 95 71 96 def getattr(self, path): … … 94 119 st.st_nlink = 2 95 120 elif depth == 1: 96 if parts[-1] in machines:121 if parts[-1] in self.getMachines(): 97 122 st.st_mode = stat.S_IFDIR | 0755 98 123 st.st_nlink = 2 124 st.st_uid = st.st_gid = self.getUid(parts[0]) 99 125 else: 100 126 return -errno.ENOENT … … 102 128 st.st_mode = stat.S_IFREG | 0444 103 129 st.st_nlink = 1 104 st.st_size = 17 130 st.st_size = len(self.getK5login(parts[0])) 131 st.st_uid = st.st_gid = self.getUid(parts[0]) 105 132 else: 106 st = os.lstat(self.mirrorPath(path)) 133 stats = list(os.lstat(self.mirrorPath(path))) 134 stats[4:6] = [self.getUid(parts[0])] * 2 135 return tuple(stats) 107 136 return st.toTuple() 108 137 109 138 def readdir(self, path, offset): 110 139 print '*** readdir', path, offset 140 for (value, zero) in self.getdir(path): 141 yield fuse.Direntry(value) 142 143 def getdir(self, path): 144 print '*** getdir', path 111 145 if path == '/': 112 for r in ['.', '..']+machines: 113 yield fuse.Direntry(r) 146 contents = ['.', '..']+self.getMachines() 114 147 elif getDepth(path) == 1: 115 for r in set(os.listdir(self.mirrorPath(path)) + ['.k5login']): 116 yield fuse.Direntry(r) 148 contents = set(os.listdir(self.mirrorPath(path)) + ['.k5login', '.', '..']) 117 149 else: 118 for r in os.listdir(self.mirrorPath(path)):119 yield fuse.Direntry(r)150 contents = os.listdir(self.mirrorPath(path)) + ['.', '..'] 151 return [(i, 0) for i in contents] 120 152 121 153 def read ( self, path, length, offset ): 122 154 print '*** read', path, length, offset 123 155 156 parts = getParts(path) 157 124 158 if getDepth(path) < 2: 125 159 return -errno.ENOENT 126 elif getParts(path)[1:] == ['.k5login']: 127 pass 160 elif parts[1:] == ['.k5login']: 161 if parts[0] not in self.getMachines(): 162 return -errno.ENOENT 163 else: 164 return self.getK5login(parts[0])[offset:length + offset] 128 165 else: 129 166 fname = self.mirrorPath(path) … … 136 173 137 174 if __name__ == '__main__': 175 sipb_xen_database.connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen') 138 176 usage=""" 139 177 ConsoleFS [mount_path]
Note: See TracChangeset
for help on using the changeset viewer.