Wednesday, June 8, 2016

CentOS7 ifconfig nmcli nmtui


How to Setup network on centos 7


On CentOS 7 instead of ifconfig , it must be used << ip address >>
or the abbreviated << ip a >> command ...

It seems that ipconfig  is deprecated and superseeded by ip command from iproute2 package

Setup network on CentOS 7 minimal

Type “nmtui” command in your terminal ~ opens Network manager

nmtui is an alternative command for nmcli which is based on “Text User Interface”



hostnamectl set-hostname Your-New-Host-Name-Here


Monday, June 6, 2016

JAVA_HOME Variable in Windows

Setting the JAVA_HOME Variable in Windows


The error : 

The registry refers to a nonexistent java runtime enviorement installation or the runtime is currupted.

The system cannot find the path specified.



After you've installed Java in Windows, you must set the  JAVA_HOME environment variable to point to the Java installation directory.


If you installed the Java Development Kit (JDK) you'll be setting the JAVA_HOME environment variable. If you installed the Java Runtime Environment (JRE) you will follow the same steps but set the JRE_HOME environment variable instead. 


Set the JAVA_HOME Variable

To set the JAVA_HOME variable:
  1. Find out where Java is installed. If you didn't change the path during installation, it will be something like this:
    C:\Program Files\Java\jdk1.8.0_65
  2. In Windows 7 right click My Computer and select Properties > Advanced.
    In Windows 8 go to Control Panel > System > Advanced System Settings.
  3. Click the Environment Variables button.
  4. Under System Variables, click New.
  5. In the Variable Name field, enter:
    • JAVA_HOME if you installed the JDK (Java Development Kit)
      or
    • JRE_HOME if you installed the JRE (Java Runtime Environment) 
  6. In the Variable Value field, enter your JDK or JRE installation path.
    If the path contains spaces, use the shortened path name, for example C:\Progra~1\Java\jdk1.8.0_65
  7. Click OK and Apply Changes as prompted.


Note for Windows users on 64-bit systems
Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'


JAVA_HOME Variable in Windows

Setting the JAVA_HOME Variable in Windows


The error : 

The registry refers to a nonexistent java runtime enviorement installation or the runtime is currupted.

The system cannot find the path specified.



After you've installed Java in Windows, you must set the  JAVA_HOME environment variable to point to the Java installation directory.


If you installed the Java Development Kit (JDK) you'll be setting the JAVA_HOME environment variable. If you installed the Java Runtime Environment (JRE) you will follow the same steps but set the JRE_HOME environment variable instead. 


Set the JAVA_HOME Variable

To set the JAVA_HOME variable:
  1. Find out where Java is installed. If you didn't change the path during installation, it will be something like this:
    C:\Program Files\Java\jdk1.8.0_65
  2. In Windows 7 right click My Computer and select Properties > Advanced.
    In Windows 8 go to Control Panel > System > Advanced System Settings.
  3. Click the Environment Variables button.
  4. Under System Variables, click New.
  5. In the Variable Name field, enter:
    • JAVA_HOME if you installed the JDK (Java Development Kit)
      or
    • JRE_HOME if you installed the JRE (Java Runtime Environment) 
  6. In the Variable Value field, enter your JDK or JRE installation path.
    If the path contains spaces, use the shortened path name, for example C:\Progra~1\Java\jdk1.8.0_65
  7. Click OK and Apply Changes as prompted.


Note for Windows users on 64-bit systems
Progra~1 = 'Program Files'
Progra~2 = 'Program Files(x86)'


Saturday, March 26, 2016

Convert ADT projects to Andmore

You can convert your existing ADT projects and workspace to work with Andmore. Select a project, and bring up the context menu, then select Configure->Convert ADT Android Configuration. The project will be updated to allow Andmore to recognize it as a Android project. This currently only works for existing Android Developer Tools projects, Android Studio projects that are using the old legacy directory structure should use the Import->Android->Existing Android Code into Workspace. Project support for Android Studio Projects is planned in an upcoming release.


Friday, June 19, 2015

