[Networkmanager] Implementing a NetworkManager VPN Plugin in Rust
amidamaru rookie
ardtimeit at gmail.com
Mon Dec 11 10:46:48 UTC 2023
Hi Thomas,
I want to generate a NM.gir file, so I think it may require building
NetworkManager from source. And I looked at the CONTRIBUTING.md at
section Building
from source
<https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md#building-from-source>.
Which options I suppose to add for CONFIGURE_OPTIONS when doing this
command?
meson build $CONFIGURE_OPTIONSninja -C build# optional: sudo meson
install -C build
Because of this note "Beware to set the correct $CONFIGURE_OPTIONS. In
particular, you may not want the default installation prefix and not
overwrite files in /usr." Therefore I don't want my system to crash.
I'm based on arch linux.
Thank you.
<#fedora>
Vào Th 4, 6 thg 12, 2023 vào lúc 14:46 amidamaru rookie <
ardtimeit at gmail.com> đã viết:
> Thanks for your detailed guideline. I really appreciate it.
> I'd like to implement it in Rust and I know it would be much more work.
>
> Cheers,
> Thao.
>
> Vào Th 4, 6 thg 12, 2023 vào lúc 01:17 Thomas Haller <thaller at redhat.com>
> đã viết:
>
>> On Tue, 2023-12-05 at 23:56 +0700, amidamaru rookie wrote:
>> > Thanks for your advice. I will play some code first based on
>> > your suggestion and check networkmanager code for adding new type
>> > before submitting a MR.
>> >
>> > Cheers,
>>
>> to have a working VPN plugin, you need at least a file
>>
>> /usr/lib/NetworkManager/VPN/*.name
>>
>> and a executable
>>
>> [VPN Connection]
>> program=/usr/libexec/nm-*-service
>>
>> And that executable is spawned by NetworkManager, and is expected to
>> service the D-Bus interface for VPN plugins.
>>
>> Also, there is a client library that can provide meta-data (information
>> about the plugin) to client applications (nmcli, nm-connection-editor).
>> Those are
>>
>> [libnm]
>> plugin=libnm-*.so
>>
>> These provide a nm_vpn_editor_plugin_factory() function, to load a
>> NMVpnEditorPlugin. That API is in libnm (and implemented by the
>> plugin).
>>
>> There is also a helper tool for requesting secrets
>>
>> [GNOME]
>> auth-dialog=/usr/libexec/nm-openvpn-auth-dialog
>>
>> which again implements some API (being forked by nm-applet, and
>> communicating via stdin/stdout).
>>
>>
>> The legacy library you can ignore. It's no longer relevant:
>>
>> [GNOME]
>> properties=libnm-*
>>
>>
>> You at least need the first part.
>>
>> All these pieces can be implemented in any language. However, since all
>> existing plugins are in C+glib, it's much easier to look at
>> NetworkManager-openvpn and just duplicate that. If you need to
>> implement that all in a new language, it's much more work.
>>
>>
>> Good luck,
>> Thomas
>>
>>
>> >
>> > Vào Th 3, 5 thg 12, 2023 vào lúc 23:38 Frédéric Martinsons
>> > <frederic.martinsons at gmail.com> đã viết:
>> > > I don't think it is possible without patching the networkmanager
>> > > code itself. You should look at how these kind of type are defined
>> > > in nmcli/libnm code base and possibly submit a merge request to add
>> > > a new rosenpass one.
>> > >
>> > > Le mar. 5 déc. 2023, 17:33, amidamaru rookie <ardtimeit at gmail.com>
>> > > a écrit :
>> > > > Thanks for your reference links, I will check them out.
>> > > > For nmcli integration, the only thing I have no idea is the value
>> > > > of type must be known.
>> > > > So as my example above:
>> > > > nmcli con import type rosenpass file /data/rp.conf
>> > > > the value of type is "rosenpass".
>> > > > Is there any way to add this new value ?
>> > > >
>> > > > Thank you,
>> > > >
>> > > > Vào Th 3, 5 thg 12, 2023 vào lúc 23:16 Frédéric Martinsons
>> > > > <frederic.martinsons at gmail.com> đã viết:
>> > > > > Maybe you can take a look
>> > > > > at https://crates.io/crates/networkmanager which uses nm dbus
>> > > > > api.
>> > > > >
>> > > > > You may also want to look at gtk-rs project
>> > > > > (https://gtk-rs.org/) to find inspiration.
>> > > > >
>> > > > >
>> > > > >
>> > > > > On Tue, 5 Dec 2023 at 17:12, amidamaru rookie
>> > > > > <ardtimeit at gmail.com> wrote:
>> > > > > > Hi team,
>> > > > > >
>> > > > > > Currently I'm implementing a Rosenpass NM Plugin in Rust.
>> > > > > > I cannot find much information about this except the VPN
>> > > > > > support page - but most of the projects there were written in
>> > > > > > C.
>> > > > > > The only reference I can find is this repository.
>> > > > > > But after all these years, the NetworkManager codebase won't
>> > > > > > have this shared directory anymore.
>> > > > > > So now, my question is where can I collect these files from
>> > > > > > the current NM codebase? Also,
>> > > > > > Besides the GUI (editor dialog) part, I want to integrate
>> > > > > > Rosenpass into nmcli also.
>> > > > > > For example, after integration, I can do something like this:
>> > > > > > nmcli con import type rosenpass file /data/rp.conf
>> > > > > >
>> > > > > > Could you please give some advice on this?
>> > > > > >
>> > > > > > Thank you,
>> > > > > > --
>> > > > > > Đinh Thảo_PTIT's student - ardtimeit at gmail.com
>> > > >
>> > > >
>> > > > --
>> > > > Đinh Thảo_PTIT's student - ardtimeit at gmail.com
>> >
>> >
>> > --
>> > Đinh Thảo_PTIT's student - ardtimeit at gmail.com
>>
>>
>
> --
> Đinh Thảo_PTIT's student - *ardtimeit at gmail.com <ardtimeit at gmail.com>*
>
--
Đinh Thảo_PTIT's student - *ardtimeit at gmail.com <ardtimeit at gmail.com>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/networkmanager/attachments/20231211/769fc312/attachment.htm>
More information about the Networkmanager
mailing list