SSH

Install OpenSSH, ssh-agent, and Keychain.

# pacman -S openssh ssh-agent keychain

Edit SSH client configurations.

# nano /etc/ssh/ssh_config
  Protocol 2

  ControlMaster auto
  ControlPath ~/.ssh/socket-%r@%h:%p
  Compression yes
  AddressFamily inet

Edit SSH server configurations.

# nano /etc/ssh/sshd_config
  AllowUsers user@hostname
  PermitRootLogin no

  PasswordAuthentication no
  ChallengeResponseAuthentication no

Start the SSH daemon.

# systemctl start sshd
# systemctl enable sshd.service

Generate the SSH client key and export to the SSH server.

$ ssh-keygen -t ecdsa -b 521
$ ssh-copy-id -i ~/.ssh/id_ecdsa.pub user@hostname

Optionally, add the SSH key to the keychain.

$ eval `keychain --eval --agents ssh -Q --quiet id_ecdsa`
Posted in Uncategorized | Tagged , | Leave a comment

Installing Cyanogenmod on the HTC Sensation

Rooting your Android phone can be a daunting task, considering the number of options, methods, and packages floating in the ethertubes. This guide attempts to provide a more detailed walk-through to installing Cyanogenmod on the HTC Sensation.

Preparation

Begin by disabling Fastboot on your phone

Settings > Power > Fastboot

and enable USB debugging.

Settings > Applications > Development > USB debugging

Next, configure your Linux device subsystem to recognize your phone. The idVendor of 0bb4 is the HTC manufacturer ID returned by lsusb.

  # echo 'SUBSYSTEM="usb", ATTR{idVendor}=="0bb4", MODE="0666"' > /etc/udev/rules.d/51-android.rules
  # udevadm control --reload-rules

Revolutionary

With the preparation complete, the first step is to gain S-OFF access with Revolutionary. S-OFF, or security off, access removes protected access from the bootloader and the root folders allowing you to write and install custom ROMs.

Download the latest revolutionary-X.X.tgz file, and unpack and execute the binary.

 $ tar xfz revolutionary-X.X.tgz
 $ ./revolutionary

Connect your phone to your computer, and restart the phone in Fastboot USB mode by first completely powering off, and then powering on with Volume-Down button depressed. If you do not see the HBOOT screen on startup, then try removing your battery for a few seconds before trying again.

HBOOT, the HTC bootloader, will initialize and drop you into a selection menu. Select Fastboot USB press the power button to enable Revolutionary to detect your phone.

Once Revolutionary recognizes your phone, it will provide you with your HBOOT version and serial number. Enter these numbers into the Revolutionary page to generate the beta key. Copy the key to the running program and Revolutionary will attempt to gain S-OFF access.

Once S-OFF access is granted, Revolutionary will prompt you to install ClockworkMod Recovery; press n to decline and install it manually.

ClockworkMod Recovery

ClockworkMod Recovery is a program that enables you to install custom ROMs to your phone. To install ClockworkMod Recovery, first download and install the Android SDK. Next, download the ClockworkMod Recovery ROM Manager, recovery-clockwork-X.X.X.X.img.

Run fastboot from the Android platform tools directory with the ClockworkMod Recovery image.

$ fastboot flash recovery recovery-clockwork-X.X.X.X.img

Android Superuser

With ClockworkMod Recovery installed, the next step is to use it to obtain root access with the Android Superuser custom ROM. Download the su-bin-X.X.X.X-signed.zip file and copy it to your SD card.

 # mount /dev/sdb1 /mnt/phone
 # cp /path/to/su-bin-X.X.X.X-signed.zip /mnt/phone
 # umount /mnt/phone

Restart your phone into ClockworkMod Recovery mode by powering off and powering on with Volume Down depressed. Select RECOVERY, BACKUP AND RESTORE, and BACKUP to backup the original manufacturer’s ROM.

With the original ROM backed up, it is now safe to load Android Superuser. Select install zip from sdcard, choose zip from sdcard, and su-bin-X.X.X.X-signed.zip. Once the installation is complete, select reboot and your phone will reboot with root access.

Cyanogenmod

We are finally ready to install Cyanogenmod. Install Superuser and ClockworkMod ROM Manager from the Android Marketplace. Open the ROM Manager and select Flash ClockworkMod Recovery to update the application. The Superuser will prompt you to allow ClockworkMod Recovery root access; allow it. Finally, select Download ROM from the ROM Manager and install Cyanogenmod.

Posted in Uncategorized | Leave a comment

Irssi, BitlBee, and more…

Irssi is perhaps the best IRC client available, and BitlBee allows you to conduct your instant messaging and Twitter musings through the same IRC client.

First, install Irssi and BitlBee.

 # pacman -S irssi bitlbee

Once the installation is complete, start the BitlBee server and connect to it with Irssi.

 # /etc/rc.d/bitlbee start

 $ irssi -c localhost -p 6667

Within the Irssi client, create a BitlBee account, and add your Google account.

 [&bitlbee] register <bitlbee-password>

 [&bitlbee] account add jabber user@gmail.com
 [&bitlbee] /oper <google-password>
 [&bitlbee] account on

