IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij ([email protected]) 1 Samba...

21
May 6, 2005 © 2005 Jelmer Vernooij ([email protected]) Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team [email protected] SambaXP May 2005

Transcript of IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij ([email protected]) 1 Samba...

Page 1: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

1

Samba 4

Supporting Windows IPC mechanisms in Samba

Jelmer VernooijSamba Team

[email protected]

SambaXPMay 2005

Page 2: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

2

Samba 4

Thinking as a Windows ISV...

● Agenda– Transports involved

– Discussion of available IPC Mechanisms

– External use of RPC

– External use of WMI

Page 3: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

3

Samba 4

History of Windows IPC mechanisms

● Mailslots● RPC● DCOM● WMI● .NET Remoting

Win 3

NT 3

NT 4

Win2k

Win2k

Samba 1.9

Samba 2.0

Samba 4.0

Samba 4.0

Mono?

Page 4: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

4

Samba 4

Transports

● SMB Named Pipes● IPX/SPX● NetBEUI● TCP/IP● “Local”● ... and more

Page 5: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

5

Samba 4

Named Pipes

● Similar to unix domain sockets● \PIPE\... on local systems● Shared over SMB as IPC$

Page 6: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

6

Samba 4

Registering Named Pipes

● Plugin● Fallback to Unix Domain Sockets(?)

Page 7: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

7

Samba 4

RAP

● Supported by OS/2, Windows for Workgroups● “Original” RPC mechanism in SMB● Not user-extendible (global opnums)

Page 8: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

8

Samba 4

Mailslots

● Used for browsing (Network Neighborhood)● One-Way● 425- and 426-byte messages not possible ● Uses Named Pipes for small messages, datagrams

for larger ones● Unreliable

Page 9: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

9

Samba 4

(MS)RPC

● Based on DCE/RPC● Works over SMB, TCP/IP or SPX● Interfaces specified in IDL● Used extensively by 3rd-party developers

Page 10: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

10

Samba 4

DCOM

● Distributed version of COM● Uses RPC underneath● Basis of various other technologies

– WMI

– ActiveX

Page 11: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

11

Samba 4

WMI

● Based on DCOM● Windows Management Interface● Implementation of WBEM● Used by the Windows MMC● Scriptable

Page 12: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

12

Samba 4

WMI – Where it gets complicated...

Page 13: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

13

Samba 4

WMI and the Windows MMC

Page 14: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

14

Samba 4

WMI ­ Scripting

For Each Host In WScript.Arguments Set WMIservice = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _ & host & "\root\cimv2")

Set colsettings = WMIservice.ExecQuery("SELECT * FROM Win32_Processor")

For Each proc In colsettings Wscript.Echo(host & ": " & proc.description) NextNext

Scripting in all COM-compatible languages: VBScript, Jscript, Python(!)

Page 15: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

15

Samba 4

WMI – in .NETusing System;using System.Management;

class Class1{

static void Main(string[] args) { ConnectionOptions co = new ConnectionOptions(); co.Username = "john"; co.Password = "john"; ManagementScope ms =

new ManagementScope("\\\\192.168.1.2\\root\\cimv2", co);

ObjectQuery oq = new ObjectQuery("SELECT * FROM Win32_OperatingSystem");

ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms,oq); query1.Get()[0].InvokeMethod("Reboot",{“”});

}}

Page 16: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

16

Samba 4

.NET Remoting

● Mono?● Various backends (“Channels”)

– DCOM

– “Simple”

– Indigo

Page 17: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

17

Samba 4

Reasons for external use of RPC/DCOM● Other projects

– Wine / ReactOS

– OpenChange

– GUI Utilities

– OpenPegasus

– Mono?

– Support ActiveX controls in Mozilla ?

– 3rd party vendor integration

Page 18: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

18

Samba 4

External use of RPC

● Interface implementation scenarios:– Standalone (just epm registration)

– Proxy-forwarded

– Internal (plugin-based)

● Use Samba libraries– Installed headers

– pidl

Page 19: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

19

Samba 4

GUI ­ gregedit

Page 20: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

20

Samba 4

State of affairs● pidl

– Updated for being MIDL-compatible

– Not installed (yet)

● RPC subsystem

– Headers need to be installed for use by other projects

● DCOM

– Very simple sample example working, working on infrastructure at the moment

– Python support planned

● WMI

– Not started (yet)

Page 21: IPC in Sambajelmer/samba-ipc.pdf · May 6, 2005 © 2005 Jelmer Vernooij (jelmer@samba.org) 1 Samba 4 Supporting Windows IPC mechanisms in Samba Jelmer Vernooij Samba Team jelmer@samba.org

May 6, 2005

© 2005 Jelmer Vernooij ([email protected])

21

Samba 4

Further Resources

● Slides available at http://samba.org/~jelmer/● http://devel.samba.org/