Kumari.net
Interesting things... ?
  1. You are here:  
  2. Home
  3. System Administration
  4. SysAdmin Tips and Tricks

Gitea admin tips and tricks...

I recently started having issues with my Yubikey / Security Key that I use for Gitea, and was unable to login.

This explains how to fix it.

 

Connect to the database. I only have a single user, and so I use the sqlite3 database backend.

$ sqlite3 gitea.db

sqlite> select id from user where name="wkumari";
sqlite> 
delete from u2f_registration where user_id =1;

This still didn't work -- and then I noticed that the url ended in 'webauthn', so I also did:

$ sqlite3 gitea.db

sqlite> select * from webauthn_credential;
sqlite> 
delete delete from webauthn_credential where id=2;

Done!

Fixing fish shell reporting 'fatal: not a git repository (or any of the parent directories): .git'

For a long time I ran the 'fish' shell, with the Oh My Fish extension and Agnoster theme. I did this purely because I like the magic autocompletion, but never really liked it, because it has some very strong views on things like scripting, gratuitiously differnt syntax, etc. E.g:

echo $(PATH)
fish: $(...) is not supported. In fish, please use '(PATH)'

After a friend showed me that the combination of zsh,  Oh My Zsh and zsh-autosuggestions I moved to this, and am much much happier.

However, every now and then I still pick up and use a machine which I haven't yet migrated. I recently did this and ran into the annoying error:

~ $
fatal: not a git repository (or any of the parent directories): .git
~ $
fatal: not a git repository (or any of the parent directories): .git

This happens on every command, after just pressing enter, etc because it is actually part of building the prompt. I knew I'd run into this before, and that the root cause had filled me with rage, but it once again took some digging to find and fix.

My fish prompt included:

command git rev-parse --is-inside-work-tree ^/dev/null >/dev/null

and, apparently, in some fish update they decided that ^ is no longer a supported redirection, and so I had to change this everywhere to 2> so:

command git rev-parse --is-inside-work-tree 2>/dev/null >/dev/null

So, next time I run into this:

grep -r '\^[/&]' ~/.config/fish/

and then go fix them... or, better yet, get around to removing fish and adding zsh instead... 

Removing an IP address from fail2ban

I use fail2ban to stop annoying things like ssh bruteforcers, etc.

Sometimes I accidentally manage to get my own address added, or need to unblock a specifc address. Here's how:

user> sudo fail2ban-client status sshd
Status for the jail: sshd
|- Filter
| |- Currently failed: 0
| |- Total failed: 3
| `- File list: /var/log/auth.log
`- Actions
|- Currently banned: 1
|- Total banned: 1
`- Banned IP list: 192.0.2.1

And then to remove the IP:

user> sudo fail2ban-client set sshd unbanip 76.104.43.89

 

 

Performing remote Wireshark and tcpdump over SSH

tcpdump can be configured to write its capture to standard out, and Wireshark can read from standard in. SSH allows you to remote exec a command, and have it stream the output back.

This allows one to perform a remote Wireshark capture quickly and easily - one of the nice uses for this is to perform captures from a Ubiquti router. For exmaple:

ssh 192.168.0.1 'sudo tcpdump -f -i eth1 -w - port 53' | /Applications/Local/Wireshark.app/Contents/MacOS/Wireshark  -k -i -

This ssh's to my home router, and starts tcpdump listening on interface eth1. It writes the output to STDOUT ('-w -') and only captures port 53. This then streams to wireshark on my local machine (-k is "start capturing immediately" and -i is interface -- in this case, STDIN (-)).

 

 

Sync'ing a git / GitHub fork.

I need to do this fairly frequently, and for some reason I can never remember the steps, so I'm writing it down!

This isn't news, it is lifted from the GitHub Configuring a remote for a fork and Syncing a fork pages.

$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

$ git fetch upstream
$ git checkout master
$ git merge upstream/master

Make your edits, etc. Push (this will push to your fork), make pull-request. Next time you need to sync the orogin, start at the 'git fetch upstream' step.

 

  1. Adding a new git repo to my system
  2. Making Avocent KVM work under OS X.
  3. Using AWK to generate a sum / add up all the numbers in a column
  4. Removing bullets from slides.com / reveal.js

Page 1 of 3

  • 1
  • 2
  • 3

Main Menu

  • Home
  • About Me
  • Projects
    • Random Projects
    • Atomic Clocks / NTP
    • FPGA Based POCSAG Decoder
    • FPGA Based Password Cracking
    • Adding TV support to an ICOM IC-7000
    • Hacking the Sectera Wireline Terminal
    • Geiger counter based RNG
    • Making a Naked Portafilter
  • Proximity Card Access Systems
    • Building a Proxmark 3
    • Cloning an HID card
  • Cars
    • Ferrari 599GTB Fiorano
      • Tips and Trick
      • Repainting a Ferrari 599 Key
    • Lamborghini Murcielago Roadster
    • Ferrari 308
      • Ferrari 308 Door Lock Issues
    • Ferrari Battery Charger Cable
      • Creating a CTEK to Ferrari adaptor cable
      • Making a CTEK to Ferrari battery tender adaptor cable.
    • Aston Martin V8 Vantage Roadster
    • Land Rover Series IIA
  • Blog
  • Networking
    • Tips and Tricks
    • Funny
  • System Administration
  • Programming
    • Python
  • Random
  • Pontification
  • Pictures