summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamassassin.lua
Commit message (Collapse)AuthorAgeFilesLines
...
* [Fix] Fix body rules in SA pluginVsevolod Stakhov2016-04-281-32/+45
|
* [Fix] Add more priority for config file symbols registered from UCLVsevolod Stakhov2016-04-261-2/+2
|
* [Feature] Use new version of register_symbol in rspamd pluginsVsevolod Stakhov2016-04-221-1/+5
|
* [Fix] Fix calling of process_regexp after flatteningVsevolod Stakhov2016-04-121-1/+1
|
* [Feature] Optimize hot paths in SA pluginVsevolod Stakhov2016-04-121-27/+7
|
* [Feature] Use sabody rules in SA pluginVsevolod Stakhov2016-04-111-3/+29
|
* [Fix] Properly handle MIME headers in SA pluginVsevolod Stakhov2016-04-111-11/+31
|
* [Fix] Fix eval:check_for_missing_to_header ruleVsevolod Stakhov2016-04-111-1/+2
|
* [Feature] Save trace for SA metasVsevolod Stakhov2016-03-311-2/+3
|
* [Fix] Lowercase keys in SA listsVsevolod Stakhov2016-03-181-8/+8
|
* [Fix] SA uses mime recipients/senders for everythingVsevolod Stakhov2016-03-081-7/+7
|
* [Feature] Add support for WLBLEval SA pluginVsevolod Stakhov2016-03-041-1/+98
|
* [Fix] Set 'ignore' flags from symbols coming from SAVsevolod Stakhov2016-03-031-1/+1
|
* [Feature] SA plugin can now set missing scores for rspamdVsevolod Stakhov2016-03-021-5/+16
|
* Add some more replacementsVsevolod Stakhov2016-02-211-1/+8
|
* Better dependencies support between SA and rspamdVsevolod Stakhov2016-02-211-13/+77
| | | | | Now SA rules can depend on the corresponding rspamd rules applying the replacement table.
* In lua, number cannot be used in boolean contextVsevolod Stakhov2016-02-181-2/+1
|
* Fix negation for header rules in SA pluginVsevolod Stakhov2016-02-171-4/+12
|
* Fix one shot mode for SA metasVsevolod Stakhov2016-02-081-1/+5
|
* Use has symbol when no need to get extra data for a symbolVsevolod Stakhov2016-02-081-2/+2
|
* Fix metas memoization in SA pluginVsevolod Stakhov2016-02-061-1/+4
|
* Switch the rest to apache 2Vsevolod Stakhov2016-02-041-22/+12
|
* Small improvement of loggingVsevolod Stakhov2016-01-181-1/+1
|
* Add globbing supportVsevolod Stakhov2016-01-121-11/+19
|
* Avoid cached regexpsVsevolod Stakhov2016-01-041-4/+4
|
* Fix freemail rulesVsevolod Stakhov2015-12-231-9/+11
|
* Fix issue when SA metas contain other metasVsevolod Stakhov2015-12-221-5/+8
|
* Allow to exclude some regexps from hyperscanVsevolod Stakhov2015-12-101-223/+252
|
* Write errors about missing SA conf filesVsevolod Stakhov2015-12-101-1/+4
|
* Add rawmime classVsevolod Stakhov2015-12-091-2/+6
|
* Fix pcre post-filteringVsevolod Stakhov2015-12-091-1/+1
|
* Fix a stupid misprintVsevolod Stakhov2015-12-091-0/+1
|
* Fix SA plugin for multiple regexpsVsevolod Stakhov2015-12-091-3/+17
|
* Add support of 'special' SA headers to 'exists' functionVsevolod Stakhov2015-12-071-2/+17
|
* Add support for Mail::SpamAssassin::Plugin::MIMEHeaderVsevolod Stakhov2015-12-071-3/+27
|
* More fixes for SA plugin to deal with the new cacheVsevolod Stakhov2015-12-071-9/+71
|
* Fix replacements in spamassassin pluginVsevolod Stakhov2015-12-061-2/+5
|
* More rework for re_cacheVsevolod Stakhov2015-12-041-52/+23
|
* Start rework of spamassassin pluginVsevolod Stakhov2015-12-041-10/+65
|
* Add check_for_mime('mime_attachement') functionVsevolod Stakhov2015-11-231-0/+23
|
* Rework SA plugin for some problematic casesVsevolod Stakhov2015-11-231-21/+88
|
* Add 'check_relays_unparseable' supportVsevolod Stakhov2015-11-231-1/+16
|
* Add support for check_for_shifted_date and check_for_missing_to_header eval ↵Vsevolod Stakhov2015-11-131-6/+54
| | | | rules to SA plugin
* Allow the same keys in the configurationVsevolod Stakhov2015-11-131-3/+13
|
* Fix critical issue with parsing of scores.Vsevolod Stakhov2015-11-131-81/+105
|
* Allow dependencies on rspamd symbols for SA metasVsevolod Stakhov2015-10-261-0/+38
|
* Update logging in lua modules.Vsevolod Stakhov2015-09-011-15/+18
|
* Improve spamassassin plugin.Vsevolod Stakhov2015-08-251-38/+68
| | | | | | | - Now headers are matched more like SA - Improve support of Message-ID - Add support of ToCc header type - Fix :addr and :name in headers regexps
* If replacement cannot be applied, just remove regexp.Vsevolod Stakhov2015-05-261-0/+4
|
* Fix misprint in spamassassin plugin.Vsevolod Stakhov2015-05-261-1/+1
|
n>"image/svg+xml", Sizes: "512x512", }, }, }) if err != nil { log.Error("unable to marshal manifest JSON. Error: %v", err) return make([]byte, 0) } return bytes } // MakeAbsoluteAssetURL returns the absolute asset url prefix without a trailing slash func MakeAbsoluteAssetURL(appURL, staticURLPrefix string) string { parsedPrefix, err := url.Parse(strings.TrimSuffix(staticURLPrefix, "/")) if err != nil { log.Fatal("Unable to parse STATIC_URL_PREFIX: %v", err) } if err == nil && parsedPrefix.Hostname() == "" { if staticURLPrefix == "" { return strings.TrimSuffix(appURL, "/") } // StaticURLPrefix is just a path return util.URLJoin(appURL, strings.TrimSuffix(staticURLPrefix, "/")) } return strings.TrimSuffix(staticURLPrefix, "/") } func loadServerFrom(rootCfg ConfigProvider) { sec := rootCfg.Section("server") AppName = rootCfg.Section("").Key("APP_NAME").MustString("Gitea: Git with a cup of tea") Domain = sec.Key("DOMAIN").MustString("localhost") HTTPAddr = sec.Key("HTTP_ADDR").MustString("0.0.0.0") HTTPPort = sec.Key("HTTP_PORT").MustString("3000") // DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version // if these are removed, the warning will not be shown if sec.HasKey("ENABLE_ACME") { EnableAcme = sec.Key("ENABLE_ACME").MustBool(false) } else { deprecatedSetting(rootCfg, "server", "ENABLE_LETSENCRYPT", "server", "ENABLE_ACME", "v1.19.0") EnableAcme = sec.Key("ENABLE_LETSENCRYPT").MustBool(false) } Protocol = HTTP protocolCfg := sec.Key("PROTOCOL").String() if protocolCfg != "https" && EnableAcme { log.Fatal("ACME could only be used with HTTPS protocol") } switch protocolCfg { case "https": Protocol = HTTPS if EnableAcme { AcmeURL = sec.Key("ACME_URL").MustString("") AcmeCARoot = sec.Key("ACME_CA_ROOT").MustString("") if sec.HasKey("ACME_ACCEPTTOS") { AcmeTOS = sec.Key("ACME_ACCEPTTOS").MustBool(false) } else { deprecatedSetting(rootCfg, "server", "LETSENCRYPT_ACCEPTTOS", "server", "ACME_ACCEPTTOS", "v1.19.0") AcmeTOS = sec.Key("LETSENCRYPT_ACCEPTTOS").MustBool(false) } if !AcmeTOS { log.Fatal("ACME TOS is not accepted (ACME_ACCEPTTOS).") } if sec.HasKey("ACME_DIRECTORY") { AcmeLiveDirectory = sec.Key("ACME_DIRECTORY").MustString("https") } else { deprecatedSetting(rootCfg, "server", "LETSENCRYPT_DIRECTORY", "server", "ACME_DIRECTORY", "v1.19.0") AcmeLiveDirectory = sec.Key("LETSENCRYPT_DIRECTORY").MustString("https") } if sec.HasKey("ACME_EMAIL") { AcmeEmail = sec.Key("ACME_EMAIL").MustString("") } else { deprecatedSetting(rootCfg, "server", "LETSENCRYPT_EMAIL", "server", "ACME_EMAIL", "v1.19.0") AcmeEmail = sec.Key("LETSENCRYPT_EMAIL").MustString("") } if AcmeEmail == "" { log.Fatal("ACME Email is not set (ACME_EMAIL).") } } else { CertFile = sec.Key("CERT_FILE").String() KeyFile = sec.Key("KEY_FILE").String() if len(CertFile) > 0 && !filepath.IsAbs(CertFile) { CertFile = filepath.Join(CustomPath, CertFile) } if len(KeyFile) > 0 && !filepath.IsAbs(KeyFile) { KeyFile = filepath.Join(CustomPath, KeyFile) } } SSLMinimumVersion = sec.Key("SSL_MIN_VERSION").MustString("") SSLMaximumVersion = sec.Key("SSL_MAX_VERSION").MustString("") SSLCurvePreferences = sec.Key("SSL_CURVE_PREFERENCES").Strings(",") SSLCipherSuites = sec.Key("SSL_CIPHER_SUITES").Strings(",") case "fcgi": Protocol = FCGI case "fcgi+unix", "unix", "http+unix": switch protocolCfg { case "fcgi+unix": Protocol = FCGIUnix case "unix": log.Warn("unix PROTOCOL value is deprecated, please use http+unix") fallthrough case "http+unix": Protocol = HTTPUnix } UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666") UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32) if err != nil || UnixSocketPermissionParsed > 0o777 { log.Fatal("Failed to parse unixSocketPermission: %s", UnixSocketPermissionRaw) } UnixSocketPermission = uint32(UnixSocketPermissionParsed) if !filepath.IsAbs(HTTPAddr) { HTTPAddr = filepath.Join(AppWorkPath, HTTPAddr) } } UseProxyProtocol = sec.Key("USE_PROXY_PROTOCOL").MustBool(false) ProxyProtocolTLSBridging = sec.Key("PROXY_PROTOCOL_TLS_BRIDGING").MustBool(false) ProxyProtocolHeaderTimeout = sec.Key("PROXY_PROTOCOL_HEADER_TIMEOUT").MustDuration(5 * time.Second) ProxyProtocolAcceptUnknown = sec.Key("PROXY_PROTOCOL_ACCEPT_UNKNOWN").MustBool(false) GracefulRestartable = sec.Key("ALLOW_GRACEFUL_RESTARTS").MustBool(true) GracefulHammerTime = sec.Key("GRACEFUL_HAMMER_TIME").MustDuration(60 * time.Second) StartupTimeout = sec.Key("STARTUP_TIMEOUT").MustDuration(0 * time.Second) PerWriteTimeout = sec.Key("PER_WRITE_TIMEOUT").MustDuration(PerWriteTimeout) PerWritePerKbTimeout = sec.Key("PER_WRITE_PER_KB_TIMEOUT").MustDuration(PerWritePerKbTimeout) defaultAppURL := string(Protocol) + "://" + Domain + ":" + HTTPPort AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL) // Check validity of AppURL appURL, err := url.Parse(AppURL) if err != nil { log.Fatal("Invalid ROOT_URL '%s': %s", AppURL, err) } // Remove default ports from AppURL. // (scheme-based URL normalization, RFC 3986 section 6.2.3) if (appURL.Scheme == string(HTTP) && appURL.Port() == "80") || (appURL.Scheme == string(HTTPS) && appURL.Port() == "443") { appURL.Host = appURL.Hostname() } // This should be TrimRight to ensure that there is only a single '/' at the end of AppURL. AppURL = strings.TrimRight(appURL.String(), "/") + "/" // AppSubURL should start with '/' and end without '/', such as '/{subpath}'. // This value is empty if site does not have sub-url. AppSubURL = strings.TrimSuffix(appURL.Path, "/") UseSubURLPath = sec.Key("USE_SUB_URL_PATH").MustBool(false) StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/") // Check if Domain differs from AppURL domain than update it to AppURL's domain urlHostname := appURL.Hostname() if urlHostname != Domain && net.ParseIP(urlHostname) == nil && urlHostname != "" { Domain = urlHostname } AbsoluteAssetURL = MakeAbsoluteAssetURL(AppURL, StaticURLPrefix) AssetVersion = strings.ReplaceAll(AppVer, "+", "~") // make sure the version string is clear (no real escaping is needed) manifestBytes := MakeManifestData(AppName, AppURL, AbsoluteAssetURL) ManifestData = `application/json;base64,` + base64.StdEncoding.EncodeToString(manifestBytes) var defaultLocalURL string switch Protocol { case HTTPUnix: defaultLocalURL = "http://unix/" case FCGI: defaultLocalURL = AppURL case FCGIUnix: defaultLocalURL = AppURL default: defaultLocalURL = string(Protocol) + "://" if HTTPAddr == "0.0.0.0" { defaultLocalURL += net.JoinHostPort("localhost", HTTPPort) + "/" } else { defaultLocalURL += net.JoinHostPort(HTTPAddr, HTTPPort) + "/" } } LocalURL = sec.Key("LOCAL_ROOT_URL").MustString(defaultLocalURL) LocalURL = strings.TrimRight(LocalURL, "/") + "/" LocalUseProxyProtocol = sec.Key("LOCAL_USE_PROXY_PROTOCOL").MustBool(UseProxyProtocol) RedirectOtherPort = sec.Key("REDIRECT_OTHER_PORT").MustBool(false) PortToRedirect = sec.Key("PORT_TO_REDIRECT").MustString("80") RedirectorUseProxyProtocol = sec.Key("REDIRECTOR_USE_PROXY_PROTOCOL").MustBool(UseProxyProtocol) OfflineMode = sec.Key("OFFLINE_MODE").MustBool(true) if len(StaticRootPath) == 0 { StaticRootPath = AppWorkPath } StaticRootPath = sec.Key("STATIC_ROOT_PATH").MustString(StaticRootPath) StaticCacheTime = sec.Key("STATIC_CACHE_TIME").MustDuration(6 * time.Hour) AppDataPath = sec.Key("APP_DATA_PATH").MustString(filepath.Join(AppWorkPath, "data")) if !filepath.IsAbs(AppDataPath) { AppDataPath = filepath.ToSlash(filepath.Join(AppWorkPath, AppDataPath)) } EnableGzip = sec.Key("ENABLE_GZIP").MustBool() EnablePprof = sec.Key("ENABLE_PPROF").MustBool(false) PprofDataPath = sec.Key("PPROF_DATA_PATH").MustString(filepath.Join(AppWorkPath, "data/tmp/pprof")) if !filepath.IsAbs(PprofDataPath) { PprofDataPath = filepath.Join(AppWorkPath, PprofDataPath) } checkOverlappedPath("[server].PPROF_DATA_PATH", PprofDataPath) landingPage := sec.Key("LANDING_PAGE").MustString("home") switch landingPage { case "explore": LandingPageURL = LandingPageExplore case "organizations": LandingPageURL = LandingPageOrganizations case "login": LandingPageURL = LandingPageLogin case "", "home": LandingPageURL = LandingPageHome default: LandingPageURL = LandingPage(landingPage) } }