diff options
author | Simon Streit <simon@netpanic.org> | 2022-02-03 12:58:05 +0100 |
---|---|---|
committer | Simon Streit <simon@netpanic.org> | 2022-02-03 12:58:05 +0100 |
commit | 2ffba9a1f56af9e849316c8477e5a3e3aae3ba24 (patch) | |
tree | c04c15bcabb59a177dc5894aa64a96c217f15e04 | |
parent | c9a12148d415e28b192d13b8195fa0893896a5d9 (diff) |
Finalise Samba's service.
Complete Samba's service documentation.
Clean up and debug Samba's service too.
modified: siguix/doc/samba.texi
modified: siguix/services/samba.scm
-rw-r--r-- | siguix/doc/samba.texi | 145 | ||||
-rw-r--r-- | siguix/services/samba.scm | 69 |
2 files changed, 164 insertions, 50 deletions
diff --git a/siguix/doc/samba.texi b/siguix/doc/samba.texi index f6707ad..613b47e 100644 --- a/siguix/doc/samba.texi +++ b/siguix/doc/samba.texi @@ -10,16 +10,149 @@ @cindex samba @cindex smb The @code{(gnu services samba)} module provides Guix service definitions -for Samba as well as wsdd. While Samba provides features such as shares -for folder and printers, it can also be an active domain controler for -other samba hosts in an heterougenious network with Windows computers. +for Samba as well as additional helper services. Currently it provides +the following services: + +@subsubheading Samba + +Samba provides network shares for folder and printers, it can also be an +AD DC for other samba hosts in an heterougenious network with Windows +computers. + +@defvar{samba-service-type} + +The service type to enable the samba services @code{samba}, @code{nmbd}, +@code{smbd} and @code{winbindd}. By default this service type does not +run as an AD DC, hence @code{samba} remains disabled. It is recommended +that Samba's package is added to the system profile to have the tool-set +available for modifications in Samba's runtime directories. + +@end defvar + +@deftp{Data Type} samba-service-configuration +Configuration record for the Samba suite. + +@table @asis +@item @code{package} (default: @code{samba}) +The samba package to use. + +@item @code{config-file} (default: @code{#f}) +The config file to use. Please note: Setting this variable will disable +all config options that come after @code{enable-winbindd?}. + +@item @code{enable-samba?} (default: @code{#f}) +Manually enable the @code{samba} daemon. + +@item @code{enable-smbd?} (default: @code{#f}) +Manually enable the @code{smbd} daemon. + +@item @code{enable-nmbd?} (default: @code{#f}) +Manually enable the @code{nmbd} daemon. + +@item @code{enable-winbindd?} (default: @code{#f}) +Manually enable the @code{winbindd} daemon. + +@item @code{workgroup} (default: @code{"WORKGROUP"}) +This controls what workgroup your server will appear to be in when +queried by clients. + +@item @code{server-string} (default: @code{"Samba Server"}) +This controls what string will show up in the printer comment box in +print manager and next to the IPC connection in net view. It can be any +string that you wish to show to your users. + +@item @code{server-role} (default: @code{"standalone"}) +This option determines the basic operation mode of a Samba server and is +one of the most important settings in the @code{smb.conf} file. + +@item @code{bind-interfaces-only?} (default: @code{#f}) +This global parameter allows the Samba admin to limit what interfaces on +a machine will serve SMB requests. It affects file service +@code{smbd(8)} and name service @code{nmbd(8)} in slightly different +ways. + +@item @code{interfaces} (default: @code{'()}) +This option allows you to override the default network interfaces list +that Samba will use for browsing, name registration and other NetBIOS +over TCTP/IP (NBT) traffic. By default Samba will query the kernel for +the list of all active interfaces and use any interfaces except +127.0.0.1 that are broadcast capable. + +@item @code{hosts-allow} (default @code{'()}) +This parameter is a list of hosts which are permitted to access a +service. + +@item @code{guest-account} (default: @code{"nobody"}) +This is a username which will be used for access to services. + +@item @code{log-file} (default: @code{"/var/log/samba/log.%m"}) +This option allows you to override the name of the Samba log file (also +known as the debug file). + +@item @code{logging} (default: @code{"file"}) +This parameter configures logging backends. Multiple backends can be +specified at the same time, with different log levels for each backend. + +@item @code{realm} (default: @code{#f}) +This option specifies the kerberos realm to use. The realm is used as +the ADS equivalent of the NT4 domain. It is usually set to the DNS name +of the kerberos server. + +@item @code{passdb-backend} (default: @code{#f}) +This option allows the administrator to chose which backend will be used +for storing user and possibly group information. This allows you to swap +between different storage mechanisms without recompile. + +@item @code{include-config} (default: @code{#f}) +This allows you to include one config file inside another. The file is +included literally, as though typed in place. + +@item @code{logon-path} (default: @code{"\\\\%N\\%U\\profile"}) +This option takes the standard substitutions, allowing you to have +separate logon scripts for each user or machine. It also specifies the +directory from which the ``Application Data'', desktop, start menu, +network neighborhood, programs and other folders, and their contents, +are loaded and displayed on your Windows NT client. + +@item @code{wins-support?} (default: @code{#f}) +This boolean controls if the @code{nmbd(8)} process in Samba will act as +a WINS server. You should not set this to yes unless you have a +multi-subnetted network and you wish a particular nmbd to be your WINS +server. Note that you should @emph{never} set this to yes on more than +one machine in your network. + +@item @code{wins-server} (default: @code{#f}) +This specifies the IP address (or DNS name: IP address for preference) +of the WINS server that @code{nmbd(8)} should register with. If you +have a WINS server on your network then you should set this to the WINS +server's IP. + +@item @code{wins-proxy?} (default: @code{#f}) +This is a boolean that controls if @code{nmbd(8)} will respond to +broadcast name queries on behalf of other hosts. You may need to set +this to @code{#t} for some older clients. + + +@item @code{dns-proxy?} (default: @code{#t}) +Specifies that @code{nmbd(8)} when acting as a WINS server and finding +that a NetBIOS name has not been registered, should treat the NetBIOS +name word-for-word as a DNS name and do a lookup with the DNS server for +that name on behalf of the name-querying client. + + +@item @code{config-sections} (default: @code{#f}) +Extra config sections to add to the tail of the generated config file +@code{smb.conf}. + +@end table +@end deftp @cindex wsdd @subsubheading Web Service Discovery Daemon Web Service Discovery Daemon implements the WSD protocoll. It is a drop-in replacement for host discovery that lack support for the SMBv1 -protocoll. +protocol. @defvr{Scheme Variable} wsdd-service-type @@ -28,8 +161,8 @@ this service type is a @code{wsdd-configuration} record. The details for the @code{wsdd-configuration} record type are given below. @end defvr -@deftp{Data Type} wsdd-configuration -This data type represents the configuration for the wsdd service. +@deftp{Data Type} wsdd-configuration This data type represents the +configuration for the wsdd service. @table @asis diff --git a/siguix/services/samba.scm b/siguix/services/samba.scm index 3568bb4..6d810b5 100644 --- a/siguix/services/samba.scm +++ b/siguix/services/samba.scm @@ -71,8 +71,8 @@ samba-configuration-dns-proxy? samba-configuration-config-sections - ;; temp! - samba-configuration-default-config-file + ;; ;; temp! + ;; samba-configuration-default-config-file wsdd-service wsdd-service-type @@ -116,7 +116,7 @@ ;; From here on anything goes to smb.conf - ;; This line will be put at the end of [global]. + ;; This will be put at the end of [global]. (global-extra-config samba-configuration-global-extra-config (default #f)) (workgroup samba-configuration-workgroup @@ -124,7 +124,7 @@ (server-string samba-configuration-server-string (default "Samba Server")) (server-role samba-configuration-server-role - (default "standalone server")) + (default "standalone")) (bind-interfaces-only? samba-configuration-bind-interfaces-only? (default #f)) (interfaces samba-configuration-interfaces @@ -185,11 +185,17 @@ (string-append " server string = " server-string "\n") "") (if server-role (string-append " server role = " server-role "\n") "") -(if bind-interfaces-only? " bind interfaces only = Yes\n" "") +(if bind-interfaces-only? " bind interfaces only = yes\n" "") (if (not (null? interfaces)) - (string-append " interfaces = " (string-join interfaces) "\n") "") + (string-append " interfaces = " + (string-join (map (lambda (interface) + (format #f "~s" interface)) + interfaces) ";") "\n") "") (if (not (null? hosts-allow)) - (string-append " hosts allow = " (string-join hosts-allow) "\n") "") + (string-append " hosts allow = " + (string-join (map (lambda (host) + (format #f "~s" host)) + hosts-allow) ";") "\n") "") (if guest-account (string-append " guest account = " guest-account "\n") "") (if log-file @@ -204,11 +210,14 @@ (string-append " include config = " include-config "\n") "") (if logon-path (string-append " logon path = " logon-path "\n") "") -(if wins-support? " wins support = Yes" "") +(if wins-support? " wins support = yes\n" "") (if wins-server - (string-append " wins server = " wins-server "\n") "") -(if wins-proxy? " wins proxy = Yes\n" "") -(if dns-proxy? " dns proxy = Yes\n" "") + (string-append " hosts allow = " + (string-join (map (lambda (wins) + (format #f "~s" wins)) + wins-server) ";") "\n") "") +(if wins-proxy? " wins proxy = yes\n" "") +(if dns-proxy? " dns proxy = yes\n" "") (if global-extra-config (string-append "\n#Extra options provided by ‘global-extra-config’:\n" @@ -221,7 +230,6 @@ (match-lambda (($ <samba-configuration> package config-file - ;; enable-samba? enable-smbd? enable-nmbd? enable-winbindd? _ _ _ _ global-extra-config workgroup @@ -270,30 +278,14 @@ (smb.conf "/etc/samba/smb.conf")) #~(begin (use-modules (guix build utils)) + (mkdir-p #$log-directory) (mkdir-p #$run-directory) (mkdir-p (string-append #$lib-directory "/private")) - - ;; I'd like to place smb.conf to /etc/samba. It might - ;; make sense, since there will be other daemons wanting - ;; to access it. - (mkdir-p "/etc/samba") (copy-file #$config-file #$smb.conf) - - ;; Test config (system* (string-append #$samba "/bin/testparm") - "--suppress-prompt") - - ;; (display #$(string-append lib-directory "/private\n")) - ;; (display (string-append #$(file-append samba "/sbin/smbd") - ;; (string-append "--configfile=" - ;; #$config-file) - ;; "--foreground" - ;; (string-append "--log-basename=" - ;; #$log-directory) - ;; "--no-process-group")) - )))))) + "--suppress-prompt" #$smb.conf))))))) (define samba-shepherd-service (match-lambda @@ -308,7 +300,6 @@ (string-append "--configfile=" #$config-file) "--foreground" - "--debuglevel=3" ;remove this! "--no-process-group"))) (stop #~(make-kill-destructor)))))))) @@ -325,7 +316,6 @@ (string-append "--configfile=" #$config-file) "--foreground" - "--debuglevel=3" ;remove this! "--no-process-group"))) (stop #~(make-kill-destructor)))))))) @@ -342,7 +332,6 @@ (string-append "--configfile=" #$config-file) "--foreground" - "--debuglevel=3" ;remove this! "--no-process-group"))) (stop #~(make-kill-destructor)))))))) @@ -359,15 +348,14 @@ (string-append "--configfile=" #$config-file) "--foreground" - "--debuglevel=3" ;remove this! "--no-process-group"))) (stop #~(make-kill-destructor)))))))) (define (samba-shepherd-services config) (append ;; (samba-shepherd-service config) - (samba-nmbd-shepherd-service config) - (samba-smbd-shepherd-service config) - (samba-winbind-shepherd-service config))) + (samba-nmbd-shepherd-service config) + (samba-smbd-shepherd-service config) + (samba-winbind-shepherd-service config))) (define samba-service-type (service-type @@ -383,13 +371,6 @@ )) (default-value (samba-configuration)))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (let ((uid (passwd:uid (getpw "samba"))) -;; (gid (group:gid (getgr "samba")))) -;; ) - ;;; ;;; WSDD |