Convert PFX certificate to crt and key for apache httpd

How to convert PFX certificate to .crt and .key to use with apache httpd

Certificate in PFX format are commonly exported from MS Active Directory Using OpenSSL Command in Linux System:

openssl pkcs12 -in server.pfx -out server.key -nodes -nocerts

server.key

-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIl4COeWKpJooCAggA
MBQGCCqGSIb3DQMHBAhzLEVbvIcuIASCBMhLiTd6/n6feWfBNRPDpeQl4oecUt6Q
nQrGbtcbDlPaMcCjSrquZO3MCfwstPhv3kyk6ntc8A6MJZCALvAdf6g0xetNb4L0
ThoJ5IfsVM4K7SRy/Q4JxR6OWhdTVNSinc4aPncjJClImPmFc+QOrHuFY19Z9kTW
nVsWOg3CG4tx2HfNVLrH3ZQJ7bM0Imohw464wGLf2k+l5/+XEnqqHfJLazx67GbP
KGdq7YnZLWXv8j6E4ZLrxpEx+KyGgSqB8vcVMttpjM07iVTKD7ig0FwRaN2TlPeT
FiK7n0y/UCIpH4KRFtJIgJfWuGkKUJFQVs+eiD8xZRM6sl6KvkebG4O4vEtJS2PF
cXNfVxtbmhroOjRrP9Wjd0K9tZQ+zBGnhoF2fo5T8LCyeTRPeECFCiRoGmW2QF3y
8QHz017qw4CwfSPMQRf6Y6gTlvg9tFmuIHgA9YGSGXYgqNXYtkw7dxR40LsbKYTb
y81j5EjT0Whn6dQYhYx4dSWGcx/m7Ybzlka9ftkrV+E9KvBh1eg8vjrU/VSAAFHo
BmDCK3dxQNt5gDqlbjX5d/cmd9eu1oYGqZKkhC1fN0TRK7XmnPEZ8bHc+YCDzeHb
yAEgETngSm2AOTFRd7TMpzHOaMJUMnFqX4QYeQfuerPkF3lvIf/OOi9UKdcYkY3Y
97zFqZny2rFVmaCiFk/a8X+Ecwn4xm9RZHeibo1dCTrZ54BIzO7bBaae7HOjxwwH
ZqWCfLeFboZ2GoQ3zAhIOF3h8jL+UVHJRDKlJJix9i0uyOm0JmIz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zertifikats Inhalts auslesen

Wie lese ich den Inhalt des Zertifikates (*.pem oder *.crt) aus?

Der Inhalt des Zertifikates kann mit OpenSSL ausgelesen werden:

openssl x509 -in ZERTIFIKAT.CRT -text -noout

openssl x509 -in ZERTIFIKAT.PEM -text -noout

Beispiele

openssl x509 -in /etc/pki/ca-trust/extracted/pem/email-ca-bundle.pem -text -noout

openssl x509 -in/etc/pki/tls/certs/localhost.crt -text -noout

Certificate:
Data:
Version: 3 (0x2)
Serial Number: 18473 (0x4829)
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=--, ST=SomeState, L=SomeCity, O=SomeOrganization, OU=SomeOrganizationalUnit, CN=centos1.localdomain/emailAddress=root@centos1.localdomain
Validity
Not Before: Oct 6 14:49:10 2016 GMT
Not After : Oct 6 14:49:10 2017 GMT
Subject: C=--, ST=SomeState, L=SomeCity, O=SomeOrganization, OU=SomeOrganizationalUnit, CN=centos1.localdomain/emailAddress=root@centos1.localdomain
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:c1:0d:b0:20:81:73:a4:3f:d2:09:33:bd:5f:3d:
42:d8:4f:0e:11:86:ad:6d:84:93:55:5c:9c:b6:00:
4e:a0:35:a9:72:68:0e:f7:3d:9f:7d:b7:73:a3:30:
a5:d1:ea:c8:c3:6c:96:46:f2:9e:8c:d2:2c:5f:44:
4d:2b:07:35:f7:92:4e:48:80:a3:5f:d4:5f:16:82:
83:a5:f2:09:9e:74:b8:95:8f:55:13:1e:3d:a1:07:
c7:11:24:f3:e7:75:3e:e5:da:4e:85:dd:b6:b9:b5:
e3:32:8d:ec:23:08:bf:22:7c:c0:55:27:07:36:f2:
b3:18:5a:6b:62:0d:9a:a4:d0:4a:e0:3a:ea:b6:31:
d2:06:52:46:8a:6e:16:aa:cb:fe:bc:8a:f8:c8:94:
0f:ca:e1:78:a6:f9:b3:b6:69:07:0d:18:97:b1:60:
6e:24:4b:df:bf:ba:67:42:3e:2d:81:cf:f7:55:ed:
47:15:a0:00:b9:26:36:56:d3:29:d6:9e:bf:99:6d:
0f:a9:63:b8:4a:9f:f4:e0:f8:98:e5:ab:2e:81:9c:
f3:eb:a3:0a:27:dd:4f:70:e9:3b:e2:c1:1f:07:fe:
cb:1c:ee:5b:74:e9:31:b8:e8:5e:80:30:28:e6:e1:
7a:16:ac:25:d0:39:50:08:ff:db:71:5d:46:87:49:
47:83
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key Encipherment
Signature Algorithm: sha256WithRSAEncryption
37:e0:e1:92:2a:cc:51:8a:4c:d4:31:91:20:f4:f3:72:b2:bb:
34:82:5c:e0:b1:29:33:b5:6d:c5:3b:42:50:8b:49:2b:cc:8c:
72:57:c3:ff:92:00:f4:cb:7e:00:34:86:88:ed:38:ea:10:57:
8d:43:fc:9d:ae:5c:9d:87:4f:73:c0:8d:79:e4:a3:44:de:b1:
27:6c:93:f3:c9:d1:b3:4c:df:6c:5f:0b:1e:19:e9:51:69:68:
af:fb:47:45:85:03:64:04:a9:47:24:3a:8d:8b:b5:4f:0c:25:
44:e2:10:a8:58:6a:f9:8d:5d:3f:2f:9f:41:75:f5:04:47:a4:
e1:90:53:a1:dc:a1:fa:20:5b:d5:41:79:cb:f5:47:66:1b:02:
dd:94:bb:52:69:00:2c:3a:d5:44:0a:a4:15:23:36:fb:5c:aa:
fa:28:af:89:17:fb:f4:c6:d7:8b:1b:14:d2:7d:6b:01:d2:33:
eb:43:62:c0:bd:88:b9:31:86:ed:e7:28:11:b4:b2:9e:b3:1e:
c6:3e:bd:54:8b:f9:53:ed:0d:c3:ea:1d:c2:54:53:b5:d5:83:
30:58:6e:37:87:9f:d8:cf:44:3f:29:90:0c:84:b7:9f:cb:4f:
11:f5:d0:a3:6e:ea:22:87:eb:9b:63:b9:9c:46:99:32:6d:a7:
42:3c:e8:a0

Backup und Wiederherstellung von MySQL Datenbank

Backup

Der Backup kann entweder von allen Datenbanken erfolgen:

sudo mysqldump --all-databases > /tmp/mysqldump.sql

mysqldump -u root -p --all-databases > /tmp/mysqldump.sql

oder mit nur eine Datenbank (Beispiel xwiki)

sudo mysqldump -u root -p xwiki > /tmp/xwiki.sql

Wiederherstellung

Wenn nur eine Datenbank wiederherstellt werden soll, dann muss die Ziel-Datenbank eingegeben werden:

mysql -u root -p --database=xwiki < /tmp/xwiki.sql

Weitere Information in https://dev.mysql.com/doc/refman/5.7/en/mysqldump-sql-format.html

Virtual Box: Die vorhandene VDI Festplatten vergrößern

Wie kann eine vorhandene VDI (Virtual Drive) Festplatte in Virtual Box vergrößern? In der GUI der Virtual Box (Version 5.1) gibt es keine Option. Die einzige mir bekannte Lösung ist VBoxManage.exe (C:\Program Files\Oracle\VirtualBox\VBoxManage.exe).

Der Aufruf erfolgt mit: VBoxManage.exe modifyhd "Absoluten Adresse zu VDI" --resize <neue Größe in MB>

Beispiel um eine vorhandene VDI Festplatte auf 40GB zu erhöhen C:\Program Files\Oracle\VirtualBox\VBoxManage.exe modifyhd C:\tomas\ubuntu\ubuntu.vdi --resize 40960

Weiteren VBoxManager Parameter :

Oracle VM VirtualBox Command Line Management Interface Version 5.1.6
(C) 2005-2016 Oracle Corporation
All rights reserved.

Usage:

VBoxManage [<general option>] <command>
 
 
General Options:
 
 [-v|--version] print version number and exit
 [-q|--nologo] suppress the logo
 [--settingspw <pw>] provide the settings password
 [--settingspwfile <file>] provide a file containing the settings password
 
 
Commands:
 
 list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|
 intnets|bridgedifs|hostonlyifs|natnets|dhcpservers|
 hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|
 usbhost|usbfilters|systemproperties|extpacks|
 groups|webcams|screenshotformats

showvminfo <uuid|vmname> [--details]
 [--machinereadable]
 showvminfo <uuid|vmname> --log <idx>

registervm <filename>

unregistervm <uuid|vmname> [--delete]

createvm --name <name>
 [--groups <group>, ...]
 [--ostype <ostype>]
 [--register]
 [--basefolder <path>]
 [--uuid <uuid>]

modifyvm <uuid|vmname>
 [--name <name>]
 [--groups <group>, ...]
 [--description <desc>]
 [--ostype <ostype>]
 [--iconfile <filename>]
 [--memory <memorysize in MB>]
 [--pagefusion on|off]
 [--vram <vramsize in MB>]
 [--acpi on|off]
 [--pciattach 03:04.0]
 [--pciattach 03:04.0@02:01.0]
 [--pcidetach 03:04.0]
 [--ioapic on|off]
 [--hpet on|off]
 [--triplefaultreset on|off]
 [--apic on|off]
 [--x2apic on|off]
 [--paravirtprovider none|default|legacy|minimal|
 hyperv|kvm]
 [--paravirtdebug <key=value> [,<key=value> ...]]
 [--hwvirtex on|off]
 [--nestedpaging on|off]
 [--largepages on|off]
 [--vtxvpid on|off]
 [--vtxux on|off]
 [--pae on|off]
 [--longmode on|off]
 [--cpu-profile "host|Intel 80[86|286|386]"]
 [--cpuid-portability-level <0..3>
 [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]
 [--cpuidremove <leaf>]
 [--cpuidremoveall]
 [--hardwareuuid <uuid>]
 [--cpus <number>]
 [--cpuhotplug on|off]
 [--plugcpu <id>]
 [--unplugcpu <id>]
 [--cpuexecutioncap <1-100>]
 [--rtcuseutc on|off]
 [--graphicscontroller none|vboxvga|vmsvga]
 [--monitorcount <number>]
 [--accelerate3d on|off]
 [--accelerate2dvideo on|off]
 [--firmware bios|efi|efi32|efi64]
 [--chipset ich9|piix3]
 [--bioslogofadein on|off]
 [--bioslogofadeout on|off]
 [--bioslogodisplaytime <msec>]
 [--bioslogoimagepath <imagepath>]
 [--biosbootmenu disabled|menuonly|messageandmenu]
 [--biosapic disabled|apic|x2apic]
 [--biossystemtimeoffset <msec>]
 [--biospxedebug on|off]
 [--boot<1-4> none|floppy|dvd|disk|net>]
 [--nic<1-N> none|null|nat|bridged|intnet|hostonly|
 generic|natnetwork]
 [--nictype<1-N> Am79C970A|Am79C973|
 82540EM|82543GC|82545EM|
 virtio]
 [--cableconnected<1-N> on|off]
 [--nictrace<1-N> on|off]
 [--nictracefile<1-N> <filename>]
 [--nicproperty<1-N> name=[value]]
 [--nicspeed<1-N> <kbps>]
 [--nicbootprio<1-N> <priority>]
 [--nicpromisc<1-N> deny|allow-vms|allow-all]
 [--nicbandwidthgroup<1-N> none|<name>]
 [--bridgeadapter<1-N> none|<devicename>]
 [--hostonlyadapter<1-N> none|<devicename>]
 [--intnet<1-N> <network name>]
 [--nat-network<1-N> <network name>]
 [--nicgenericdrv<1-N> <driver>
 [--natnet<1-N> <network>|default]
 [--natsettings<1-N> [<mtu>],[<socksnd>],
 [<sockrcv>],[<tcpsnd>],
 [<tcprcv>]]
 [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
 <hostport>,[<guestip>],<guestport>]
 [--natpf<1-N> delete <rulename>]
 [--nattftpprefix<1-N> <prefix>]
 [--nattftpfile<1-N> <file>]
 [--nattftpserver<1-N> <ip>]
 [--natbindip<1-N> <ip>
 [--natdnspassdomain<1-N> on|off]
 [--natdnsproxy<1-N> on|off]
 [--natdnshostresolver<1-N> on|off]
 [--nataliasmode<1-N> default|[log],[proxyonly],
 [sameports]]
 [--macaddress<1-N> auto|<mac>]
 [--mouse ps2|usb|usbtablet|usbmultitouch]
 [--keyboard ps2|usb
 [--uart<1-N> off|<I/O base> <IRQ>]
 [--uartmode<1-N> disconnected|
 server <pipe>|
 client <pipe>|
 tcpserver <port>|
 tcpclient <hostname:port>|
 file <file>|
 <devicename>]
 [--lpt<1-N> off|<I/O base> <IRQ>]
 [--lptmode<1-N> <devicename>]
 [--guestmemoryballoon <balloonsize in MB>]
 [--audio none|null|dsound]
 [--audiocontroller ac97|hda|sb16]
 [--audiocodec stac9700|ad1980|stac9221|sb16]
 [--clipboard disabled|hosttoguest|guesttohost|
 bidirectional]
 [--draganddrop disabled|hosttoguest]
 [--vrde on|off]
 [--vrdeextpack default|<name>
 [--vrdeproperty <name=[value]>]
 [--vrdeport <hostport>]
 [--vrdeaddress <hostip>]
 [--vrdeauthtype null|external|guest]
 [--vrdeauthlibrary default|<name>
 [--vrdemulticon on|off]
 [--vrdereusecon on|off]
 [--vrdevideochannel on|off]
 [--vrdevideochannelquality <percent>]
 [--usb on|off]
 [--usbehci on|off]
 [--usbxhci on|off]
 [--usbrename <oldname> <newname>]
 [--snapshotfolder default|<path>]
 [--teleporter on|off]
 [--teleporterport <port>]
 [--teleporteraddress <address|empty>
 [--teleporterpassword <password>]
 [--teleporterpasswordfile <file>|stdin]
 [--tracing-enabled on|off]
 [--tracing-config <config-string>]
 [--tracing-allow-vm-access on|off]
 [--usbcardreader on|off]
 [--autostart-enabled on|off]
 [--autostart-delay <seconds>]
 [--videocap on|off]
 [--videocapscreens all|<screen ID> [<screen ID> ...]]
 [--videocapfile <filename>]
 [--videocapres <width> <height>]
 [--videocaprate <rate>]
 [--videocapfps <fps>]
 [--videocapmaxtime <ms>]
 [--videocapmaxsize <MB>]
 [--videocapopts <key=value> [,<key=value> ...]]
 [--defaultfrontend default|<name>]

clonevm <uuid|vmname>
 [--snapshot <uuid>|<name>]
 [--mode machine|machineandchildren|all]
 [--options link|keepallmacs|keepnatmacs|
 keepdisknames]
 [--name <name>]
 [--groups <group>, ...]
 [--basefolder <basefolder>]
 [--uuid <uuid>]
 [--register]

import <ovfname/ovaname>
 [--dry-run|-n]
 [--options keepallmacs|keepnatmacs|importtovdi]
 [more options]
 (run with -n to have options displayed
 for a particular OVF)

export <machines> --output|-o <name>.<ovf/ova>
 [--legacy09|--ovf09|--ovf10|--ovf20]
 [--manifest]
 [--iso]
 [--options manifest|iso|nomacs|nomacsbutnat]
 [--vsys <number of virtual system>]
 [--product <product name>]
 [--producturl <product url>]
 [--vendor <vendor name>]
 [--vendorurl <vendor url>]
 [--version <version info>]
 [--description <description info>]
 [--eula <license text>]
 [--eulafile <filename>]

startvm <uuid|vmname>...
 [--type gui|sdl|headless|separate]

controlvm <uuid|vmname>
 pause|resume|reset|poweroff|savestate|
 acpipowerbutton|acpisleepbutton|
 keyboardputscancode <hex> [<hex> ...]|
 setlinkstate<1-N> on|off |
 nic<1-N> null|nat|bridged|intnet|hostonly|generic|
 natnetwork [<devicename>] |
 nictrace<1-N> on|off |
 nictracefile<1-N> <filename> |
 nicproperty<1-N> name=[value] |
 nicpromisc<1-N> deny|allow-vms|allow-all |
 natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
 <hostport>,[<guestip>],<guestport> |
 natpf<1-N> delete <rulename> |
 guestmemoryballoon <balloonsize in MB> |
 usbattach <uuid>|<address>
 [--capturefile <filename>] |
 usbdetach <uuid>|<address> |
 clipboard disabled|hosttoguest|guesttohost|
 bidirectional |
 draganddrop disabled|hosttoguest |
 vrde on|off |
 vrdeport <port> |
 vrdeproperty <name=[value]> |
 vrdevideochannelquality <percent> |
 setvideomodehint <xres> <yres> <bpp>
 [[<display>] [<enabled:yes|no> |
 [<xorigin> <yorigin>]]] |
 screenshotpng <file> [display] |
 videocap on|off |
 videocapscreens all|none|<screen>,[<screen>...] |
 videocapfile <file>
 videocapres <width>x<height>
 videocaprate <rate>
 videocapfps <fps>
 videocapmaxtime <ms>
 videocapmaxsize <MB>
 setcredentials <username>
 --passwordfile <file> | <password>
 <domain>
 [--allowlocallogon <yes|no>] |
 teleport --host <name> --port <port>
 [--maxdowntime <msec>]
 [--passwordfile <file> |
 --password <password>] |
 plugcpu <id> |
 unplugcpu <id> |
 cpuexecutioncap <1-100>
 webcam <attach [path [settings]]> | <detach [path]> | <list>
 addencpassword <id>
 <password file>|-
 [--removeonsuspend <yes|no>]
 removeencpassword <id>
 removeallencpasswords

discardstate <uuid|vmname>

adoptstate <uuid|vmname> <state_file>

snapshot <uuid|vmname>
 take <name> [--description <desc>] [--live]
 [--uniquename Number,Timestamp,Space,Force] |
 delete <uuid|snapname> |
 restore <uuid|snapname> |
 restorecurrent |
 edit <uuid|snapname>|--current
 [--name <name>]
 [--description <desc>] |
 list [--details|--machinereadable]
 showvminfo <uuid|snapname>

closemedium [disk|dvd|floppy] <uuid|filename>
 [--delete]

storageattach <uuid|vmname>
 --storagectl <name>
 [--port <number>]
 [--device <number>]
 [--type dvddrive|hdd|fdd]
 [--medium none|emptydrive|additions|
 <uuid|filename>|host:<drive>|iscsi]
 [--mtype normal|writethrough|immutable|shareable|
 readonly|multiattach]
 [--comment <text>]
 [--setuuid <uuid>]
 [--setparentuuid <uuid>]
 [--passthrough on|off]
 [--tempeject on|off]
 [--nonrotational on|off]
 [--discard on|off]
 [--hotpluggable on|off]
 [--bandwidthgroup <name>]
 [--forceunmount]
 [--server <name>|<ip>]
 [--target <target>]
 [--tport <port>]
 [--lun <lun>]
 [--encodedlun <lun>]
 [--username <username>]
 [--password <password>]
 [--initiator <initiator>]
 [--intnet]

storagectl <uuid|vmname>
 --name <name>
 [--add ide|sata|scsi|floppy|sas|pcie]
 [--controller LSILogic|LSILogicSAS|BusLogic|
 IntelAHCI|PIIX3|PIIX4|ICH6|I82078|NVMe]
 [--portcount <1-n>]
 [--hostiocache on|off]
 [--bootable on|off]
 [--rename <name>]
 [--remove]

bandwidthctl <uuid|vmname>
 add <name> --type disk|network
 --limit <megabytes per second>[k|m|g|K|M|G] |
 set <name>
 --limit <megabytes per second>[k|m|g|K|M|G] |
 remove <name> |
 list [--machinereadable]
 (limit units: k=kilobit, m=megabit, g=gigabit,
 K=kilobyte, M=megabyte, G=gigabyte)

showmediuminfo [disk|dvd|floppy] <uuid|filename>

createmedium [disk|dvd|floppy] --filename <filename>
 [--size <megabytes>|--sizebyte <bytes>]
 [--diffparent <uuid>|<filename>
 [--format VDI|VMDK|VHD] (default: VDI)
 [--variant Standard,Fixed,Split2G,Stream,ESX]

modifymedium [disk|dvd|floppy] <uuid|filename>
 [--type normal|writethrough|immutable|shareable|
 readonly|multiattach]
 [--autoreset on|off]
 [--property <name=[value]>]
 [--compact]
 [--resize <megabytes>|--resizebyte <bytes>]
 [--move <full path to a new location>]
 clonemedium [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>
 [--format VDI|VMDK|VHD|RAW|<other>]
 [--variant Standard,Fixed,Split2G,Stream,ESX]
 [--existing]

mediumproperty [disk|dvd|floppy] set <uuid|filename>
 <property> <value>

[disk|dvd|floppy] get <uuid|filename>
 <property>

[disk|dvd|floppy] delete <uuid|filename>
 <property>

encryptmedium <uuid|filename>
 [--newpassword <file>|-]
 [--oldpassword <file>|-]
 [--cipher <cipher identifier>]
 [--newpasswordid <password identifier>]

checkmediumpwd <uuid|filename>
 <pwd file>|-

convertfromraw <filename> <outputfile>
 [--format VDI|VMDK|VHD]
 [--variant Standard,Fixed,Split2G,Stream,ESX]
 [--uuid <uuid>]
 convertfromraw stdin <outputfile> <bytes>
 [--format VDI|VMDK|VHD]
 [--variant Standard,Fixed,Split2G,Stream,ESX]
 [--uuid <uuid>]

getextradata global|<uuid|vmname>
 <key>|enumerate

setextradata global|<uuid|vmname>
 <key>
 [<value>] (no value deletes key)

setproperty machinefolder default|<folder> |
 hwvirtexclusive on|off |
 vrdeauthlibrary default|<library> |
 websrvauthlibrary default|null|<library> |
 vrdeextpack null|<library> |
 autostartdbpath null|<folder> |
 loghistorycount <value>
 defaultfrontend default|<name>
 logginglevel <log setting>

usbfilter add <index,0-N>
 --target <uuid|vmname>|global
 --name <string>
 --action ignore|hold (global filters only)
 [--active yes|no] (yes)
 [--vendorid <XXXX>] (null)
 [--productid <XXXX>] (null)
 [--revision <IIFF>] (null)
 [--manufacturer <string>] (null)
 [--product <string>] (null)
 [--remote yes|no] (null, VM filters only)
 [--serialnumber <string>] (null)
 [--maskedinterfaces <XXXXXXXX>]

usbfilter modify <index,0-N>
 --target <uuid|vmname>|global
 [--name <string>]
 [--action ignore|hold] (global filters only)
 [--active yes|no]
 [--vendorid <XXXX>|""]
 [--productid <XXXX>|""]
 [--revision <IIFF>|""]
 [--manufacturer <string>|""]
 [--product <string>|""]
 [--remote yes|no] (null, VM filters only)
 [--serialnumber <string>|""]
 [--maskedinterfaces <XXXXXXXX>]

usbfilter remove <index,0-N>
 --target <uuid|vmname>|global

sharedfolder add <uuid|vmname>
 --name <name> --hostpath <hostpath>
 [--transient] [--readonly] [--automount]

sharedfolder remove <uuid|vmname>
 --name <name> [--transient]

guestproperty get <uuid|vmname>
 <property> [--verbose]

guestproperty set <uuid|vmname>
 <property> [<value> [--flags <flags>]]

guestproperty delete|unset <uuid|vmname>
 <property>

guestproperty enumerate <uuid|vmname>
 [--patterns <patterns>]

guestproperty wait <uuid|vmname> <patterns>
 [--timeout <msec>] [--fail-on-timeout]

guestcontrol <uuid|vmname> [--verbose|-v] [--quiet|-q]
 [--username <name>] [--domain <domain>]
 [--passwordfile <file> | --password <password>]

run [common-options]
 [--exe <path to executable>] [--timeout <msec>]
 [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]
 [--ignore-operhaned-processes] [--profile]
 [--no-wait-stdout|--wait-stdout]
 [--no-wait-stderr|--wait-stderr]
 [--dos2unix] [--unix2dos]
 -- <program/arg0> [argument1] ... [argumentN]]

start [common-options]
 [--exe <path to executable>] [--timeout <msec>]
 [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]
 [--ignore-operhaned-processes] [--profile]
 -- <program/arg0> [argument1] ... [argumentN]]

copyfrom [common-options]
 [--dryrun] [--follow] [-R|--recursive]
 <guest-src0> [guest-src1 [...]] <host-dst>

copyfrom [common-options]
 [--dryrun] [--follow] [-R|--recursive]
 [--target-directory <host-dst-dir>]
 <guest-src0> [guest-src1 [...]]

copyto [common-options]
 [--dryrun] [--follow] [-R|--recursive]
 <host-src0> [host-src1 [...]] <guest-dst>

copyto [common-options]
 [--dryrun] [--follow] [-R|--recursive]
 [--target-directory <guest-dst>]
 <host-src0> [host-src1 [...]]

mkdir|createdir[ectory] [common-options]
 [--parents] [--mode <mode>]
 <guest directory> [...]

rmdir|removedir[ectory] [common-options]
 [-R|--recursive]
 <guest directory> [...]

removefile|rm [common-options] [-f|--force]
 <guest file> [...]

mv|move|ren[ame] [common-options]
 <source> [source1 [...]] <dest>

mktemp|createtemp[orary] [common-options]
 [--secure] [--mode <mode>] [--tmpdir <directory>]
 <template>

stat [common-options]
 <file> [...]

guestcontrol <uuid|vmname> [--verbose|-v] [--quiet|-q]

list <all|sessions|processes|files> [common-opts]

closeprocess [common-options]
 < --session-id <ID>
 | --session-name <name or pattern>
 <PID1> [PID1 [...]]

closesession [common-options]
 < --all | --session-id <ID>
 | --session-name <name or pattern> >

updatega|updateguestadditions|updateadditions
 [--source <guest additions .ISO>]
 [--wait-start] [common-options]
 [-- [<argument1>] ... [<argumentN>]]

watch [common-options]

metrics list [*|host|<vmname> [<metric_list>]]
 (comma-separated)

metrics setup
 [--period <seconds>] (default: 1)
 [--samples <count>] (default: 1)
 [--list]
 [*|host|<vmname> [<metric_list>]]

metrics query [*|host|<vmname> [<metric_list>]]

metrics enable
 [--list]
 [*|host|<vmname> [<metric_list>]]

metrics disable
 [--list]
 [*|host|<vmname> [<metric_list>]]

metrics collect
 [--period <seconds>] (default: 1)
 [--samples <count>] (default: 1)
 [--list]
 [--detach]
 [*|host|<vmname> [<metric_list>]]

natnetwork add --netname <name>
 --network <network>
 [--enable|--disable]
 [--dhcp on|off]
 [--port-forward-4 <rule>]
 [--loopback-4 <rule>]
 [--ipv6 on|off]
 [--port-forward-6 <rule>]
 [--loopback-6 <rule>]

natnetwork remove --netname <name>

natnetwork modify --netname <name>
 [--network <network>]
 [--enable|--disable]
 [--dhcp on|off]
 [--port-forward-4 <rule>]
 [--loopback-4 <rule>]
 [--ipv6 on|off]
 [--port-forward-6 <rule>]
 [--loopback-6 <rule>]

natnetwork start --netname <name>

natnetwork stop --netname <name>

natnetwork list [<pattern>]

hostonlyif ipconfig <name>
 [--dhcp |
 --ip<ipv4> [--netmask<ipv4> (def: 255.255.255.0)] |
 --ipv6<ipv6> [--netmasklengthv6<length> (def: 64)]]
 create |
 remove <name>

dhcpserver add|modify --netname <network_name> |
 --ifname <hostonly_if_name>
 [--ip <ip_address>
 --netmask <network_mask>
 --lowerip <lower_ip>
 --upperip <upper_ip>]
 [--enable | --disable]

dhcpserver remove --netname <network_name> |
 --ifname <hostonly_if_name>

usbdevsource add <source name>
 --backend <backend>
 --address <address>
 usbdevsource remove <source name>

Introspection and guest debugging:
 VBoxManage debugvm <uuid|vmname> dumpvmcore [--filename=name]
 VBoxManage debugvm <uuid|vmname> info <item> [args...]
 VBoxManage debugvm <uuid|vmname> injectnmi
 VBoxManage debugvm <uuid|vmname> log [[--release] | [--debug]]
 [group-settings...]
 VBoxManage debugvm <uuid|vmname> logdest [[--release] | [--debug]]
 [destinations...]
 VBoxManage debugvm <uuid|vmname> logflags [[--release] | [--debug]] [flags...]
 VBoxManage debugvm <uuid|vmname> osdetect
 VBoxManage debugvm <uuid|vmname> osinfo
 VBoxManage debugvm <uuid|vmname> osdmesg [--lines=lines]
 VBoxManage debugvm <uuid|vmname> getregisters [--cpu=id] [reg-set.reg-name...]
 VBoxManage debugvm <uuid|vmname> setregisters [--cpu=id]
 [reg-set.reg-name=value...]
 VBoxManage debugvm <uuid|vmname> show [[--human-readable] | [--sh-export] |
 [--sh-eval] | [--cmd-set]] [settings-item...]
 VBoxManage debugvm <uuid|vmname> stack [--cpu=id]
 VBoxManage debugvm <uuid|vmname> statistics [--reset] [--descriptions]
 [--pattern=pattern]

Extension package management:
 VBoxManage extpack install [--replace] <tarball>
 VBoxManage extpack uninstall [--force] <name>
 VBoxManage extpack cleanup

MySQL auf Ubuntu installieren

Die MySQL Datenbank kann mit sudo apt-get install mysql-server installiert werden.

Während der Installation muss ein root Kennwort gesetzt werden. mysql root password

Der test login erfolgt mittels mysql -u root -p

Die Datenbank Konfiguration kann über command promt erfolgen oder via eine GUI. Eine passende quelloffene GUI ist MySQL Workbench MySQL Workbench. Die Instalaltion erfolgt mit sudo apt-get install mysql-workbench.

 

Android Smarphone erhält keine IP Adresse über WLAN (IP-Adresse wird abgerufen)

Problem

Das Android Handy (Version 4.2.x) erhält keine IP Adresse über WLAN Anbindung, obwohl diese Verbindung früher möglich war. Das Handy soll die IP-Adresse von DHCP Server erhalten.

Der Status in der WLAN Einstellung ist stets IP-Adresse wird abgerufen

Android IP-Adresse wird abgerufen

Lösung

In einem Terminal Emulator (über App Store erhältlich) folgende Befehle durchführen.

cd /data/misc/dhcp
rm dhcpcd-wlan0.lease
rm dhcpcd-wlan0.pid

Android IP-Adresse wird abgerufen Lösung

Verbindung zu SLES (OpenSUSE) nach frischer Installation nicht möglich

Die SSH Verbindung zu einem neuen frisch installierten OpenSUSE bzw. SLES ist nich möglich.

In der OpenSUSE Installation (Version 11) ist die Verbindung von externen Systemen über SSH nicht erlaubt.

tomas@ubuntu:~$ ssh -vvvv root@sles1
OpenSSH_7.2p2 Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "sles1" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to sles1 [10.0.2.7] port 22.
debug1: connect to address 10.0.2.7 port 22: Connection timed out
ssh: connect to host sles1 port 22: Connection timed out

Schritte:

  1. Verifiziere das auf dem OpenSUSE System die Firewall für SSH geöffnet ist.  $ iptables -nL | grep 22 soll Ergebnisse liefern:
  2. Öffnen Firewall für SSH Daemon $ yast firewall und navigiere Allowed Services -> Service to Allow -> Secure Shell Server -> Add -> Next -> Finish

Um sich als root auf dem OpenSUSE Sever mit angaben von Passwort anmelden zu können, muss dies in ssh erlaubt sein (Eintrag PermitRootLogin yes).
$ vi /etc/ssh/sshd_config

PermitRootLogin yes

 

 

 

Ansible – Wie erfahre ich die Linux Distribution

Wie erfahre ich die Linux Distribution in Ansible?

  • Wie erfahre ich, welche Linux Distribution das Zielsystem hat?
  • Wie begrenze ich die Ausführung vom ansible tasks auf einige Linux Distributionen?

Ansible speichert automatisch die Beschreibung der linux Distribution in den folgenden Variablen:
ansible_distribution, ansible_distribution_release und ansible_distribution_version. (Mehr dazu in Ansible Best Practise)

Um die Distribution Information zu erhalten:  ansible all -m setup -a "filter=ansible_distribution*"

Mit dem Ergebnis:

"ansible_distribution": "CentOS",
"ansible_distribution_release": "Final",
"ansible_distribution_version": "6.4"

und um die tasks nur bei einigen Distributionen in ansible playbook durchzuführen
when: ansible_distribution == 'CentOS'

Konfiguriere Network / Netz im CentOS6.8 minimal

Nach der Installation von CentOS 6.8 minimal ist per default das Netz / Network ausgeschaltet.

Zu erst soll das Netz automatisch beim boot aktiviert sein und die IP Adresse soll von DHCP kommen.

$ vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=08:00:27:C4:9D:C8
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=dhcp

$ service network restart
$ service network status

Konfigurierte Geräte:
lo eth0
Derzeit aktive Geräte:
lo eth0