Powershelliä UNIX-ylläpitäjille, osa 10

March 11, 2016 – Samuli Seppänen

Windowsin käynnistyviin ohjelma- ja kirjastotiedostoihin liittyy paljon erilaista metatietoa, esimerkiksi ohjelman versionumero, julkaisija yms. Näiden metatietojen tarkastelu on toisinaan hyödyllistä, etenkin ohjelmistoja testattaessa. Alla OpenVPN:n bin -kansion sisältö kokonaisuudessaan:

PS C:Program FilesOpenVPNbin> Get-ChildItem 
 
 Directory: C:Program FilesOpenVPNbin 
 
 Mode LastWriteTime Length Name
 ---- ------------- ------ ----
 -a--- 7.3.2016 16:40 1753440 libeay32.dll 
 -a--- 7.3.2016 16:40 226432 liblzo2-2.dll
 -a--- 7.3.2016 16:40 123000 libpkcs11-helper-1.dll 
 -a--- 7.3.2016 16:40 465760 openvpn-gui.exe
 -a--- 7.3.2016 16:40 965984 openvpn.exe 
 -a--- 7.3.2016 16:40 65888 openvpnserv.exe 
 -a--- 7.3.2016 16:40 396640 ssleay32.dll

Metatiedot on tallennettu tiedosto-objektin VersionInfo-parametriin - alla tarkastellaan openvpn.exe -tiedoston metatietoja:

PS C:Program FilesOpenVPNbin> (Get-ChildItem openvpn.exe).VersionInfo|fl 
 
 OriginalFilename : openvpn.exe 
 FileDescription : OpenVPN Daemon 
 ProductName : OpenVPN 
 Comments : 
 CompanyName : The OpenVPN Project 
 FileName : C:Program FilesOpenVPNbinopenvpn.exe 
 FileVersion : 2.3_guipr18and26.0 
 ProductVersion : 2.3_guipr18and26.0 
 IsDebug : False 
 IsPatched : False 
 IsPreRelease : False 
 IsPrivateBuild : False 
 IsSpecialBuild : False 
 Language : englanti (Yhdysvallat) 
 LegalCopyright : Copyright © The OpenVPN Project 
 LegalTrademarks : 
 PrivateBuild : 
 SpecialBuild : 

Yllä komento Get-ChildItem tarvitaan openvpn.exe:n muuntamiseksi Powershell-objektiksi.

Metatietojen lisäksi Powershellillä on mahdollista tarkistaa ohjelmien digitaaliset allekirjoitukset (Authenticoode signature). Tähän tarkoitukseen käytetään Get-AuthenticodeSignature CmdLetiä:

PS C:Program FilesOpenVPNbin> Get-AuthenticodeSignature *.exe 
 
 Directory: C:Program FilesOpenVPNbin 
 
 SignerCertificate Status Path 
 ----------------- ------ ----
 5E66E0CA2367757E800E65B770629026E131A7DC Valid openvpn-gui.exe 
 5E66E0CA2367757E800E65B770629026E131A7DC Valid openvpn.exe 
 5E66E0CA2367757E800E65B770629026E131A7DC Valid openvpnserv.exe

Digitaalisten allekirjoitusten kanssa Windows on nykyisellään kovin tarkka, joten tälle CmdLetille tulee varmasti tulevaisuudessa käyttöä.

Powershelliä UNIX-ylläpitäjille -artikkelisarjan muut osat:

Did you like the article? Share it with others!
Categories
#aad #Access #acl #alertmanager #ansible #ansible module development #Apache #API #augeas #authentication #authorization #automation #automatization #aws #azure #backup #bash #bitbucket #buildbot #cache #centos #cloud #cloud-init #cloudflare #cloudfront #cluster #connectionsJpa #control repo #custom fact #database #debian #devops #digital sovereignty #DNS #docker #domain mode #duplo #edenred #ejabberd #email #encryption #erb #europe #eyaml #fabric #facter #facts #fargate #fedora #file #finnish #foreman #freeipa #git #github #gitlab #gnome #google #grafana #hammer #hiera #IAM #import #infinispan #Infrastructure as Code #ipmi #irc #jboss #jdk #jenkins #JMESPath #json #kanban #keycloak #letsencrypt #librarian-puppet #librenms #linkedin #Linux #Location #loop #marketing #mautic #Mellon #mfa #microsoft #monitoring #mysql #nagios #network-manager #oauth #oauth2 #office365 #oidc #openshift #open source #openvpn #oxygen #packer #paranormal #pdk #people #php #pkcs7 #pomodoro #Powershell #preseed #presentation #profiles #prometheus #provisioning #puppet #puppet-bolt #puppet-litmus #puppetboard #puppetdb #Puppetfile #puppetserver #puppet types and providers #pxeboot #qemu #quality #r10k #rds #recruitment #redirect #Restrict #Reverse Proxy #robotframework #roles #rspec #ruby #SAML #selinux #sem #shell #showsql #snmp #snmpd #software developement #spam #ssh #sso #standardization #systemd #systemd-resolved #teams #terraform #twilio #ubuntu #user-data #vagrant #vanity awards #variable #vim #virtualbox #visualstudio #webdevelopment #wildfly #Windows #wireguard #wordpress #workflow #x11 #xmpp #zimbra
We are
 Puppeteers
menucross-circle