Comments (1)
OK, I figured it out using
import dbus
from pprint import pprint
bus = dbus.SystemBus()
ssn = "org.freedesktop.NetworkManager"
sysproxy = bus.get_object(ssn, "/org/freedesktop/NetworkManager/Settings")
settings = dbus.Interface(sysproxy, ssn + ".Settings")
c = settings.ListConnections()[0]
#pprint(settings.ListConnections())
for conn in settings.ListConnections():
connproxy = bus.get_object(ssn, conn)
conn = dbus.Interface(connproxy, ssn+'.Settings.Connection')
pprint(conn.GetSettings())
print()
The connection object has a different form for VPN connections from WiFi connections. So I had to do
import dbus
import uuid
import os
bus = dbus.SystemBus()
ssn = "org.freedesktop.NetworkManager"
sysproxy = bus.get_object(ssn, "/org/freedesktop/NetworkManager/Settings")
settings = dbus.Interface(sysproxy, ssn + ".Settings")
s_vpn = dbus.Dictionary({
'ca-cert' : '/usr/local/share/ca-certificates/my-cert-chain.pem',
'user' : 'usernmae',
'refuse-eap': 'yes',
'refuse-chap': 'yes',
'gateway' : 'vpn.example.com',
'domain' : 'EXAMPLE',
'refuse-pap' : 'yes',
'password-flags' : '0',
'proxy-password-flags' : '0',
})
s_secs = dbus.Dictionary({
'password' : 'password',
})
s_con = dbus.Dictionary({
'id': 'Example SSTP',
'type': 'vpn',
'uuid': str(uuid.uuid4()),
'permissions': ['user:'+os.environ['USER']],
'autoconnect' : False,
})
s_ip4 = dbus.Dictionary({'method' : 'auto'})
s_ip6 = dbus.Dictionary({
'method' : 'ignore',
'ip6-privacy' : False,
'addr-gen-mode' : 1, # 'stable-privacy' ?
})
con = dbus.Dictionary({
'connection': s_con,
'vpn': dbus.Dictionary({
'data': s_vpn,
'service-type' : ('org.freedesktop.'
'NetworkManager.sstp'),
'secrets' : s_secs,
}),
'ipv4': s_ip4,
'ipv6': s_ip6,
})
settings.AddConnection(con)
from network-manager-sstp.
Related Issues (20)
- GUI Gnome not opening HOT 2
- Ubuntu 18.04 LTS Bionic Beaver compatibility HOT 6
- nm-sstp-dialog.ui for Gnome package not installed in 1.2.6 HOT 2
- Enable simulaneous Internet connection HOT 1
- DNS in always got Override in /etc/resolv.conf when set Set DHCP Options to address only HOT 1
- Ubuntu 19.10 support HOT 2
- Failure to establish SSTP VPN between Fedora 31 client and Windows Server 2008 HOT 6
- Support for certificate auth (Azure Basic VPN) HOT 13
- SSTP connection issue HOT 2
- install in centos7? HOT 2
- sstp-client : Depends: libevent-2.1-6 (>= 2.1.8-stable) but it is not installable HOT 8
- Use VPN only for internal resources is ignoring VPN's DNS server and automatic routes HOT 1
- Missing package for Ubuntu Focal Fossa (20.04 LTS) HOT 1
- -Werror=stringop-overflow= in src/nm-sstp-pppd-plugin.c HOT 4
- Missing package for Ubuntu 20.10 and 21.04 HOT 1
- Support for Ubuntu 21.10 HOT 11
- network-manager-sstp-gnome compatibility with GTK4 HOT 3
- work with 20.04 but not with 22.04!
- Custom Port for SSTP
- how to use in android os
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from network-manager-sstp.