Samba File Server: Stop files from being set with executable bit

While doing a bit of code cleanup today, I found some files which were marked as executable even though they weren't meant to be.

image

As I looked around at the files affected, a colleague did some snooping on git and found out why it was being set.

"Err Twig, I think it's you".

After double checking the git logs, yep it was me. How embarassing!

dramatic_alpaca

Preventing the stupid setting

Fortunately it's an easy fix to stop it from happening.

Open up the Samba FS config file

  • sudo vi /etc/samba/smb.conf
  • Under "[global]", paste in:

map archive = no

  • Save and restart

Bonus: Fixing affected files

Unfortunately, this part isn't so easy

You can use this command to quickly search and list out files affected:

find -type f -perm /u+x | vim -

If you want to just find and turn off the executable bit automatically, then use:

find -type f -perm /u+x -exec chmod -x {} \;

find -type d -perm /u+x -exec chmod 0755 {} \;

It'll be up to you to set +x back onto any files which were supposed to have it.

Source

cPanel / WHM: How to redirect sub-addressed (plus addressing) emails to your inbox folder

For a few months now, my inbox has been pretty quiet. I thought that the war on spam is finally over, but then I noticed that my regular cron job emails weren't being received either.

I checked and disabled all my email filters, nothing strange there.

I disabled all my spam checks. Nope nothing there too.

Without many other options, I contacted my web host and they said it seemed fine. I sent various test emails and replied back saying it wasn't working for me on all email addresses on their servers.

Something seemed fishy, but I decided to bypass my usual IMAP method of use and went straight to webmail. Wasn't showing up there either.

The problem

Clicking around on all the options on Roundcube, by chance I stumbled upon an option to select folder subscriptions and noticed a bunch of folders which matched the names of my test emails!

It turns out somewhere along the line, in a "recent" update cPanel decided to redirect all plus-addressed emails to a subfolder matching the name of the sub-address. This was a ridiculously stupid decision as IMAP clients generally don't refresh the subfolder listings until you tell them to. With plus-addressing being a useful tool to determine where spam emails come from, it's a chore to keep refreshing the folders whenever I sign up to a new website.

 Untitledemail filters
Thunderbird and Roundcube both don't automatically subscribe to new folders when accessing your email via IMAP.

What makes it worse is there is no option to disable this default behaviour. They've just proudly written down in the docs as a note under "Email subaddresses" in case you happen to stumble upon it.

image

The solution

In the docs there are notes about tweaking EXIM (which sounds like it could cause more trouble), but thankfully I managed to find a help page by Ngage Hosting UK which provided a fix for this. I'd take a guess it was a response to customers frequently complaining about not receiving emails...

  • Go to your cPanel setup page
  • Click on Mail > "User-Level Filtering"
  • For each email address, click on "Manage Filters"
  • Click "Create a New Filter"
  • Give it a name (eg. "Sub-address to inbox")
  • Set rule to be "To" > "matches regex" > you\+[a-z0-9]@yourdomain.com (replace "you" and "yourdomain.com" parts)
  • Set action to be "Deliver to Folder"
  • Click the browse button and select "Inbox"
  • Save it and repeat for other email addresses

You'll also have to do this for every domain, so enjoy this tedious process!

Sources

Fix Windows 7 getting stuck on "Checking for updates...", high CPU usage or installing updates

So my friend's computer has had issues with getting updates since day 1. I didn't really know why, but at the time a lot of the responses online was to leave it running overnight and hope for the best.

Eventually, my computers became victim to the same issue. For months, Windows Update would get stuck on the "Checking for updates..." or hang when trying to download the updates.

windows updates chcekingwindows update scanning

It also pegs a CPU core to almost 100% usage (or 25% in quad cores and 50% in dual cores) under the process "svchost.exe" while it searches aimlessly, wasting valuable battery life and compute cycles on something that should be sitting quietly in the background.

Note: svchost.exe is used to host many services, but in my case after stopping the "Windows Update" service, the CPU spike stopped. If this isn't the case for you, then you have another problem.

I stumbled upon some information by chance which described the issues. Apparently there were some changes to Windows Updates which fixes these issues, but only made available through optional rollup patches.

1283775594667

