I try to create an autologin to use posteo within neomutt.
Is it possible to use the gpg file from the pass folder
.password-store/
in a .muttrc config?
In the Mutt Archwiki there is the following Password-Manger section:
1.create file and input
set my_pass = "password"
2.encrypt the file and call the gpg in muttrc
source "gpg -dq $HOME/.my-pwds.gpg |"
3.call password in a script
set imap_pass=$my_pass
This should work, but i want to use my existing pass gpg file directly. I have the passport gpg file decrypted for testing, but the file only contains the password without an addition. How to use this password as a variable in my script?
I've found a solution for my problem
1.Copy gpg.rc from samples
cp /usr/share/doc/neomutt/samples/gpg.rc ~/.mutt
My .neomuttrc use a source file like this:
source ~/.mutt/gpg.rc
set my_pass=`pass Email/...`
# Receive options
set from="user#posteo.de"
set hostname="posteo.de"
set realname='urename'
set imap_login='user#posteo.de'
set imap_pass=$my_pass
set folder="imaps://user#posteo.de#posteo.de/"
set spoolfile="=INBOX"
set record="=Sent"
set postponed="=Drafts"
# Send options
smtp_url="
set from="user#posteo.de"
# Hook
account-hook $folder "set imap_user=user#posteo.de imap_pass=$my_pass"
Related
I have a properties file which contains several name=value pairs. This properties file contains several secrets in value. My requirement is to delete the property value after reading the values using a shell script. The property file will also contain comments.
Properties file:
#docker image key
name=secret_value
#username
abc=bcd
#password
def=efg
The shell script should delete all values after reading the properties file like:
New Properties file :
#docker image key
name=
#username
abc=
#password
def=
How to achieve this?
In the script, after the properties file is read, add the below command:
sed -i 's/\=.*/=/' property_file_name
I have a p12 file, which is needed to execute tests.
I added following lines to system.properties file.
javax.net.ssl.keyStoreType=pkcs12
javax.net.ssl.keyStore=C:\certs\certificate.p12
javax.net.ssl.keyStorePassword=certificate_password
It was not working, so I created jks file from certificate with keytool and set it in the same file.
javax.net.ssl.keyStore=C:\certs\keystore.jks
javax.net.ssl.keyStorePassword=certificate_password
I used CSV Data Set Config to set also alias, which is used in Keystore Configuration component, but not sure, what should be stored in csv data file, how to provide key aliasses. Options -> SSL Manager stores certificates until JMeter is closed, doesn't store those permanently.
For example you have the csv file holding aliases aliases.csv looking like:
alias1
alias2
alias3
etc.
So you can add CSV Data Set Config to read this file and store the alias value into, say alias variable
And finally you can use alias variable value in the Keystore Configuration which will refer the value of the alias from the CSV file:
More information: How to Use Multiple Certificates When Load Testing Secure Websites
I have a ruby script main.rb which takes in two parameters, ipaddress and apitoken.
$token = "VALUE"
$ip_addr = "ADDRESS"
These values are hard coded into the script. When I push the project into Github's repo, I get a warning that my keys are visible.
What is the recommended way to hide these variables? Is it as simple as adding a separate file for these values and adding them to .gitignore?
Personally, I don't like using open and file operations in code. Better way would be to use one of the following approaches,
Put the keys in system environment as follows,
export MY_TOKEN=xyz
export MY_IP_ADDR=a.b.c.d
If you want it to be available after you restart shell, then put it in ~/.bash_profile.
and in your code use as follows,
$token = ENV["MY_TOKEN"]
$ip_addr = ENV["MY_IP_ADDR"]
OR
You can use dotenv gem, if you don't want system wide environment variables and exclude .env from git but putting the file in .gitignore.
Following this guide, a simple way to do this is to create folders .auth_token and .ip_addr.
Add the necessary keys in them and access them by reading the files as follows:
$token = open("lib/assets/.auth_token").read()
$ip_addr = open("lib/assets/.ip_addr").read()
If pushing to a repository, make sure the folders are added to .gitignore
for some kind of yml files that we have to store passwords (of MySQL users) we use ansible-vault encrypt to maintain some security.
The problem is every time we have to edit we are forced to input the password.
I was looking how to fix this and seems is pretty easy but I couldn't make it work yet.
I've created a file in my home directory called:
.vault_pass.txt
inside of that, I have the password. And in the ansible.cfg in my repository I have the variable:
vault_password_file = ~/.vault_pass.txt
Didn't work as expected. So I tried to force ansible-vault command to read the file with this parameter
# ansible-vault decrypt --vault-password-file ~/.vault_pass.txt vars/vars-mysql-config.yml
Output error:
ERROR! input is not vault encrypted data for vars/vars-mysql-config.yml
It seems I forgot something here but I wasn't able to find the right info.
Anyone has any idea about that?
Thanks guys!
I guess you misuse decrypt command instead of view.
To view encrypted file use view:
ansible-vault view --vault-password-file ~/.vault_pass.txt vars/vars-mysql-config.yml
If you want to decrypt the file and leave it in plain text, use decrypt:
ansible-vault decrypt --vault-password-file ~/.vault_pass.txt vars/vars-mysql-config.yml
If you try to run decrypt command second time, it will give you expected error:
ERROR! input is not vault encrypted data for vars/vars-mysql-config.yml
because file is already plain-texted.
I'm trying to change the output file name, fOut, in a bat file, but have no luck so far.
I'm developing on Windows 7 and will deploy the code to Windows 2003 server.
The code looks like this:
set fName=%1
set fExt=%fName:~-5,-1%
set fOut=%fName:~0,-5%_PAD%fName:~-5%
Examples of fOut:
abcdc2evv_PAD.dat
abcdefgh33ij_3737_PAD.dat
How can I change fOut to get the following file names?
A. Adding FMT_ at the beginning of the file name:
FMT_abcdc2evv_PAD.dat
FMT_abcdefgh33ij_3737_PAD.dat
B. Adding FMT_ at the beginning of the file name and remove _PAD before .dat:
FMT_abcdc2evv.dat
FMT_abcdefgh33ij_3737.dat
Addendum:
Just one argument is passed to the bat file: path + file name.
x.bat "C\test\xxx.dat"
In the bat file:
#echo ^-input file name = ^%1
set fName=%1
set fExt=%fName:~-5,-1%
set fOut==%fName:~0,-5%_PAD%fName:~-5%
I don't know if I'm missing something obvious - it's not clear what the input to this script is.
However adding FMT_ before should just be a case of changing:
set fOut=%fName:~0,-5%_PAD%fName:~-5%
to:
set fOut=FMT_%fName:~0,-5%_PAD%fName:~-5%
or if you want to put the FMT_ version into another variable, then:
set bob=FMT_%fOut%
As for removing _PAD, can you not just repeat the SET fOut line without the _PAD? This would seem to be the simplest way to do it. In fact, removing _PAD and prefixing FMT_ would seem to simply be this:
set bob=FMT_%1
if you want to remove pad just take it out of your assignment statement
you have:
set fOut=%fName:~0,-5%_PAD%fName:~-5%
you want:
set fOut=%fName:~0,-5%fName:~-5%
to add FMT_ just add it at the beginning of the file name:
set fOut=%FMT_%fName:~0,-5%_PAD%fName:~-5%
If you want to separate the filename from the extension, don't mess around counting chars; there is a built-in method (described in for /?):
echo Filename=%~n1
echo Extension=%~x1
echo resulting file="FMT_%~1"
REM without _PAD, following with _PAD
set filename="FMT_%~n1_PAD%~x1"
If there is really need to remove _PAD (as Chris already noted, you are explicitely adding it with your code), just replace _PAD. with . only:
set filename=%filename:_PAD.=.%