To set up your Twitter account, follow the instructions below, and refer to http://wiki.bitlbee.org/HowtoTwitter.

 [&bitlbee] account add twitter username password
 [&bitlbee] account on

If you are registered with Freenode, you can configure Irssi to automatically connect to the network and channels on startup.

 /network add -autosendcmd "/^msg nickserv ident pass;wait 2000" Freenode
 /server add -auto -network Freenode irc.freenode.net 6667
 /channel add -auto #irssi Freenode

If you do not have Freenode account, you can register from your Irssi client.

 /msg nickserv register <password> <email>
 /msg nickserv set hidemail on
 /nick <nick>_
 /msg nickserv identify <nick> <password>
 /msg nickserv group
Posted in Uncategorized | Leave a comment

GnuPG

Or Alice and Bob need an ansible.

The GNU Privacy Guard is an open source implementation of the OpenPGP
standard providing public-key encryption and digital signatures.

In order to utilize public-key encryption, it is required to generate
a keypair with which to sign and encrypt messages. A keypair consists
of a public key and private key; the sender will encrypt messages
using the receiver’s public key, which can then only be decrypted
using the receiver’s private key. For the highest level of security,
it is recommended to use 4096-bit RSA encryption at this time.

$ gpg --gen-key

To quickly generate entropy, start the following as root.

 # pacman -S rng-tools
 # rngd -r /dev/urandom

Upon creating the keypair, it is highly recommended to generate a
revocation certificate. The revocation certificate may be issued in
the event that the private key is compromised or the passphrase is
forgotten to notify senders that communication is longer valid or
secure.

$ gpg -o ~/.gnupg/revoke.asc --gen-revoke alice@example.com

In order to exchange secured messages, the sender must encrypt the
message with receiver’s public key. Public keys may be exported either
as binary (default) or ASCII-armored text using the –armor
option. The following command creates the public key file, alice.gpg,
that the sender requires to encrypt messages to Alice.

$ gpg -o ~/.gnupg/alice.gpg --armor --export alice@example.com

Importing public keys and assigning trust involves verifying and
signing the public key. Here, Alice imports Bob’s public key.

$ gpg --import bob.gpg

It is strongly recommended to verify the public key fingerprint with
the owner

 $ gpg --fingerprint
 $ gpg --keyserver pgp.mit.edu --recv-key

before signing over trust.

 $ gpg --sign-key bob@example.com
 $ gpg --keyserver pgp.mit.edu --send-key bob@example.com
 $ gpg --keyserver pgp.mit.edu --recv-key alice@example.com

or

$ gpg --edit-key bob@example.com
  > fpr
  > sign

Finally, Alice can send and receive encrypted messages to and from
Bob.

$ gpg -o MESSAGE.gpg -r bob@example.com --encrypt MESSAGE
$ gpg -o MESSAGE --decrypt MESSAGE.gpg

In addition to public-key encryption, GnuPG supports digital
signatures. Digital signatures combine the sender’s private key with
the message to certify that both the sender and the message have not
been tampered.

GnuPG provides three commands for creating digital signatures.

The –sign command makes a compressed, binary signature, and may be
encrypted with –encrypt.

$ gpg -o FILE.sig --sign [--encrypt] FILE

The –clearsign command makes a clear text signature.

$ gpg --clearsign FILE

The –detach-sign command makes a detached signature useful for
attachments and signing binary data.

$ gpg -o FILE.sig --detach-sign FILE

The sender’s public key is then used to verify digitally-signed
messages.

$ gpg --verify FILE.sig FILE
Posted in linux | Tagged , | Leave a comment

Mutt with Gmail

“All mail clients suck. This one just sucks less.”
   — Michael Elkins, Mutt creator

Mutt is a console-based email client, or mail user agent. It does
not send or retrieve emails. In order to send or retrieve emails,
one needs a mail transport agent, or MTA, and a mail retrieval
agent, or MRA. One popular configuration uses msmtp and
fetchmail.

However, this entry will discuss using Gmail to send and retrieve
messages through the IMAP protocol. This keeps emails
synchronized across all running email clients.

Install mutt.

# pacman -S mutt

Create the mutt configuration file replacing NAME, EMAIL, and PASSWORD.

$ nano ~/.muttrc

# IMAP configuration

set realname="NAME"
set from="NAME "
set imap_user=EMAIL
#set imap_pass=PASSWORD
set folder=imaps://imap.gmail.com
set spoolfile=+INBOX
set record="+[Gmail]/Sent Mail"
set postponed=+[Gmail]/Drafts
set trash=+[Gmail]/Trash

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/messages
set certificate_file=~/.mutt/certificates

mailboxes =INBOX

# SMTP Configuration

set smtp_url=smtps://EMAIL\@gmail.com@smtp.gmail.com
set ssl_force_tls=yes

set editor=nano

# Display

