Tuesday, July 28, 2026

Android app policy violation triggered by old testing tracks - Blank release fix

We have multiple tracks in google play console for one of our Android apps. Currently we don't need all of them, we need only the production track. But unfortunately, google does not provide a way to delete unwanted tracks. Also, even releases in paused tracks can trigger "policy violation" of having app releases targeting older target SDK values - we need to update every year to the latest target SDK.

Asking Gemini via aistudio.google.com about this, it suggested a "Blank Release" method - create a new release, but don't upload any aab/apk file. We can do this for each of the testing tracks which we don't need. That would make the older releases "Inactive" and prevent the "policy violation" for old releases.

I've done this yesterday for one of our apps, and it seems to be working. The changes were approved after review in just an hour or less. The policy violation popup did not go away yesterday even after the changes were approved, but today I see that the policy violation popup is replaced with "Policy status - No policy issues found" in the "Monitor and improve" tab.

While we can upload the latest release to all of the tracks, and use the "Add from library" method for each track instead of uploading, the "Blank release" strategy above avoids that busy-work, hopefully permanently.

Sunday, July 26, 2026

h5p page in Moodle does not show next activity on completion

There was this issue faced by the admins of one of our Moodle instances - "Quite a few sections use the H5P Interactive Book format and contain a video to be viewed and a few quizzes to be answered. The completion condition that has been set is to view the activities and get a grade in the quiz. Even though the conditions are met, the option to move to the next activity is not available. However, if the learner refreshes the screen, then the next activity is available. But it also clears the submitted responses in the current activity."

Gemini gave a long reply, based on which the final solution, obtained by testing on a development instance, was:

  1. Enable "Save Content State" in Site Administration > Plugins > Activity Modules > H5P
  2. Add a "Refresh" prompt for students Because Moodle cannot currently auto-refresh the page when an H5P grade is achieved
Instead of just putting in a button or javascript to refresh the page manually, we can achieve a similar result using Moodle's standard activity tools.

  1. Turn on Edit mode.
  2. Click Add an activity or resource below the H5P activity.
  3. Select URL.
  4. In the Name field, type: Save changes (or Save changes and continue).
  5. In the External URL field, paste the URL of the course page.
  6. Under Appearance, set "Display" to Open (or "Automatic").
  7. Click Save and return to course.
This will place a link on the course page that looks like a standard Moodle activity. When students click it, it essentially re-opens the course page they are already on, refreshing the backend completion triggers and unlocking the next module.

Saturday, July 25, 2026

slightly more user-friendly mass mailing script

Prompted Gemini via aistudio.google.com to make the mass-mailer using Google Apps Scripts a bit more user-friendly - displaying a checklist of actions to be performed for sending the emails, and picking up the rich-text html from a draft email instead of needing to write out the html by hand. Creating a custom menu and displaying a sidebar UI are done by these functions, using this html.

The Draft email with subject MassMailTemplate must not be deleted, it must remain available throughout the run of the script. The body of the email is taken from this Draft.

Inline images inside the draft will be sent as attachments, and it is better to avoid attachments to prevent our mails from being marked as spam. Formatted text is fine.

The Checklist in the Mass Mailer menu item is just for display, unchecking all the items can be done manually before the next send.

disk space alert and cleanup of MySQL databases with Moodle logs

We got an alert from our script that one of our servers had 95% utilization of the root disk. Asked Gemini via aistudio.google.com and carried out the following.

Find the Top 20 largest directories on the root partition:

sudo du -ahx / | sort -rh | head -20

Note: The `-x` flag ensures it only searches the root partition and doesn't scan external mounts or network drives.

Found that 29 GB was being used by MySQL databases.

Find individual files larger than 100MB:

sudo find / -xdev -type f -size +100M -exec ls -lh {} \;

Found that there were some .ibd files, with the names of Moodle table  like logstore_standard_log.ibd which were very large. Gemini suggested retaining only 180 or 365 days of logs instead of "Never delete logs" in Site administration > Plugins > Logging > Standard log.

Then, to get back space ...

First, logged on as the administrator of a particular database which we do not need, and dropped that database.
mysql -u thatusername -p
drop database unuseddbname

(sudo mysql does not work on this server, a root password is set, but I did not need the root password.)

That gave us 3-5 GB. Then, there were two options for Moodle logstore_standard_log - either just truncate the table - very quick, get back disk space instantly - or copy over the last 180 days' logs to a new table and then delete the old table.

(Other methods suggested by Gemini were very slow, mentioning only the good options below. Just deleting entries from a table would require an OPTIMIZE TABLE step afterwards, which would need enough disk space to create a full copy of the table.)

