Which ssh publickey was used to access an account

When you have more than one public key set up to be able to access a single account (ie more than one public key listed in the authorized_keys you may want to check which public key was used to make a login). Since openssh 6.3 (released 2013) the public key fingerprint is logged - for example the below shows a set of made up “Accepted publickey” entries from an ssh auth.log: ...

bandwidth measurement using netcat

For plain bytes/second bandwidth testing - ie without taking things like encryption overhead and compression improvements into account - the netcat command-line utility is pretty handy. Once installed on both servers (let’s call them serverA and serverB): start netcat to listen on one server and pipe the output through wc -c to both count the bytes (for confirmation) but also so that the bytes are not written to a filesystem or the terminal (which would cause a bottleneck and likely reduce the apparent bandwidth). By default nc will quit when the first network connection it accepts is closed: <span id="line-58" class="anchor"></span>serverA$ nc -l -p 12345 | wc -c start netcat to send data from the other server - using dd to send as quickly as possible (using /dev/zero is fast). Using -q 0 will cause netcat to quit as soon as it sees an end of file (EOF): <span id="line-61" class="anchor"></span>serverB$ dd if=/dev/zero bs=$((2**20)) count=$((2**10)) | nc -q 0 serverA 12345 On the sending server (serverB) the output will show the number of bytes transmitted and the time it took to do that: <span id="line-66" class="anchor"></span>1048576+0 records in <span id="line-67" class="anchor"></span>1048576+0 records out <span id="line-68" class="anchor"></span>1073741824 bytes (1.1 GB) copied, 9.68678 s, 111 MB/s And on the other server (serverA) the number of bytes will be printed (confirming the transmission was complete): 1073741824 Run this in both directions a few times to get a good feeling for the bandwidth between the servers.

March 2, 2017 · 2 min · 242 words · Brad

Cache::FileCache Thoughts

