@anybody, thanks, I'm open for discussion.
Let's move on if you know the way
I think, I have finished the issue.
Thanks @anybody and @jernejmramor
Jernej, I have merged your code (by applying the patch, the merge was failed).
Thanks again, but I will continue a work.
@Jernej, many thanks for your work.
I'm still unsure whether implementing a whitelist/protected IPs is necessary.
The check is only performed at the form level, but Advban is a service, and even protected IPs can be banned using the banIp() function.
External systems that use Advban have such a whitelist—for example, for the Autoban module https://git.drupalcode.org/project/autoban/-/blob/8.x-1.x/src/Controller/AutobanController.php?ref_type=heads .
And since the banIp() function doesn't return a result (just like it does in the Ban core module), we're always sure that an IP ban has been successfully performed. If we add the result of banIp() , this complicates the workflow and the automatic IP ban module will constantly send a ban request, since the IP will not be banned.
I have added a patch to the 1.12 version - https://git.drupalcode.org/project/autoban/-/blob/8.x-1.x/modules/autoba...
if (method_exists($this, 'addFilterToQuery')) {
$this->addFilterToQuery($request, $query);
}
else {
$filter = $this->buildFilterQuery($request);
if (!empty($filter['where'])) {
$query->where($filter['where'], $filter['args']);
}
}
George, thank you for your report.
Unfortunately, I cannot reproduce it.
Could you re-get the version 1.12 from drupal.org by composer?
@anybody, yes, that's right, modules should change module dependencies. Initially, advban was made as a fork, not an extension. Perhaps this was incorrect, but I wanted to be independent of the ban core module. However, ban is now considered obsolete and will be removed from the core in Drupal 12, so module developers will have to change the dependency anyway. In this sense, advban and ban are on the same level, so why not choose advban in this case?
Hi Julian, thanks for your interest in the module.
Advban is a sort of fork of the core Ban module and uses its own table.
Advban can be used by other modules, such as Perimeter, as a ban provider if they want to of course.
Yes, of course, version 1 will be updated. Version 2 is a different approach - using system breadcrumbs instead of subdomain breadcrumbs.
It's a pity that this patch is only for the menu. But I encountered a custom entity that has a status field called "published". Is there a universal solution for the status field?
@matia.ward, many thanks for your testing.
I've fixed that case, please test it on the dev version.
But the right way is to use contributed breadrumb modules like
Easy breadcrumb →
.
The dev version should now work with both versions up to 11.2 and 11.2 and later.
I made selector if the function is exist (instead of checking Drupal version)
if (method_exists($this, 'addFilterToQuery'))
It will be fixed permanently on 8.x-1.12 version.
Sorry for the inconvenience
@cbstuart, thanks for report, the issue was fixed on dev-version, please see https://www.drupal.org/project/autoban/issues/3530962 🐛 Drupal 11.2.0 - Upgrade Error Active
@drupalbubb,
I still haven't stopped thinking about your words and decided to make a Force mode. When it is enabled, all 404, 403 requests will be automatically blocked. I would be grateful if you could look at the
dev →
version of the site. You need to enable the Force mode checkbox in the general settings of the module. It is better to disable the Cron checkbox.
Thank you for your post.
Thanks, @xtaz, @willids
@matia.ward, I did commit to dev version, please check.
@matia.ward, ah, sorry, you are right. Core breadcrumb doesn't know how to construct breadcrumb correctly (it uses $this->context->getPathInfo() istead of $route_match data). Try to use Easy breadcrumb → or similar modules.
@willids, thank you very much for your report.
I have updated the dev version, please test.
@matia.ward, I decided to add breadcrumb into Decoupled Kit Block (2.0.3 version).
Please, see system_breadcrumb_block
block and settings/breadcrumb
section in the resulted JSON.
Ruslan, no, the Database Logging dependence is the key point of the module.
Ruslan, sorry. The module has not dependency to other modules (see https://git.drupalcode.org/project/advban/-/blob/8.x-1.x/advban.info.yml...)
goodboy → changed the visibility of the branch 3524654-country-ban-request to hidden.
goodboy → changed the visibility of the branch 3524654-country_ban_request to hidden.
Niels, it's extremely hard for me - creating forks, merge requests. It's done in an inconvenient and unclear way.
I've created https://git.drupalcode.org/project/advban/-/merge_requests/8 - please review
Niels,
I've installed the ip2country module and applied a patch from
https://www.drupal.org/project/ip2country/issues/2571835
✨
Use HTTP instead of FTP
Needs review
(
https://www.drupal.org/files/issues/2025-03-24/ip2country-2571835-21.patch →
).
I think we need to create advban_bycountry submodule of the advban module.
We can get coutry code for user and check the selected forbidden countries from the module's setings.
$ip = \Drupal::request()->getClientIp();
$country_code = \Drupal::service('ip2country.lookup')->getCountry($ip);
if (in_array($country_code,$forbidded_countries)) {
// Ban the ip in the middleware class
}
We need also to get countries list for settings by combine 2 lists:
$countries = \Drupal\Core\Locale\CountryManager::getStandardList();
"SELECT country FROM {ip2country} GROUP BY country"
I think we need to create a plugins system, then use getDefinitions()
and createInstance()
for checking all advban extentions.
After the submodule was completed we will have 2 ways for IP banning: by IP list and by country. What should be the priority?
Hi, Niels
Thanks for your proposition
I think we could use
ip2country →
I'm not sure if the data on https://www.nirsoft.net/countryip/ is up to date, and the Drupal module seems pretty easy to use.
@drupalbubb, I think there is no such event..
In any case, I think it's too resource-intensive to run an IP ban check for each log entry writing. Perhaps it would be easier to make a separate cron, for example, every minute.
@agarzola, thank you, merged
@drupalbubb,
This is an interesting question. I haven't implemented it yet. It's not clear yet what event we're talking about.
Hello, drupalbubb
you can use /admin/config/people/autoban/ban or drush autoban:ban for the 'Ban all' action.
Regarding of idea 📌 [Policy] Deprecate Ban module in Drupal 10 and move it to contrib for Drupal 11 Active I've added the ban reason field to the latest release of advban → module. This was the only concern I read with advban.
@somebodysysop,
try
$controller = \Drupal::service('autoban');
$banned_ip = $controller->getBannedIp($rule);
$banned = $controller->banIpList($banned_ip, $rule);
You need to create an Autoban rule before and use the rule ID ($rule
).
$banned
is the count of the banned IP from the
$banned_ip list.
Hello, promo-il
You can use advban.ip_manager
service or can see how it was done at the
Autoban →
module.
I set $settings['mailer_sendmail_commands'] = ['/usr/sbin/sendmail -t'];
in settings.php and there are no errors, but I can receive emails. My own transport returns an error. Is it possible to send emails to Acquia so that they reach the recipient?
Thank you, Marc-Antoine, merged
@steven jones, I have changed the type of the field, as you said. Thank you
Thank you all, now description of my projects are correct
@leslieg, thank you again. I can see logo for my projects. But I am shocked that the description is wrong. How do you write descriptions for modules?
@chrisfromredfin, I tried to click to the button but the storage didn't clear. I see very old and wrong description to my modules. What I need to do to fix the great problem for me?
If your module can't get correct module descriptions, is there a way to opt out of being included in the "index" of your module?
@leslieg, thank you. I have removed the first picture from the module's page ( https://www.drupal.org/project/autoban → )
@steven_jones, I use '#type' => 'textfield' and '#type' => 'textarea' for form fields and correspond them to schema fields as 'textfield' => 'string', 'textarea' => 'text'. The textfield type has limitation 255 chars.
I consider the expiry_durations field like a description and I found core schemas use 'text' type for descriptions. So, I think the field can be left 'text' type. Perhaps the type 'string' can also be used but I prefer don't change anything if I can.
I also asked AI for differences between 'string' and 'text' schema types.
"In Drupal, both string and text are data types used for storing textual data, but they serve different purposes and have distinct characteristics. Here's a breakdown of the differences:
1. string Type
Purpose: Used for short, simple text values.
Storage: Typically stored in the database as a VARCHAR with a limited length (e.g., 255 characters by default in Drupal).
2. text Type
Purpose: Used for longer, more complex text values that may include formatting or multiple lines.
Storage: Stored in the database as a TEXT field, which can hold much larger amounts of data compared to VARCHAR."
Honestly, I don't know how right this is. But I think something like that.
@steven jones, I use "text" because the expiration date can potentially be longer than 255 characters.
@steven jones, I changed the schema. Please, review
@steven jones, thank you for your report.
@ikphilip, many thanks for the integration
@heikkiy, thank you very much for your answer. I have changed the default branch to 8.x-1.x and I can see the logo at the https://git.drupalcode.org/project/autoban . Hopefully I will have to wait a bit for the project images to update.
@bart lambert, thank you for your report.
I decided to remove the default value and allow the field to accept NULL values.
You can delete the new column by running SQL command
"alter table advban_ip drop column reason;"
Hi, @kristen_pol,
I am desperate because I can't install the logo for the Autoban module. I used the logo from this page, but I have been waiting for months for the logo to appear without any success. I also have created an issue at the
https://www.drupal.org/project/project_browser/issues/3496549
💬
Logo for Autoban project does not show
Active
Hi, @jons
Thank you for your thoughts.
It was designed as an open system and third party IP ban providers can use the integration with the Autoban module.
I want to keep the structure.
I've changed README.md
Hi, @jons
Thank you for using Autoban
You should enable Autoban submodule (for the Ban provider is the Autoban Core Ban Provider).
I wrote in README.md
"You must enable Database Logging core module and at least one
IP Ban Provider by enabling submodules."
Perhaps I clumsily formulated the requirements. Maybe you will help me with this.
I also tried working Autoban on Drupal 9.5.11, it found the Ban provider.
@lfersoy, thank you for your message.
Can you check the module's dev version and I will do release
@somebodysysop, thanks for testing.
I can't reproduce the whitelist issue for Drupal 10.1.6 and 11 versions.
The logic for adding the Autobank links is:
$ip = $dblog->hostname;
if (!empty($ip) && $autobanController->canIpBan($ip)) {
// Retrieve Autoban Ban Providers list.
$providers = [];
$banManagerList = $autobanController->getBanProvidersList();
if (!empty($banManagerList)) {
$destination = $this->getDestinationArray();
foreach ($banManagerList as $id => $item) {
$url_item = Url::fromRoute('autoban.direct_ban', [
'ips' => $ip,
'provider' => $id,
], [
'query' => [
'destination' => $destination['destination'],
],
]);
$url_link = Link::fromTextAndUrl($item['name'], $url_item);
$providers[$id] = $url_link->toString();
}
}
}
The main checking is autobanController->canIpBan($ip)
. It didn't change after 8.1.10.
The function calls the whitelist checking function:
if ($this->whitelistIp($ip)) {
return FALSE;
}
Perhaps in your particular case this function is failing and needs to be fixed.
@somebodysysop, thank you for report.
Please, check on the latest dev version.
Hi, @netgeek123
That's cool, thank you for your work.
Hello, is.manu
I've added 9.3 version requirement to the latest dev version. Please, test.
Hello, @aaronbauman
We are going to extend Drupal\salesforce\SelectQuery by adding simple functions. This will allow us to create chains like
$query
->fields(['field1', 'field2'])
->addCondition('status', 1)
->addOrder('DateCreated', 'DESC')
->limit(1);
Does it make sense to propose these functions for inclusion in Drupal\salesforce\SelectQuery? If not, can we safely use our derived class with these functions?
public function objectType($value) {
$this->objectType = $value;
return $this;
}
public function fields(array $fields) {
$this->fields = $fields;
return $this;
}
public function addField($field) {
$this->fields[] = $field;
return $this;
}
public function order(array $order) {
$this->order = $order;
return $this;
}
public function addOrder($field, $value = 'ASC') {
$this->order[$field] = $value;
return $this;
}
public function limit($value) {
$this->limit = (int) $value;
return $this;
}
public function offset($value) {
$this->offset = (int) $value;
return $this;
}
Hello @bburg, thanks for your proposition.
I think I could be add a "Merge" button to addition to "Add" button.
If you pushed to the Merge button and if you entered a range IP - we won't check existing IP.
@Kristen Pol, @AaronDeutsch - thanks for logos for Advanced ban and Autoban modules.
@Kristen Pol, thanks for your message.
I tried to add logo.png to my another project
https://www.drupal.org/project/autoban →
and it doesn't work (https://git.drupalcode.org/project/autoban/-/raw/8.x-1.x/logo.png?ref_type=heads). I figured out that the logo file has size 10.7kb but I don't know to decrease it. In my opinion, the conditions for the image are close to impossible.
But if someone sends me a image and I like it, I will add it to the project.
Fixed
@trickfun, please check the removing at the latest dev version.
The watchdog table has 2 columns: untranslated text pattern (on English) and the serialized variables. The human-reading text is generating by t(pattern, variables) due to current language. We can use only the unified message pattern or the variables string with serialized format.
I don't see a simple solution yet.
@jwilson3, I'm agree with your idea. That's a right solution, in my mind.
If you create a merge request or patch file, I will consider it
@jungle, thanks for your work.
Could you tell me how you performed the deprecation check?
VladimirAus → credited goodboy → .