CREATE TABLE prefix_logstore_standard_log_new LIKE prefix_logstore_standard_log;

# find starting id to reduce copy time, since id is an indexed field
SELECT id FROM prefix_logstore_standard_log 
WHERE timecreated >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 180 DAY)) 
LIMIT 1;

INSERT INTO prefix_logstore_standard_log_new 
SELECT * FROM prefix_logstore_standard_log 
WHERE id >= YOUR_NUMBER_FROM_ABOVE_STEP;

The copying of log entries into the new table took 51 seconds using this method for our smallest db.

The quick and dirty way, of deleting all the logstore standard log entries (this is only the "what has the user clicked" data - grades etc are not deleted) -
TRUNCATE TABLE prefix_logstore_standard_log; 

This completes in less than a second, and makes disk space available immediately.

Thursday, July 23, 2026

Azure portal - Review Azure Copilot agent access settings before 1 August

There was an email from Microsoft, letting us know that if we don't take action, we will be opted in for enabling Azure Copilot agents. In general, my instinct is to disable every new "feature' which Microsoft introduces, because sooner or later, that will be involved in some security incident. After consulting the other admins, I disabled "Azure Copilot" on both Azure tenants I have admin access to, with the result that these agents

Observability Agent
Deployment Agent
Troubleshooting Agent
Optimization Agent
Resiliency Agent
Migration Agent

will not be available.

When we navigate to Azure Copilot Admin Center (which we can access via the search at the top of portal.azure.com after logging in) to disable Azure Copilot, there is a link to toggle the control for <User> can manage access to all Azure subscriptions and management groups in this tenant. Since they recommend turning this off, I turned it on, disabled Copilot and turned it back on. The link to this control is https://portal.azure.com/#view/Microsoft_AAD_IAM/TenantProperties.ReactView

The documentation referencing this is at

Wednesday, July 22, 2026

transition to Moodle Marketplace - mod_book unavailable

We got an email from Moodle about moving the Plugins directory to Moodle Marketplace - 

"The transition to Moodle Marketplace may require you to make some adjustments to your Moodle site set-up. See what’s changed at Plugins Directory has moved to Moodle Marketplace."

Here is the list of plugins (at the bottom of the page in this link) which will not be supported after 31 August 2026,

In case any of the plugins we regularly use are listed there, they may not work (or may not be updated) after 31 Aug.

So, VLS got back saying that he 
reviewed the complete list with the list of installed plugins. I have identified 2 plugins, viz., mod_book, atto_fontfamily. 

ChatGPT suggested running SQL to check which courses use mod_book, which I ran - 

SELECT DISTINCT  c.id, c.shortname, c.fullname,
    COUNT(cm.id) AS number_of_books
    FROM prefix_course_modules cm
    JOIN prefix_modules m ON cm.module = m.id
    JOIN prefix_course c ON cm.course = c.id
    WHERE m.name = 'book'
    GROUP BY c.id, c.shortname, c.fullname
    ORDER BY c.fullname; 

On one of our instances, there were 5 courses with 6 "books" while two others had "books" only in "test" or "dump" courses.

Creating service account for accessing Google Drive API

There was a request from the developers to create a shared drive for them in our Google Workspace, and to create a service account to access it programmatically.

Accordingly, created a new shared drive (and have added email1 and email2 as managers)

I have created the service account under an existing google cloud project under my (admin) google account (initially created for rclone), and have added Google Drive Api to the project.

The service account is called 
servaccname@projectname.iam.gserviceaccount.com

I have added this account also as a Content Manager on the Shared drive and shared the json key with the dev team.

Shared Drive storage quota - According to google help, a single shared drive can theoretically hold up to 5 TB per file, but it is strictly capped at 500,000 total items (files, folders, and shortcuts). 


I've currently not put any other cap on the storage quota for this shared drive.

Tuesday, July 14, 2026

Manage your unused OAuth clients - Google cloud

We got emails from Google cloud, "the following projects that you manage have OAuth clients that have been inactive for at least 5 months, and will be deleted in 30 days unless you take action" - checked, and we're planning on allowing them to be deleted, since those seemed to be clients which are not currently in use.

Friday, July 10, 2026

Google apps script issue - script.google.com refused to connect - google glitch

One of our servers which had a google apps script embedded in a php page started showing "script.google.com refused to connect" - the issue was noticed last afternoon. We checked that no changes had been made to the script, we did have
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
as mentioned in

The only other change was to install and set up fail2ban on the server, that was unlikely to be the cause. 

