Thursday, June 5, 2014

OpenSSL Heartbleed Again

The OpenSSL published another advisory today for people to update their openssl. Red Hat has also put an Advisory out


  • http://www.wired.com/2014/06/heartbleed-redux-another-gaping-wound-in-ssl-uncovered/?mbid=social_fbhttp://www.wired.com/2014/06/heartbleed-redux-another-gaping-wound-in-ssl-uncovered
  • https://rhn.redhat.com/errata/RHSA-2014-0627.html
  • https://www.redhat.com/archives/enterprise-watch-list/2014-June/msg00009.html
Please update your Red Hat servers. 

Quick satellite note, just to sync up your erratta only run the following command:
  • # satellite-sync --step=errata

Monday, May 19, 2014

Red Hat Certification Changes

Red Hat announced today that it is making some changes to it's certifications. They will be expanding the number of Red Hat Certificates of Expertise that can be applied to the RHCA. Since I'm on the path to my own RHCA (hope to have it by end of 2014), I'm very interested in these changes. I pretty much have the exam 436 (which I passed last month), the exam 318, and exam 401 scheduled for RHCDS. But now I will have more choices, and so will everyone else, when it comes to RHCA path.

I'm wondering if this will lessen the appeal of RHCA and make it less difficult to acheive?

Read more at this link: http://servicesblog.redhat.com/2014/05/19/red-hat-certification-program-changes

Friday, May 16, 2014

How to Check Java Heap

Just some quick tips on checking the java heap.

You can get the process id from ps or use jps -l to list it.

jmap, jstat and jconsole are very good tools for finding out more about your jvm.

Check Heap size and details memory usage.
  • jmap -heap <jvm proc id> 
Check Max Settings
  • # ./jmap -heap 14272 |grep Max
    • Attaching to process ID 14272, please wait...Debugger attached successfully.Server compiler detected.JVM version is 23.3-b01   MaxHeapFreeRatio = 70   MaxHeapSize      = 1610612736 (1536.0MB)   MaxNewSize       = 17592186044415 MB   MaxPermSize      = 536870912 (512.0MB)
Other Java Memory Tips 

Check Java Process ID 
  •  ./jps -l 

Use jstat to See GC 
  • ./jstat -gcutil <jvm proc> 10 1 

Output Info 

Here is a list of acronyms used in the above output. 
  • S0 Survivor space 0 
  • S1 Survivor space 1 
  • E Eden Generation 
  • O Old Generation 
  • P Permanent Generation 
  • YGC Young GC Count 
  • YGCT Young GC time 
  • FGC Full GC Count 
  • FGCT Full GC time 
  • GCT Any GC time 
--- 

How to Find Age of a Process

If you need to know how old a process is or how long a process has been running you can find it very easily with ps and stat.  First find the PID of the process you'd like to know how long it's been running. In this example we will use ntp.


  • $ ps -ef |grep ntp
    ntp      62446     1  0  2013 ?        00:01:19 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
Set PID
  • # PID=62446