Great logic there Microsoft. You've fix your updater but made it optional, so anyone who uses it has to go on a wild goose chase in order to get it working.

These rollup patches come in a form of rollup updates, which basically mean they're a monthly service pack.

Before you continue... Service Pack 1 is required!

Make sure you're on Windows 7 SP1!

Right click on "My Computer" and select Properties. That'll give you the service pack information under "Windows edition".

If you're not on SP1, go to Windows 7 and Windows Server 2008 R2 Service Pack 1 (KB976932), click download and select either:

  • windows6.1-KB976932-X64.exe (64 bit)
  • windows6.1-KB976932-X86.exe (32 bit)

And depending on how long your updater has been broken for, you'll also need the April 2015 service servicing stack update. For most people this shouldn't be a problem. Only download and install it the fix process complains.

The fix

  • When it's done, disable the Windows Update service from running in the background. This will speed up installation of the update by a great amount.
  • To disable it, find command prompt in the start menu, right click, run as administrator and paste in:

sc stop wuauserv

  • Go to the Update for Windows 7 file and run it
  • Click through the prompts and let it do its thing. After a while, it'll ask you to restart. Hope you've got some time because it takes a while!

DSC_1012

Stays on 13% for ages! Worst quality photo, no apologies.

  • Once you're back into Windows, make sure that Windows Updates works by clicking on "Check for updates". It should work much faster (within a few minutes) like it used to!

imageAs you can see, this computer hasn't had a proper update since June...

  • If it shows new updates available quickly then you should be on your way.
  • Install the updates to test it out. Everything should be working perfectly now.

image

So now you should have gone from a computer which takes about 10 minutes to scan for updates to one that scans within a minute. And now the updates should actually work!

1461611048714

Sources

Android: Fix for YouTube "There was a problem while playing. Tap to retry" - Videos Stop Playing After a Few Days

This was an annoying issue plaguing me for the past year or so. I don't know exactly when it started happening or why, but there are numerous posts and issue trackers for it scattered around the internet without a solid fix.

The problem

The official YouTube app suddenly decides to stop working about 2 days after rebooting the phone. There's no real information available (as a user) to figure out what's wrong.

All it says is "There was an error while playing. Touch to Retry".

Oh but not to worry, you're still able to watch YouTube ads before the actual video itself.

http://i.imgur.com/y96imEp.png

For those more technically inclined, here's what the stack trace looks like when YouTube freaks the hell out:

Fixes that I've tried

Over the year, nothing I tried works aside from restarting the phone. That was the only thing that kept YouTube working, other than just watching it via the browser which bypasses the app altogether.

In case you've stumbled upon this guide while running into an entirely different issue, here are a few things that may get YouTube working again:

Clearing cache and data for YouTube didn't work
Uninstalling and reinstalling YouTube didn't work
Downgrading to an older version of YouTube didn't work - I went all the way back from v11 to v6
Removing current WiFi details and adding it back didn't work - some people believe this works
As mentioned above, restarting the phone works for about 2 days. You'll find it frustrating after putting up with an ad and it doesn't work again
Using a web browser to play the video Works consistently, but it's not as good as the app

The Solution!

Only until last week did I manage to find a new suggestion on XDA forums. I tried it out, gave it a few days and surprisingly it still works!

Unfortunately, it requires you to have root access to your Android device. I guess there's only so much you can do before you have to dig deeper to fix these sort of issues.

What you need to do is rename a few system files and restart the phone.

  1. Open up a file explorer capable of browsing system folders. If your phone doesn't have one, I recommend FX File Explorer as it comes with root explorer mode.
  2. Navigate your way to /system/etc/firmware/
  3. Rename the following files to add ".bak":
    tzwidevine.b00 tzwidevine.b00.bak
    tzwidevine.b01 tzwidevine.b01.bak
    tzwidevine.b02 tzwidevine.b02.bak
    tzwidevine.b03 tzwidevine.b03.bak
    tzwidevine.mdt tzwidevine.mdt.bak

  4. Restart your phone.
  5. Make YouTube great again! You shouldn't have any more issues with watching silly videos again after doing this.

Source

Video playback issue - Post #4

Sony Z5 Compact: Root without losing TA partition (DRM features) on Marshmallow

