-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow modifying unix socket permissions (ory#1915)
This allows the reverse proxy to actually read the unix socket, since - The default permissions are 0755 - Hydra is usually run as a user different than the reverse proxy - One needs read and write permissions to connect to the socket With the commit, one can set the group to be a group that contains the reverse proxy user and permissions to 0770
- Loading branch information
Showing
9 changed files
with
182 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package configuration | ||
|
||
import ( | ||
"os" | ||
"os/user" | ||
"strconv" | ||
) | ||
|
||
type UnixPermission struct { | ||
Owner string | ||
Group string | ||
Mode os.FileMode | ||
} | ||
|
||
func (p *UnixPermission) SetPermission(file string) error { | ||
var e error | ||
e = os.Chmod(file, p.Mode) | ||
if e != nil { | ||
return e | ||
} | ||
|
||
gid := -1 | ||
uid := -1 | ||
|
||
if p.Owner != "" { | ||
var user_obj *user.User | ||
user_obj, e = user.Lookup(p.Owner) | ||
if e != nil { | ||
return e | ||
} | ||
uid, e = strconv.Atoi(user_obj.Uid) | ||
if e != nil { | ||
return e | ||
} | ||
} | ||
if p.Group != "" { | ||
var group *user.Group | ||
group, e := user.LookupGroup(p.Group) | ||
if e != nil { | ||
return e | ||
} | ||
gid, e = strconv.Atoi(group.Gid) | ||
if e != nil { | ||
return e | ||
} | ||
} | ||
|
||
e = os.Chown(file, uid, gid) | ||
if e != nil { | ||
return e | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters