Opened 9 months ago

Last modified 9 months ago

#18823 new enhancement

Consider consolidating BNetworkServiceSettings to launch daemon — at Version 5

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Network & Internet Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by kallisti5)

the net_server currently has a BNetworkServiceSettings class to handle inetd-style forking of network services (our sshd currently uses it)

However, it was pointed out in IRC that launch daemon might be a better place for this.

Considerations:

  • net_server is likely not the most secure place to be forking processes.
  • launch_daemon is already well designed, and could have a new type added for "inetd services"

Design Considerations:

  • net_server could do basic firewalling of ports, and notify launch daemon of unhandled inbound requests.
  • launch daemon could then "decide" if it wants to do anything with the network request, or drop it.

Pros:

  • launch daemon managing inetd services would put full control and inventory of services in one place.
  • launch daemon could adjust inetd services based on varying targets.
  • services could "self-register" inetd with launch daemon by dropping a new launch script. (openssh drops a disabled inetd service off with launch daemon which waits on network)
  • Today, ssh is hardcoded in our Network Preflet add-on.
  • CLI management of inetd style services through launch_roster
  • GUI management of inetd style services via X512's launch daemon gui tool.

Cons:

  • It's kind of a shuffle of code
  • Our use case doesn't need "targets" for inetd services

Change History (5)

comment:1 by kallisti5, 9 months ago

See #14086 for where this conversation spawned.

comment:2 by kallisti5, 9 months ago

example:

target desktop {
    netservice x-vnd.sshd {
        port 22/tcp                                                                         
        launch /bin/sshd -D
        on network_available
    }
}

We may want to rename "service" to "daemon" within launch dameon if this is something we want to consider.

comment:3 by kallisti5, 9 months ago

Context / example for SSH today:

  • src/add-ons/network_settings/sshd/SSHServiceAddOn.cpp: BNetworkServiceSettings settings;
  • src/kits/network/libnetapi/NetworkSettings.cpp:BNetworkServiceSettings
  • src/kits/network/libnetapi/NetworkSettings.cpp: return BNetworkServiceSettings(service);
  • src/kits/network/libnetapi/NetworkSettings.cpp:const BNetworkServiceSettings

comment:4 by kallisti5, 9 months ago

Description: modified (diff)

comment:5 by kallisti5, 9 months ago

Description: modified (diff)
Summary: Consider consolidating BNetworkService to launch daemonConsider consolidating BNetworkServiceSettings to launch daemon
Note: See TracTickets for help on using tickets.