mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-08-28 04:46:42 -04:00
Bump peercred-mini
This commit is contained in:
+3
-3
@@ -83,15 +83,15 @@ func handleConn(conn net.Conn) {
|
||||
ucred := peercred.Get(conn)
|
||||
|
||||
// check if the RPC call is coming from an identical binary and from the same user
|
||||
callingBinPath := pidToPath(ucred.PID())
|
||||
if ucred.UserID() == strconv.Itoa(os.Getuid()) && bytes.Equal(getFileHash(callingBinPath), daemonHash) {
|
||||
callingBinPath := pidToPath(ucred.PID)
|
||||
if ucred.UID == strconv.Itoa(os.Getuid()) && bytes.Equal(getFileHash(callingBinPath), daemonHash) {
|
||||
// valid client; hand off the connection to the RPC server
|
||||
rpc.ServeConn(conn)
|
||||
} else {
|
||||
// invalid client; close the connection w/o a response,
|
||||
// log the client's path, and kill the daemon
|
||||
conn.Close()
|
||||
log.Printf("Request received from invalid client: PID(%d), UID(%s), Path(%s)", ucred.PID(), ucred.UserID(), callingBinPath) // TODO log to file
|
||||
log.Printf("Request received from invalid client: PID(%d), UID(%s), Path(%s)", ucred.PID, ucred.UID, callingBinPath) // TODO log to file
|
||||
os.Exit(2)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ module rcw
|
||||
|
||||
go 1.24.2
|
||||
|
||||
require github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d
|
||||
require github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41
|
||||
|
||||
require github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032 // indirect
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d h1:Uio9uhJuKLp8+c/C3TUrsC9Vd93hBK5oRcm2+o8+DvI=
|
||||
github.com/rwinkhart/peercred-mini v0.0.0-20250405012931-0e071fcd683d/go.mod h1:cH3916WNofkve4MeeK56H0whuUUVf57iYht3nsUyEh8=
|
||||
github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41 h1:wUMbTEwPIf6bqLCAUmJ58uuYu6OX0iGa6S6NjYUXGPA=
|
||||
github.com/rwinkhart/peercred-mini v0.0.0-20250405191724-d116525c2b41/go.mod h1:cH3916WNofkve4MeeK56H0whuUUVf57iYht3nsUyEh8=
|
||||
github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032 h1:4qzc09ysQhkyI2oN7pLbZMQP+qHq2TlVRCkMSmbl8m8=
|
||||
github.com/rwinkhart/sys-freebsd-13-xucred v0.0.0-20250405011819-d304d362d032/go.mod h1:U89aT1yaUAbs+9Dp9i1lZ2+5GsRNYk0l42+d1wykDBA=
|
||||
|
||||
Reference in New Issue
Block a user