public void SetAuthUserPass(string username, string password) { if (PasswordAuthFile != null) { PasswordAuthFile.Close(); PasswordAuthFile = null; } PasswordAuthFile = new TemporaryFile("ppw"); string fileNameAuthOvpn = PasswordAuthFile.Path; string fileNameData = username + "\n" + password + "\n"; Platform.Instance.FileContentsWriteText(fileNameAuthOvpn, fileNameData); Platform.Instance.FileEnsurePermission(fileNameAuthOvpn, "600"); Platform.Instance.FileEnsureOwner(fileNameAuthOvpn); OpenVpnProfileStartup.AppendDirective("auth-user-pass", OpenVpnProfileStartup.EncodePath(fileNameAuthOvpn), "Auth"); }
public void CleanAfterStart() { if (OvpnFile != null) { OvpnFile.Close(); OvpnFile = null; } if (ManagementPasswordFile != null) { ManagementPasswordFile.Close(); ManagementPasswordFile = null; } if (ProxyAuthFile != null) { ProxyAuthFile.Close(); ProxyAuthFile = null; } }
public void InitStart() { OvpnFile = new TemporaryFile("ovpn"); Platform.Instance.FileContentsWriteText(OvpnFile.Path, OpenVpnProfileStartup.Get(), Encoding.UTF8); }
public static void Add(TemporaryFile file) { m_files.Add(file); }