Month: August 2025
certbot renew failed on FreeSBD 13.2-R apache24
When I ran certbot renew, it always failed to authenticate domain.
INFO:certbot._internal.auth_handler:Challenge failed for domain mydomain.com
INFO:certbot._internal.auth_handler:http-01 challenge for mydomain.com
DEBUG:certbot._internal.display.obj:Notifying user:
Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
Domain: mydomain.com
Type: connection
Detail: 10.10.10.5: Fetching http://mydomain.com/.well-known/acme-challenge/challengestring: Connection refused
I found that certbot append some setting to config file of apache and restart apache before authenticating. It ran apachectl graceful to restart, but graceful cause some error so apache stop and not to start again.
My solution is to modify
/usr/local/lib/python3.9/site-packages/certbot_apache/_internal/configurator.py
self.restart_cmd = ['apachectl', 'graceful']
toself.restart_cmd = ['apachectl', 'restart']
ref: certbot suddenly fails | The FreeBSD Forums
—
Update (2024-03-13) :
I find this thread to solve the crash of apache when running apachectl graceful. Just add apache24_aslr_disable="YES" in /etc/rc.conf to disable ASLR and works like a charming.
ref: Bug 268318 – www/apache24 with www/mod_php8{0,1,2,3?}: opcache + ASLR turned on crashes Apache
Puppeteer on FreeBSD 12.1
1. Install Chromium
# pkg install chromium
2. Install puppeteer alone
# PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer@1.0.0
3. Launch puppeteer with executablePath
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
executablePath: '/usr/local/bin/chrome',
})
const page = await browser.newPage()
await page.goto('https://github.com/GoogleChrome/puppeteer')
await page.screenshot({path: 'example.png'})
await page.pdf({
path: 'example.pdf',
format: 'A4',
printBackground: true,
})
await browser.close()
})()
Ref:
https://github.com/puppeteer/puppeteer/issues/1049#issuecomment-381846813
Ext:
puppeteer-extra
puppeteer-extra-plugin-stealth
https://github.com/puppeteer/puppeteer/issues/4871#issuecomment-549771954
Sync data to Google drive using rclone
Installation
# cd /usr/port/net/rclone
# make install
Create OAuth client id and secret
See: https://rclone.org/drive/#making-your-own-client-id
Setup
Before we start, generate config file first. It’s not necessary to run with root permission.
$ rclone config
See: https://rclone.org/drive/
It will generate config file in $HOME/.config/rclone/rclone.conf
Beware that answer “No” for “Use auto config” when you run rclone on a sever that has no browser installed, or you could not complete the authorization of oauth.
Run
/* gdrive is the name of rclone config */
$ rclone sync --create-empty-src-dirs /nas/staff gdrive:/nas/staff
After installation of MySQL 8
After installation, some things you can do.
Security
# mysql_secure_installation
Change auth_plugin
mysql> ALTER USER 'root'@'localhost'
IDENTIFIED WITH mysql_native_password
BY 'newpassword_you_want';
Change default auth_plugin
edit /usr/local/etc/mysql/my.cnf
[mysqld]
default-authentication-plugin = mysql_native_password
Below is some things about password.
Change password
# mysqladmin -u root -p password
* Reset root password
# /usr/local/etc/rc.d/mysql-server stop
# mysqld_safe --skip-grant-tables &
# mysqladmin -u root password
# /usr/local/etc/rc.d/mysql-server restart
MySQL backup and restore
Backup
# mysqldump -u root -p [database_name] > backup.sql
– OR –
# mysqldump -u root -p --all-database > backup.sql
– OR –
# mysqldump -u root -p [database_name] --tables [table_name] > backup.sql
Restore
# mysql -u root -p < backup.sql
– OR –
# mysql -u root -p [database_name] < backup.sql
TimeZone setup
setup the timezone
# tzsetup /usr/share/zoneinfo/Asia/Taipei