# color object foreground background
color status white blue
color index green default ~N
color index red default ~D
color index brightmagenta default ~T
color index brightyellow default ~F
color header green default "^Subject:"
color header yellow default "^Date:"
color header yellow default "^To:"
color header yellow default "^CC:"
color header yellow default "^Bcc:"
color header yellow default "^From:"
color header red default "^X-.*:"

Run mutt.

$ mutt
Posted in linux | Tagged | 4 Comments

Beware the IDEs of Java (Part 2)

The JDEE supports many features of modern IDEs, including syntax highlighting, code formatting, code completion, code generation, and abbreviations. These features are customizable from the jde group, either with M-x customize-variable or M-x jde-customize-variable. The latter saves the setting to a project file for future sessions.

The following is a sample project file, prj.el. The JDEE searches up the current working directory for a project file named prj.el. If none exist, then the JDEE initializes with the default settings. If multiple project files exist, then the JDEE loads each one beginning with the topmost.

  (jde-project-file-version "1.0")
  (jde-set-variables
   '(jde-jdk-registry (quote (("1.6.0" . "$JAVA_HOME"))))
   '(jde-jdk (quote ("1.6.0")))
   '(jde-jdk-doc-url "http://java.sun.com/javase/6/docs/api/")
   '(jde-enable-abbrev-mode t)
   '(jde-gen-k&r t)
   '(jde-gen-cflow-enable t)
   '(jde-complete-function (quote jde-complete-minibuf))
   '(jde-electric-return-p t)
   '(jde-import-auto-collapse-imports nil)
   '(jde-import-auto-sort t)
   '(jde-compile-enable-kill-buffer nil)
   '(jde-compiler (quote ("javac-server" "")))
   '(jde-compile-option-directory "./target/classes")
   '(jde-compile-option-deprecation t)
   '(jde-compile-option-debug t)
   '(jde-compile-option-verbose t)
   '(jde-build-function (quote jde-ant-build))
   '(jde-ant-home "$ANT_HOME")
   '(jde-ant-program "ant")
   '(jde-ant-buildfile "build.xml")
   '(jde-ant-read-buildfile nil)
   '(jde-ant-enable-find t)
   '(jde-ant-args "run")
   '(jde-run-working-directory ".")
   '(jde-run-application-class "com.wordpress.alepho.Main")
   '(jde-sourcepath (quote ("./src/main/java")))
   '(jde-global-classpath (quote ("./src/main/java" "./target/classes"))))
Posted in programming | Tagged , , | Leave a comment

Beware the IDEs of Java (Part 1)

Modern IDEs suck.

The JDEE, or Java Development Environment for Emacs, is an open-source Emacs package for programming in Java. It provides syntactic and semantic knowledge of
the Java programming language through BeanShell, and integrates with standard JDK and build tools.

If JDEE is the kitchen sink, then Emacs is the rest of the kitchen, providing a rich text editor, a file and directory browser, a version control interface, external shell interaction, a toplevel interpreter, and an infinitely configurable and extensible environment.

Requirements

Obtaining the Packages

# pacman -S emacs cedet ecb openjdk6 beanshell
$ wget http://downloads.sourceforge.net/project/jdee/jdee/Dependencies/elib.tar.gz
$ tar xfz elib.tar.gz
$ tar xfz pub/comp/os/unix/gnu/elib/elib-1.0.tar.gz -C /path/to/elib

$ wget http://downloads.sourceforge.net/project/jdee/jdee/2.4.0.1/jdee-bin-2.4.0.1.zip
$ unzip jdee-bin-2.4.0.1.zip -d /path/to/jdee

Installing the JDEE

$ emacs ~/.emacs

(add-to-list 'load-path "/path/to/jdee")
(add-to-list 'load-path "/path/to/jdee/lisp")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet/common")
(load-file "/usr/share/emacs/site-lisp/cedet/common/cedet.el")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet/eieio")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet/semantic")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/cedet/speedbar")
(add-to-list 'load-path "/path/to/elib")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ecb")
(load-file "/usr/share/emacs/site-lisp/ecb/ecb.el")
(require 'ecb-autoloads)

(autoload 'jde-mode "jde-mode" "JDE Mode." t)
(setq auto-mode-alist (append '(("\\.java$" . jde-mode)) auto-mode-alist))
(require 'jde)

;; optional configuration

(defun my-jde-mode-hook
  (message "Loading my-jde-mode-hook...")
  (define-key c-mode-base-map "\C-ca" 'jde-javadoc-generate-javadoc-template)
  (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  (c-set-offset 'substatement-open 0)
  (c-set-offset 'statement-case-open 0)
  (c-set-offset 'case-label '+)
  (abbrev-mode t)
  (setq c-comment-continuation-starts "* "
	tab-width 4
	indent-tabs-mode nil
	temp-interactive t
	c-basic-offset 4)
  (c-add-style "my-java"
	       '("java"
		 (c-basic-offset . 4)
		 (c-hanging-braces-alist . ())))
  (c-set-style "my-java")
  (setq c-auto-newline t)
  (message "...jde-mode-hook loaded."))

(add-hook 'jde-mode-hook 'my-jde-mode-hook)
Posted in programming | Tagged , , | 1 Comment