I've spent too long on Android without root access and it really bothers me. I need it!

1046
Feeling imprisoned by my own Android OS... I did not sign up for iOS!

Overview

  • In order to back up the TA partition (where the DRM keys are stored) we need temporary root access via the iovyroot exploit, which is only available on a Lollipop build. This part is optional if you don't care about that functionality
  • Once that's done, you can unlock the bootloader. Doing so wipes the TA partition.
  • Upgrade to Marshmallow
  • We then trick the kernel into thinking it's still locked, giving us both root access and access to DRM-locked features.
  • Optionally, for completion we can also partially restore DRM keys from the TA backup.
  • Having your TA backed up correctly prevents any issues if you want to keep your DRM features such as camera optimisations.

Before starting, make sure you have:

  • enabled USB debugging via Developer mode
  • backed everything up. It's going to get wiped!

Before starting

We have to make sure that this process is actually possible with your device.

  • Open the dialler and enter *#*#7378423#*#* to access the service menu.
  • Go to Service info > Configuration > Rooting Status
  • If "Bootloader unlock allowed" says Yes, then you can continue with this tutorial.
  • If it says No or if the status is missing, then your device cannot be unlocked. Good luck.

Note: If it says "allowed" it means you CAN unlock your device. It does NOT mean your device IS unlocked.

While we're here, make a note of your IMEI number. You'll need it later.

Screenshot_2016-04-16-17-47-40

Downloads

Downgrade to Lollipop

