Author: cweb

  • New coat of paint incoming

    I haven’t been happy with any of the themes I have installed on this site since I started it. WordPress sent a notice about the new 2025 default theme and it looks pretty nice, but still is not what I want. I’ve decided to just figure out how to create my own so I’ll stop getting like 70% of the way there only to find that I can’t change what I want to change. I started messing around but it was really annoying trying to test things out and not break the site at the same time. Luckily I still have chrisweber.online so I’ll setup a test site on that. Actually, I’ll probably just copy over the Zion site to it for testing.

    I’m hoping if I read through a couple tutorials on how the templates work and get at least something basic completed this week.

  • Guacamole – Road to MFA – TOTP

    Guacamole – Road to MFA – TOTP

    Well, that was easy. I literally just copied over the jar file and restarted guacd, apache2, and tomcat9. After that I just logged out and back in to enroll in TOTP.

    I did find unfortunately that the KeePass app I’m using on Android doesn’t seem to sync things both ways. Entries I create on my phone do not see to be able to sync to google drive, but that just took me a second to work around. It’s not really a big deal but it meant I had to manually enter in the secret key and such. Guac TOTP supports QR codes, and I was able to add it with my phone, but wasn’t able to get it to sync back to my computer(after five minutes of trying). That may be a project for another day.

  • Guacamole – Road to MFA – DB auth

    Guacamole – Road to MFA – DB auth

    I’ve decided with all the convience features I’ve got setup on the computers I remote into, that I should probably attempt to setup TOTP on the site to improve the security of the system. The password and username I use hasn’t been involved in any leaks that I know of, and both are unique to the site, plus you’d need the passwords to the actual computers too, but I figure it’s better safe than sorry.

    The first step is to configure a database authentication extension. One nice thing about this change is that it will allow me to modify connections and user settings in the web interface, instead of connecting to SSH and modifying an XML file, and then restarting guacd.

    The first step is to install the JDBC connector for mysql, which went without a hitch with

    sudo apt install /media/store/mysql-connector-j_9.1.0-1ubuntu24.04_all.deb

    Now to create the database, which they are providing scripts to create the schema which saves a whole lot of copy/pasting. So, sign into mysql as root, create the DB, and import the schema.

    cweb@thecweb:/media/store/mysql$ sudo mysql -u root
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3362
    Server version: 8.0.39-0ubuntu0.24.04.2 (Ubuntu)
    
    Copyright (c) 2000, 2024, Oracle and/or its affiliates.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> CREATE DATABASE guacamole_db;
    Query OK, 1 row affected (0.01 sec)
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | cwOLzion           |
    | guacamole_db       |
    | information_schema |
    | mysql              |
    | performance_schema |
    | sys                |
    | wordpress          |
    +--------------------+
    7 rows in set (0.00 sec)
    
    mysql> quit
    Bye
    cweb@thecweb:/media/store/mysql$ cat schema/*.sql | sudo mysql -u root guacamole_db
    cweb@thecweb:/media/store/mysql$

    Create the DB user.

    cweb@thecweb:/media/store/mysql$ sudo mysql -u root
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3371
    Server version: 8.0.39-0ubuntu0.24.04.2 (Ubuntu)
    
    Copyright (c) 2000, 2024, Oracle and/or its affiliates.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> CREATE USER 'guacamole_user'@'localhost' IDENTIFIED BY '****';
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole_user'@'localhost';
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)

    Seems like that went welll, so copying over the JDBC driver and guac extension.

    cweb@thecweb:/media/store/mysql$ sudo cp guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/
    cweb@thecweb:/usr/share/java$ sudo mkdir /etc/guacamole/extensions/lib
    cweb@thecweb:/usr/share/java$ sudo cp mysql-connector-j-9.1.0.jar /etc/guacamole/extensions/lib/

    No surprises there, but I’m going to heed this warning message about restarting guac, because I’m at work and I don’t want to kill my session if I have something configured or installed incorrectly.

    It’s config time

    not sure this really applies since I’ve been using vi since the late 1900s

    The basic config is just telling guacd how to connect to the DB, so we just need to specify the DB server, DB, user, and password. So creating the /etc/guacamole/guacamole.properties and adding that info.

    # MySQL properties
    mysql-hostname: localhost
    mysql-database: guacamole_db
    mysql-username: guacamole_user
    mysql-password: ******

    And that is it for now. I need to restart the servlet, which will disconnect me, and if I configured things incorrect, also prevent me from signing back in. I’m going to research cooking a turkey for now, and maybe later I will see if this is working. I can always poke holes in the firewall for SSH, and forward port 22, but I’d rather not just because of the immediate hacking attacks that will likely insue.

    Part 2

    Ok, I got bored with reddit so I poked some holes for SSH and restarted everything, and it came back up fine. Looking at /var/log/auth.log, I was a little surprised to find my paranoia was unfounded and I didn’t see a single authentication attempt during the five minutes my stupid little SSH server was accessible from the internet. Though, I guess it’s pretty unlikely that I would happened to be scanned during that short amount of time.

    Now for the bad news… I can’t sign in with the guacadmin account it supposedly created in the DB. To the log files!

    I checked the mysql log first, and found not connection attempts. I then checked the tomcat logs and found that the JDBC driver is not loading for some reason.

    [2024-11-08 06:41:39] [info] 06:41:39.629 [main] ERROR o.a.g.extension.ProviderFactory - authentication provider extension failed to start: No JDBC driver for MySQL/MariaDB is installed.

    So I first go to check permissions on the file and realize that I copied the jar file to /etc/guacamole/extensions/lib instead of /etc/guacamole/lib, so fixing that and restarting everything again.

    And it works! I had to recreate my user account and all the connections, but it was a lot easier with the admin GUI.

    Fancy that!

    Taking another break to read about TOTP setup and reddit.

  • Trump again…

    I’m not really surprised he won. I mean the poll numbers were pretty clear that he was going to win. I thought I would be a lot more disappointed, but I find myself overcome with morbid curiosity. I don’t really believe he’ll be able to get a second term, or turn America into a dictatorship, so I’m going to really enjoy reading about all the escapades of his administration.

    Of course I could be wrong about that too, so who knows.

  • Cat comic

    https://www.instagram.com/p/DBGPZZDx3RD/?igsh=N29rZnM3NGVtdGsy

  • Enabling firewall on the ol’ webserver

    Enabling firewall on the ol’ webserver

    This evening at work I have decided to enable the firewall on my webserver. It is ofcourse already behind my network firewall, but if one of my other devices gets hack or something, it could become a target. I have been meaning to do it for a while now, but it’s probably been tweenty years since I’ve used iptables to do anything. And Ubuntu has a handly little utility called Uncomplicated Firewall(ufw), which is just a configuration system for iptables. And in keeping with linux development over the last couple decades, this new easier configuration comes with all these lovely config files!

    Since I’m doing this at work, I have to make sure I’ve got all the rules configured correctly, or I risk being blocked for the rest of the work shift, so gotta dot my t’s and cross my eye’s.

    Checking current config

    /etc/default/ufw only had a couple things I might need to change, which are listed below.

    # Set the default input policy to ACCEPT, DROP, or REJECT. Please note that if
    # you change this you will most likely want to adjust your rules.
    DEFAULT_INPUT_POLICY="DROP"
    
    # Set the default output policy to ACCEPT, DROP, or REJECT. Please note that if
    # you change this you will most likely want to adjust your rules.
    DEFAULT_OUTPUT_POLICY="ACCEPT"
    
    # Set the default forward policy to ACCEPT, DROP or REJECT.  Please note that
    # if you change this you will most likely want to adjust your rules
    DEFAULT_FORWARD_POLICY="DROP"
    
    # Set the default application policy to ACCEPT, DROP, REJECT or SKIP. Please
    # note that setting this to ACCEPT may be a security risk. See 'man ufw' for
    # details
    DEFAULT_APPLICATION_POLICY="SKIP"
    

    The .rules files I checked just had some common sense stuff, but I haven’t found a “Drop All” command anywhere in the files. I really need to know if this is configured for default deny or allow, because that changes the order I need to add rules. I’m assuming it’s processed last. I attempted to just enable the firewall but I got a message that it may disconnect my ssh session, so I’ve decided to enter the rules I know I need and hope I don’t get blocked when I enable it.

    So, building the commands to add the rules I need, which is HTTP(S) for the webserver, SSH to configure the webserver, and I’ll add some rules for RDP and Samba later, though I’m not sure I really need to because it’s acting as client. Apache and SSH are already defined as applications in /etc/ufw/applications.d.

    # add rule for SSH
    sudo ufw allow from 192.168.0.0/24 to any app OpenSSH
    
    #add rule for Apache
    sudo ufw allow from any to any app "Apache Full"
    
    Unfortunately, it doesn't all me to run the status command without enabling the firewall, so I may have 7-8 hours of boredom if this goes titts up.

    Wow, I wasn’t disconnected, so I did things right, or it’s just not blocking anything at all. Time to check the log.

    Nothing but this error, so I think I’m good. Not sure why my router is sending this shit, but I’m guessing it’s UNPNP or Multicast something or other. It logs this every 20 seconds.

    2024-10-20T04:25:18.125010+00:00 thecweb kernel: [UFW BLOCK] IN=eno1 OUT= MAC=01:00:5e:00:00:01:c8:7f:54:90:f5:d8:08:00 SRC=192.168.1.1 DST=224.0.0.1 LEN=36 TOS=0x00 PREC=0x00 TTL=1 ID=11284 DF PROTO=2

    I’m kind of surpised neither my SSH, RDP, or Apache/Tomcat lost connection when I turned it on, but things seem to be working perfectly…

    The status command certialy looks like I did what I inteneded…

    cweb@thecweb:/var/log$ sudo ufw status verbose
    Status: active
    Logging: on (low)
    Default: deny (incoming), allow (outgoing), disabled (routed)
    New profiles: skip
    
    To                         Action      From
    --                         ------      ----
    80/tcp                     ALLOW IN    Anywhere
    443/tcp                    ALLOW IN    Anywhere
    22/tcp (OpenSSH)           ALLOW IN    192.168.0.0/24
    80,443/tcp (Apache Full)   ALLOW IN    Anywhere
    80/tcp (v6)                ALLOW IN    Anywhere (v6)
    443/tcp (v6)               ALLOW IN    Anywhere (v6)
    80,443/tcp (Apache Full (v6)) ALLOW IN    Anywhere (v6)

    One last setting to enable at boot and I’m done. Oh, well actually, it turns out that /etc/ufw/ufw.conf is automatically updated to start on boot with the ufw enable command. Cool.

  • Feeding strays

    I have been seeing two cats that I believe live in my backyard for a few weeks now. I put a bowl of food and came back after several hours and it was gone. Yesterday I woke up around 3:30 am and decided to put a bowl out. This hungry little tortie was eating in less than a minute. lol

    Her orange friend came buy, but I didn’t actually catch him eating anything.