| 1186 | file.commit() |
| 1187 | |
| 1188 | def del_l2tp_ipsec_user(self, user, obj): |
| 1189 | userfound = False |
| 1190 | password = obj['password'] |
| 1191 | userentry = "%s * %s *" % (user, password) |
| 1192 | |
| 1193 | logging.debug("Deleting the user '%s'" % user) |
| 1194 | file = CsFile(self.PPP_CHAP) |
| 1195 | file.deleteLine(userentry) |
| 1196 | file.commit() |
| 1197 | |
| 1198 | if not os.path.exists('/var/run/pppd2.tdb'): |
| 1199 | return |
| 1200 | |
| 1201 | logging.debug("killing the PPPD process for the user '%s'" % user) |
| 1202 | |
| 1203 | fileContents = CsHelper.execute("tdbdump /var/run/pppd2.tdb") |
| 1204 | for line in fileContents: |
| 1205 | if user in line: |
| 1206 | contentlist = line.split(';') |
| 1207 | for str in contentlist: |
| 1208 | pppd = str.split('=')[0] |
| 1209 | if pppd == 'PPPD_PID': |
| 1210 | pid = str.split('=')[1] |
| 1211 | if pid: |
| 1212 | logging.debug("killing process %s" % pid) |
| 1213 | CsHelper.execute('kill -9 %s' % pid) |
| 1214 | |
| 1215 | |
| 1216 | class CsRemoteAccessVpn(CsDataBag): |