"If no changes have been made to the script, then perhaps it is a transient google problem, and might be resolved in a few hours.

If not, we would need to check if google apps scripts have any recent policy changes."

It might have been a google glitch, since last night the issue was resolved by itself. Looked like the outage was for around 8-10 hours.

Tuesday, July 07, 2026

reminder to take a break - Mac version

I wanted to recreate the earlier "reminder to take a break" cron job script on MacOS. Asked Claude about it, and it suggested using launchd instead of cron, since cron jobs run without access to the display by default. After several rounds of trial and error, here is the method that worked.

nano ~/Library/LaunchAgents/com.yourname.walkreminder.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.yourname.walkreminder</string>

    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-c</string>
        <string>osascript -e 'display notification "Time to take a walk" with title "Reminder" sound name "Ping"'; afplay /Users/yourusername/Sounds/Walk.mp3</string>
    </array>

    <key>StartCalendarInterval</key>
    <array>
        <dict>
            <key>Hour</key>
            <integer>14</integer>
            <key>Minute</key>
            <integer>0</integer>
        </dict>
    </array>

    <key>StandardOutPath</key>
    <string>/tmp/walkreminder.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/walkreminder.err</string>
</dict>
</plist>

In the above, the schedule is to run once a day at 14:00 hours. For running every half an hour from the time the user was logged on, we can use 

<key>StartInterval</key>
  <integer>1800</integer>

instead of <key>StartCalendarInterval</key>

Or, in my case, since I wanted every half an hour aligned to 0:00 and 0:30 exactly, 

 <key>StartCalendarInterval</key>
    <array>
        <dict>
            <key>Minute</key>
            <integer>0</integer>
        </dict> 
        <dict>
            <key>Minute</key>
            <integer>30</integer>
        </dict>
    </array>

We had to use a Sounds directory which we had created, since afplay could not access the Downloads directory when run from launchd.

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.yourname.walkreminder.plist

and test with

launchctl kickstart -k gui/$(id -u)/com.yourname.walkreminder

Troubleshooting can be done with
plutil -lint ~/Library/LaunchAgents/com.yourname.walkreminder.plist
launchctl list | grep walkreminder
cat /tmp/walkreminder.err


Saturday, July 04, 2026

Running OpenSpace on ARM64 hardware like Apple Silicon Macs

The OpenSpace project has officially removed support for Mac, and newer commits make OpenGL 4.6 the minimum required version. Since Apple has frozen OpenGL support on MacOS at 4.1 (and even that is without support for some features like double-precision math in shaders), getting OpenSpace to run natively on MacOS seems difficult

Unfortunately, even earlier releases of OpenSpace can't be built for Mac, even with patches, due to external dependencies whose referenced older commits have been rebased away. 

The way out seems to be to use the older official releases with VMWare Windows 11 for best performance, with the current official release running atop VMWare only with software rendering. 

Edit: VMWare Fusion can be downloaded by following the links from https://www.vmware.com/products/desktop-hypervisor/workstation-and-fusion - a free login needs to be created for support.broadcom.com following which we can follow the link to the free downloads area and download VMWare Fusion (which runs on MacOS hosts) or WMWare Desktop (which runs on Windows hosts). As their FAQ page says, these products are free to use for educational, personal or commercial use after 2025.


There is a table of performance tests on various configurations, OpenSpace versions and drivers at
https://github.com/hn-88/OpenSpace-AppImage/wiki/OpenSpace-on-Mac#running-openspace-on-vms-in-macos

Interestingly, 0.21.x official x86 OpenSpace releases can run on Win11-ARM VMs on VMWare - the prism virtualization handles the x86 to ARM translation.

But 0.22.x official x86 OpenSpace releases can't run on Win11-ARM VMs on VMWare - the minimum OpenGL requirement has been bumped to 4.6, while VMWare's Windows drivers currently supply up to OpenGL 4.3.

In order to run OpenSpace 0.22.x with software rendering on Windows, we need to copy opengl32.dll from https://github.com/mmozeiko/build-mesa/releases/latest as mentioned at https://github.com/hn-88/OpenSpace-AppImage/issues/141 - and the dll architecture must match the OpenSpace binary's architecture. Further, the prism emulation layer can't handle x86 OpenGL dlls. So, only the ARM build of OpenSpace 0.22.x can currently run with software rendering, with the limitations like lack of molecule module, etc.

Friday, July 03, 2026

incident and response - malicious bots

One of our servers, which hosted a dot net backend as well as some wordpress sites, showed some outages two days in a row, restored by restarting. Feeding the apache access logs to Gemini via aistudio.google.com, Gemini said,

