Blog

  • Automating GlobalProtect Certificate Renewal on a Palo Alto Firewall

    Disclaimer: This text is highly AI generated

    Keeping SSL/TLS certificates updated for a GlobalProtect portal is one of those tasks that sounds simple until you account for validation, firewall policy, certificate import, profile updates, and commits. This project automates that entire workflow with a single Python script.

    Get it here: https://github.com/skadevare/PaloAlto-Letsencrypt-Certificate-Auto-Updater

    Details

    The script is designed for Palo Alto firewalls and handles both automated Let’s Encrypt renewal and manual certificate import. Its main purpose is to keep a GlobalProtect SSL/TLS Service Profile updated with the correct certificate without requiring repeated manual work every few months.
    What Problem This Solves

    A GlobalProtect portal needs a valid public certificate. If that certificate expires, users will see certificate warnings or lose trust in the portal entirely. Renewing the certificate manually every time is tedious and error-prone.
    This script automates the full lifecycle:

    • opening HTTP access temporarily for ACME validation
    • running Certbot
    • closing the temporary firewall access
    • importing the new certificate into PAN-OS
    • updating the SSL/TLS Service Profile
    • committing the configuration
      It also supports a manual mode for cases where you already have a certificate and private key and only want to push them to the firewall.

    How the Automated Mode Works

    In normal mode, the script performs the following steps:

    1. It connects to the Palo Alto firewall API.
    2. It checks the current state of a predefined NAT rule and an optional predefined security rule.
    3. If those rules are disabled, it enables them.
    4. It commits the firewall configuration so inbound TCP port 80 is reachable.
    5. It runs Certbot in standalone mode.
    6. Certbot temporarily hosts the HTTP-01 validation response on the local machine.
    7. After validation, the script restores the original rule state and commits again.
    8. It builds a temporary PKCS#12 bundle from the certificate and private key.
    9. It uploads that bundle to the firewall.
    10. It updates the configured SSL/TLS Service Profile to use the matching certificate object.
    11. It commits the change.
      This gives you a repeatable certificate renewal process with minimal manual intervention.

    Why It Uses Existing Firewall Rules

    The script does not try to create NAT or security rules from scratch. Instead, it toggles rules that already exist on the firewall.
    That is intentional.
    NAT and security rules depend on details that are different in every environment, such as:

    • interface names
    • zones
    • public IP addresses
    • translated addresses
    • existing policy structure
      Because of that, the safer design is to create the required rules once in PAN-OS, keep them disabled, and let the script enable and disable them only when needed.
      Security Rule Handling
      If a security rule is configured, the script handles it just like the NAT rule.
      That means:
    • if the security rule is disabled, it gets enabled before Certbot validation
    • after validation, it is disabled again
    • if it was already enabled, the script leaves it enabled
      This makes the workflow cleaner and avoids leaving temporary access open longer than necessary.

    Manual Certificate Import Mode

    • The script also supports a manual import mode.
      This is useful when:
    • you already received a certificate from another source
    • you want to test certificate import without running Certbot
    • you want to update the GlobalProtect profile directly from a certificate and key file
      Example command:
      python3 renew_globalprotect_cert.py –manual-cert –incert /path/to/fullchain.pem –inkey /path/to/privkey.pem
      In manual mode, the script:
    • skips Certbot entirely
    • does not touch NAT or security rules
    • builds the PKCS#12 file
    • uploads it to the firewall
    • updates the SSL/TLS profile
    • commits the change

    How Certificate Naming Works

    The script derives the PAN-OS certificate object name from the certificate fingerprint.
    That gives two benefits:

    the same local certificate can be reused cleanly

    the script can avoid creating unnecessary duplicate certificate objects
    If the firewall already has the matching certificate object and the SSL/TLS profile already points to it, the script skips the update.

    Scheduling

    Manual mode works best with real certificate files or proper Let’s Encrypt paths.

    The intended use case is periodic execution through systemd, for example every three months.
    A quarterly timer matches the original renewal idea, but in practice monthly execution is safer for 90-day Let’s Encrypt certificates. Certbot usually does nothing until a renewal is actually needed, so running more often reduces the risk of missing the renewal window.
    Important Operational Notes
    A few things matter in production:

    The script performs full PAN-OS commits.

    If unrelated candidate changes already exist on the firewall, those should be considered before running it.

    Final Thoughts

    This script turns certificate renewal for a Palo Alto GlobalProtect portal into a predictable workflow instead of a manual maintenance task. It reduces the chance of expired certificates, keeps the firewall changes temporary, and makes it easier to manage both automatic and manual certificate updates from one place.
    If you manage GlobalProtect in an environment where certificate rotation has been a recurring headache, this kind of automation can remove a lot of unnecessary operational friction

  • Lipo battery cheat sheet

    Ever since transitioning from traditional drones from DJI over to FPV and now self buildt fpv drones using LiPos Ive been a bit scared of how you are supposed to treat these batteries. Im used to the traditional percent indication of battery charging and usage. LiPos is something much more complex and requires a bit of learning to be comfortable using, charging and storing. Here`s a little cheatsheet that I use to remember all of this and different recommendations.

    For a 6S LiPo battery used in an FPV drone, the recommended voltage values are:

    • Max Charging Voltage (Fully Charged):
      • 4.2V per cell25.2V total (Standard LiPo)
      • 4.35V per cell26.1V total (If using HV LiPo – High Voltage LiPo)
    • Minimum Recommended Voltage for Landing:
      • 3.5V–3.6V per cell21.0V–21.6V total (Safe landing voltage)
      • 3.3V per cell19.8V total (Absolute minimum, but avoid reaching this often to prevent battery damage)
    • Storage Voltage (For Long-Term Battery Health):
      • 3.8V per cell22.8V total (Ideal storage voltage)

    1. Internal Resistance (IR)

    • What it is: Measures battery health and efficiency; lower resistance means better performance.
    • Ideal Values:
      • 1–5 mΩ per cell for a high-quality, new battery.
      • Above 10 mΩ per cell indicates aging or potential degradation.
    • Tips:
      • Higher IR leads to voltage sag and lower power output.
      • Regularly check IR using a charger or battery tester.
      • Avoid using batteries with significantly high IR, as they may overheat under load.

    2. Temperature Management

    • Ideal Operating Temperature:
      • During Use: 20°C to 45°C (68°F to 113°F)
      • During Charging: 15°C to 35°C (59°F to 95°F)
      • Avoid:
        • Over 60°C (140°F) as this can damage cells permanently.
        • Flying in cold temperatures (<10°C / 50°F) can cause voltage sag. Warm up batteries before flight in cold weather.
    • Cooling Down:
      • After flying, let the battery cool to room temperature before charging.
      • Never charge a hot battery immediately after use.

    3. Storage Recommendations

    • Voltage: 3.8V per cell (22.8V for 6S)
    • Temperature: 15°C to 25°C (59°F to 77°F)
    • Humidity: Low humidity (<50%) to prevent corrosion.
    • Storage Duration:
      • Short-term: Can store for a few days fully charged but not recommended.
      • Long-term (weeks/months): Always store at 3.8V per cell.
    • Safe Storage Practices:
      • Store in a LiPo-safe bag or fireproof container.
      • Keep away from flammable materials.
      • Periodically check voltage if stored for months.

    4. Placement and Mounting in FPV Drones

    • Secure Mounting: Use a strong Velcro strap and battery pad (like Ummagrip) to prevent shifting during flight.
    • Center of Gravity: Place the battery as close to the center as possible to maintain balance.
    • Orientation:
      • Most FPV drones mount batteries on top for better maneuverability.
      • Some long-range setups use bottom-mounted batteries for stability.
    • Protection:
      • Consider foam padding to absorb impact.
      • Avoid crushing or bending the pack.

    5. Charging Safety

    • Use a Balance Charger to ensure all cells are charged evenly.
    • Charge in a Safe Area: Avoid charging near flammable objects.
    • Never Leave Unattended while charging.
    • Use the Right Amperage:
      • 1C charging (e.g., 1300mAh battery → charge at 1.3A) is the safest.
      • 2C+ charging is possible for some high-quality LiPos, but it may reduce lifespan.

    LiPo Connectors & Chargers for FPV Drones

    Proper connectors and charging equipment are essential for safety and performance. Here’s what you need to know:


    1. Battery Connectors

    Different LiPo connectors affect power delivery, resistance, and compatibility with your FPV drone setup.

    Common Connector Types for FPV Drones:

    1. XT60 (Most Common for 4S & 6S LiPo)
      • Rated for 60A continuous, 180A peak
      • Standard on most FPV drones (5-inch & up)
      • Reliable and widely used
    2. XT90 (For High-Power Setups)
      • Rated for 90A continuous, 240A peak
      • Used for larger quads (7-inch+, X-Class, cine-lifters)
      • Includes an anti-spark version to prevent arcing when plugging in
    3. XT30 (For Small Drones & Whoops)
      • Rated for 30A continuous
      • Used on 2S–4S small drones (Toothpicks, Tiny Trainers)
    4. EC5 / AS150 / QS8 (For Heavy-Lift Drones)
      • Used in X-Class drones, large cine-lifters, & long-range quads
      • QS8 has an anti-spark feature to prevent connector damage
    5. JST / PH2.0 / BT2.0 (For Micro Drones)
      • JST (Red) → Used in some 2S drones (~5A rated)
      • PH2.0 / BT2.0 → Used in tiny whoops (BT2.0 is better for power delivery)

    Connector Tips:

    ✅ Always match connectors on your drone and battery.
    ✅ Use high-quality, gold-plated connectors for better conductivity.
    ✅ Keep connectors clean and tight to avoid voltage drops.
    ✅ If soldering connectors, use proper gauge wire (12AWG for 6S).
    ✅ Avoid adapters unless necessary (they add resistance and voltage sag).


    2. LiPo Chargers & Charging Tips

    Types of LiPo Chargers:

    1. Basic Chargers (Single Port, Plug & Play)
      • Example: iMAX B6
      • Good for beginners but slow & limited
    2. Smart Chargers (Multi-Port, Balance, Fast Charging)
      • Example: ISDT, HOTA D6 Pro, ToolkitRC M6
      • Supports multiple LiPos, balance charging, and adjustable current
    3. Parallel Chargers (Charge Multiple Batteries at Once)
      • Use a parallel charging board to charge multiple same-voltage batteries
      • Ensure all batteries are at a similar voltage before plugging in

    Recommended Charger Features:

    Balance Charging (ensures even voltage across all cells)
    Adjustable Current & Voltage (for different battery sizes)
    Storage Mode (automatically discharges to 3.8V per cell)
    High Power Output (for faster charging; 100W+ recommended)

    Charging Safety Tips:

    ⚠️ NEVER charge damaged or puffy batteries!
    ⚠️ Always charge in a LiPo-safe bag or fireproof container.
    ⚠️ Never overcharge (4.2V per cell max).
    ⚠️ Don’t leave batteries charging unattended.
    ⚠️ Use correct charge current (1C = safest, 2C max for fast charging).


    3. Parallel Charging – Fast Charging Multiple Batteries

    Parallel charging is great for FPV pilots who need to charge multiple packs quickly.

    How It Works:

    • All batteries must be same cell count (e.g., all 6S, all 4S)
    • All batteries should be at a similar voltage before plugging in
    • Use a high-quality parallel board with fuses

    Parallel Charging Formula:

    • Example: If charging four 6S 1300mAh batteries in parallel, set charger to 5.2A (1.3A × 4) for 1C charging.
    • For 2C charging, double the current (10.4A).

    Final Takeaways

    🔋 XT60 is the standard for 6S FPV drones.
    ⚡ Use a smart charger for flexibility & better safety.
    🔥 Charge in a safe place, always monitor, and store correctly.
    🚀 Parallel charging saves time but must be done carefully.

  • Adding user interactive UID webportal for paloalto firewalls

    Just adding authentication user identification functionallity on selfhosted webportal based on local active directory

    BY NO MEANS SECURE, no input is sanitized…

    ref: https://wp.12p.no/2022/05/13/alternative-to-captive-webportal/

    First thing that is needed. php-ldap. I noticed it was not supported by php7, so i change php version to 8.x.

    # a2dismod php7.x.x

    # a2enmod php8.x.x

    then

    # apt install php-ldap

    #service apache2 restart

    then created a local website in my apache folder

    index.php:

    Then create an auth file:

    The syslogip points to the syslog recieving interface of paloalto

    domain points to the domain name

    replace: ad.placebodome.local with your ADs FQDN.

    The php-ldap function then tries to bind to the domain using the userprovided username and password. If binding fails the user is not authenticated.

    If the binding is successfull a logger command is run to send a syslog message to the Paloalto firewall with username of user and the ipaddress for the requester/user.

    As the previouse example: https://wp.12p.no/2022/05/13/alternative-to-captive-webportal/ using the syslog parser:

    Voila, the user is populated in the same way as the original

  • Alternative to captive webportal Palo Alto

    The idiotic way to implement user identification when everything else fails.

    You need:

    GPO to push automaticly run powershell

    A webserver, for example Apache

    A syslog forwarder, for example rsyslog

    And setup the Paloalto firewall as a User ID agent with syslog listener.

    Plain and simple. Absolutely not secure, but until I bother with integrating user certificates as authentication for the requests this will do.

    Powershell which runs every hour or minute on the clients

    The webserver, a simple apache server hosted on an ubuntu box without any content


    Install rsyslog if not installed

    put the following in /etc/rsyslog.d/02-apache2.conf

    Validate the config:

    systemctl restart rsyslogd

    On the paloalto, enable user-id syslog on the interface and lock the permitted address to the webserver sending the syslogs

    add the uid profile to the interface:

    Add the following syslog parser:

    Setup the server monitor:

    and the syslog parser profile.

    And you’re good to go. Not secure, but it works as a simple solution

  • Hvordan 2.5 time på Herdla ser ut når det er nordlys.

    Tok en tur til Herdla og så på nordlyset med en kompis. Dette ble resultatet:

    En timelapse av bildene
  • Trip to Bølgekraftverket

    Took a sponatious trip to Bølgekraftverket located in Toft, Rong. https://www.google.com/maps/place/B%C3%B8lgekraftverket/@60.4699557,4.9247579,15z/data=!4m2!3m1!1s0x0:0x9092354b5b6cc1c0?sa=X&ved=2ahUKEwiG3YrHms_xAhXql4sKHTVsDIYQ_BIwGHoECEAQBQ

    Took a few photos. Fun to take photos again.

  • Northern Lights from Herdla

    Pictures taken 5th of january 2021

  • GlobalProtect + Client Certificate

    Setup the client certificate deployment by following this guide : https://www.virtuallyboring.com/setup-microsoft-active-directory-certificate-services-ad-cs/

    Start of by exporting the CA certificate:

    Install the certificate on you Palo Alto Firewall:

    the certificate should look something like this:

    Create a Certificate profile:


    Add this profile to your Authentication settings on the GlobalProtect gateway:

    Now you can access your globalprotect vpn with the required client certificate.

    If you get disconnected right away you can check the debug logs undre Troubleshooting, look for this message:

    indicating the client certificate is not correct or missing

  • 2. february 2020

    Went for a walk in the mountains today… took some pictures

    On top of Stoltzekleiven. Beautiful weather today. Sandvikspilen to the left
    Panorama stiched from 6 photos
    F22 1 sek

  • Setting up Palo Alto GlobalProtect VPN 2fa-authentication using Google Authenticator

    TL;DR : Enable free 2FA using an Ubuntu server, Google authenticator and FreeRadius on service supporting radius authentication.

    So, I’ve been messing around with this for a while, and I decided I’d create a post showing how to do it.

    Basicly i have a small Ubuntu Server, with Free radius, and Google authenticator module. Using the users defined on the Ubuntu server as allowed-users.

    Step1: Start installing the needed tools on the Ubuntu server running this command

    This will install the applications and tools you need. There are different ways of setting up free-radius in terms of the user running the service, but since I hate services running as root I used the freerad user account with lower privlegdes.

    Step 2: edit the /etc/freeradius/users file, and add the following:

    Step3: edit the /etc/freeradius/sites-enabled/default and remove # before PAM

    Step4: edit the file /etc/freeradius/clients.conf. Add these lines to the end. Change the ip-adress allowed andradius secret to whatever you need it to be, I recommend using a password generator…

    Then Restart the service: sudo service freeradius restart

    Step 5: Then edit the /etc/pam.d/radiusd file to define the google authenticator:

    Step 6: For each user you need to create a google authenticator token. running the command google_authenticator as each user will guide you trough the process.

    You can scan the QR-code in the google authenticator app, and ofcourse keep the backupcodes of later use (you can access these keys by viewing .google_authenticator file)

    A file named .google_authenticator will be created in each users homefolder. We need to move this file in to the freeradius folder under /etc/freeradius/*USERNAME*

    Step 6.1: Since we dont use the root user we need to allow the freerad user to access the google authenticator file for the user (the user is named TEST here):

    Step 7: Test the setup using radtest:

    Yellow is the google authenticator code

    If the test is successfull you should see this line:

    Step 8: Configure the Palo Alto firewall to use the radius server with 2FA for Global Protect VPN:

    Go to Device, then Server Profiles, and select Radius. Create new radius profile:

    To test the settings, commit and from CLI to the firewall type:

    Ofcourse you need to change the profilename and username to what it needs to be.
    At the passwordprompt type YourPassword+GoogleAuthenticatorCode
    Result should look something like this.

    For more troubleshooting if this does not work.

    tail -f /var/log/auth.log

    or

    tail -f /var/log/freeradius/freeradius.log

    Troubleshooting from cli (yes, i use Tmux.)

    Step 9: Go to authentication profile, and add a new


    Add this profile to the portal config:

    Step 10: Test the config

    Commit the config, visit the Globalprotect portal externally. Type in username, and in the passwordfield, type thepassword + the google authenticator code.

    So if your password is MyPassword and google authenticator code is 123 456 the password you type in would be “MyPassword123456”

    Step 12: Testing the authentication in the GlobalProtect client

    Download and install the client, if you havent done it yet. Add the portal address, your username and password+googleauthenticator:


    And you’re logged in

    Remember to change password at next logon. I use this settings aswell:

    LATER: I will do a turitorial on LDAP integration aswell later.