SSL certificates on sites

I am getting an error message TypeError: init() got an unexpected keyword argument ‘user’

Kindly Help.

Can you please be more specific, where are you getting this error message and share some screenshot if possible.

I am getting this error message when I am trying to run the command sudo bench setup lets-encrypt site_name

@Prashanta_Mahato

Please refer the document link given which lists procedure to add SSL certificates [Lets Encrypt SSL certificates] (https://www.mitchcanter.com/lets-encrypt-ssl-amazon-aws/) as this is a standard procedure to add SSL certificates for your domain you might not face any error which might be completely related to bench.

As far as I see the issue comes up during authorization procedure. It can’t connect to server on https port (port 443). This usually happens when domain is not pointing to that particular server. Do you perhaps have a firewall which is blocking this port?
In order to get certificate created, domain has to be pointed to ERPNext server and port 443 must be accessible. I hope this helps.

1 Like

Dear Andrej,

Thank you for the pointer. Turns out that AWS did not have an HTTPS
incoming rule. We added that for SSL. Just for future reference for others,
its not enough to create a new security group. Once the security group is
created, one must select the instance and attach the new security rule to
it.

However, while the challenge error was resolved, while executing the
branch, a new error showed up. Even despite the error, when we visit the
site, the SSL is active. So I’m not sure if this really matters or not.
Here it is anyway:

Here is the stack trace:

IMPORTANT NOTES:

  • Congratulations! Your certificate and chain have been saved at
    /etc/letsencrypt/live/runga.rungamatteegroup.com/fullchain.pem.
    Your cert will expire on 2016-12-01. To obtain a new or tweaked
    version of this certificate in the future, simply run certbot-auto
    again. To non-interactively renew all of your certificates, run
    “certbot-auto renew”

  • If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let’s Encrypt: Donate - Let's Encrypt
    Donating to EFF: https://eff.org/donate-le

nginx.conf already exists and this will overwrite it. Do you want to
continue? [y/N]: y
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==2.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/ubuntu/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in
call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in
main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060,
in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060,
in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in
invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in
invoke
return callback(*args, **kwargs)
File “/home/ubuntu/bench-repo/bench/commands/setup.py”, line 84, in
setup_letsencrypt
setup_letsencrypt(site, bench_path=‘.’)
File “/home/ubuntu/bench-repo/bench/config/lets_encrypt.py”, line 26, in
setup_letsencrypt
setup_crontab()
File “/home/ubuntu/bench-repo/bench/config/lets_encrypt.py”, line 62, in
setup_crontab
user_crontab = CronTab(user=True)
TypeError: init() got an unexpected keyword argument ‘user’

Hi Prashanta,

I would say this error suggests an issue when the cronjob should be created (but I could be wrong since I’m far from being developer). The process creates cronjob which updates your SSL certificate since by default it has pretty short “life” and it automatically renew all letsencrypt certificates.

Can you check if cronjob was created (crontab -l)?

@Prashanta_Mahato

@rackoon Is correct in their assumption, it seems there was a problem during crontab creation. Good news is that everything else has been setup properly.

SSL configuration should already work. Along with that you need to add this to your crontab :

@daily sudo service nginx stop && /opt/certbot-auto renew && sudo service nginx start

I’m going to test this out and let you all know.

Sir,
We have two ErpNext Instance(Sites) raw.rungamatteegroup.com &
rungamatteegroup.com

We want to read/write some data from raw.rungamatteegroup.com into
runga.rungamatteegroup.com.

I am using FrappeClient library. From localhost it’s works, but from server
is throwing an SSLError.

My Code:
client = FrappeClient(“https://raw.rungamatteegroup.com”, "
pmahato@rawjute.in", “rungamattee!@#$%^&*()”)
return client

ERROR:
(SSLError(CertificateError(“hostname ‘raw.rungama…’ doesn’t match ’
runga.rungamatteegroup.com’”,),),)

Kindly Help.

Prashanta Mahato (+91 9800 940 952)
Rungamattee Tea & Industries Limited.

90/31 D.H. Road, James Long Sarani, Kolkata 700038, West Bengal, India
IT Department | P: + 91 9800 940 952

Hello Prashanta,

Please change you password asap (you left it in code part).

Server name and SSL certificate do not match:
raw.rungamatteegroup.com does not match runga.rungamatteegroup.com

I wonder why does it get certificate for runga first, because I see you have SSL certificates for both domains.
By localhost do you mean its working in your computer or server where ERPNext is installed? And you get an error on which server?

Thank you @rackoon, Both sites are installed on Amazom Aws, I am trying to push some data from runga.rungamatteegroup.com to raw.rungamatteegroup.com.

Yes by localhost if mean from my local system and its working as expected.but form Amazon it is not working.