Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Subscribe to this RSS Feed
  • How to Use Credentials That Contain Special Characters with curl
    05/02/2016 12:00PM
    In order to execute curl commands to endpoints with passwords that contain special characters, the cleanest way that I have found to do so is to Base64 encode the authentication string for curl and then pass an Authorization request header along with the request.

    In this example the credentials are uid 'rchapin' and passwd 'abc123!@#'.  Normally we would pass this to curl as follows:

    $ curl -u rchapin:abc123!@# -X GET https://some-endpoint:443

    However, this will not work and the password will need to be sent in some other fashion other than ASCII.

    Following are the steps to pass the credentials as Base64:

    1. Using your favorite Base64 encoder, generate and ASCII string of the entire 'username:password' strin
    g that you would normally pass with the -u option for curl

    rchapin:abc123!@# converted = cmNoYXBpbjphYmMxMjMhQCM=

    2. Now modify the curl command as follows:

    $ curl -H "Authorization: Basic cmNoYXBpbjphYmMxMjMhQCM=" -X GET https://some-endpoint:443
  • Solution for MySQL ERROR 1396 (HY000): Operation CREATE USER failed for
    04/28/2016 11:56AM

    This indicates that the user already exists, or did exist but that all of the data for that user has not been deleted.

    As the mysql root user:

    REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'hostname';
    DROP USER 'user'@'hostname'


    Then re-try creating the user.

  • How to Configure a Linux Client for Active Directory Authentication
    04/26/2016 9:06PM
    I am currently working on setting up multiple environments for a new project (DEV, QA, and PROD) and will be integrating all of the servers to an Active Directory Domain Controller for user management.

    Following are notes from when I configured a Fedora Core 18 laptop to integrate with an AD server.  It is likely things have changed some from then and I will update this as required for a current version of RHEL7/CentOS 7.

      Run the following commands as a local user with root priveleges:

      . Installed necessary packages:
        . # yum install sssd-tools adcli realmd
        . sssd will not have the /etc/sssd/sssd.conf file installed until you join a domain (see below) so do not try to configure it.

      . disabled selinux
        . Perhaps selinux can be re-enabled after joining and configuration?

      . search for a realm:
        . # realm discover -v
    # realm discover -v
     * Looking up our DHCP domain
     * Discovering for DHCP domain: somedomain.com
     * Searching for kerberos SRV records for domain: _kerberos._udp.somedomain.com
     * Searching for MSDCS SRV records on domain: _kerberos._tcp.dc._msdcs.somedomain.com
     * server1.somedomain.com:88 server2.somedomain.com:88 server3.somedomain.com:88
     * Found kerberos DNS records for: somedomain.com
     * Found AD style DNS records for: somedomain.com
     * Successfully discovered: somedomain.com
    somedomain.com
      type: kerberos
      realm-name: SOMEDOMAIN.COM
      domain-name: somedomain.com
      configured: kerberos-member
      server-software: active-directory
      client-software: sssd
      required-package: sssd-tools
      required-package: sssd
      required-package: adcli
      required-package: samba-common
      login-formats: SOMEDOMAIN\%U
      login-policy: allow-any-login

      . joined the domain:
        . # realm join -U admin --verbose somedomain.com

      . allowed all lotame users to login
        . # realm permit --realm somedomain.com --all

      . Add the home directory paths
        . # mkdir /home/SOMEDOMAIN

      . chkconfig on sssd:
        . # systemctl enable sssd

      . Log out from the local user account and then log in as a user in the domain:
        . uid: SOMEDOMAIN\uid
        . This will log you in as that user and create a home account in /home/SOMEDOMAIN/uid
  • [SOLVED] Delete key not working with x2go server running XFCE
    03/17/2016 10:09AM

    I am working with a development environment whereby I VPN into an environment with an Ubuntu VirtualBox guest and then initiate an x2go client session to a developement workstation server that lives in the development environment.

    I had everythining working exactly as I wanted except that the Delete key did not work in the x2go session.

    Previously the xev output when pressing the delete key was:

    FocusOut event, serial 36, synthetic NO, window 0x2e00001,
        mode NotifyGrab, detail NotifyAncestor

    FocusIn event, serial 36, synthetic NO, window 0x2e00001,
        mode NotifyUngrab, detail NotifyAncestor

    KeymapNotify event, serial 36, synthetic NO, window 0x0,
        keys:  0   0   0   0   0   0   0   0   0   0   0   0   0   0 0   0
               0   0   0   0   0   0   0   0   0   0   0   0   0   0 0   0


    For the given user/X-session, go to Applications Menu -> Settings -> Keyboard

    Then under the 'Layout' tab, uncheck the 'Use system defaults' and specify the keyboard that you are using.  In my case it was:
        Keyboard Model: Generic 105-key (Intl) PC
        Keyboard Layout: English (US)

    NOTE:  the layout had TWO options that were both 'English (US)' and I selected the top-most item.
    Log out of the X session, which will kill the x2go session and then log back in to a new session and the delete key works as expected.

    xev output when pressing delete key is now:

    KeyPress event, serial 36, synthetic NO, window 0x3600001,
        root 0x146, subw 0x0, time 2229006870, (-615,43), root:(879,645),
        state 0x10, keycode 107 (keysym 0xffff, Delete), same_screen YES,
        XLookupString gives 1 bytes: (7f) "
        XmbLookupString gives 1 bytes: (7f) "
        XFilterEvent returns: False

    KeyRelease event, serial 36, synthetic NO, window 0x3600001,
        root 0x146, subw 0x0, time 2229006981, (-612,41), root:(882,643),
        state 0x10, keycode 107 (keysym 0xffff, Delete), same_screen YES,
        XLookupString gives 1 bytes: (7f) "
        XFilterEvent returns: False

  • My Git Cheat Sheet
    02/25/2016 9:44PM
    Some standard configs:

    git config --global user.name "Ryan Chapin"
    git config --global user.email "rchapin@nbinteractive.com"
    git config --global core.editor vim

    Ignore files in your repo:

    .gitignore files contain patterns for files or directories to ignore

    You can also set up a global .gitignore file for all Git repos via the core.excludesfile setting
    $ git config --global core.excludesfile ~/path/to/some/.gitignore

    The local .gitignore can be committed to a repo, the global one is only locally visible

    Empty dirs need to have some file in there, .gitkeep for example:
    $ touch .gitkeep

    ========================================
    Git Cheat-Sheet:

    # Some standard configs for git on your local box

    $ git config --global user.name "Ryan Chapin"
    $ git config --global user.email "rchapin@nbinteractive.com"
    $ git config --global core.editor vim

    $ git checkout master : checks out the master and sets it to HEAD
    $ git checkout <branch_name> : checks out the 'branch_name' branch and sets it to HEAD
    $ git branch -a : lists the branches in the current git repo


    # -------------------------------------
    # Creating and working with repos:

    # create a remote repo on a server without a working tree, by default the repo
    # should end in .git
    $ git init --bare

    # show existing defined remote repos
    $ git remote

    # show details of named remot repos
    $ git remote show <name>


    # -------------------------------------
    # Adding and removing files to be commited
    #
    # Add all files already tracked that have been changed
    $ git add -u

    # Add all files already tracked and new files
    $ git add -A
      or
    $ git add .

    # remove a file from the index, or undoing a git add before committing
    $ git reset name_of_file_in_index.txt


    # -------------------------------------
    # Tags:
    # create a tag:
    $ git tag version0.01

    # With a comment
    $ git tag -a 1.0.0 -m 'First complete version of the hadoop-utility-scripts'
    $ git push origin --tags

    # create a tag for a commit id
    $ git tag version0.01 <tagID>

    # checkout a certain tag
    $ git checkout <tag_name>

    # delete a tag (I did it from the master branch)
    # first list it
    $ git tag -l

    # delete it
    $ git tag -d foo-blah

    # push it to the remote
    $ git push origin :refs/tags/foo-blah

    # -------------------------------------
    # Branches
    #
    # list local branches
    $ git branch

    # list remote-tracking branches
    $ git branch -r

    # list both remote-tracking and local branches
    $ git branch -a

    # switch HEAD pointer to a branch
    $ git checkout <branch_name>

    # create a branch
    $ git checkout -b <new-branch-name>

    # delete a branch
    $ git branch -d <branch-name-to-delete>

    # delete a remote branch
    $ git push origin --delete <branch-name-to-delete>

    # push a branch
    $ git push origin <branch-name>

    # Set up a tracking branch from a remote in your local repo:
    $ git checkout -b <branch-name> origin/<branch-name>

    # Merge a specific commit from one branch to another, cherry picking:
    #
    # First figure out the commit id(s) that you want to merge
    # Then, checkout the target branch (the one into which you want to merge the specific commit)
    $ git checkout -b <target-branch-name>

    # Then merge just that commit (the commit id is a specific commit on a specific branch)
    $ git cherry-pick abacac

    #
    # Rename a branch locally and remotely
    #
    # Rename branch locally    
    $ git branch -m old_branch new_branch

    # Delete the old branch    
    $ git push origin :old_branch
    # Push the new branch, set local branch to track the new remote
    $ git push --set-upstream origin new_branch

    # -------------------------------------
    # Solution for
    # 'fatal: No path specified. See 'man git-pull' for valid url syntax'
    # error message when attempting to push to a remote repo
    #
    # This is the result of git not being configured properly for this user and
    # this repository.
    #
    # 1. Get the correct url for your repository.  For example:
    #    git@github.com:rchapin/some-repo.git
    #    Where 'git@github.com' is the top-level url for your repo,
    #    'rchapin' is your user name, and 'some-repo.git' is the repo to
    #    which you are trying to push.
    # 2. Issue the following commands (be sure to update them to match your url,
    #    user name, and repo), in the repository directory.
    $ git remote rm
    $ git remote add origin 'git@github.com:rchapin/some-repo.git'

Advanced Search

Categories

Archives