diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/aerc.conf | 10 | ||||
-rw-r--r-- | config/config.go | 20 |
2 files changed, 24 insertions, 6 deletions
diff --git a/config/aerc.conf b/config/aerc.conf index 458f6359..00c6c499 100644 --- a/config/aerc.conf +++ b/config/aerc.conf @@ -1,6 +1,16 @@ # # aerc main configuration +[general] +# +# By default, the file permissions of accounts.conf must be restrictive and +# only allow reading by the file owner (0600). Set this option to true to +# ignore this permission check. Use this with care as it may expose your +# credentials. +# +# Default: false +unsafe-accounts-conf=false + [ui] # # Describes the format for each row in a mailbox view. This field is compatible diff --git a/config/config.go b/config/config.go index 8eeea100..048dd238 100644 --- a/config/config.go +++ b/config/config.go @@ -26,7 +26,8 @@ import ( ) type GeneralConfig struct { - DefaultSavePath string `ini:"default-save-path"` + DefaultSavePath string `ini:"default-save-path"` + UnsafeAccountsConf bool `ini:"unsafe-accounts-conf"` } type UIConfig struct { @@ -583,11 +584,7 @@ func LoadConfigFromFile(root *string, logger *log.Logger) (*AercConfig, error) { _root := path.Join(xdg.ConfigHome(), "aerc") root = &_root } - filename := path.Join(*root, "accounts.conf") - if err := checkConfigPerms(filename); err != nil { - return nil, err - } - filename = path.Join(*root, "aerc.conf") + filename := path.Join(*root, "aerc.conf") // if it doesn't exist copy over the template, then load if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) { @@ -620,6 +617,10 @@ func LoadConfigFromFile(root *string, logger *log.Logger) (*AercConfig, error) { Ini: file, + General: GeneralConfig{ + UnsafeAccountsConf: false, + }, + Ui: UIConfig{ IndexFormat: "%D %-17.17n %s", TimestampFormat: "2006-01-02 03:04 PM", @@ -705,6 +706,13 @@ func LoadConfigFromFile(root *string, logger *log.Logger) (*AercConfig, error) { } } + filename = path.Join(*root, "accounts.conf") + if !config.General.UnsafeAccountsConf { + if err := checkConfigPerms(filename); err != nil { + return nil, err + } + } + accountsPath := path.Join(*root, "accounts.conf") if accounts, err := loadAccountConfig(accountsPath); err != nil { return nil, err |