The logs clearly show an Apache HTTP
Server running PHP and hosting a WordPress application.

The logs indicate that your server was hit by an aggressive automated attack
(likely a botnet) starting around 07:33:35, which appears to have either
succeeded in exploiting a vulnerability or overloaded the server, causing it to
crash shortly after.

(Server had run out of memory). 

Gemini suggested the following - 

  1. Hide and Protect Your Origin IP - which we may not do
  2. Patch and Update the Server Software - which we're doing
  3. Implement a Web Application Firewall (WAF) - which is in place
  4. Clean Up WordPress Configuration - "Open your wp-config.php file, locate line 63, and remove the    duplicate definition of WP_AUTO_UPDATE_CORE. While this didn't cause the crash, it eats up server I/O and makes reading logs difficult."
  5. Restrict PHP Execution in Uploads Directories
  6. Implement Intrusion Prevention (Fail2Ban)

Then, feeding the access logs of the dot net api to Gemini 
and as suggested by Gemini,
journalctl -u ourapi.service --since "2026-06-28 07:15:00" --until "2026-06-28 07:45:00"

Gemini gave some recommendations like returning 0 instead of a 500 error for no data found -
"As we saw in the access logs, when the mobile app sees
    this 500 error, its poorly designed error-handling logic says: "Something
    went wrong! Retry the entire sync process!" It then proceeds to download 4MB
    of lesson data, hits the notification endpoint again, gets another 500
    error, and repeats the cycle every 15 seconds until your server runs out of
    memory and crashes."
- this may or may not be actually what is happening here, since Gemini just saw the logs and does not have access to the code.

In any case, I've enabled bot protection on Cloudflare for this domain, and also installed and configured Fail2ban.

On Cloudflare, 
ourdomain.org > Security > Security rules > Custom rules

Block .env scans
URI Path equals .env
Block

 also added Cloudflare's default rate limiting rule,

Leaked credential check [Template]
Password Leaked equals true
Block

also enabled Cloudflare's AI blocking tools - AI Labyrinth enabled, and Block AI training bots on all pages.

Then, installed and set up Fail2ban on the server, monitoring the apache web server and sshd logs. It will temporarily block ip addresses which fail authentication repeatedly, or which repeatedly request non-existent files like malicious bots.

Gemini via aistudio.google.com gave step-by-step instructions for installation and setup of Fail2ban. 

sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

(we can optionally edit these,
bantime  = 1h
findtime = 10m
maxretry = 5
)

Enable the Apache jails with
sudo nano /etc/fail2ban/jail.local
[apache-auth]
enabled  = true
port     = http,https
logpath  = %(apache_error_log)s

In case the logpath is custom - fail2ban looks by default for
Error logs: /var/log/apache2/*error.log
Access logs: /var/log/apache2/*access.log

In the case of one of our servers, we needed to change this to
logpath  = %(apache_error_log)s
           /var/www/mysite/logs/custom-error*.log

More Apache jails to enable - basically need to add the enabled = true line - 

[apache-badbots]
enabled  = true
port     = http,https
logpath  = %(apache_access_log)s
bantime  = 48h
maxretry = 1

[apache-noscript]
enabled  = true
port     = http,https
logpath  = %(apache_error_log)s

[apache-overflows]
enabled  = true
port     = http,https
logpath  = %(apache_error_log)s

[apache-nohome]
enabled  = true
port     = http,https
logpath  = %(apache_error_log)s

[apache-botsearch]
enabled  = true
port     = http,https
logpath  = %(apache_error_log)s

Then we can test

sudo systemctl start fail2ban
sudo systemctl enable fail2ban
sudo systemctl status fail2ban

and check the enabled jails with

sudo fail2ban-client status

On one server, we had to resolve
ERROR   Failed during configuration: Have not found any log file
for sshd jail

For that, we had to change the block to
[sshd]
enabled = true
port    = ssh
backend = systemd

since that server was using systemd, and traditional text log files like /var/log/auth.log (which Fail2Ban looks for by default for SSH) are no longer created. After the change, after restarting the service, we can check that jail alone with

sudo fail2ban-client status sshd

Then, for using a different port rather than port 22 for sshd - 

[sshd]
enabled = true
port    = 2022
backend = systemd
(if port 2022 is being used) 
and so on, because that is the port which fail2ban would ban using the machine's firewall, iptables or nftables as the case may be.

To see the rules, we can use
sudo nft list ruleset # for nftables, Ubuntu 24.04
sudo iptables -nL # for iptables, earlier Ubuntu etc