WildFly 8.2.0 as service on Ubuntu 14.04

WildFly 8.2.0 on Ubuntu 14.04


sudo -s root
cd /opt
groupadd wildfly
adduser --no-create-home --disabled-password --disabled-login wildfly
wget http://download.jboss.org/wildfly/8.2.0.Final/wildfly-8.2.0.Final.tar.gz
tar -xzvf wildfly-8.2.0.Final.tar.gz
ln -s wildfly-8.2.0.Final wildfly
chown -R wildfly.wildfly wildfly
chown -R wildfly.wildfly wildfly-8.2.0.Final
cd /etc/default
ln -s /opt/wildfly/bin/init.d/wildfly.conf wildfly
cd /etc/init.d
ln -s /opt/wildfly/bin/init.d/wildfly-init-debian.sh wildfly
service wildfly start
cd /etc/init.d
update-rc.d wildfly defaults

INSTALLING WILDFLY AS SERVICE on CENTOS, Fedora

PostgreSQL Datasource on WildFly 8.2.0



Show Code in Your Blog Using Github

Github as Syntax Highlighter for Blogs



Step 1: Create a public Gist at gist.github.com

Step 2: Embed your Gist : click the show embed link and copy-paste the script into your blog




Tuesday, February 11, 2014

Sendmail with DKIM on Fedora 19


http://www.ipsure.com/blog/2010/domainkeys-identified-mail-dkim-with-postfix-smtp-only/
http://www.techsneeze.com/deploy-dkim-milter-multiple-domains-centos-5-sendmail
http://www.cesafaci.ro/tutoriale/sendmail-cu-dkim-pe-centos-fedora-19.html

yum install dkim-milter


cd /etc/mail/dkim-milter/keys
dkim-genkey -r -d your-domain.com
= > 2 files : public key (default.txt) and private key (default.private)

At this point you should have a "default.private" and "default.txt" file in your current working directory (which is /etc/mail/dkim-milter/keys). 
default.txt contains the DNS TXT record you must add to your DNS entries. 

cat default.txt >> /var/named/chroot/var/named/yourdomain.zone
mv default.private /etc/mail/dkim-milter/domeniultau_default.key.pem
chown dkim-milter:dkim-milter /etc/mail/dkim-milter/domeniultau_default.key.pem



/etc/mail/dkim-milter/dkim-filter.conf


Domaindomeniu.ro
KeyFile/etc/mail/dkim-milter/domeniultau_default.key.pem
MTAMSA
Selectordefault
SignatureAlgorithmrsa-sha1
Socketlocal:/var/run/dkim-milter/dkim-milter.sock
SyslogYes
X-HeaderYes












