Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions gvpn/CFx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
import json
import keyring
import time
import signal
import socket
Expand All @@ -16,6 +17,7 @@
from CBT import CBT as _CBT
from CFxHandle import CFxHandle

CONFIG = ipoplib.CONFIG

class CFX(object):

Expand Down Expand Up @@ -44,8 +46,10 @@ def __init__(self):
self.ip4 = self.CONFIG['AddressMapper']["ip4"]
if(self.vpn_type == 'GroupVPN'):
self.uid = ipoplib.gen_uid(self.ip4) # SHA-1 Hash
CONFIG["uid"] = self.uid
elif(self.vpn_type == 'SocialVPN'):
self.uid = self.CONFIG['CFx']['local_uid']
CONFIG["uid"] = self.uid
self.ip6 = ipoplib.gen_ip6(self.uid)

if socket.has_ipv6:
Expand Down Expand Up @@ -300,12 +304,21 @@ def parse_config(self):
"must be specified in config file or string")

if "xmpp_password" not in self.CONFIG["CFx"]:
prompt = "\nPassword for %s:" % self.CONFIG["CFx"]["xmpp_username"]
if args.pwdstdout:
self.CONFIG["CFx"]["xmpp_password"] = getpass(prompt,
if not args.update_config:
temp = keyring.get_password("ipop", CONFIG["xmpp_username"])
if temp == None and "xmpp_password" not in CONFIG:
prompt = "\nPassword for %s:" % self.CONFIG["CFx"]["xmpp_username"]
if args.pwdstdout:
self.CONFIG["CFx"]["xmpp_password"] = getpass(prompt,
stream=sys.stdout)
else:
self.CONFIG["CFx"]["xmpp_password"] = getpass(prompt)
else:
self.CONFIG["CFx"]["xmpp_password"] = getpass(prompt)
if temp != None:
CONFIG["xmpp_password"] = temp
try:
keyring.set_password("ipop", CONFIG["xmpp_username"],CONFIG["xmpp_password"])
except:
raise RuntimeError("Unable to store password in keyring")

if args.ip_config:
ipoplib.load_peer_ip_config(args.ip_config)
Expand Down
7 changes: 6 additions & 1 deletion gvpn/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"xmpp_host": "",
"stat_report": true,
"tincan_logging": 0,
"icc": true,
"icc": false,
"icc_port": 30000,
"vpn_type": "GroupVPN"
},
Expand Down Expand Up @@ -49,6 +49,11 @@
"timer_interval": 15,
"joinEnabled": true,
"dependencies": ["Logger"]
},
"StatReport":{
"timer_interval": 1,
"joinEnabled": true,
"dependencies": ["Logger"]
}
}

Expand Down
11 changes: 9 additions & 2 deletions gvpn/ipoplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"multihop_sr": True, # Multihop source route
"stat_report": False,
"stat_server": "metrics.ipop-project.org",
"stat_server_port": 5000
"stat_server_port": 80
},
"TincanListener": {
"buf_size": 65507,
Expand Down Expand Up @@ -90,7 +90,14 @@
"Watchdog": {
"timer_interval": 15,
"joinEnabled": False,
}
},
"StatReport": {
"timer_interval": 200,
"joinEnabled": True,
},
"uid" : None,
"ipop_ver" : "\x02"

}

IP_MAP = {}
Expand Down