Exemple #1
0
        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");
        }
Exemple #2
0
        public void CleanAfterStart()
        {
            if (OvpnFile != null)
            {
                OvpnFile.Close();
                OvpnFile = null;
            }

            if (ManagementPasswordFile != null)
            {
                ManagementPasswordFile.Close();
                ManagementPasswordFile = null;
            }

            if (ProxyAuthFile != null)
            {
                ProxyAuthFile.Close();
                ProxyAuthFile = null;
            }
        }
Exemple #3
0
        public void InitStart()
        {
            OvpnFile = new TemporaryFile("ovpn");

            Platform.Instance.FileContentsWriteText(OvpnFile.Path, OpenVpnProfileStartup.Get(), Encoding.UTF8);
        }
Exemple #4
0
 public static void Add(TemporaryFile file)
 {
     m_files.Add(file);
 }