/etc/mail/sendmail.mc
dnl # dkim - yahoo domainkeys implementation
INPUT_MAIL_FILTER(`dkim-filter', `S=local:/var/run/dkim-milter/dkim-milter.sock')

cd /etc/mail
make
service named reload
service dkim-milter start
service sendmail restart
chkconfig dkim-milter on






 The config file (/etc/mail/dkim-milter/dkim-filter.conf) is fully self-documented and easy to understand. 
I made the following changes from the default config:
AutoRestart  Yes
AutoRestartRate 10/1h
Canonicalization simple/simple
Domain  techsneeze.com
ExternalIgnoreList /etc/mail/dkim-milter/trusted-hosts
InternalHosts /etc/mail/dkim-milter/InternalHosts.txt
LogWhy  yes
On-Default accept
On-BadSignature accept
On-DNSError accept
On-InternalError accept
On-NoSignature accept
On-Security accept
SignatureAlgorithm rsa-sha256
Socket  local:/var/run/dkim-milter/dkim-milter.sock
Syslog  yes
SyslogSuccess yes
UserID  dkim-milter:dkim-milter
X-Header  yes



PROBLEM : 
if in the logs appear something like : "no signature data" 
       [ cat /var/log/maillog | grep "no signature data" ] or 
   "external host [192.168.101.54] attempted to send as yourdomain.com
  and this host  [192.168.101.54] is on your internal network ...
SOLUTION: 
#cd /etc/mail/dkim-milter/ 
#touch InternalHosts.txt 
# chmod 444 InternalHosts.txt
 # vi InternalHosts.txt 
         192.168.101.0/24
   
          yourdomain.com     
          smtp.yourdomain.com

~ ~ ~ 

We may enhance DKIM TXT entries like: 
 _domainkey.(yourdomain.com). IN TXT "t=y; o=~; r=postmaster@(yourdomain.com)" 
 where 
 t=y means “this domain is currently testing DKIM, verifier side mustn’t treat the messages differently from unsigned e-mails even if the signature fails to be verified”

 

 o=~ means “some e-mails from this domain are signed, some are not”

  

o=- means “all e-mails from this domain are signed”

 

 r=postmaster@(yourdomain.com) designates responsible e-mail address



When we implemented DomainKeys Identified Mail (DKIM) with Postfix on FreeBSD, we had used dkim-milter plugin. However, it seems that dkim-milter has expired and recently it has been removed from the ports tree. Consequently, we’ll also move to OpenDKIM which is in fact claimed to be bug free compared to dkim-milter. - See more at: http://www.ipsure.com/blog/2012/dkim-milter-is-no-longer-available-how-to-use-opendkim-instead/#sthash.UraBfaka.dpuf





Open



DKIM includes a cryptographic hash in the e-mail header which is calculated with the private key (on the server) and verified with the public key (in the DNS record).
DKIM-Signature: v=1; a=rsa-sha256; d=example.net; s=brisbane;
     c=relaxed/simple; q=dns/txt; l=1234; t=1117574938; x=1118006938;
     h=from:to:subject:date:keywords:keywords;
     bh=MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=;
     b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZ
              VoG4ZHRNiYzR


First, install opendkim.
yum install opendkim

/etc/opendkim.conf.
AutoRestart             Yes
UMask                   002
Syslog                  yes
AutoRestartRate         10/1h
Canonicalization        relaxed/simple
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts
KeyTable                refile:/etc/opendkim/KeyTable
LogWhy                  Yes
Mode                    sv
PidFile                 /var/run/opendkim/opendkim.pid
SignatureAlgorithm      rsa-sha256
SigningTable            refile:/etc/opendkim/SigningTable
Socket                  inet:8891@localhost
SyslogSuccess           Yes
TemporaryDirectory      /var/tmp
UserID                  opendkim:opendkim
As you can see, there are three more files to be added, TrustedHosts (whitelisted IPs that can sign e-mails), KeyTable (multiple domain configuration for public and private keys) and SigningTable (whitelisted users that can sign e-mail).

/etc/opendkim/TrustedHosts:
127.0.0.1
example.com
192.168.0.1/24


/etc/opendkim/SigningTable:
*@example.com default._domainkey.example.com
All users from @example.com can sign. You can specifiy usernames and domains, instead of the wildcard, for additional security.

/etc/opendkim/KeyTable:
default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com.pvt
Location of the private key and name of the DNS record for each domain. The "default" before _domainkey.example.com and :default: is a selector. This can be changed to something else.

Next, we need to generate the public and private key for each domain.
If some folders don't exist, just create them.
# opendkim-genkey -D /etc/opendkim/keys/example.com -d example.com -s default
Again -s flag is for the selector. If you changed it, you need to enter it here.
The command generates a private key (default) and public key (default.txt). You will probably rename them, to match the configuration.
An important note here is that the files are owned by user opendkim, or you will get permission denied errors in /var/log/mail.err. Default permissions on those files are -rw------.

Move the private key to where you specified it should be in the KeyTable.
Insert the public key in your DNS as a TXT record.

Next up, telling sendmail to talk to opendkim.
Edit /etc/mail/sendmail.mc and add this line at the end. 
INPUT_MAIL_FILTER(`opendkim', `S=inet:8891@localhost')

Rebuild sendmail configuration and restart, start opendkim if it's not running yet
service sendmail restart; service opendkim start