(Optional if you don't care about the DRM keys)

If you're already on Marshmallow, then I'm afraid you need to downgrade back to Lollipop (and in the process wipe everything). Make a backup using the Sony PC Companion before doing so.

  • Download Flashtool and install it
  • Download firmware (It's Aussie firmware, but we only need it for a short amount of time so it'll do) and put it into %USERPROFILE%\.flashTool\firmwares
  • Start Flashtool
  • Click on the lightning bolt icon
  • Select "Flashmode"
  • Select the Lollipop firmware (32.0.A.6.200) and select the wipe options APPS_LOG, DIAG and USERDATA. Otherwise things will crash a lot and you won't get into the phone properly. Trust me, I've tried.
  • Turn off the phone.
  • Wait for Flashtool to finish preparing the files.
  • When prompted, hold "volume DOWN" button while plugging in the USB.
  • Wait for it to finish. Don't trust the progress bar! Make sure it's finished by reading the text. It will tell you when to disconnect and restart.

Backing up the TA partitions

(Optional if you didn't bother downgrading to Lollipop)

Now that you're on Lollipop, you can use iovyroot. With this we can gain temporary root access and dump the TA partition to a file. This file is what we use to restore the DRM keys to your device after it's been wiped by unlocking the bootloader.

Extract iovyroot_v0.4.zip and run "tabackup.bat"

Once it's done, you should have a TA-####.img file which sorta looks like "TA-16042016.img" and is approximately 2mb in size. That's your TA backup done and dusted!

Keep it safe somewhere.

Unlocking your bootloader

  • Go to Settings > Developer options
  • Tick "Enable OEM unlock"
  • Open up a browser on your computer and follow the instructions at Sony's developer website. You'll need to provide your email in order to continue. Mine got caught in junk mail so be sure to check that.
  • After receiving your email, entering your IMEI number and accepting some user conditions will provide you with an unlock code.
  • This is the point where I remind you again...

BACK UP WHAT YOU NEED NOW. There's no turning back after this!

  • Turn off your phone.
  • In Flashtool, click on "BLU"
  • Hold "volume DOWN" on your phone and plug it into the computer.
  • When prompted, release volume down and unplug.
  • Hold volume UP and plug it back in.
  • You should now get a dialog which lets you enter an unlock code.
  • Paste in the unlock code and click "Unlock".
  • Wait for the phone to finish doing it's thing and restart.
  • Your phone is now wiped clean so you'll need to go through an initial setup again.
  • Checking the service status again should now say "Bootloader unlocked: Yes".

Upgrading to Marshmallow

(optional if you're already on Marshmallow)

At this point you can either download the firmware I provided (if you're Australian) or download the right one for your region.

If you're not an awesome Australian, then you'll need to download your own firmware.

  • Using FlashTool, click on the "XF" icon to launch "XperiFirm"
  • This lets you search for firmware files for your device.
  • Look for "Xperia Z5 Compact" and then your model. In my case E5823 (check your phone under Settings > About > Model)
  • Select the region you want (Customised AU means generic unbranded firmware for Australia)
  • Select the firmware on the right, shown as highlighted.
  • Click download.

image

  • Close the downloader when it's done unpacking.
  • It will take some time to repackage the firmware files into an FTF file. This is what we use to re-flash your phone with stock firmware. It also contains the kernel file you need for the next part of the tutorial.
  • Now turn off your phone.
  • In Flashtool > Lightning bolt icon > Flashmode
  • Select the Marshmallow upgrade (32.1.A.1.185)
  • Wait for it to prepare the files.
  • When prompted, hold volume DOWN on phone, plug it in.
  • Wait until it's done. Restart and ensure the phone is working.

Rooting your Z5 Compact

Now for the main course. This is why you're here.

  • Open your Marshmallow FTF file using Winrar or 7-zip and extract out "kernel.sin".
  • In FlashTool > Tools > Sin Editor, open up "kernel.sin" and click "Extract"
  • This will give you "kernel.elf"
  • Extract the files from "rootkernel_v4.22_Windows_Linux.zip" into a folder without spaces (ie. not your desktop or program files)
  • Copy "UPDATE-SuperSU-v2.65-####.zip" into the rootkernel folder and rename so it becomes "SuperSU-v2.65-####.zip"
  • Open a command prompt to the rootkernel folder and type in "rootkernel kernel.elf kernel_patched.elf". This process deactivates SONY-RIC, removes DM-VERITY, adds TWRP bootloader as well as the DRM FIX.
  • Ensure that the SuperSU service was added by scanning the output for "Adding service entry for SuperSU".
  • If you come across this error, it means you did it on a Lollipop kernel.

- Found SuperSU-v2.65-20151226141550.zip
  Adding service entry for SuperSU
source type fsck does not exist
Could not add rule for perm: dac_override
source type fsck does not exist
Could not add rule for perm: write
source type fsck does not exist
Could not add rule for perm: create

I don't know how to fix it, but I'm pretty sure the author of rootkernel isn't bothered to fix it either.

  • Now that you have your patched kernel, it's time to flash it using Flashtool!
  • Turn off your phone.
  • Flashtool > Lightning bolt icon > Fastboot
  • Now we've got a lot of options! Click "Select kernel to Flash"

image

  • Hold the volume UP button and plug in your phone.
  • When the Kernel Chooser dialog appears, click on the "*.sin" dropdown to change it to "*.elf", then select "kernel_patched.elf".

image

  • It should finish pretty quickly with something like "Please check the log before rebooting into system".
  • If everything went well, unplug and turn on your phone.
  • The device should now have the SuperSU app installed.
  • Checking unlock status should now say "Bootloader unlock allowed: Yes" again.
  • Download and test Titanium Backup. You should be prompted to give root access on start.
  • Turn your phone off completely and then on again to make sure root status persists.
  • Now you can enjoy your... well, EVERYTHING!

Restoring the DRM keys

(optional, I guess?)

This is for the perfectionists and completionists. If you can't stand the thought of being at 99% and absolutely NEED to have that 100% completion then follow me.

  • Copy your TA partition backup to the rootkernel folder.
  • Open up a command prompt to the rootkernel folder and type in the following:

flash_dk TA-####.img restore-drm-keys.ftf

  • The script will spit out a new file called "restore-drm-keys.ftf".
  • Put this into "%USERPROFILE/.flashTool/firmwares/"
  • In Flashtool, click on the lightning bolt icon
  • Select flashmode
  • Select "DeviceKey" and click Flash
  • Hold "volume DOWN" and plug in USB cable.
  • Unplug and restart phone when instructed (read the activity log)

This new restored TA partition should persist across device wipes and Android upgrades.

Well, that's the end of that! We sure showed Sony who's boss!

View post on imgur.com

Donations

Big props go to zxz0O0 for making the TA backup easy to use and tobias.waldvogel for the DRM restoration patch. I've linked to their donation pages so please donate for their amazing work.

If you thought this guide was helpful then please feel free to donate to me too! (link is on the right)

Sources

Git: Post-merge hook to detect when certain files have changed and display a notification

When certain files in a project change, the project needs to be rebuilt/restarted/recompiled. Using the following git hook, you can keep an eye out for changes in certain files then display a reminder message to perform an update or just make it run the command automatically.

It's just a simple bash script that's executed by git after a successful merge.

Use check_run() to run the script automatically, or check_warn() if you want it to only be noisy about it.

Store this in your_project/.git/hooks/ as "post-merge".

14QJ3Mv
Automate things. Less room for errors and mistakes.

How to safely downgrade your Old/New Nintendo 3DS to firmware 9.2.0-20

Assuming you're on firmware 9.3 to 10.3, then you can downgrade to 9.2 using the following method.

  • Download starter.zip (aka the "homebrew starter kit")
  • Download sysUpdater.zip
  • Download 9.2.0-20X firmware for your console (Replace X with E for Europe, U for US and J for Japan)

I can't link you the firmware download links, but I can tell you how to find it.

  • Google for "[MEGA] [CIA/BIN] MSET 4.X & 6.X backups, Browser backups, Update packs (All Regions)" with the quotation marks.
  • Search for your console generation (3ds OLD or NEW)
  • Then be VERY careful to download the right 9.2.0-20X firmware for your console.

You will risk bricking your console if you try to install the wrong firmware onto your console.

To double-check the download after it's done, verify the zip archive with an MD5 checker against the following checksums.

Region

N3DS

O3Ds

9.2.0-20E (Full)

MD5: 6dcca8fcbc9a28c82c2a4e5182f3acf8
SHA-1: e7c77bf205137167f1f1befa0c4db9d879a21a2e?

MD5: caec3e015bc065dd0ca512f219c8fc3c
SHA-1: 63f0e83892af0f43d159685b4d775e09360552e4?

9.2.0-20U (Full)

MD5: e5f40c3b155cfd12ef38be35d2e81d2e
SHA-1: 377c140377fb6cf31a0c032c4e1196cc521f87fe?

MD5: 879f437d7c78f09ae565f79f5aa9c421
SHA-1: ccc272c495a84aa49f8db2da6072a79a73053e19?

9.2.0-20J (Full)

MD5: f46677696ed4bf0e182de5a8168b7542
SHA-1: c9a1aaf4a4923fb5e065546da5c4a4da37aafdb2?

MD5: a7c14f50e553d99d93efd3a8dd4f8b9d
SHA-1: 422af53b07c270d65bf443d09736f3d1c540641c?

Setting up the 3DS for downgrade

Before starting, use a file hash checker to MAKE SURE THE FILE WAS DOWNLOADED CORRECTLY!

  • Extract starter.zip to root folder of your sd card
  • Extract sysUpdater app to "3ds/sysUpdater" folder of sd card
  • Make a folder called "updates" on the root of the sd card
  • Put all the firmware CIA files into the "updates" folder
  • Safely remove sd card from computer
  • Put it into the 3ds
  • Turn it on
  • Y8MAaYR

Installing Menuhax

Since all the files are already on the SD card and ready to go...

  • Open up the 3DS browser and run browserhax by typing in http://yls8.mtheall.com/3dsbrowserhax_auto.php
  • It'll flicker and take you into Homebrew Launcher.
  • From there, select Menuhax installer
  • Press A to install
  • Restart when instructed
  • Now that it's installed, turn off WiFi
  • Turn off your 3DS
  • Turn it on again, but hold L as it loads
  • This should now start you directly into Homebrew Launcher without the need of browserhax

I've written this up in greater detail in a previous tutorial if you're still confused.

Downgrading your Old/New 3DS to 9.2

From homebrew launcher:

  • Start up sysUpdater
  • Press Y to downgrade. It takes a moment to response so give it about 10 seconds before giving up.
  • Wait a few minutes for it to finish
  • It will reboot itself
  • If everything worked, you will now be on 9.2.0-20 (but you've lost your menuhax)
  • When you're rebooted back into your 3DS, open up the browser
  • Run and reinstall menuhax via browserhax at http://yls8.mtheall.com/3dsbrowserhax_auto.php
  • Remember to turn off WIFI after it's all done

Problems you may encounter with sysUpdate

  • opening sysUpdate gives a black screen
  • sysUpdate turns on and shows text, but pressing Y or B does nothing

In these cases, I recommend trying:

Method A: Trying a new sd card

  • Copy all the stuff from your SD card onto your computer
  • Copy all the stuff from the computer to a new sd card made by a more reliable brand (Apparently Samsung works well)
  • Try again with new card

Method B: Format the card to FAT32

  • Copy all the stuff from your SD card onto your computer
  • Format the card to FAT32 using Windows Explorer
  • Copy all the stuff back
  • Try again

Method C: Run FTBrony first

This one is a strange one but actually worked for me after the third attempt (and after formatting the SD card)

  • Get into Homebrew Launcher
  • Start FTBrony
  • Spam the B button to exit immediately
  • Spam the "Right" button on the d-pad to find sysUpdater
  • Start it and hope to see text

Things to do now

If you've got a Gateway card, you'd be pleased to know that Gateway supports v9.2 so you can start using it again.

Much like installing sysUpdater, you'll need to load Gateway mode via Homebrew Loader

  • Grab GW_ULTRA_3_6_2_BETA.zip from their website
  • Extract the contents of GW_3dsx.zip to your SD card so you have X:\3ds\GW\
  • Start Homebrew Loader
  • Load up Gateway
  • Sleep. I'll write up more stuff another day.

VYtJ9

    Sources

      nginx: How To Set Up an SSL Reverse Proxy (Windows / Linux)

      So you have a program on your computer that's running a HTTP server, but you want to add HTTPS support to it to prevent people from snooping on your activity.

      Fortunately, that's pretty easy to do.

      Downloads

      • nginx
      • openssl (for Windows, mine came with cmder)

      Installing nginx

      Pretty straight forward.

      Windows: Download, extract and open command prompt there

      Linux: Add repo, update and apt-get to install

      Testing default setup

      • Windows: type "start nginx"
      • Linux: Should already be started after installation. If not, try /etc/init.d/nginx start

      Open up a browser to http://localhost/ and you should see an nginx page.

      Generating Encryption Certificate

      For this process I'm just going to self-sign a certificate to get your server up and running. The browser will complain about it for the first time, but after you add the exception and test that it's all working you can get it signed properly elsewhere.

      • Open up a terminal and "cd" to nginx conf folder
        • Linux: cd /etc/nginx/
        • Windows: cd /D X:\Wherever\You\Extracted\nginx\conf\
      • Type in

      openssl req -x509 -sha256 -newkey rsa:2048 -keyout yourdomain.com.key -out yourdomain.com.pem -days 1825 -subj '/CN=yourdomain.com' -nodes

      • This will generate your private key file and your certificate. Keep your key safe!

      Configuring SSL on nginx

      • Open up nginx.conf
      • Under the "http" entry
      • Add in this snippet and modify to suit your domain/port numbers

      # SSL reverse proxy server
      server {
          listen      443 ssl;
          server_name localhost;

          ssl_certificate      yourdomain.com.pem;
          ssl_certificate_key  yourdomain.com.key;

          #ssl_session_cache    shared:SSL:1m;
          #ssl_session_timeout  5m;

          #ssl_ciphers  HIGH:!aNULL:!MD5;
          #ssl_prefer_server_ciphers  on;

           location / {
              proxy_pass http://localhost:1234/;
          }
      }

      In this example I'm proxying the HTTPS request to https://yourdomain.com:443 (default HTTPS port being 443) to a service running at http://localhost:1234 on the same computer.

      Reload nginx and you see if it works on the browser.

      • Linux: /etc/init.d/nginx reload
      • Windows: nginx -s reload

      Now you should be able to access your HTTP service via a secure HTTPS proxy.

      See? Wasn't that hard after all!

      22a53b79dac1e7a50ba3c5c3836ef702

      Additional redirects

      You might want to add a regular HTTP server which redirects to the new HTTP server. Simply add this to the conf script above or below the details for the HTTPS "server {}".

      server {
          listen       80;
          server_name  yourdomain.com;

          location / {
              return 301 https://$host/;
          }
      }

      Sources

       
      Copyright © Twig's Tech Tips
      Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog