# Other

Random commands &amp; scripts &amp; other stuff

# Links

## **SSL**

[https://www.whynopadlock.com](https://www.whynopadlock.com)

[https://www.ssllabs.com/ssltest/](https://www.ssllabs.com/ssltest/)

[https://www.sslshopper.com/ssl-checker.html](https://www.sslshopper.com/ssl-checker.html)

### **DNS / Domain**

[https://toolbox.googleapps.com/apps/dig/](https://toolbox.googleapps.com/apps/dig/)

[https://www.whatsmydns.net/](https://www.whatsmydns.net/)

[https://intodns.com/](https://intodns.com/)

[https://www.whois.net/](https://www.whois.net/)

[http://redirectdetective.com/](http://redirectdetective.com/)

## **Mail**

[https://www.mail-tester.com/](https://www.mail-tester.com/)

[https://getnada.com/](https://getnada.com/)

[https://mxtoolbox.com/NetworkTools.aspx](https://mxtoolbox.com/NetworkTools.aspx)

##### **RBL checks**

[https://mxtoolbox.com/blacklists.aspx](https://mxtoolbox.com/blacklists.aspx)

[http://multirbl.valli.org/](http://multirbl.valli.org/)

[http://www.anti-abuse.org/multi-rbl-check/](http://www.anti-abuse.org/multi-rbl-check/)

## **Vulnerability checker**

[https://www.exploit-db.com/](https://www.exploit-db.com/)

[https://www.rapid7.com/db/search](https://www.rapid7.com/db/search)

[https://wpvulndb.com/](https://wpvulndb.com/)

## **News/Articals**

[http://www.linuxinsider.com/](http://www.linuxinsider.com/)

[http://www.linuxtoday.com/](http://www.linuxtoday.com/)

[http://www.linuxjournal.com/](http://www.linuxjournal.com/)

[https://www.reddit.com/r/sysadmin/](https://www.reddit.com/r/sysadmin/)

[https://krebsonsecurity.com/](https://krebsonsecurity.com/)

[http://news.cpanel.com/](http://news.cpanel.com/)

## **Tutorials**

[https://www.unixmen.com/category/linux-tutorials/](https://www.unixmen.com/category/linux-tutorials/)

[https://www.digitalocean.com/community/tutorials](https://www.digitalocean.com/community/tutorials)

[http://www.learnitguide.net/](http://www.learnitguide.net/)

[http://www.itzgeek.com/category/how-tos](http://www.itzgeek.com/category/how-tos)

[https://www.vultr.com/docs/](https://www.vultr.com/docs/)

# SSL .htaccess

### WordPress

```default
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
```

### Drupal

```default
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
```

### Magento

```default
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://mydomain.com/$1 [L,R=301]
```

### No CMS

```lang-php
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
```

# IPMI (SuperMicro)

**Update your firmware**  
[ftp://ftp.supermicro.com/utility/IPMI%20FW%20flash%20tools/SMT/](ftp://ftp.supermicro.com/utility/IPMI%20FW%20flash%20tools/SMT/)

```
./lUpdate.sh -f SMT_X9_130.bin -i kcs -r n
```

**IPMICFG**

[https://www.supermicro.com/SwDownload/SwSelect\_Free.aspx?cat=IPMIftp://ftp.supermicro.com/utility/IPMICFG/](ftp://ftp.supermicro.com/utility/IPMICFG/)

<table class="confluenceTable tablesorter" id="bkmrk-fonction-commande-sh" style="height:1076px;"><thead><tr class="sortableHeader" style="height:31px;"><th class="confluenceTh sortableHeader" style="height:31px;width:151.25px;"><div>Fonction</div></th><th class="confluenceTh sortableHeader" style="height:31px;width:421.25px;"><div>Commande</div></th></tr></thead><tbody><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Show IP</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -m</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Show subnet mask</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -k</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Show Gateway</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -g</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Check FW</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -vgr</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Show VLAN</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -vlan</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set VLAN on</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -vlan on #VLAN</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set VLAN off</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -vlan off</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Check IPMI chipset</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -selftest</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set IP Static</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -m 10.x.x.x</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set Subnet</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -k 255.255.255.0</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set gateway</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -g 10.x.x.1</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set DHCP off</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -dhcp off</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Set DHCP on</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -dhcp on</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Check fan mode</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -fan</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">List users</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -user list</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Add user</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -user add \[user ID\] \[user name\] \[password\] \[privilege\]</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Del user</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -user del \[user id\]</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Change user passwd</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -user setpwd \[user ID\] \[password\]</td></tr><tr style="height:55px;"><td class="confluenceTd" style="height:55px;width:151.25px;">Change user pri</td><td class="confluenceTd" style="height:55px;width:421.25px;">ipmicfg -user level \[user ID\] \[privilege\]</td></tr></tbody></table>

#### Change LAN mode

Check the current mode:

```
./IPMICFG-Linux.x86_64 -raw 0x30 0x70 0x0c 0
```

```
# X9 ATE -raw 0x30 0x70 0x0c 0  X9 AM -raw 0x30 0x70 0x0c 0
```

The output will be one of these:

0x00 = Dedicated  
0x01 = Onboard / Shared  
0x02 = Failover

To set the mode to

Dedicated

```
./IPMICFG-Linux.x86_64 -raw 0x30 0x70 0xc 1 1 0
```

```
# X9 ATE -raw 0x30 0x70 0x0c 1  X9 AM -raw 0x30 0x70 0x0c 1 0
```

Shared

```
./IPMICFG-Linux.x86_64 -raw 0x30 0x70 0xc 1 1 1
```

```
# X9 ATE -raw 0x30 0x70 0x0c 1  X9 AM -raw 0x30 0x70 0x0c 1 1
```

Failover

```
./IPMICFG-Linux.x86_64 -raw 0x30 0x70 0xc 1 0 0
```

```
# X9 ATE -raw 0x30 0x70 0x0c 1  X9 AM -raw 0x30 0x70 0x0c 1 2
```

**IPMIView**

[ftp://ftp.supermicro.com/utility/IPMIView/](ftp://ftp.supermicro.com/utility/IPMIView/)  
Install java JRE and open 'IPMIView20.jar' with the java bin

**IPMITOOL**

Set next boot to PXE for next boot

```
ipmitool -I lanplus -H <ipmi_ip> -U ADMIN -P ADMIN chassis bootdev pxe
```

Set next boot to DISK for next boot

```
ipmitool -I lanplus -H <ipmi_ip> -U ADMIN -P ADMIN chassis bootdev disk
```

Reboot host from IPMI

```
ipmitool -I lanplus -H <ipmi_ip> -U ADMIN -P ADMIN chassis power cycle
```

Soft shutdown

```
ipmitool -H <ipmi_ip> -v -I lanplus -UADMIN -P ADMIN chassis power soft
```

Find Mac on eth0

```
ipmitool -I lanplus -U ADMIN -P ADMIN -H <ipmi_ip> raw 0x30 0x21 | tail -c 18
```

Find FW version

```
ipmitool -I lanplus -H <ipmi_ip> -U ADMIN -P ADMIN mc info | grep 'Firmware Revision'
```

Factory reset BMC

```
ipmitool -I lanplus -H <ipmi_ip> -U ADMIN -P ADMIN raw 0x3c 0x40
```

Disable Auto Control

```
ipmitool raw 0x30 0x45 0x1 0x01
```

Set Fan Speed to not ear cancer

```
ipmitool raw 0x30 0x70 0x66 0x01 0x00 0x15
```

Factory reset

```
ipmitool -I lanplus -H 1.1.1.1 -U ADMIN -P ADMIN raw 0x3c 0x40
```

Restart

```
ipmitool -I lanplus -H 1.1.1.1 -U ADMIN -P ADMIN bmc reset cold
```

<div id="bkmrk-smcipmitool">**SMCIPMITool**</div><div id="bkmrk-https%3A%2F%2Fwww.supermic">[https://www.supermicro.com/wftp/utility/SMCIPMItool/](https://www.supermicro.com/wftp/utility/SMCIPMItool/)</div><div id="bkmrk-.%2Fjre%2Fbin%2Fjava--jar-"><div>./jre/bin/java -jar SMCIPMITool.jar {{ ipmi_ip }} ADMIN ADMIN shell</div></div><div id="bkmrk--0"></div>

# Test Drive Performance [Windows / Linux]

## Test Sequential Read/Write with DD

Write

```
dd if=/dev/zero of=./largefile bs=1M count=12288
```

Read

```
dd if=./largefile of=/dev/null bs=4k
```

## Test IOPS with FIO

```
vim test.fio
```

> \[random\]  
> rw=randread  
> size=4g  
> directory=./iops  
> iodepth=403  
> direct=1  
> blocksize=4k  
> numjobs=16  
> nrfiles=1  
> group\_reporting  
> ioengine=sync  
> loops=1  
> rwmixread=75

```
mkdir ./iops
fio ./test.fio
```

## Test Windows Performance with DiskSpd

Download DiskSpd

[https://gallery.technet.microsoft.com/DiskSpd-A-Robust-Storage-6ef84e62](https://gallery.technet.microsoft.com/DiskSpd-A-Robust-Storage-6ef84e62)

Source code here: [https://github.com/microsoft/diskspd](https://github.com/microsoft/diskspd)

```
DiskSpd.exe -c150G -d300 -r -w40 -t8 -o32 -b64K -Sh -L D:\SpeedTest\testfile.dat
```

> <div></div>**Parameters:**
> 
> - <span class="droideEnlighterJS EnlighterJS"><span>-c150G</span></span> – Create a file of the specified size. Size can be stated in bytes or **K**iBs, **M**iBs, **G**iBs. Here – 150GB.
> - <span class="droideEnlighterJS EnlighterJS"><span>-d300</span></span> – Duration of measurement period in seconds, not including cool-down or warm-up time (default = 10 seconds). Here – 5 minutes.
> - <span class="droideEnlighterJS EnlighterJS"><span>-r</span></span> – Random I/O access (override <span class="droideEnlighterJS EnlighterJS"><span>-s</span></span>).
> - <span class="droideEnlighterJS EnlighterJS"><span>-s</span></span> – Sequential I/O access.
> - <span class="droideEnlighterJS EnlighterJS"><span>-w40</span></span> – Percentage of write requests to issue (default = 0, 100% read). Here 40% of IO operations are Writes, remaining 60% are Reads. This is a usual load for my SQL Server OLTP databases.
> - <span class="droideEnlighterJS EnlighterJS"><span>-t8</span></span> – The number of threads per file. Here – 8. One thread per available core.
> - <span class="droideEnlighterJS EnlighterJS"><span>-o32</span></span> – The number of outstanding I/O requests per target per thread. In other words, it is a queue depth. Here – 32.
> - <span class="droideEnlighterJS EnlighterJS"><span>-b46K</span></span> – Block size in bytes or **K**iBs, **M**iBs, or **G**iBs. Here – 64KB.
> - <span class="droideEnlighterJS EnlighterJS"><span>-Sh</span></span> – Disable both software caching and hardware write caching.
> - <span class="droideEnlighterJS EnlighterJS"><span>-L</span></span> – Measure latency statistics.
> - <span class="droideEnlighterJS EnlighterJS"><span>D:\\SpeedTest\\testfile.dat</span></span> – My target file used for testing (created with <span class="droideEnlighterJS EnlighterJS"><span>-c</span></span>).