Converting Spamassassin rules to rspamd - spam-prevention

I set up a new mail server using rspamd. I have sets of rules from spamassasin.
I would like to import/convert them to rspamd.
What I did:
Created file with rules on /etc/rspamd/custom/spamassasin.map
Added config in local.d/spamassassin.conf:
ruleset = "/etc/rspamd/custom/spamassasin.map";
Restarted rspamd
In logs there are errors:
#1(main) <83zuwt>; lua; spamassassin.lua:871: unknown function Subject:raw=~/=\?(UTF|utf)-8\?B\?4(p|q)/
#1(main) <83zuwt>; lua; spamassassin.lua:871: unknown function From=~/Administrator/
#1(main) <83zuwt>; lua; spamassassin.lua:871: unknown function To=~/Recipients /
#1(main) <83zuwt>; lua; spamassassin.lua:871: unknown function Subject=~/(?: darmo| gratis|bez op.{1,8}at)/
#1(main) <83zuwt>; lua; spamassassin.lua:871: unknown function Subject=~/\-\d+\%/
Rules are fetched from: https://github.com/zabojcaspamu/spamassassin_rules/blob/master/local.cf.reguly.ZABOJCASPAMU
and looks lik:
header ZABOJCASPAMU_SUBJECT_KREDYT Subject=~/(?:(K|k)redyt| po.{1,8}yczka)/
describe ZABOJCASPAMU_SUBJECT_KREDYT W temacie slowo kredyt lub pozyczka
score ZABOJCASPAMU_SUBJECT_KREDYT 0.8
Question is how to make it work or how to write/convert this rules to rspamd format. I didn't find a similar way as in Spamassassin on rspamd documentation.

It seems I've seen something similar in the past - does this error disappear if you add spaces around =~ operator in SA rules? If yes, then could you please open an issue in Rspamd bug tracker: https://github.com/vstakhov/rspamd/issues ?

Related

Android Manifest merger error in Codename One