If using perl Cache::FileCache, some comments offering a helpful starting point to get a cache that works in a relatively well behaved and unsurprising way: use Cache::FileCache; use File::Spec; my $cache = Cache::FileCache->new({ # "The namespace associated with this # cache." namespace => 'BJD-TESTING-app_id_cache_id', # "The default expiration time for # objects place in the cache." # This is in seconds. default_expires_in => 1, # "Sets the auto purge interval. If this # option is set to a particular time ( in # the same format as the expires_in ), # then the purge( ) routine will be # called during the first set after the # interval expires. The interval will # then be reset." # # XXX To work needs at least one of # auto_purge_on_set or auto_purge_on_get # to be set to true auto_purge_interval => 5, auto_purge_on_set => 1, # restrict access to the cache to just this # user (data security) # # NOTE that if you set directory_umask # but no cache_root you can end up clashing # with other users who will also be trying # to use (and maybe set the umask) on # /tmp/FileCache # # If we care about data security set # cache_root as well to put the files in # out own private directory: directory_umask => 0077, cache_root => File::Spec->tmpdir() . "/bjdean-perl-Cache-FileCache", });

/usr/bin/base64 - copying and pasting code / patches betweeen terminals

The Scenario A couple of terminals open, connected to a mix of your own workstation, local development servers and remote servers running on a different network and frequently behind a variety of security barriers. You want to copy a smallish chunk of code from a file across the network, or the output of a diff to apply a patch - but characters like whitespace and newlines which should not change will frequently be modified through the copy. You end up with whitespace changes where you don’t want them (perhaps later causing source code control merges to fail, and patches will fail straight away). ...

Perl Gotcha : xor precedence

Perl has a logical xor operator but it happens to be at the very bottom of the precedence priority list , importantly below the humble comma. So this innocent looking piece of code: foobar( $a xor $b, $c ); Is interpreted as: foobar( $a xor <strong>($b, $c)</strong> ); And note unlike the not, and and or low-precedence logical operators, there is no high-precedence xor operator. So it’s a good idea to wrap xors in parentheses to guarantee intended behaviour: ...

March 1, 2016 · 1 min · 85 words · Brad

Choc-Banana-Chia Spread

Description This is a simple and quick spread that’s very tasty on toast. The chia seeds thicken the mixture and add nutritional value. Refrigerate after making to allow the chia seeds to properly gel. Stats ⏱️ Prep time: 5 minutes ✦ Misc time: 30 minutes (refrigeration) ✦ Total time: 35 minutes 🍽️ Serves: Makes approximately 1 cup Ingredients 2 bananas 1/2 cup chia seeds 1 tablespoon cacao powder Instructions Mash or blend the bananas until smooth. Add chia seeds and cacao powder. Mix until fully combined. Refrigerate to allow chia seeds to thicken the mixture. Notes Based on this recipe from my old wiki. The chia seeds will absorb moisture and thicken the spread as it sits in the refrigerator. This spread is best consumed within a few days. Great on toast, crackers, or as a dip for fruit.

February 26, 2016 · 1 min · 139 words · Bradley Dean

Diced Lamb and Beef Turkish Style

Description This Turkish-inspired dish features finely diced lamb and beef cooked with warm spices, sweetened with sultanas, and enriched with pine nuts. It’s served over creamy mashed potato and finished with a generous sprinkle of sumach for a tangy, vibrant finish. Stats ⏱️ Prep time: 20 minutes ✦ Cook time: 30 minutes ✦ Total time: 50 minutes 🍽️ Serves: 4 people Ingredients Lamb and beef, diced into small (½cm) cubes Sultanas or similar dried fruit Pine nuts Olive oil Sumach Paprika Rice (approximately ½ cup) Potatoes (a mix of sweet and white varieties suggested) Instructions Prepare approximately half a cup of rice and let it cool slightly. Boil potatoes until tender (10-15 minutes), then mash. Cook the diced meat with paprika and olive oil, maintaining moisture. Incorporate sultanas and pine nuts, cooking until nuts are lightly browned. Mix in rice, using about one quarter rice relative to meat. Plate mashed potato, create an indent in the center, and fill with the meat mixture. Finish with generous sprinkles of sumach. Notes Based on this recipe from my old wiki. The combination of sweet sultanas, nutty pine nuts, and tangy sumach creates a wonderful balance of flavors characteristic of Turkish cuisine.

December 8, 2015 · 1 min · 199 words · Bradley Dean

Yogurtlu Inspired

Description This Turkish-inspired dish combines crispy fried bread with savory meat, tangy yogurt, and melted cheese, all topped with a generous sprinkle of sumach. It’s a layered dish with contrasting textures and flavors that come together beautifully. Stats ⏱️ Prep time: 15 minutes ✦ Cook time: 25 minutes ✦ Total time: 40 minutes 🍽️ Serves: 4 people Ingredients Lamb chunks, sausages, or preferred meat chunks Bacon strips (optional) Canned diced tomato Diced bread Olive oil Plain or Greek yoghurt (1 cup) Grated cheese (1 cup) Sumach (to taste) Instructions Fry sausages and optional bacon until cooked. Coat diced bread with olive oil and add to pan. Stir gently without breaking the bread pieces. Once bread browns slightly, add diced tomato and stir gently. Simmer on low heat for 5-10 minutes until reduced. Add dollops of yoghurt over the top of the mix (do not stir in). Spread grated cheese over mix (do not stir in). Melt and brown cheese using a grill or cooking torch. Generously sprinkle sumach over the top. Serve with salad. Notes Based on this recipe from my old wiki. The key to this dish is maintaining the layers - don’t stir in the yogurt or cheese. The contrast between the crispy bread, creamy yogurt, and melted cheese creates wonderful texture. The sumach adds a tangy, slightly lemony finish that’s characteristic of Turkish cuisine.

December 8, 2015 · 2 min · 227 words · Bradley Dean

Avoiding Custom Internet Explorer Error Pages

A bit more of a short and to the point comment rather than an actual article. Various web browsers used to display a “helpful” page saying “something is broken” when a website responded with a HTTP 4xx or 5xx error response. At a time when those pages were frequently the apache default error page these custom pages were still not a very good idea, but these days useful information is frequently included in error pages (in particular for errors like 410 Gone). Most browsers have switched to showing the actual error page sent by the web server, but Internet Explorer keeps a version of this custom error page alive. Fortunately there’s a work-around which is that Internet Explorer does this with a silent switch when the error page has at least 512 bytes in the initial response (ie not including any linked content like scripts, styles and images). The upshot of this is that these pages will display a custom error page on Internet Explorer: ...

September 3, 2015 · 1 min · 181 words · Brad

Docker FROM debian:latest

So in my last article I created a Docker container with nothing but a statically compiled helloworld in it. That demonstrated how it’s possible to define a very very (very very) simple container. Here I define a similarly simple container with more complex dependencies - a hello world perl script requiring the Modern::Perl perl module. Now I don’t even need to build the executable binary, but all of a sudden I need to include enough of an environment to support my simple perl script. As far as working with Docker this is not much more complex than changing “FROM scratch” to “FROM debian:latest”. The result is a much bigger container which will take more resources to run, but other than providing the computing resources to support that I really don’t have to care about it that much. The Dockerfile now looks like this: ...

Docker FROM scratch

Docker is a framework which makes it easy to wrap linux applications in “containers” - a sort chroot’d jail but with tools to take away the pain of setting up dependencies and also providing tools to help automate setting up dependencies between those containers. The Docker Hub provides a bunch of pre-defined containers from major projects like Ubuntu, mysql, Redis, nginx, wordpress, postgres and java. It’s also a central store (like github, but for Docker) of publicly created and licensed Docker containers. What’s the simplest quickest way to start? Well there is a special base container called SCRATCH, which is used in the Docker official hello world container. A container based on SCRATCH has nothing in it, so whatever you add has to be fully self sufficient. The Docker official hello world does this with some assembly code compiled by nasm which certainly covers the angle of a stand-alone executable but I think is arguably more complex than a statically compiled hello world - so here we go: ...

"Roast" Veggie Soup

Description This experimental soup features earthy mushroom flavors that come through beautifully. The vegetables are first caramelized on the stovetop, then slow-roasted in the oven for enhanced depth. Select mushrooms with robust earthy characteristics for best results. Stats ⏱️ Prep time: 15 minutes ✦ Cook time: 45 minutes - 2.5 hours ✦ Total time: 1 hour - 2 hours 45 minutes 🍽️ Serves: 4 people Ingredients 2-3 tablespoons coconut oil (or lard/butter) 2 brown onions 2 potatoes 1 carrot 2 large tasty mushrooms Hot water Instructions Cut onions, potatoes, and carrots into 3-5mm cubes. Cut mushrooms into slightly larger 5-10mm pieces. Heat oil in an oven-safe saucepan to medium temperature. Add all ingredients simultaneously and mix thoroughly. Preheat oven to approximately 160°C. Stir occasionally over 15-30 minutes to prevent bottom burning and ensure even cooking. Pour hot water until ingredients are covered by roughly 1cm. Transfer pan to oven for minimum 30 minutes. Longer cooking enhances flavor - 2 hours is recommended for superior results. Notes Based on this recipe from my old wiki. The longer you cook this soup in the oven, the better the flavors develop. The earthy mushroom notes are the star of this dish, so choose your mushrooms carefully. This is a great soup to make when you have time to let it develop slowly in the oven.

August 10, 2015 · 2 min · 222 words · Bradley Dean

Herman the Carrot Cake

Description This recipe adapts Stephanie Alexander’s excellent carrot cake recipe from The Cook’s Companion by incorporating a sourdough-style Herman the German Friendship Cake starter. The starter adds depth and a subtle tang to the classic carrot cake. Stats ⏱️ Prep time: As per original recipe ✦ Cook time: As per original recipe 🍽️ Serves: As per original recipe Ingredients All ingredients from Stephanie Alexander’s carrot cake recipe Self-raising flour: 175g (increased from 125g in original) Eggs: 1 (reduced from 2 in original) Herman starter: 350-400g (one quantity) Instructions Follow Stephanie Alexander’s carrot cake recipe for the initial instructions. When combining wet ingredients, incorporate the Herman starter along with the other wet ingredients. Use the adjusted quantities for self-raising flour (175g) and eggs (1). Follow the same cooking time as specified in the original recipe. Notes Based on this recipe from my old wiki. This variation uses the Herman the German Friendship Cake starter, which is a sourdough-style starter that gets passed between friends.

August 10, 2015 · 1 min · 163 words · Bradley Dean

Getting WordPress Up and Going

Setting up WordPress server there were a couple of minor wrinkles to sort out. I’ve run a blog before before and that fell by the wayside when I started using a personal wiki instead. But this seems like a good opportunity to see how one of the very popular blogging platforms works and what’s involved in keeping that running under the hood. I work primarily with Debian systems, so that was a natural place to start. The wordpress package makes it very easy to get the base dependencies going with a known supported version, so if you’re running a recent release of Debian that seems like a reasonable place to start as well. That said, this of course means that the package is reconfigured along Debian guidelines and I found that I needed to spend a little time working out how this was done before it made sense. ...

July 18, 2015 · 3 min · 638 words · Brad

Protecting Joomla : User-Registration Spam Relay

The Problem: A Default Setting By default user registration is enabled. It’s important to realise that even though links to the user registration page may not have been included in the design of a Joomla site the components are still present and they will be regularly targetted by automatic spiders searching for vulnerable sites. Check access logs for requests to paths like: /index.php/shop-login /index.php/shop-login?view=registration&layout=complete /index.php/component/users/?view=registration /index.php/component/user/?task=register /index.php?option=com_user&view=register With user registration enabled scripts can use a Joomla site as an open mail relay by registering users with target email addresses and inserting spam/attack payload into the user details. The Joomla site will send a confirmation email to the target email address, and any email tracing of the source of the email will lead directly to the weakened Joomla server. ...

So, This is Life

Marvin once said: Life, don’t talk to me about life But really, what was the problem. Life’s not so bad and after all : there are puppies, and fish, and ponies, and food, and walks in the forest, and walks through the grass, and cycling, and talking, and meeting and travelling and all those other things without which Life would not be Life. So here’s a soothing image instead: Soothing Image No. 123132512233

Slow Cooker Stew - Chicken, Sausage and Veggies

Description This is a set-and-forget slow cooker stew that combines chicken thighs, sausages, and hearty vegetables with dried lemons for a unique citrus note. The long cooking time melds all the flavors together beautifully. Stats ⏱️ Prep time: 20 minutes ✦ Cook time: 6-8 hours ✦ Total time: 6-8 hours 20 minutes 🍽️ Serves: 6-8 people Ingredients Eggplant Pumpkin Beetroot Onion 4 Chicken thighs 6 Sausages 3 Dried lemons Mixed herbs (to taste) Passata Water Instructions Chop eggplant, pumpkin, beetroot, and onion into large chunks and add to slow cooker. Add whole chicken thighs to the slow cooker. Slice sausages and add to the mixture. Distribute dried lemons throughout the mixture for flavor. Sprinkle mixed herbs over everything. Pour passata over the mixture. Add water until it reaches the top of the ingredients. Cook on high heat for 4 hours. Reduce to low setting and cook for an additional 2-4 hours until everything is tender and well-blended. Notes Based on this recipe from my old wiki. The finished stew pairs well when served over couscous. The dried lemons add a distinctive Middle Eastern flavor to this hearty stew. You can substitute the dried lemons with fresh lemon zest if needed, though the flavor will be different.

Beef, Pork, Chicken Bolognese

Description This is a hearty multi-meat ragù-style bolognese that combines beef, pork, and chicken for a complex, layered flavor. The sauce develops deep flavor through long simmering with aromatic vegetables and herbs. Stats ⏱️ Prep time: 20 minutes ✦ Cook time: 2 hours ✦ Total time: 2 hours 20 minutes 🍽️ Serves: 6-8 people Ingredients Ground beef Ground pork Ground chicken Brown onions, diced Garlic cloves Carrot, diced Celery, diced Fresh sage Fresh rosemary Nutmeg Cumin Mustard seeds Canned diced tomatoes Tomato paste Olive oil Water Instructions Dice and sauté the onions in olive oil until browned. Finely chop or blend the garlic with sage and rosemary, then add to the pan. Add ground spices (nutmeg, cumin, and mustard seeds) along with diced carrot and celery. Cook until the vegetables begin to soften. Set the vegetable-spice mixture aside temporarily. Add more oil to the pan and brown all three types of ground meat. Return the vegetable-spice mixture to the pan with the meat and combine thoroughly. Add canned tomatoes and tomato paste, then top up with water until just covering the mixture. Bring to a boil, then reduce heat and simmer for approximately two hours, stirring occasionally. Notes Based on this recipe from my old wiki. This sauce benefits from the long simmer time, which allows the flavors to meld and develop. Serve over pasta with grated parmesan cheese.

October 10, 2013 · 2 min · 229 words · Bradley Dean

Herbal Tea - Extended Blend with Lemon Grass, Lemon Verbena, and Spearmint

Description This is an expanded herbal tea blend with eight ingredients, building on the simpler version with additional lemon-scented herbs and mint. The blend has specific proportions for a well-balanced cup with sweet licorice notes, warming spices, and refreshing citrus and mint flavors. Stats ⏱️ Prep time: 10-15 minutes 🍽️ Makes: Variable, depending on batch size Ingredients Mix in the following proportions (in relative units): 1.5 units licorice root 1 unit cinnamon quills, roughly crushed 0.5 units lemon myrtle 0.5 units lemon grass 0.5 units lemon verbena 0.5 units spearmint 0.5 units elderflower Cloves (small quantity, to taste), roughly ground Instructions Using a mortar and pestle, roughly grind cinnamon and licorice together. Combine and lightly grind all remaining ingredients except elderflower. Mix in elderflower. To brew, steep 1-2 teaspoons of the blend in hot water for 5-10 minutes. Notes Based on this recipe from my old wiki. The elderflower is added last to preserve its delicate floral notes. Store in an airtight container away from light to maintain freshness and potency.

June 1, 2013 · 1 min · 171 words · Bradley Dean

Herbal Tea - Cinnamon, Cloves, Elderflower, Lemon Myrtle, Licorice Root

Description This is a simple five-ingredient herbal tea blend combining warming spices with floral and citrus notes. The licorice root provides natural sweetness, while the cinnamon and cloves add warmth. Stats ⏱️ Prep time: 5-10 minutes 🍽️ Makes: Variable, depending on batch size Ingredients Mix in roughly equal proportions (or to taste): Cinnamon quills Cloves Elderflower Lemon myrtle Licorice root Instructions Blend all ingredients together in approximately equal amounts, adjusting proportions to your preference. For enhanced flavor, grind the mixture using a mortar and pestle. To brew, steep 1-2 teaspoons of the blend in hot water for 5-10 minutes. Notes Based on this recipe from my old wiki. Adjust the proportions based on your taste preferences. Grinding the ingredients helps release more flavor when steeping. Store in an airtight container to maintain freshness.

July 18, 2012 · 1 min · 133 words · Bradley Dean