dagrha / pypia

Configuration of Private Internet Access VPN routes for Linux
GNU General Public License v3.0
78 stars 15 forks source link

Upgrade to 17.10 #25

Open chadhumphrey opened 6 years ago

chadhumphrey commented 6 years ago

Greetings,

I had pypia working prefectly on 16.10, but the upgrade to 17.10 seems to have messed up my configurations.

Just to complicate thing I'm running the python command thru PHP. I know crazy right? (long story)


    echo exec('ls', $out);
    echo exec('pwd', $out);
    echo exec('python3 pypia/pypia.py -s -r us  2>&1', $out);
    var_dump($out);```

So this command worked just fine in 16.10, but upgrading to 17.10, I might have missed a configuration. Obviously the command `python3 pypia/pypia.py -s -r us` works just fine from the command line. But when I access the php file from a web browser I get the following

`{ [0]=> string(11) "LICENSE.txt" [1]=> string(9) "README.md" [2]=> string(14) "legacy_scripts" [3]=> string(5) "pypia" [4]=> string(8) "setup.py" [5]=> string(7) "test.sh" [6]=> string(19) "/var/www/html/pypia" [7]=> string(88) "Connection 'PIA - US East' deactivation failed: Not authorized to deactivate connections" [8]=> string(74) "Error: Connection activation failed: Not authorized to control networking." [9]=> string(30) "Disconnecting PIA - US East..." [10]=> string(30) "Activating PIA - US Midwest..." } ` 

I suspect it's because the user "www-data" does not have access to control networking? This might be outside the scope of the code, cause it deals more with network configurations?

Thanks 
dagrha commented 6 years ago

Hi Chad, thanks for bringing this up. I'm afraid this one has me a bit stumped...

I'm not positive but I don't think this is a pypia issue. Seems more likely to have something to do with the many changes between 16.10 and 17.10 (e.g. LightDM to GDM).

I will leave the issue open in case anyone has ideas for you. If you figure it out, please post how you solved it! Cheers

chadhumphrey commented 6 years ago

Okay getting into the details of LightDM or GDM, nmcli, or polkit are way out of my "wheelhouse". So made a quick fix that is not secure, but then the again the code only runs on my computer and I don't want to go done this rabbit hole any further.

I modified the php script:

chdir('pypia');
echo exec('ls', $out);
echo exec('pwd', $out);
echo exec('echo "password" | sudo -S python3 pypia/pypia.py -s -r us  2>&1', $out);
var_dump($out);

Basically I followed this link in regard to running a sudo command from a bash script.