├── COPYING
├── Makefile
├── README.md
├── debian
├── changelog
├── compat
├── control
├── copyright
├── install
├── postinst
├── rules
└── source
│ └── format
├── makepot
├── pia-manager.pot
├── test
└── usr
├── bin
└── pia-manager
├── lib
└── pia-manager
│ ├── apply-pia-configuration
│ └── pia-manager.py
└── share
├── applications
└── pia-manager.desktop
├── glib-2.0
└── schemas
│ └── com.pia.manager.gschema.xml
├── icons
└── hicolor
│ ├── 16x16
│ └── apps
│ │ └── pia-manager.png
│ ├── 22x22
│ └── apps
│ │ └── pia-manager.png
│ ├── 24x24
│ └── apps
│ │ └── pia-manager.png
│ ├── 32x32
│ └── apps
│ │ └── pia-manager.png
│ ├── 48x48
│ └── apps
│ │ └── pia-manager.png
│ ├── 96x96
│ └── apps
│ │ └── pia-manager.png
│ └── scalable
│ └── actions
│ ├── pia-manager-lock-symbolic.svg
│ ├── pia-manager-user-symbolic.svg
│ └── pia-manager-view-password-symbolic.svg
├── pia-manager
├── ca.crt
├── crl.pem
├── gateways.list
├── logo.png
└── main.ui
└── polkit-1
└── actions
└── com.pia.manager.policy
/COPYING:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | all: buildmo
2 |
3 | buildmo:
4 | @echo "Building the mo files"
5 | # WARNING: the second sed below will only works correctly with the languages that don't contain "-"
6 | for file in `ls po/*.po`; do \
7 | lang=`echo $$file | sed 's@po/@@' | sed 's/.po//' | sed 's/pia-manager-//'`; \
8 | install -d usr/share/locale/$$lang/LC_MESSAGES/; \
9 | msgfmt -o usr/share/locale/$$lang/LC_MESSAGES/pia-manager.mo $$file; \
10 | done \
11 |
12 | clean:
13 | rm -rf usr/share/locale
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # A VPN configuration tool for PIA (Private Internet Access).
2 |
3 | ## Dependencies
4 | - openvpn
5 | - networkmanager
6 | - networkmanager-openvpn
7 | - python3-proctitle
8 |
9 |
--------------------------------------------------------------------------------
/debian/changelog:
--------------------------------------------------------------------------------
1 | pia-manager (1.0.8) tara; urgency=medium
2 |
3 | [ Elias Ojala ]
4 | * Fixed a typo (#10)
5 |
6 | [ Clement Lefebvre ]
7 | * Update the list of gateways
8 | * Sort the gateways alphabetically
9 |
10 | -- Clement Lefebvre Mon, 22 Oct 2018 14:27:03 +0100
11 |
12 | pia-manager (1.0.7) tara; urgency=medium
13 |
14 | * Fix wrong user in polkit policy
15 |
16 | -- Clement Lefebvre Thu, 09 Aug 2018 17:40:05 +0200
17 |
18 | pia-manager (1.0.6) sylvia; urgency=medium
19 |
20 | * Remember the username/password/gateway
21 |
22 | -- Clement Lefebvre Wed, 13 Dec 2017 15:51:31 +0000
23 |
24 | pia-manager (1.0.5) sylvia; urgency=medium
25 |
26 | * Gateways: Add South Korea and Chicago
27 |
28 | -- Clement Lefebvre Wed, 25 Oct 2017 14:15:22 +0100
29 |
30 | pia-manager (1.0.4) sylvia; urgency=medium
31 |
32 | * Update package description
33 |
34 | -- Clement Lefebvre Mon, 02 Oct 2017 11:39:50 +0100
35 |
36 | pia-manager (1.0.3) sylvia; urgency=medium
37 |
38 | [ Clement Lefebvre ]
39 | * Run PIA Manager in user mode
40 |
41 | -- Clement Lefebvre Mon, 02 Oct 2017 11:07:51 +0100
42 |
43 | pia-manager (1.0.2) sonya; urgency=medium
44 |
45 | * Help: Make sure the path exists
46 |
47 | -- Clement Lefebvre Mon, 08 May 2017 11:08:56 +0100
48 |
49 | pia-manager (1.0.1) serena; urgency=medium
50 |
51 | [ Clement Lefebvre ]
52 | * Removed temp file
53 | * Continued implementation
54 | * Finished initial implementation
55 | * Added dependencies on needed vpn packages
56 | * Gateways: Removed Russia (following decision from PIA)
57 |
58 | [ Daniel Oaks ]
59 | * Allow users to update their list of gateways
60 | * Update icons to newer PIA logo
61 |
62 | [ Clement Lefebvre ]
63 | * Remove trailing spaces
64 | * Embed the ability to reveal the password into the password entry
65 | * test script: call pia-manager with sudo
66 | * Add "forgot password?" link
67 | * Use symbolic icons
68 | * Move the ability to refresh gateways into the UI
69 | * Update l10n infrastructure
70 | * Set the process name
71 | * Add a menubar
72 | * Add help->contents
73 | * Add about dialog
74 | * Add File->Quit
75 | * Implement the option to skip DNS resolution
76 |
77 | [ leigh123linux ]
78 | * Create COPYING
79 | * Rename pia-manager.desktop.desktop to pia-manager.desktop
80 |
81 | [ Clement Lefebvre ]
82 | * Change the way NetworkManager is restarted
83 | * Add an infobar
84 | * Don't restrict access to the connection to a single user
85 |
86 | -- Clement Lefebvre Thu, 15 Dec 2016 13:47:28 +0000
87 |
88 | pia-manager (1.0.0) sarah; urgency=medium
89 |
90 | * Initial version
91 |
92 | -- Clement Lefebvre Tue, 12 Apr 2016 12:15:00 +0000
93 |
--------------------------------------------------------------------------------
/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/debian/control:
--------------------------------------------------------------------------------
1 | Source: pia-manager
2 | Section: admin
3 | Priority: optional
4 | Maintainer: Clement Lefebvre
5 | Build-Depends: debhelper (>= 9), python
6 | Standards-Version: 3.9.5
7 |
8 | Package: pia-manager
9 | Architecture: all
10 | Depends: python3, openvpn, network-manager-openvpn, network-manager-openvpn-gnome, python3-setproctitle
11 | Description: Easily configure your Private Internet Access VPN
12 | Configure your PIA VPN.
13 |
--------------------------------------------------------------------------------
/debian/copyright:
--------------------------------------------------------------------------------
1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2 | Upstream-Name: pia-manager
3 | Upstream-Contact: Clement Lefebvre
4 | Source: https://github.com/linuxmint/pia-manager
5 |
6 | Files: *
7 | Copyright: 2016 Clement Lefebvre
8 | License: GPL-3+
9 | This program is free software: you can redistribute it and/or modify
10 | it under the terms of the GNU General Public License as published by
11 | the Free Software Foundation, either version 3 of the License, or (at
12 | your option) any later version.
13 | .
14 | This program is distributed in the hope that it will be useful, but
15 | WITHOUT ANY WARRANTY; without even the implied warranty of
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | General Public License for more details.
18 | .
19 | You should have received a copy of the GNU General Public License
20 | along with this program. If not, see .
21 | .
22 | On Debian systems, the complete text of the GNU General
23 | Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
24 |
--------------------------------------------------------------------------------
/debian/install:
--------------------------------------------------------------------------------
1 | usr
2 |
--------------------------------------------------------------------------------
/debian/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # postinst script
3 |
4 | set -e
5 |
6 | case "$1" in
7 | configure)
8 | if which glib-compile-schemas >/dev/null 2>&1
9 | then
10 | glib-compile-schemas /usr/share/glib-2.0/schemas
11 | fi
12 | ;;
13 | abort-upgrade|abort-remove|abort-deconfigure)
14 | ;;
15 | triggered)
16 | ;;
17 | *)
18 | echo "postinst called with unknown argument \`$1'" >&2
19 | exit 1
20 | ;;
21 | esac
22 |
23 | exit 0
24 |
--------------------------------------------------------------------------------
/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 |
3 | DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
4 |
5 | %:
6 | dh ${@}
7 |
8 | # Inject version number in the code
9 | override_dh_installdeb:
10 | dh_installdeb
11 | for pkg in $$(dh_listpackages -i); do \
12 | find debian/$$pkg -type f -exec sed -i -e s/__DEB_VERSION__/$(DEB_VERSION)/g {} +; \
13 | done
14 |
--------------------------------------------------------------------------------
/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (native)
2 |
--------------------------------------------------------------------------------
/makepot:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | intltool-extract --type=gettext/glade usr/share/pia-manager/*.ui
4 |
5 | xgettext --language=C --keyword=_ --keyword=N_ --output=pia-manager.pot usr/share/pia-manager/*.ui.h
6 | xgettext --language=Python --keyword=_ --output=pia-manager.pot --join-existing usr/lib/pia-manager/*.py usr/bin/*
7 |
8 | rm -f usr/share/pia-manager/*.ui.h
9 |
--------------------------------------------------------------------------------
/pia-manager.pot:
--------------------------------------------------------------------------------
1 | # SOME DESCRIPTIVE TITLE.
2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3 | # This file is distributed under the same license as the PACKAGE package.
4 | # FIRST AUTHOR , YEAR.
5 | #
6 | #, fuzzy
7 | msgid ""
8 | msgstr ""
9 | "Project-Id-Version: PACKAGE VERSION\n"
10 | "Report-Msgid-Bugs-To: \n"
11 | "POT-Creation-Date: 2016-11-30 17:06+0000\n"
12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 | "Last-Translator: FULL NAME \n"
14 | "Language-Team: LANGUAGE \n"
15 | "Language: \n"
16 | "MIME-Version: 1.0\n"
17 | "Content-Type: text/plain; charset=CHARSET\n"
18 | "Content-Transfer-Encoding: 8bit\n"
19 |
20 | #: usr/share/pia-manager/main.ui.h:1
21 | msgid "_File"
22 | msgstr ""
23 |
24 | #: usr/share/pia-manager/main.ui.h:2
25 | msgid "Use IP addresses instead of domain names to point to PIA gateways"
26 | msgstr ""
27 |
28 | #: usr/share/pia-manager/main.ui.h:3
29 | msgid "_Skip DNS resolution"
30 | msgstr ""
31 |
32 | #: usr/share/pia-manager/main.ui.h:4
33 | msgid "_Quit"
34 | msgstr ""
35 |
36 | #: usr/share/pia-manager/main.ui.h:5
37 | msgid "_Help"
38 | msgstr ""
39 |
40 | #: usr/share/pia-manager/main.ui.h:6
41 | msgid "_Contents"
42 | msgstr ""
43 |
44 | #: usr/share/pia-manager/main.ui.h:7
45 | msgid "_About"
46 | msgstr ""
47 |
48 | #: usr/share/pia-manager/main.ui.h:8
49 | msgid ""
50 | "Configuration saved!\n"
51 | "Please use your Network Manager to connect to PIA."
52 | msgstr ""
53 |
54 | #: usr/share/pia-manager/main.ui.h:10
55 | msgid "Private Internet Access"
56 | msgstr ""
57 |
58 | #: usr/share/pia-manager/main.ui.h:11
59 | msgid "PIA username"
60 | msgstr ""
61 |
62 | #: usr/share/pia-manager/main.ui.h:12
63 | msgid "PIA password"
64 | msgstr ""
65 |
66 | #: usr/share/pia-manager/main.ui.h:13
67 | msgid "Gateway"
68 | msgstr ""
69 |
70 | #: usr/share/pia-manager/main.ui.h:14
71 | msgid "Forgot password?"
72 | msgstr ""
73 |
74 | #: usr/share/pia-manager/main.ui.h:15
75 | msgid "Refresh the list of PIA gateways"
76 | msgstr ""
77 |
78 | #: usr/lib/pia-manager/pia-manager.py:212
79 | msgid "PIA Manager"
80 | msgstr ""
81 |
--------------------------------------------------------------------------------
/test:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | sudo rm -rf /usr/lib/pia-manager
4 | sudo rm -rf /usr/share/pia-manager
5 | sudo cp -R usr /
6 |
7 | # pia-manager --update-gateways
8 | pia-manager
9 |
--------------------------------------------------------------------------------
/usr/bin/pia-manager:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import os
4 |
5 | os.system("/usr/lib/pia-manager/pia-manager.py")
6 |
--------------------------------------------------------------------------------
/usr/lib/pia-manager/apply-pia-configuration:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import os, sys, subprocess
4 |
5 | LOCAL_FILE = sys.argv[1]
6 |
7 | if os.path.exists(LOCAL_FILE):
8 | CONFIG_FILE="/etc/NetworkManager/system-connections/PIA"
9 |
10 | subprocess.call(["mv", LOCAL_FILE, CONFIG_FILE])
11 | subprocess.call(["chown", "root:root", CONFIG_FILE])
12 | subprocess.call(["chmod", "600", CONFIG_FILE])
13 |
14 | if os.path.exists("/bin/systemctl"):
15 | # Systemd
16 | subprocess.call(["systemctl", "restart", "NetworkManager"])
17 | elif os.path.exists("/etc/init.d/network-manager"):
18 | # SysV
19 | subprocess.call(["/etc/init.d/network-manager", "restart"])
20 |
--------------------------------------------------------------------------------
/usr/lib/pia-manager/pia-manager.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python3
2 |
3 | import sys, os
4 | import gettext
5 | import subprocess
6 | import gettext
7 | import uuid
8 | import time
9 | import json
10 | import urllib.request
11 | import setproctitle
12 |
13 | import gi
14 | gi.require_version('Gtk', '3.0')
15 | from gi.repository import Gtk, Gio
16 |
17 | setproctitle.setproctitle('pia-manager')
18 |
19 | # i18n
20 | gettext.install("pia-manager", "/usr/share/locale")
21 |
22 | CONFIGURATION = """[connection]
23 | id=PIA
24 | uuid=UUID
25 | type=vpn
26 | autoconnect=false
27 | permissions=
28 | secondaries=
29 | timestamp=TIMESTAMP
30 |
31 | [vpn]
32 | username=PIA_USERNAME
33 | comp-lzo=yes
34 | remote=PIA_GATEWAY
35 | connection-type=password
36 | password-flags=0
37 | ca=/usr/share/pia-manager/ca.crt
38 | service-type=org.freedesktop.NetworkManager.openvpn
39 |
40 | [vpn-secrets]
41 | password=PIA_PASSWORD
42 |
43 | [ipv4]
44 | dns-search=
45 | method=auto
46 |
47 | [ipv6]
48 | dns-search=
49 | ip6-privacy=0
50 | method=auto"""
51 |
52 | TMP_CONFIG_FILE = os.path.expanduser("~/.config/pia-manager/PIA")
53 | os.system("mkdir -p ~/.config/pia-manager")
54 |
55 | CONFIG_FILE = '/etc/NetworkManager/system-connections/PIA'
56 | SKIP_DNS_KEY = 'skip-dns-resolution'
57 |
58 | class Manager(Gtk.Application):
59 | ''' Create the UI '''
60 | def __init__(self):
61 | Gtk.Application.__init__(self, application_id='com.pia.manager', flags=Gio.ApplicationFlags.FLAGS_NONE)
62 | self.connect("activate", self.on_activate)
63 |
64 | def on_activate(self, data=None):
65 | list = self.get_windows()
66 | if len(list) > 0:
67 | # Already running, focus the window
68 | self.get_active_window().present()
69 | else:
70 | self.create_window()
71 |
72 | def create_window(self):
73 |
74 | self.settings = Gio.Settings(schema="com.pia.manager")
75 | self.skip_dns = self.settings.get_boolean(SKIP_DNS_KEY)
76 |
77 | gladefile = "/usr/share/pia-manager/main.ui"
78 | self.builder = Gtk.Builder()
79 | self.builder.add_from_file(gladefile)
80 |
81 | self.window = self.builder.get_object("main_window")
82 | self.username = self.builder.get_object("entry_username")
83 | self.password = self.builder.get_object("entry_password")
84 | self.gateway = self.builder.get_object("combobox_gateway")
85 | self.button = self.builder.get_object("button_ok")
86 |
87 | self.window.set_title("PIA")
88 | self.window.set_icon_name("pia-manager")
89 |
90 | self.builder.get_object("link_forgot_password").set_markup("%s" % self.builder.get_object("link_forgot_password").get_text())
91 |
92 | (username, password, self.gateway_value) = self.read_configuration()
93 | self.username.set_text(username)
94 | self.password.set_text(password)
95 |
96 | renderer = Gtk.CellRendererText()
97 | self.gateway.pack_start(renderer, True)
98 | self.gateway.add_attribute(renderer, "text", 1)
99 |
100 | self.load_combo()
101 |
102 | self.window.show()
103 |
104 | self.add_window(self.window)
105 |
106 | self.infobar = self.builder.get_object("infobar")
107 | self.infobar.hide()
108 |
109 | # Configuration
110 | self.use_ip_addresses_checkbox = self.builder.get_object("menuitem_skip_dns")
111 | self.use_ip_addresses_checkbox.set_active(self.skip_dns)
112 |
113 | # Signals
114 | self.use_ip_addresses_checkbox.connect("toggled", self.on_menuitem_use_ip_addresses_toggled)
115 | self.builder.get_object("menuitem_quit").connect("activate", self.on_quit)
116 | self.builder.get_object("menuitem_help_contents").connect("activate", self.on_menuitem_help_contents_activated)
117 | self.builder.get_object("menuitem_help_about").connect("activate", self.on_menuitem_help_about_activated)
118 | self.builder.get_object("entry_password").connect("icon-press", self.on_entry_icon_pressed)
119 | self.builder.get_object("button_cancel").connect("clicked", self.on_quit)
120 | self.builder.get_object("link_forgot_password").connect("activate-link", self.on_forgot_password_clicked)
121 | self.builder.get_object("button_refresh").connect("clicked", self.on_button_refresh_clicked)
122 | self.username.connect("changed", self.check_entries)
123 | self.password.connect("changed", self.check_entries)
124 | self.gateway.connect("changed", self.on_combo_changed)
125 | self.button.connect("clicked", self.save_configuration)
126 |
127 | def on_button_refresh_clicked(self, button):
128 | self.infobar.hide()
129 | self.download_latest_gateways()
130 | self.load_combo()
131 |
132 | def on_menuitem_use_ip_addresses_toggled(self, menuitem):
133 | self.skip_dns = menuitem.get_active()
134 | self.settings.set_boolean(SKIP_DNS_KEY, self.skip_dns)
135 | self.download_latest_gateways()
136 | self.load_combo()
137 |
138 | def load_combo(self):
139 | # Gateway combo
140 | model = Gtk.ListStore(str, str) #id, name
141 | model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
142 | selected_iter = None
143 | # load list of gateways
144 | gateway_info = []
145 | try:
146 | with open('/usr/share/pia-manager/gateways.list.dynamic') as fp:
147 | gateway_info = fp.readlines()
148 | except IOError:
149 | with open('/usr/share/pia-manager/gateways.list') as fp:
150 | gateway_info = fp.readlines()
151 |
152 | for line in gateway_info:
153 | line = line.strip()
154 | if not line.startswith("#"):
155 | bits = line.split()
156 | if len(bits) >= 2:
157 | gateway_id = bits[0]
158 | gateway_name = " ".join(bits[1:])
159 | iter = model.append([gateway_id, gateway_name])
160 | if gateway_id == self.gateway_value:
161 | selected_iter = iter
162 |
163 | self.gateway.set_model(model)
164 |
165 | if selected_iter is not None:
166 | self.gateway.set_active_iter(selected_iter)
167 |
168 | def download_latest_gateways(self):
169 | """Updates the list of PIA gateways. If 'skip-dns-resolution' is true, store IP addresses rather than hostnames."""
170 | # TODO: also update the CRL from this call, can be handled in similar way most likely.
171 | # grab new gateway json
172 | response = urllib.request.urlopen('https://privateinternetaccess.com/vpninfo/servers?version=24')
173 | data = response.read()
174 | text = data.decode('utf-8')
175 |
176 | # split json from CRL blob
177 | server_info_text, crl = text.split('\n\n')
178 | server_info = json.loads(server_info_text)
179 |
180 | # assemble file that the manager uses
181 | gateway_info = {}
182 | for key, info in server_info.items():
183 | if key == 'info':
184 | continue
185 |
186 | host = info['dns']
187 | if self.skip_dns:
188 | host = info['openvpn_udp']['best'].split(':')[0]
189 |
190 | gateway_info[key] = '{host} {name}'.format(host=host, name=info['name'])
191 |
192 | # arrange by the region list we prefer
193 | gateway_list = []
194 | for key in server_info['info']['auto_regions']:
195 | gateway_list.append(gateway_info[key])
196 |
197 | gateways = '\n'.join(gateway_list)
198 |
199 | # write out file
200 | with open('/usr/share/pia-manager/gateways.list.dynamic', 'w') as fp:
201 | fp.write(gateways)
202 |
203 | def on_entry_icon_pressed(self, entry, position, event):
204 | if position == Gtk.EntryIconPosition.SECONDARY:
205 | self.password.set_visibility(not self.password.get_visibility())
206 |
207 | def on_forgot_password_clicked(self, label, uri):
208 | subprocess.Popen(["xdg-open", "https://www.privateinternetaccess.com/pages/reset-password.html"])
209 | return True # needed to suppress the link callback in Gtk.Entry
210 |
211 | def on_menuitem_help_contents_activated(self, menuitem):
212 | subprocess.Popen(["xdg-open", "https://helpdesk.privateinternetaccess.com"])
213 |
214 | def on_menuitem_help_about_activated(self, menuitem):
215 | dlg = Gtk.AboutDialog()
216 | dlg.set_program_name(_("PIA Manager"))
217 | dlg.set_icon_name("pia-manager")
218 | dlg.set_transient_for(self.window)
219 | dlg.set_logo_icon_name("pia-manager")
220 | dlg.set_website("https://www.github.com/linuxmint/pia-manager")
221 | dlg.set_version("__DEB_VERSION__")
222 | try:
223 | for path in ["/usr/share/common-licenses/GPL-3"]:
224 | if os.path.exists(path):
225 | h = open(path, 'r')
226 | s = h.readlines()
227 | gpl = ""
228 | for line in s:
229 | gpl += line
230 | h.close()
231 | dlg.set_license(gpl)
232 | except Exception as e:
233 | print (e)
234 | print(sys.exc_info()[0])
235 |
236 | def close(w, res):
237 | if res == Gtk.ResponseType.CANCEL or res == Gtk.ResponseType.DELETE_EVENT:
238 | w.hide()
239 | dlg.connect("response", close)
240 | dlg.show()
241 |
242 | def on_combo_changed(self, combo):
243 | self.infobar.hide()
244 | tree_iter = combo.get_active_iter()
245 | if tree_iter != None:
246 | model = combo.get_model()
247 | gateway_id, gateway_name = model[tree_iter][:2]
248 | self.gateway_value = gateway_id
249 | self.check_entries()
250 |
251 | def on_quit(self, widget):
252 | self.quit()
253 |
254 | def read_configuration(self):
255 | username = ""
256 | password = ""
257 | gateway = None
258 | try:
259 | if os.path.exists(CONFIG_FILE):
260 | with open(CONFIG_FILE) as fp:
261 | for line in fp:
262 | line = line.strip()
263 | if not line.startswith("#"):
264 | bits = line.split("=")
265 | if len(bits) == 2:
266 | if bits[0] == "username":
267 | username = bits[1]
268 | elif bits[0] == "password":
269 | password = bits[1]
270 | elif bits[0] == "remote":
271 | gateway = bits[1]
272 | except:
273 | # If we can't read the config file, we use dconf
274 | username = self.settings.get_string("username")
275 | password = self.settings.get_string("password")
276 | gateway = self.settings.get_string("gateway")
277 | return (username, password, gateway)
278 |
279 | def save_configuration(self, button):
280 | username = self.username.get_text()
281 | password = self.password.get_text()
282 | gateway = self.gateway_value
283 | self.settings.set_string("username", username)
284 | self.settings.set_string("password", password)
285 | self.settings.set_string("gateway", gateway)
286 | configuration = CONFIGURATION.replace("PIA_USERNAME", username)
287 | configuration = configuration.replace("PIA_PASSWORD", password)
288 | configuration = configuration.replace("PIA_GATEWAY", gateway)
289 | configuration = configuration.replace("UUID", str(uuid.uuid4()))
290 | configuration = configuration.replace("TIMESTAMP", str(int(time.time())))
291 | with open(TMP_CONFIG_FILE, 'w') as fp:
292 | fp.writelines(configuration)
293 | os.system("pkexec /usr/lib/pia-manager/apply-pia-configuration %s" % TMP_CONFIG_FILE)
294 | self.button.set_sensitive(False)
295 | if os.path.exists(TMP_CONFIG_FILE):
296 | os.unlink(TMP_CONFIG_FILE)
297 | else:
298 | self.infobar.show()
299 |
300 | def check_entries(self, widget=None):
301 | self.infobar.hide()
302 | if (self.username.get_text() != "" and self.password.get_text() != "" and self.gateway_value is not None):
303 | self.button.set_sensitive(True)
304 | else:
305 | self.button.set_sensitive(False)
306 |
307 | if __name__ == "__main__":
308 | app = Manager()
309 | app.run(None)
310 |
--------------------------------------------------------------------------------
/usr/share/applications/pia-manager.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=Private Internet Access
3 | Icon=pia-manager
4 | Exec=pia-manager
5 | Terminal=false
6 | Type=Application
7 | Categories=Application;System;Settings;XFCE;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
8 | StartupNotify=true
9 |
--------------------------------------------------------------------------------
/usr/share/glib-2.0/schemas/com.pia.manager.gschema.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | false
6 | Use IP addresses to point to PIA gateways, instead of domain names.
7 | Use this option to work around DNS resolution issues.
8 |
9 |
10 | ""
11 | The PIA username
12 | The PIA username
13 |
14 |
15 | ""
16 | The PIA password
17 | The PIA password
18 |
19 |
20 | ""
21 | The PIA gateway
22 | The PIA gateway
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/16x16/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/16x16/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/22x22/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/22x22/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/24x24/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/24x24/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/32x32/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/32x32/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/48x48/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/48x48/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/96x96/apps/pia-manager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/icons/hicolor/96x96/apps/pia-manager.png
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/scalable/actions/pia-manager-lock-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/scalable/actions/pia-manager-user-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
--------------------------------------------------------------------------------
/usr/share/icons/hicolor/scalable/actions/pia-manager-view-password-symbolic.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
70 |
--------------------------------------------------------------------------------
/usr/share/pia-manager/ca.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIID2jCCA0OgAwIBAgIJAOtqMkR2JSXrMA0GCSqGSIb3DQEBBQUAMIGlMQswCQYD
3 | VQQGEwJVUzELMAkGA1UECBMCT0gxETAPBgNVBAcTCENvbHVtYnVzMSAwHgYDVQQK
4 | ExdQcml2YXRlIEludGVybmV0IEFjY2VzczEjMCEGA1UEAxMaUHJpdmF0ZSBJbnRl
5 | cm5ldCBBY2Nlc3MgQ0ExLzAtBgkqhkiG9w0BCQEWIHNlY3VyZUBwcml2YXRlaW50
6 | ZXJuZXRhY2Nlc3MuY29tMB4XDTEwMDgyMTE4MjU1NFoXDTIwMDgxODE4MjU1NFow
7 | gaUxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJPSDERMA8GA1UEBxMIQ29sdW1idXMx
8 | IDAeBgNVBAoTF1ByaXZhdGUgSW50ZXJuZXQgQWNjZXNzMSMwIQYDVQQDExpQcml2
9 | YXRlIEludGVybmV0IEFjY2VzcyBDQTEvMC0GCSqGSIb3DQEJARYgc2VjdXJlQHBy
10 | aXZhdGVpbnRlcm5ldGFjY2Vzcy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
11 | AoGBAOlVlkHcxfN5HAswpryG7AN9CvcvVzcXvSEo91qAl/IE8H0knKZkIAhe/z3m
12 | hz0t91dBHh5yfqwrXlGiyilplVB9tfZohvcikGF3G6FFC9j40GKP0/d22JfR2vJt
13 | 4/5JKRBlQc9wllswHZGmPVidQbU0YgoZl00bAySvkX/u1005AgMBAAGjggEOMIIB
14 | CjAdBgNVHQ4EFgQUl8qwY2t+GN0pa/wfq+YODsxgVQkwgdoGA1UdIwSB0jCBz4AU
15 | l8qwY2t+GN0pa/wfq+YODsxgVQmhgaukgagwgaUxCzAJBgNVBAYTAlVTMQswCQYD
16 | VQQIEwJPSDERMA8GA1UEBxMIQ29sdW1idXMxIDAeBgNVBAoTF1ByaXZhdGUgSW50
17 | ZXJuZXQgQWNjZXNzMSMwIQYDVQQDExpQcml2YXRlIEludGVybmV0IEFjY2VzcyBD
18 | QTEvMC0GCSqGSIb3DQEJARYgc2VjdXJlQHByaXZhdGVpbnRlcm5ldGFjY2Vzcy5j
19 | b22CCQDrajJEdiUl6zAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAByH
20 | atXgZzjFO6qctQWwV31P4qLelZzYndoZ7olY8ANPxl7jlP3YmbE1RzSnWtID9Gge
21 | fsKHi1jAS9tNP2E+DCZiWcM/5Y7/XKS/6KvrPQT90nM5klK9LfNvS+kFabMmMBe2
22 | llQlzAzFiIfabACTQn84QLeLOActKhK8hFJy2Gy6
23 | -----END CERTIFICATE-----
24 |
--------------------------------------------------------------------------------
/usr/share/pia-manager/crl.pem:
--------------------------------------------------------------------------------
1 | -----BEGIN X509 CRL-----
2 | MIIBgTCB6zANBgkqhkiG9w0BAQ0FADCBpTELMAkGA1UEBhMCVVMxCzAJBgNVBAgT
3 | Ak9IMREwDwYDVQQHEwhDb2x1bWJ1czEgMB4GA1UEChMXUHJpdmF0ZSBJbnRlcm5l
4 | dCBBY2Nlc3MxIzAhBgNVBAMTGlByaXZhdGUgSW50ZXJuZXQgQWNjZXNzIENBMS8w
5 | LQYJKoZIhvcNAQkBFiBzZWN1cmVAcHJpdmF0ZWludGVybmV0YWNjZXNzLmNvbRcN
6 | MTQwNTA3MTgwOTE5WhcNMjQwNTA3MTgwOTE5WjAUMBICAQEXDTE0MDQyODIyMDMy
7 | NVowDQYJKoZIhvcNAQENBQADgYEA4EA2wjio+BxYFui1mBj5gmypxUQyA7xQJ3Vo
8 | cwWSllQKHpfmQ7fwyTL22uc21W9hM4geD1FwoXDUEraQjfyBJOxJwc6GOhTN2wHv
9 | 3vplKjdbXmxxAfjduBvlIB0a6qSz1L6hwZJrZUGimlWS9NQrmYaKLbtG07n2UyA+
10 | mqz5bEc=
11 | -----END X509 CRL-----
12 |
--------------------------------------------------------------------------------
/usr/share/pia-manager/gateways.list:
--------------------------------------------------------------------------------
1 | ae.privateinternetaccess.com United Arab Emirates
2 | au-melbourne.privateinternetaccess.com Australia (Melbourne)
3 | au-sydney.privateinternetaccess.com Australia (Sydney)
4 | austria.privateinternetaccess.com Austria
5 | belgium.privateinternetaccess.com Belgium
6 | brazil.privateinternetaccess.com Brazil
7 | ca-montreal.privateinternetaccess.com Canada (Montreal)
8 | ca-toronto.privateinternetaccess.com Canada (Toronto)
9 | ca-vancouver.privateinternetaccess.com Canada (Vancouver)
10 | czech.privateinternetaccess.com Czech Republic
11 | de-berlin.privateinternetaccess.com Germany (Berlin)
12 | de-frankfurt.privateinternetaccess.com Germany (Frankfurt)
13 | denmark.privateinternetaccess.com Denmark
14 | fi.privateinternetaccess.com Finland
15 | france.privateinternetaccess.com France
16 | hk.privateinternetaccess.com Hong Kong
17 | hungary.privateinternetaccess.com Hungary
18 | in.privateinternetaccess.com India
19 | ireland.privateinternetaccess.com Ireland
20 | israel.privateinternetaccess.com Israel
21 | italy.privateinternetaccess.com Italy
22 | japan.privateinternetaccess.com Japan
23 | lu.privateinternetaccess.com Luxembourg
24 | mexico.privateinternetaccess.com Mexico
25 | nl.privateinternetaccess.com Netherlands
26 | no.privateinternetaccess.com Norway
27 | nz.privateinternetaccess.com New Zealand
28 | poland.privateinternetaccess.com Poland
29 | ro.privateinternetaccess.com Romania
30 | sg.privateinternetaccess.com Singapore
31 | spain.privateinternetaccess.com Spain
32 | sweden.privateinternetaccess.com Sweden
33 | swiss.privateinternetaccess.com Switzerland
34 | turkey.privateinternetaccess.com Turkey
35 | uk-london.privateinternetaccess.com United Kingdom (London)
36 | uk-manchester.privateinternetaccess.com United Kingdom (Manchester)
37 | uk-southampton.privateinternetaccess.com United Kingdom (Southampton)
38 | us-atlanta.privateinternetaccess.com USA (Atlanta)
39 | us-california.privateinternetaccess.com USA (California)
40 | us-chicago.privateinternetaccess.com USA (Chicago)
41 | us-denver.privateinternetaccess.com USA (Denver)
42 | us-east.privateinternetaccess.com USA (East)
43 | us-florida.privateinternetaccess.com USA (Florida)
44 | us-houston.privateinternetaccess.com USA (Houston)
45 | us-lasvegas.privateinternetaccess.com USA (Las Vegas)
46 | us-newyorkcity.privateinternetaccess.com USA (New York)
47 | us-seattle.privateinternetaccess.com USA (Seattle)
48 | us-siliconvalley.privateinternetaccess.com USA (Silicon Valley)
49 | us-texas.privateinternetaccess.com USA (Texas)
50 | us-washingtondc.privateinternetaccess.com USA (Washington DC)
51 | us-west.privateinternetaccess.com USA (West)
52 | za.privateinternetaccess.com South Africa
53 |
--------------------------------------------------------------------------------
/usr/share/pia-manager/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linuxmint/pia-manager/fa65ba7c641f37381ebb26d4150e4c06435c9919/usr/share/pia-manager/logo.png
--------------------------------------------------------------------------------
/usr/share/pia-manager/main.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
15 |
20 |
464 |
465 |
--------------------------------------------------------------------------------
/usr/share/polkit-1/actions/com.pia.manager.policy:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | PIA
8 | https://privateinternetaccess.com/
9 |
10 |
11 | PIA Manager
12 | pia-manager
13 |
14 | no
15 | no
16 | auth_admin_keep
17 |
18 | /usr/lib/pia-manager/apply-pia-configuration
19 | true
20 |
21 |
22 |
--------------------------------------------------------------------------------