fix perm
This commit is contained in:
parent
62ab849d2d
commit
7e9f9300d4
3 changed files with 8 additions and 4 deletions
|
|
@ -13,10 +13,12 @@ parts:
|
|||
source: /build
|
||||
|
||||
apps:
|
||||
sshpiperd:
|
||||
sshpiperd-daemon:
|
||||
command: sshpiperd --config $SNAP_DATA/sshpiperd.ini
|
||||
plugs: [network-bind]
|
||||
daemon: simple
|
||||
sshpiperd:
|
||||
command: sshpiperd --config $SNAP_DATA/sshpiperd.ini
|
||||
|
||||
hooks:
|
||||
configure:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package workingdir
|
|||
|
||||
var (
|
||||
config = struct {
|
||||
WorkingDir string `long:"upstream-workingdir" default:"/var/sshpiper" description:"Path to workingdir" env:"SSHPIPERD_UPSTREAM_WORKINGDIR" ini-name:"upstream-workingdir" required:"true"`
|
||||
WorkingDir string `long:"upstream-workingdir" default:"/var/sshpiper" description:"Path to workingdir" env:"SSHPIPERD_UPSTREAM_WORKINGDIR" ini-name:"upstream-workingdir"`
|
||||
AllowBadUsername bool `long:"upstream-workingdir-allowbadusername" description:"Disable username check while search the working dir" env:"SSHPIPERD_UPSTREAM_WORKINGDIR_ALLOWBADUSERNAME" ini-name:"upstream-workingdir-allowbadusername"`
|
||||
NoCheckPerm bool `long:"upstream-workingdir-nocheckperm" description:"Disable 0400 checking when using files in the working dir" env:"SSHPIPERD_UPSTREAM_WORKINGDIR_NOCHECKPERM" ini-name:"upstream-workingdir-nocheckperm"`
|
||||
FallbackUsername string `long:"upstream-workingdir-fallbackusername" description:"Fallback to a user when user does not exists in directory" env:"SSHPIPERD_UPSTREAM_WORKINGDIR_FALLBACKUSERNAME" ini-name:"upstream-workingdir-fallbackusername"`
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ type plugin struct {
|
|||
}
|
||||
|
||||
func (p *plugin) CreatePipe(opt upstream.CreatePipeOption) error {
|
||||
err := os.MkdirAll(config.WorkingDir+"/"+opt.Username, os.ModePerm)
|
||||
err := os.MkdirAll(config.WorkingDir+"/"+opt.Username, 0775)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -30,7 +30,9 @@ func (p *plugin) CreatePipe(opt upstream.CreatePipeOption) error {
|
|||
}
|
||||
|
||||
content := fmt.Sprintf("%v@%v:%v", upuser, opt.Host, opt.Port)
|
||||
return ioutil.WriteFile(path, []byte(content), os.ModePerm)
|
||||
return ioutil.WriteFile(path, []byte(content), 0600)
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return fmt.Errorf("upstream file alreay exists")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue