diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-06 18:48:38 +0200 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2024-06-06 18:48:38 +0200 |
commit | e2352d510f8282771753625cba322dbf0b0020d4 (patch) | |
tree | 2a0d02b14cc8d0b182edfc44c9029095d82befa8 | |
parent | fork (diff) | |
download | pamldapd-0.4.tar pamldapd-0.4.tar.gz pamldapd-0.4.tar.bz2 pamldapd-0.4.tar.lz pamldapd-0.4.tar.xz pamldapd-0.4.tar.zst pamldapd-0.4.zip |
-rw-r--r-- | README.adoc | 2 | ||||
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | main.go | 20 |
4 files changed, 16 insertions, 12 deletions
diff --git a/README.adoc b/README.adoc index ab692d8..d5ba33d 100644 --- a/README.adoc +++ b/README.adoc @@ -63,6 +63,8 @@ Example Configuration: `listen` :: Listen IP address and port like `0.0.0.0:0000` +You may optionally listen on a UNIX socket by setting the JSON configuration key "network" to "unix" and "listen" to "/path/to/your.sock". You may actually listen on any network that is supported by https://pkg.go.dev/net#Listen + `pamservicename` :: PAM authentication requires service-name like `login`, `su`. You can choose existing service or create a new. Existing service can be seen typing `ls /etc/pam.d/` For more service, see http://www.linux-pam.org/Linux-PAM-html/sag-configuration-file.html @@ -3,7 +3,7 @@ module 4a.si/pamldapd go 1.22.3 require ( + 4a.si/ldap v0.0.0-20240606163048-4e98bda1ca75 github.com/msteinert/pam v1.2.0 github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 - github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba ) @@ -1,9 +1,9 @@ +4a.si/ldap v0.0.0-20240606163048-4e98bda1ca75 h1:9gKsHSqpmcvJv/m4NE9FDGE0xYX20RGgl3+8yMOLHSo= +4a.si/ldap v0.0.0-20240606163048-4e98bda1ca75/go.mod h1:KaEI+oGtvDXWoYzDjfASiQZnLDm4JUJcMeEE1Qou4Uk= github.com/msteinert/pam v1.2.0 h1:mYfjlvN2KYs2Pb9G6nb/1f/nPfAttT/Jee5Sq9r3bGE= github.com/msteinert/pam v1.2.0/go.mod h1:d2n0DCUK8rGecChV3JzvmsDjOY4R7AYbsNxAT+ftQl0= github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484 h1:D9EvfGQvlkKaDr2CRKN++7HbSXbefUNDrPq60T+g24s= github.com/nmcclain/asn1-ber v0.0.0-20170104154839-2661553a0484/go.mod h1:O1EljZ+oHprtxDDPHiMWVo/5dBT6PlvWX5PSwj80aBA= -github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba h1:DO8NFYdcRv1dnyAINJIBm6Bw2XibtLvQniNFGzf2W8E= -github.com/nmcclain/ldap v0.0.0-20210720162743-7f8d1e44eeba/go.mod h1:4S0XndRL8HNOaQBfdViJ2F/GPCgL524xlXRuXFH12/U= golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= @@ -7,7 +7,7 @@ import ( "fmt" "github.com/msteinert/pam" "github.com/nmcclain/asn1-ber" - "github.com/nmcclain/ldap" + "4a.si/ldap" "log" "net" "os" @@ -19,12 +19,13 @@ type Backend struct { ldap.Binder ldap.Searcher ldap.Closer - logger *log.Logger - Listen string - PAMServiceName string - PeopleDN string - GroupsDN string - BindAdminDN string + logger *log.Logger + Listen string + Network string + PAMServiceName string + PeopleDN string + GroupsDN string + BindAdminDN string BindAdminPassword string } @@ -33,6 +34,7 @@ func main() { var logfile = flag.String("l", "", "Log file (STDOUT if blank)") flag.Parse() var backend = Backend{} + backend.Network = "tcp" { confighandle, err := os.Open(*configfile) if err != nil { @@ -74,8 +76,8 @@ func main() { l.BindFunc("", backend) l.SearchFunc("", backend) l.CloseFunc("", backend) - backend.logger.Printf("LDAP server listen: %s", backend.Listen) - if err := l.ListenAndServe(backend.Listen); err != nil { + backend.logger.Printf("LDAP server listen: %s, network %s", backend.Listen, backend.Network) + if err := l.ListenAndServe(backend.Listen, backend.Network); err != nil { backend.logger.Printf("LDAP server listen failed: %s", err.Error()) os.Exit(1) } |