In a bare bones project, I added these build hints:
android.gradleDep=compile 'com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.5'
android.min_sdk_version=23
I would like to import the following Android library to make a CN1Lib (that requires at least Android SDK 23):
https://github.com/erikagtierrez/multiple-media-picker
To be short: I spent one day trying to import that, I also experimented with Android Studio and with suggestions found on Stack Overflow (trying to make a custom .aar), without success.
Could you help me to import that library? There is manifest merger error.
In fact, the issue reported by the build server is:
* What went wrong:
Execution failed for task ':processReleaseManifest'.
> Manifest merger failed : Attribute application#label value=(BareBones) from AndroidManifest.xml:15:17-42
is also present at [com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.5] AndroidManifest.xml:23:9-41 value=(#string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:15:3-43:103 to override.
I also tried to add the build hint:
android.xapplication_attr=tools:replace="android:label"
as suggested by the previous error, without success.
In the last case, I get:
Merging result: ERROR
/tmp/build1659178556337293135xxx/Test/src/main/AndroidManifest.xml:15:3-43:103 Error:
tools:replace specified at line:15 for attribute android:label, but no new value specified
/tmp/build1659178556337293135xxx/Test/src/main/AndroidManifest.xml Error:
Validation failed, exiting
-- Merging decision tree log ---
The last full log is here: https://gist.github.com/jsfan3/dd6c23f86a2ac949f996910c8cece62b
Thank you
This is happening because our code things you injected android:label on your own and doesn't inject it to avoid collision...
Change the code to this:
android.xapplication_attr=tools:replace="android:label" android:label="App Name"

React Native setAllowFontScaling argument 1 has type boolean, got java.lang.Integer

I have a heavy react native application where I am occasionally getting this error. The application has lots of images and texts but I am really unable to figure out the root cause of this issue
LOCATION ViewManagersPropertyCache.java line 100 in com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp()
EXCEPTION java.lang.IllegalArgumentException
MESSAGE method com.facebook.react.views.text.ReactTextShadowNode.setAllowFontScaling argument 1 has type boolean, got java.lang.Integer
Any help would be appreciated.
Please Use like following
import {Text} from 'react-native';
Text.defaultProps.allowFontScaling = true;
or
<Text allowFontScaling={true}> Some Test Line </Text>
Try to grep your project to search the allowFontScaling prop. It should be a boolean but if you set it to an integer that's why you are seeing this error.
grep -rn "allowFontScaling" .

Apache Zeppelin - error: overloaded method value run with alternatives

I am trying to use the angular binding feature available in Apache Zeppelin in the following code:
val ab10 = z.sqlContext.sql("select "+ z.angular("selectVari0") + " from MyDF")
ab10.toDF.registerTempTable("ab0")
z.angularBind("abb0", ab10)
val selvar = z.getInterpreterContext()
z.angularUnwatch("abb0")
z.angularWatch("abb0", (before:Object, after:Object) => {
z.run(15, selvar)
})
I get the following error:
ab10: org.apache.spark.sql.DataFrame = [BMI: double]
warning: there was one deprecation warning; re-run with -deprecation for details
selvar: org.apache.zeppelin.interpreter.InterpreterContext = org.apache.zeppelin.interpreter.InterpreterContext#216b8218
<console>:31: error: overloaded method value run with alternatives:
(x$1: java.util.List[Object],x$2: org.apache.zeppelin.interpreter.InterpreterContext)Unit <and>
(x$1: String,x$2: String)Unit
cannot be applied to (Int, org.apache.zeppelin.interpreter.InterpreterContext)
z.run(15, selvar)
^
I tried anther example from here. I got similar errors. I was not able to find any documentation to fix this error.
As stated in error message, you have to overloaded .run methods, with following signatures:
(x$1: java.util.List[Object],x$2: org.apache.zeppelin.interpreter.InterpreterContext)Unit <and>
(x$1: String,x$2: String)Unit
Please, try to call it like this:
import collection.JavaConverters._
z.run(List(15).asJava, selvar)

Difference between "drive.metadata.readonly" and "drive.readonly.metadata"

I want to ask what is the difference between DriveScopes.DRIVE_METADATA_READONLY and https://www.googleapis.com/auth/drive.readonly.metadata? In other words, what is the difference between
these two forms:
https://www.googleapis.com/auth/drive.metadata.readonly //DriveScopes.DRIVE_METADATA_READONLY
https://www.googleapis.com/auth/drive.readonly.metadata
When I was using service account for working with Drive API it takes me a long time to figure out, why my app was throwing unauthorized exception:
Uncaught exception from servlet
com.google.api.client.auth.oauth2.TokenResponseException: 403
{
"error" : "access_denied",
"error_description" : "Requested client not authorized."
}
The String constant DriveScopes.DRIVE_METADATA_READONLY was causing the exception. In which context should I use this constant?
That's clearly a mistake in the Java API client.
The API documentation states that the correct scope is :
https://www.googleapis.com/auth/drive.readonly.metadata
Whereas when you look at the latest javadoc (at the time of this answer), you get :
https://www.googleapis.com/auth/drive.metadata.readonly
You should ignore the DriveScopes constant and create your own constant, while the Google Drive team fixes this.

Drupal Domain Access module Settings Tab White Screen of Death WSOD

In the Drupal 7.x project I'm developing, I'm using Domain Access module.
Somehow, when I try to access the Settings tab (admin/structure/domain/settings) I get a WSOD.
ERROR LOG:
[Wed May 07 11:20:08 2014] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function object_log() in /var/www/MYDRUPALPROJECT/sites/all/modules/custom/domain_bonus/domain_bonus_login_restrict/domain_bonus_login_restrict.module on line 55, referer: http:// MYDRUPALPROJECT/en/admin/structure/domain
Content from the file in question:
......
/**
*Implements hook_form_alter().
*/
function domain_bonus_login_restrict_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
.....
// Provide option to enable / disable restriction on domain settings form.
case 'domain_configure_form':
(LINE 55:) object_log('form_id ' . time(), $form_id);
.....
This custom module is a copy of the contrib module with just some simple modifications that don't involve the line in question.
Anyone have any idea what can be the cause of this?
Should I share any other relevant information to help you understand this?
Thank you!
Solved!
The problem was that the contrib module Domain Bonus: Login Restrict comes with the following lines of code:
object_log('form_id ' . time(), $form_id);
object_log('form_state ' . time(), $form_state);
object_log('form ' . time(), $form);
Those lines are used to debbug, probably during the module development.
object_log() function is a function from the object log module that can be used to debbug, more specifically to check variables value in a specific part of the code.
Since in the module .info file isn't defined that the Domain Bonus: Login Restrict module depends on the Object Log module, the Object Log module wasn't even installed in our project... In that conditions when reading that line, Drupal crashes.
So, for this function to work Object Log module needs to be installed, this module needs Devel module to work. Or simply just comment or delete those lines.
Cheers.

Resources