Then just take the PID and run stat on the PID in the /proc directory
  • # stat /proc/$PID
  • File: `/proc/46448'
  • Size: 0               Blocks: 0          IO Block: 1024   directory
  • Device: 3h/3d   Inode: 48373597    Links: 7


Access: (0555/dr-xr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-02-20 15:28:34.229115802 -0600
Modify: 2014-02-20 15:28:34.229115802 -0600
Change: 2014-02-20 15:28:34.229115802 -0600


  •  Another way to view time of process

    •  ps -eo pid,etime | grep $PID


    Tuesday, May 13, 2014

    How to Extend LVM Swap Partition

    How to Extend LVM Swap 


    1. Turn off swap 
      1.  swapoff /dev/mapper/vg_spacewalk-lv_swap  
    2. Resize Swap LVM Partition 
      1. [root@spacewalk /]# lvresize -L 5G /dev/mapper/vg_spacewalk-lv_swap   Extending logical volume lv_swap to 5.00 GiB   Logical volume lv_swap successfully resized  
    3. Make swap again 
      1. [root@spacewalk /]# mkswap /dev/mapper/vg_spacewalk-lv_swap mkswap: /dev/mapper/vg_spacewalk-lv_swap: warning: don't erase bootbits sectors         on whole disk. Use -f to force. Setting up swapspace version 1, size = 5242876 KiB no label, UUID=b5b26e00-dfb5-4767-bfac-985d125c8331  
    4. Turn swap back on 
      1. [root@spacewalk /]# swapon -v /dev/vg_spacewalk/lv_swap swapon on /dev/vg_spacewalk/lv_swap swapon: /dev/mapper/vg_spacewalk-lv_swap: found swap signature: version 1, page-size 4, same byte order swapon: /dev/mapper/vg_spacewalk-lv_swap: pagesize=4096, swapsize=5368709120, devsize=5368709120  
    5. Check swap size 
      1. [root@spacewalk /]# swapon -s Filename                                Type            Size    Used    Priority /dev/dm-1                               partition       5242872 0       -1  
      2. [root@spacewalk /]# free -m              total       used       free     shared    buffers     cached Mem:          1877       1775        101          0         25        285 -/+ buffers/cache:       1464        413 Swap:         5119          0       5119

    Thursday, May 8, 2014

    Exchange Managment PowerShell Tips

    Information about Exchange Mgmt Shell Scripts 
    This page describes and lists various Exchange Mgmt Shell Scripts and how to use them. 

    Document Creator 
    Todd Walters    7/16/2010 
     Requirements 
    • Exchange Management Shell -   
    • Windows PowerShell - Scripting tool from Microsoft. 
     
    permissions 
    • To add mailbox permissions for yourself use run-as to launch Exchange Mgmt Shell using the  someserviceacct  service account and enter this: 
    • Add-mailboxpermission -identity <user> -accessrights fullaccess -user <yourname> 

    Mailbox Storage and Statistics  
    1. note - Must Add Exchange Mgmt Shell SnapIn to PowerShell to Run Scripts on PowerShell 
      1. run this in PowerSherll: add-pssnapin Microsoft.Exchange.Management.PowerShell.Admin  Microsoft.Exchange.Management.PowerShell.E2010 Microsoft.Exchange.Management.PowerShell.Support   
    2. How to list mailbox user 
      1. GET-Mailbox identity twalters  
    3. How to get mailbox statisics of user 
      1. Get-MailboxStatistics -identity twalters 
      2. set-MailboxStatistics - identity twalters | select DisplayName, TotalItemSize, TotalDeletedItemsize, DatabaseName | format-table 
    4. Get Mailbox Stats of Mailbox Server 
      1. get-mailboxstatistics -server SomeMailServer | Sort-Object TotalItemSize Descending | ft DisplayName,TotalItemSize,ItemCount  
    5. How to Increase a mailbox storage size from defaults. Use the set-mailbox cmdlet. This increases and sets the warning, prohibit send, and prohibit send and receive limits to 750mb, 800mb, and 900mb respectively and the defaults are ignored. 
      1. set-mailbox -identity username -IssueWarningQuota 786432000 -ProhibitSendQuota 838860800 -ProhibitSendReceiveQuota  943718400 -UseDatabaseQuotaDefaults $false or 
      2. Set-Mailbox testmbx -UseDatabaseQuotaDefaults:$False -IssueWarningQuota 750MB -ProhibitSendQuota 800MB -ProhibitSendReceiveQuota 900MB   
    6. Set Mailbox to Default Limits 
      1. set-mailbox -identity username -UseDatabaseQuotaDefaults $true 

    Mailbox Queue 

    1. Get-Queue -Filter {status -eq "retry"} 

    Mailbox Distribution Lists   
    1. How to list all distribution groups in OU 
      1. get-distributiongroup -OrganizationalUnit "mydomain/My DL GROUPs"  
    2. How to list members of a Distribution Group 
      1. Get-DistributionGroupMember identity distro - some distrogroup" (replace " " w/any DG)  add | ft name, primarysmtpaddress | Export-CSV c:\members.csv to export to CSV 
    3. How to list a Users Distribution Group Membership 
    4. How to Remove a Distribution Group 
      1. Remove-DistributionGroup -Identity "DG Name"  
    5. How to Remove a User from a Distribution Group 
      1. Remove-DistributionGroupMember -Identity "DG Name" -Member user@Mydomain.com 
    6. How to add permission to Manage a Distribution Group 
      • Set-DistributionList DLName -ManagedBy user1@domain.com,user2@domain.com 
      • get-content Distros.txt | foreach-object { set-group -id $_ -managedBy user1@mydom.com, user2@mydom.com } 
      • Add-ADPermission -Identity distro -User username -AccessRights WriteProperty -Properties "Member"  
    7. How to export mailbox for archiving (use z1.ps1 from NetAdmin Script Repo) 
      1. $username = Read-Host "Enter Username" $servername = Read-Host "Enter the Servername for User's H: drive" $pathname = "\\" + $servername + "\" + $username + "$\data\other" Export-Mailbox -Identity $username -PSTFolderPath $pathname -Confirm:$false 


    Various 

    list primary smtp address 
    • $addy = (get-mailbox twalters).PrimarySMTPAddress.toString() ; write-host $addy 
      
    See Managed By for Distro     
    • get-distributiongroup "Distro Name" | select ManagedBy 
     
     
    dsquery Group 
    How to List Member of said group or dl. 
    • dsquery group -samid mySrv0citrix_users | dsget group -members  
    [PS] H:\>dsget group  -members "CN=Some MailBox -Support,OU=Groups,OU=CITY,OU=Site1,DC=Company1,DC=com" | dsget user -samid   samid   PShimizu dsget succeeded 


    This command allows other command to access the mailbox in all the child domains: 
    Set-ADServerSettings -ViewEntireForest:$true 


    Mailbox migration commands that will migrate any mailbox in any domain that is listed in the Alias column of a .CSV file but Suspend the move until you are ready to start: 
    Set-ADServerSettings -ViewEntireForest:$true 
    import-csv C:\TempUserMoves1.csv | foreach {New-MoveRequest -Identity $_.Alias -BadItemLimit 10 -suspend } | find multiple 

    Mailbox migration commands that will migrate any mailbox in any domain thats listed in the Alias column of a .CSV file but Suspend the move at the end of the migration. Only works on Exchange 2010 to 2010: 
    Set-ADServerSettings -ViewEntireForest:$true 
    import-csv C:\Temp\UserMoves1.csv | foreach {New-MoveRequest -Identity $_.Alias -BadItemLimit 10 -SuspendWhenReadyToComplete} | find multiple 

    Resume suspended move request: 
    import-csv C:\Temp\UserMoves1.csv | foreach {Resume-MoveRequest -Identity $_.Alias -Confirm:$False} | find multiple 

    To exclude mailbox database from provisioning , launch EMS and type: 
    Set-MailboxDatabase -Identity  ussd-mbdb01 -IsExcludedFromProvisioning $true 

    To re-enable the mailbox database for provisioning, launch EMS and type: 
    Set-MailboxDatabase -Identity  ussd-mbdb01 -IsExcludedFromProvisioning $false 

    A script that move all public folder content from one server to another server: 
    cd 'C:\Program Files\Microsoft\Exchange Server\v14\Scripts' 
    .\MoveAllReplicas.ps1 -Server ussd-prd-esmb01 -NewServer ussd-prd-esmb03 

    The location were the Exchange 2010 Scrip's are Stored: 
    cd 'C:\Program Files\Microsoft\Exchange Server\v14\Scripts' 

    These are the commands I used to set the attributes on the conference  after they were migrated to Exchange 2010: 
    import-csv C:\temp\roomlist.csv | foreach {Set-Mailbox -Identity $_.Alias -Type Room} 
    import-csv C:\temp\roomlist.csv | foreach {Set-CalendarProcessing -Identity $_.Alias -AutomateProcessing AutoAccept -BookingWindowInDays 270} 

    A command will export a mailbox to a PST file on a file share: (In order for these commands to work the [Exchange Servers] group must have full access to the folder you are righting to) 
    Set-ADServerSettings -ViewEntireForest:$true 
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 
    New-MailboxExportRequest -Mailbox Alias -FilePath "\\server1\folder\filename.pst" 

    This command is used when create conference room to the Calendar reviewer for everyone using the Alias column of a .CSV file. Most push Enter twice for command to run: 
    import-csv C:\Temp\ConfRoom.csv | foreach { $room =  $_.Alias + ':\calendar'  
                                  Set-MailboxFolderPermission -Identity $room -AccessRights Reviewer -User "Default" } 

    This command creates Room List DLs: 
    New-DistributionGroup “Room Name” RoomList Members Conference You would like to added to the DL 

    This command is used to check the health of the Content Index on the DBs. It must be ran from the mailbox server: 
    Get-MailboxDatabaseCopyStatus | fl name, contentindexstate 

    This command forces DAG fail over ofdatabase when it is Crawling: 
    Move-ActiveMailboxDatabase USSD-MBDB08 -SkipClientExperienceChecks  

    List Mailboxes by Size on a Database: 
    Get-MailboxDatabase ussd-mbdb02 | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount 

    Removes the Hidden from Address book using the Alias filed in a .CSV: 
    import-csv C:\Temp\GoLive.csv | foreach {Set-Mailbox -Identity $_.Alias -HiddenFromAddressListsEnabled $false} | find multiple 

    Set the Accept Messages to all if a DL is set to be the only group to have rights to send to a user based on the Alias filed in a .CSV: 
    import-csv C:\Temp\GoLive2.csv | foreach {Set-Mailbox -Identity $_.Alias -AcceptMessagesOnlyFromDLMembers $NULL} | find multiple 

    When creating a new Public Database you will need to include it has a replicate. This scrip will add a new Public Database as a replicate based on the server name to all of the public folders.  This command needs to be ran from a server that already contains a Public Database: 
    cd 'C:\Program Files\Microsoft\Exchange Server\v14\Scripts' 
    .\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\" -ServerToAdd servername 
    .\AddReplicaToPFRecursive.ps1 -TopPublicFolder "\NON_IPM_SUBTREE" -ServerToAdd servername 

    Give the members of a DL Send on Behalf of right of the DL. You must have manager permissions to the group for this command to work and the group must be both a DL and a security group. 
    Set-DistributionGroup -Identity "DL-Finance_Revenue" -GrantSendOnBehalfTo "DL-Finance_Revenue" 

    This command shows you the size of a Database and how much free space is available in it. 
    Get-MailboxDatabase "MailBoxServerName" -Status | Select-Object Server,Name,AvailableNewMailboxSpace,databasesize 
      
    Exchange Mgmt Shell Links