So I have configured my pyramid application to send all mails to a mailqueue, this was no problem.
I created the maildir as such:
mkdir -p /home/luke/Maildir/{cur,new,tmp}
Now, I send my mail to the queue, and check the contents of:
/home/luke/Maildir/new
And there are all my emails waiting to send. So I run the qp command as per the docs, first of with the options as specified:
qp --hostname example.com --port 587 --username user#example.com --password etcR8hP6xMGqSU-adfaf --force-tls ~/Maildr/
These details are what I am using to connect with mandrill, note that my local postfix server is also configured to send mail via mandrill, which works fine and I can run the sendmail command and send mail.
So I also tried sending with the config in an .ini file
qp --config ~/python/delivery-2.0/mail.ini ~/Maildr/
With my mail.ini looking like this:
[app:qp]
hostname = smtp.mandrillapp.com
host = smtp.mandrillapp.com
port = 587
username = user#example.com
password = etcR8hP6xMGqSU-adfaf
tls = True
These are the same settings that work inside my production.ini file that pyramid mailer uses for message.send() where the pyramid_mailer sends the message instantly, this works fine.
When I run the qp command I get no errors, but no messages send. The documentation on QP is very limited, so I am hopeful that someone on here can help, thanks!
Related
I'm trying to get daemons to send email from a Debian 10 Server.
I'm using msmtp-mta with an OVH SMTP server. It's properly configured.
Everything works fine when sending email directly via the mail command, like so :
echo "test" | mail -s "test" email#domain.com
However, some daemons like smartd try to send email to root#localhost, but with a malformed recipient address root, which the OVH SMTP doesn't like at all :
send-mail: recipient address root not accepted by the server
send-mail: server message: 501 5.1.3 Invalid address
send-mail: could not send mail (account default from /etc/msmtprc)
Can't send mail: sendmail process failed with error code 65
and in the msmtp log :
Apr 25 00:39:49 host=ssl0.ovh.net tls=on auth=on user=***REDACTED*** from=***REDACTED*** recipients=root smtpstatus=501 smtpmsg='501 5.1.3 Invalid address' errormsg='recipient address root not accepted by the server' exitcode=EX_DATAERR
I tried adding root: email#domain.com to /etc/aliases adn relaoding with newaliases, and even put a .forward in root's homedir.
Has anyone experienced this before ? Shouldn't msmtp honor /etc/aliases and/or .forward and replace root's email address ?
Please check with msmtp -v if you have another alias that might override the one you're settings. You'll be able to check if it correctly register your aliases using that command.
You may also want to add aliases /etc/aliases to your /etc/msmtprc file.
You may also add a default alias in /etc/aliases if you would like all the mails to be send with a from corresponding: default: awesome.mail#example.tld
I need to launch an openconnect VPN on a linux router from a powershell script on Windows.
I have a working script on the linux router:
echo PASSWORD | sudo openconnect -b --no-dtls --interface=sslvpn host.isp.com --authgroup=SharedVPN --user=username --passwd-on-stdin
When I run the script locally on the router, the vpn launches perfectly.
Here is my powershell script from the windows machine:
Import-Module SSH-Sessions
New-SshSession -ComputerName "10.1.43.11" -Username "ubuntu" -KeyFile "C:\keys.pem"
Invoke-SshCommand -ComputerName "10.1.43.11" -Command '/usr/local/sbin/InitializeVPN'
Remove-SshSession -computername "10.1.43.11"
When I run the powershell script, it does launch the VPN, but freezes there, waiting for the VPN to end. I can kill the process on the router and then the powershell script finishes. I need the VPN to run in the background. So I modified the script on the router like this:
echo PASSWORD | sudo openconnect -b --no-dtls --interface=sslvpn host.isp.com --authgroup=SharedVPN --user=username --passwd-on-stdin &
Now when I run the powershell script, it does seem to send it into the background, but the VPN doesn't stay up and I only get partial output to the screen:
Key file specified. Will override password. Trying to read key file...
Successfully connected to 10.1.43.11
10.1.43.11: POST https://host.isp.com/
Connected to ip_addr:443
SSL negotiation with host.isp.com
Connected to HTTPS on host.isp.com
XML POST enabled
POST https://host.isp.com/
Connected to ip_addr:443
SSL negotiation with host.isp.com
Connected to HTTPS on host.isp.com
XML POST enabled
10.1.43.11 should now be disconnected and disposed.
When I run it directly on the router, there is more after the last "XML POST enabled":
Please enter your username and password.
POST https://host.isp.com/
Got CONNECT response: HTTP/1.1 200 OK
CSTP connected. DPD 30, Keepalive 20
Connected as 10.251.0.29, using SSL
Continuing in background; pid 11049
Connect Banner:
| Access to this system is restricted to authorized users. Unauthorized use is strictly prohibited. Information on this system may be intercepted, recorded, read, copied, and disclosed by and to authorized personnel for official purposes, including criminal investigations. Access or use of this system whether authorized or unauthorized, constitutes your awareness and consent to these terms. DISCONNECT IMMEDIATELY if you do not agree to the conditions stated in this warning.
|
How do I get the VPN to launch in the background?
I'm using ubuntu 16.04, openconnect 7.08, powershell 5.1, windows server 2016,
downloaded SSH-Sessions from http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library#Downloads
Well, I got it working using plink:
C:\bin\plink.exe -i C:\key.ppk ubuntu#10.1.43.11 "nohup /usr/local/sbin/InitializeVPN >/home/ubuntu/VPN.out 2>/home/ubuntu/VPN.err </dev/null &"
stdin, stdout, and stderr had to be redirected and use nohup.
I found it here: Getting ssh to execute a command in the background on target machine
Don't know if I'll take the time to get it working with PowerShell and SSH-Sessions now. Maybe if I need something more complex in the future.
Hi I have RHEL5 with ssmtp installed on it ssmtp-2.61-22.el5.i386.rpm
my /etc/ssmtp/ssmtp.conf updated as below :-
AuthUser=mymail#gmail.com
AuthPass=mypassword
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
UseTLS=Yes
RewriteDomain=gmail.com
also revaliases updated as below :
root:mymail#gmail.com:smtp.gmail.com:587
i have shutdown sendmail service
when i try to send email with ssmtp i get below error
[root#ctmtest ssmtp]# echo "test" | ssmtp -vvv mymail#gmail.com
[<-] 220 smtp.gmail.com ESMTP v26sm42795996pfi.56 - gsmtp
[->] EHLO ctmtest
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
ssmtp: Cannot open smtp.gmail.com:587
i searched lots of tag with this error , but unable to fix this
my system is able to connect smtp.gmail.com on port 587
[root#ctmtest ssmtp]# telnet smtp.gmail.com 587
Trying 74.125.200.108...
Connected to smtp.gmail.com (74.125.200.108).
Escape character is '^]'.
220 smtp.gmail.com ESMTP o90sm11695907pfi.17 - gsmtp
is there anyone who have fixed this ? please suggest
I encountered the same problem. The following steps worked for me:
sudo vi /etc/ssmtp/ssmtp.conf
Add the following:
TLS_CA_FILE=/etc/pki/tls/certs/ca-bundle.crt
root=XXXX#gmail.com
mailhub=smtp.gmail.com:587
AuthUser=XXXX
AuthPass=XYXYX
UseSTARTTLS=Yes
UseTLS=Yes
hostname=AAAA
Replace:
XXXX- username(mail)
XYXYX- password(mail password)
AAAA- hostname(get by running $hostname)
sudo vi /etc/ssmtp/revaliases
Add the following:
root:XXXX#gmail.com:smtp.gmail.com:587
Replace :
XXXX - username(mail)
Try running the mail now:
$mail -s "adasdas" XXXX#gmail.com
CC:
XYZLoremIpsum
.
'ctrl+D'
It solved my problem.
Hopefully for a system(Office) you need to configure correct proxy settings otherwise you will get an error:
cannot send message: Process exited with a non-zero status
try changing this option
Allowing less secure apps to access your account
https://support.google.com/accounts/answer/6010255?hl=en
This is perhaps because you're not setting the hostname parameter of ssmtp.conf. It should be a resolvable, fully-qualified domain name; yours is defaulting to the machine name of ctmtest (as shown in the EHLO command that you quote above).
The issue that user963 mentions in their answer may also be in action here, but in that case you'll get a different error message, something like ssmtp: Authorization failed (534 5.7.14 ...).
This should be a comment on Haider Raza's answer, but I am short of 1 rep point to comment lol.
From https://superuser.com/questions/431539/special-characters-in-ssmtp-password
ssmtp has bugs parsing passwords containing '=', ':' or '#'. You can use the following workaround:
feed the password directly in the command line argument
ssmtp -ap "Hash#Password" ...
alternatively put the password in an environment variable.
ssmtp -ap $PASSWD ...
Hope it helped.
first to get your hostname type in terminal : hostname
copy it and past in hostname parameter in ssmtp.conf
On my Gentoo Linux system, the error ssmtp: Cannot open smtp.server.com:port was caused by an ownership/permissions issue: the file /etc/ssmtp/ssmtp.conf should belong to the group ssmtp, which it didn't (and any user allowed to access ssmtp should be a member of that group).
I ws looking for a solution for cacti smtp mail sender.
And found myself actually sending an email using the postfix service .
I also used localhost in the postfix config.
Thanks!
This is my config for outlook365.com that works on Centos 6.10 (Final) - replace all [square brackets] with your own settings:
/etc/ssmtp/ssmtp.conf
root=[admin_emailemail#domain.ext]
mailhub=smtp.office365.com:587
RewriteDomain=[domain.ext]
# to find out run hostname command in shell
Hostname=[hostname_or_domain]
AuthUser=[your_smtp_authentication_mailbox#domain.ext]
AuthPass=[your_password]
AuthMethod=LOGIN
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
# Use SSL/TLS certificate to authenticate against smtp host.
# When enabled it was failing to send emails
#UseTLSCert=YES
TLS_CA_File=/etc/pki/tls/certs/ca-bundle.crt
/etc/ssmtp/revaliases
root:[your_sender_or_authentication_mailbox#domain.ext]:smtp.office365.com:587
Mail functions are all highly broken, so are the numerous tutorials on the internet.
This is pretty bad, for something that MUST be EASY for BEGINNERS.
A little panels of unclear errors you will face:
mailx: unrecognized option '-d'
💩
mailx: unrecognized option '-v'
💩
s-nail: Setting up PseudoRandomNumberGenerator: *SSL RAND_*
s-nail: New-style URL used without *v15-compat* being set
/home/you/dead.letter 3/106
s-nail: ... message not sent
💩
s-nail: Connecting to XX.XX.XX.XXX:465 ... connected.
s-nail: SMTP: Resource temporarily unavailable
💩
s-nail: Obsoletion warning: Use of old-style credentials, which will vanish in v15!
💩
s-nail: Obsoletion warning: please don't use *smtp*: assign a smtp:// URL to *mta*!
💩
s-nail: Unexpected EOF on SMTP connection
💩💩💩
No, there is no needs of any credentials to send a simple mail.
STEP 1: Install mail-utils
sudo apt install mailutils
STEP 2: Install mutt
sudo apt install mutt
STEP 3: Run the postfix setup
sudo dpkg-reconfigure postfix
Usage press TAB to select OK
Select "Internet site"
Enter your domain, or whatever
Leave all other settings as default. (Press RETURN till the end)
Mails will then be sent from this email: yourCurrentsession#whatever.com
STEP 4: Apply settings
service postfix reload
STEP 5: Send email
echo "Hello world" | mutt -s "Message sent at $(date)" recipient#gmail.com -y
STEP 6: Optional. Change sender email and name. Create a .muttrc file in the home folder.
echo -e "set from = \"aname#something.net\"\nset realname = \"Yay\"" > ~/.muttrc
I am trying to connect to a new user account I created via SSH with the command
useradd -s /bin/false -d /home/username james
I added/edited the password via SSH with the command
passwd james
When trying to connect to my server using this user and pass via FileZilla I get the following error messages.
Response: 331 User James OK. Password required
Command: PASS *****
Response: 530 Login authentication failed
Error: Critical error
Error: Could not connect to server
When I try to login with this user/pass through SFTP I get the following error messages
Status: Connected to domain.com
Error: Connection closed by server with exitcode 1
Error: Could not connect to server
Either way it seems it doesn't allow me to use this newuser anywhere.
My server details
Linux 2.6.18-308.11.1.el5 GNU/Linux
(Red Hat 4.1.2-52)
Centos
Regarding FTP, the FTP server commonly used on Linux systems requires users to have a shell that's listed in the file /etc/shells. For example, this online ftpd man page says that, among other things, "The user must have a standard shell returned by getusershell(3).". The page for getusershell() shows that it reads shells from /etc/shells.
You could probably make FTP work adding /bin/false to /etc/shells. Your Linux system might have a more suitable shell available, like /usr/sbin/nologin.
Regarding SFTP, the ssh server normally provides SFTP service by by invoking a program called sftp-server. If you examine the server's sshd_config file, you'll probably find a line like this:
Subsystem sftp /usr/lib/openssh/sftp-server
sshd runs the subsystem program as a shell command, using the user's shell. If you set the user's shell to /bin/false, then sshd ends up running the command:
/bin/false -c /usr/lib/openssh/sftp-server
/bin/false ignores its command-line arguments and exits with code 1, so the SFTP client's session drops immediately after it starts.
sshd has an internal SFTP server component that can be used instead of the external program. The usual way of limiting SSH access to SFTP for some users is to set up a Match group within sshd_config, forcing the internal-sftp command for certain classes of users. Here are a couple examples of that:
http://en.wikibooks.org/wiki/OpenSSH/Cookbook/SFTP#SFTP-only_Accounts
https://serverfault.com/questions/354615/allow-sftp-but-disallow-ssh
Dont use "-s /bin/false". Use "-s /sbin/nologin" instead and it should be fine.
Make sure your account password hasn't expired. Mine did, and Filezilla exited with error code 1.
After logging onto the server and updating the account password (prompted immediately after connecting), I am now able to connect with SFTP & Filezilla.
Probably is a password related issue, check account
chage -l <user>
account must not be expired.
FTP doesn't allow /usr/sbin/nologin user
Response: 220 Welcome to the Scent Library's File Service.
Command: USER ftpuser
Response: 331 Please specify the password.
Command: PASS ******
Response: 530 Login incorrect.
filezilla 530 error - but password is correct
vsftpd: 530 Login incorrect
530 Login or password incorrect!
How can I connect via FTP using FileZilla? I get a 530 error.
Response: 220 Welcome to Test FTP service.
Command: USER ftpuser
Response: 331 Please specify the password.
Command: PASS ******
Response: 530 Login incorrect.
Error: Critical error
Error: Could not connect to server
Change user's shell
usermod -s /usr/sbin/nologin username
Then edit "/etc/shells" file and add this line
/usr/sbin/nologin
In order to connect to the server using ftp, you also need to run a ftp server / service or daemon.
An example of such ftp server is "vsftpd"
After installing it, you will also need to configure it and allow anonymous ftp access or ftp access to existing users
You will find the configuration file in the path "/etc/vsftpd/vsftpd.conf"
The below link might be useful for you --
https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-on-centos-6--2
I need to create a bash script which will connect to an FTP server, upload a file and close the connection. Usually this would be an easy task but I need to specify some specific proxy settings which is making it difficult.
I can connect to the FTP fine using a GUI client i.e. Filezilla with the following settings:
Proxy Settings
--------------
FTP Proxy : USER#HOST
Proxy Host: proxy.domain.com
Proxy User: blank
Proxy Pass: blank
FTP Settings
------------
Host : 200.200.200.200
Port : 21
User : foo
Pass : bar
What I can't seem to do is replicate these settings within a text based ftp client i.e. ftp, lftp etc. Can anyone help with setting this script up?
Thanks in advance!
According to the docs, lftp should support the ftp_proxy environment variable, e.g.
ftp_proxy=ftp://proxy.domain.com lftp -c "cd /upload; put file" ftp://200.200.200.200
If that works, you can put
export ftp_proxy=ftp://proxy.domain.com
in your shell configuration files, or
set ftp:proxy=ftp://proxy.domain.com
in your ~/.lftprc.
Alternatively, try running the commands that your GUI FTP client is running, e.g.
upload.lftp
USER ...#...
PASS ...
PUT ...
And run it using -s:
lftp -s upload.lftp 200.200.200.200
Or try curl -T (docs) ncftpput (docs).
Something like:
FTP_PROXY=ftp://proxy.domain.com curl -T uploadfile -u foo:bar ftp://200.200.200.200/myfile
might work.