GlusterFS: host, is not befriended at the moment

When attempting to expand the replication distrubted file system of our cluster nodes I struck the error message:

[root@index03 ~]# gluster volume replace-brick drvol01 index04:/srv/gluster/drbrk02 index05:/srv/gluster/drbrk01 start
index05, is not befriended at the moment

Which was strange considering the previous ‘peer probe’ from another host to join the new server (index05) was successfully:

[root@index04 ~]# gluster peer probe index05
Probe successful 

I think the only clue was (on the last line):

[root@index03 drbrk02]# gluster peer status
Number of Peers: 4

Hostname: index02
Uuid: 31c0f246-0a8b-4c68-8ffa-42b2e6bb42ce
State: Peer in Cluster (Connected)

Hostname: index04
Uuid: ca61b983-b8fd-4fcc-848a-6c33f102cd5c
State: Peer in Cluster (Connected)

Hostname: index01
Uuid: b9bc474c-0017-4191-82b9-5760ba0d00fc
State: Peer in Cluster (Connected)

Hostname: index05
Uuid: c6a7cb83-4c1f-42ff-8421-bea9cc911d0f
State: Accepted peer request (Connected)

Anyway I confirmed that there were no firewall rules blocking the requests Doco: Gluster Firewall Ports and restarted the glusterd service on index05, which seems to have resolved the problem.

[root@index03 ~]# gluster peer status
Number of Peers: 4

Hostname: index02
Uuid: 31c0f246-0a8b-4c68-8ffa-42b2e6bb42ce
State: Peer in Cluster (Connected)

Hostname: index04
Uuid: ca61b983-b8fd-4fcc-848a-6c33f102cd5c
State: Peer in Cluster (Connected)

Hostname: index01
Uuid: b9bc474c-0017-4191-82b9-5760ba0d00fc
State: Peer in Cluster (Connected)

Hostname: index05
Uuid: c6a7cb83-4c1f-42ff-8421-bea9cc911d0f
State: Peer in Cluster (Connected)

In summary I believe there were firewall rules in place, when the ‘gluster peer probe index05′ was run. The rules were removed, but the gluster daemon on index05 then required a restart to become active in the cluster.

Script to remove all versions of Java

Save the following as a batch script. I’ll let you work out the rest.

Eventcreate /L Application /T information /ID 69 /SO Remove-java.bat /D "Running J2SE Uninstall"
wmic product where "name like 'J2SE Runtime%%'" call uninstall /nointeractive
Eventcreate /L Application /T information /ID 69 /SO Remove-java.bat /D "Running Java(TM) Uninstall"
wmic product where "name like 'Java(TM)%%'" call uninstall /nointeractive
Eventcreate /L Application /T information /ID 70 /SO Remove-java.bat /D "Remove-Java.bat Completed"

Need a PHP Shell? Try: Weevely

Get it here: http://epinna.github.com/Weevely/
Similar to C99 perhaps equally as useful, I’m sure you can think of some uses!!!

Elevate UAC / Admin rights for a batch file!

A great tool for all system administrators!

@echo off

:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%system32cacls.exe" "%SYSTEMROOT%system32configsystem"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%getadmin.vbs"

    "%temp%getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%getadmin.vbs" ( del "%temp%getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:--------------------------------------

<YOUR BATCH SCRIPT HERE>

Save the whole thing as install.bat
Now with WinRAR (yes go and install it), Right click install.bat and select “Add to archive…”
Under Archiving Options select: Create SFX archive
Click on the Comment tab (across the top)
Enter the following:

Path=%tmp%
SavePath
Setup=%tmp%install.bat
Silent=1
Overwrite=1

If you want to add a pretty icon etc, thats done under the Advanced tab.
Click OK and your Done!

Now your practically unstoppable, Admin Rights and an executable file - Your life just got so much easier!

Link back for the WinRAR exe
Regards to this guy for BatchGotAdmin!

Import private key and certificate into java keystore

How to import RSA private key into java keystore for tomcat
# You need:
# Your CA signed certificate (acme.com)
# Your private key (RSA)
# Your CA intermediate Certificate

# Import the certificates and key into a PKCS12 bundle

openssl pkcs12 -export -in certs/acme.com.crt -inkey acme.com.key -CAfile certs/DigiCertCA.crt  
-name "acme.com-2013-2014" -out acme.com.p12

(Remember the password you assigned it)

# Check if it worked:

openssl pkcs12 -in acme.com.p12  -info

# Import the PKCS12 bundle into a java keystore:

keytool -importkeystore -deststorepass YOUR-PASSWORD -destkeystore acme-keystore  -srckeystore acme.com.p12 
-srcstoretype PKCS12 -srcstorepass YOUR-PASSWORD 

Entry for alias acme.com-2013-2014 successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled

# Check your keystore:

keytool -list -keystore acme-keystore

Output should be similar to:

Enter keystore password:  YOUR-PASSWORD

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

Alias name: acme.com-2013-2014
Creation date: Jan 3, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
-----BEGIN CERTIFICATE-----
keytool -list -keystore acme-keystore
Enter keystore password:  

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 1 entry

acme.com.au-2013-2014, Jan 3, 2013, PrivateKeyEntry, 
Certificate fingerprint (SHA1): FA:A6:A3:42:95:34:15:68:26:35:40:18:8D:50:68:D4:15:C8:12:9E

# And match it against the import:

openssl x509 -fingerprint -in certs/acme.com.au.crt -noout
SHA1 Fingerprint=FA:A6:A3:42:95:34:15:68:26:35:40:18:8D:50:68:D4:15:C8:12:9E