aboutsummaryrefslogtreecommitdiff
path: root/awwan.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-12-17 15:36:14 +0700
committerShulhan <ms@kilabit.info>2023-12-17 18:43:01 +0700
commitb0375d78d6f1f5572e54f9427a55af0a6aaa12bc (patch)
tree624d418d07a9f62c862bfb3cb3fe4fbfe7092ae2 /awwan.go
parentcf8caf8844b51d71e39f5b454fc7c79a9bec3227 (diff)
downloadawwan-b0375d78d6f1f5572e54f9427a55af0a6aaa12bc.tar.xz
all: change the remote temporary directory to "~/.cache/awwan"
If the file to be copied contains sensitive data, putting them in "/tmp" considered a security risk, even though it will be moved to destination later. The issue is when the "#put" command failed, the plain file is left on "/tmp" directory. This changes add additional advantage where we did not need to remove the temporary directory on remote when execution completed, since the temporary directory should be accessible by user only. Implements: https://todo.sr.ht/~shulhan/awwan/8
Diffstat (limited to 'awwan.go')
-rw-r--r--awwan.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/awwan.go b/awwan.go
index 4923779..4827f94 100644
--- a/awwan.go
+++ b/awwan.go
@@ -47,7 +47,6 @@ const (
defEnvFileName = `awwan.env` // The default awwan environment file name.
defSSHConfig = `config` // The default SSH config file name.
defSSHDir = `.ssh` // The default SSH config directory name.
- defTmpDir = `/tmp`
)
// defEncryptExt default file extension for encrypted file.
@@ -56,6 +55,12 @@ const defEncryptExt = `.vault`
// defFileEnvVault default awwan environment file name that is encrypted.
const defFileEnvVault = `.awwan.env.vault`
+// defTmpDirLocal default temporary directory in local.
+const defTmpDirLocal = `.cache/`
+
+// defTmpDirPlay default temporary directory in remote.
+const defTmpDirPlay = `~/.cache/awwan`
+
// Awwan is the service that run script in local or remote.
// Awwan contains cache of sessions and cache of environment files.
type Awwan struct {
@@ -328,12 +333,6 @@ func (aww *Awwan) Local(req *ExecRequest) (err error) {
}
req.mlog.Outf(`=== END: %s %s %s`, req.Mode, req.Script, req.LineRange)
out:
- if ses != nil {
- var errRemove = os.RemoveAll(ses.dirTmp)
- if errRemove != nil {
- req.mlog.Errf(`!!! %s: %s`, logp, errRemove)
- }
- }
if err != nil {
req.mlog.Errf(`!!! %s`, err)
err = fmt.Errorf(`%s: %w`, logp, err)