Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when run create_db.py #19

Closed
mr-yaky opened this issue Jan 22, 2018 · 18 comments
Closed

Segmentation fault when run create_db.py #19

mr-yaky opened this issue Jan 22, 2018 · 18 comments

Comments

@mr-yaky
Copy link

mr-yaky commented Jan 22, 2018

Hi,

We found your fork and updated to your latest release version.
I updated PowerDNS-Admin from original version.
After installation of all requirements I tried run create_db.py but always get:

$ /opt/vens/powerdns/bin/python /var/www/powerdns-admin/create_db.py Segmentation fault

Also some additional info:
$ cat /etc/centos-release CentOS Linux release 7.4.1708 (Core)

$ /opt/vens/powerdns/bin/python --version Python 2.7.5

$ /opt/vens/powerdns/bin/pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
asn1crypto (0.24.0)
bcrypt (3.1.0)
cffi (1.10.0)
click (6.7)
configobj (5.0.5)
cryptography (2.1.4)
decorator (4.1.2)
defusedxml (0.4.1)
dm.xmlsec.binding (1.3.3)
dnspython (1.15.0)
enum34 (1.1.6)
Flask (0.12.2)
Flask-Login (0.4.0)
Flask-OAuthlib (0.9.3)
Flask-SQLAlchemy (2.1)
Flask-WTF (0.14.2)
idna (2.6)
ipaddress (1.0.19)
isodate (0.6.0)
itsdangerous (0.24)
Jinja2 (2.9.6)
lxml (4.1.1)
MarkupSafe (1.0)
MySQL-python (1.2.5)
oauthlib (2.0.2)
pbr (1.10.0)
pip (9.0.1)
pycparser (2.18)
pyOpenSSL (17.5.0)
pyotp (2.2.1)
python-ldap (2.4.21)
python-saml (2.3.0)
pytz (2017.3)
qrcode (5.3)
requests (2.7.0)
requests-oauthlib (0.8.0)
setuptools (36.2.7)
six (1.10.0)
SQLAlchemy (1.0.9)
sqlalchemy-migrate (0.10.0)
sqlparse (0.2.3)
Tempita (0.5.2)
Werkzeug (0.12.2)
wheel (0.29.0)
WTForms (2.1)

May be you can help us.
What is the problem and why it's segfaulting ?

@thomasDOTwtf
Copy link
Owner

Hi,
I recall a similar issue from my memory.
It is caused by a dependency of python-saml which could be broken.
This will hopefully solve your issue:

pip uninstall dm.xmlsec.binding
pip install --no-cache-dir dm.xmlsec.binding

You'll find further information here

Thanks,
Thoma

@fenice2
Copy link

fenice2 commented Jan 28, 2018

Hi

I've just been trying your fork and had the same segmentation fault as the o/p, I tried your suggestion and no joy I'm afraid. The segmentation fault still appears, I also tried the suggestion in the link you posted and that also did not help. I'm a novice at testing python software but is there anything I can get that would help you debug this?

I'm testing this on a CentOS7 server, fully updated to the current version.

@tung93st
Copy link

tung93st commented Feb 7, 2018

Yep, this is also my situation (Centos 7)

@thomasDOTwtf
Copy link
Owner

thomasDOTwtf commented Feb 10, 2018

Hi guys,
seems I've a trace of the error. Could you try to manually import python-saml?

run python interactively:
from onelogin.saml2.utils import OneLogin_Saml2_Utils

Does that reproduce the issue?

That will also happen if you try to import import dm.xmlsec.binding.

Thanks,
Thomas

@thomasDOTwtf
Copy link
Owner

You should edit the file /usr/bin/xmlsec1-config located in -DXMLSEC_NO_SIZE_T should be appended to variable the_flags located underneath "Assemble all the settings together".
You have to rebuild the xmlsec package after that.

vi  /usr/bin/xmlsec1-config
pip uninstall python-saml dm.xmlsec.binding isodate lxml
pip install --no-cache-dir python-saml

@fenice2
Copy link

fenice2 commented Feb 10, 2018

Hi

Thanks for your reply.

Your first question about the import, it still gives the segmentation fault. I'm not sure of the exact format for doing the same with "import dm.xmlsec.binding" - don't forget I know nothing about python. :)

For the "-DXMLSEC_NO_SIZE_T" that was already in that file, I think I read that elsewhere and added when I first hit this problem.

As the original project from which your is forked is now moving forward should I try that version again (possibly) file this bug there? I did try the original version but never had any luck with it, I currently use this version without problems: https://git.0x97.io/0x97

Regards

Bill

@thomasDOTwtf
Copy link
Owner

Hi Bill,
today I've created a environment to reproduce your issue within CentOS 7 and also came across it.
That problem is only existing if you want to use SAML authentication. And is fixed after adding this the_flags parameter and reinstall of all those libraries mentioned. Perhaps you did that inside a virtualenv? Than you should perform that inside that env as well.
Did you just try to issue both other commands right after you figured out that the parameter is already included?
I'm currently discussing how to proceed with the person who got write access to the original repo.
What I will do is adjust the requirements because that issue you figured out is raised by a requirement which is only necessary when using SAML authentication. I'll change to code not to include that one if SAML is not used. That should solve your issue anyways if you aren't using SAML.
I'll keep you posted.
Thanks,
Thomas

@fenice2
Copy link

fenice2 commented Feb 10, 2018

Hi Thomas

No I'm not using SAML at all, I know what it is but I'm just a using this for my home LAN so it's not necessary.

Regards

Bill

@fenice2
Copy link

fenice2 commented Mar 17, 2018

Hi Thomas

Is there any update on this issue?

Regards

Bill

thomasDOTwtf added a commit that referenced this issue Mar 27, 2018
@thomasDOTwtf
Copy link
Owner

Hey Bill,
i've fixed the imports. Not using SAML should not make any trouble now.
Please test from current master.
Thomas

@fenice2
Copy link

fenice2 commented Mar 28, 2018

Hi Thomas

Thanks for the update, unfortunately it's the same segmentation fault. Is there any way to get any more information that might help you debug this problem? I'll try a clean install on a fresh CentOS7 VM later today and see how that goes and let you know what happens.

@thomasDOTwtf
Copy link
Owner

Hi Bill,
sorry I missed to change one import. Thanks for testing. Could you pull the master and test again?
We can try to generate some tracing on the issue. Let's do that if this doesn't work.
Thanks,
Thomas

@fenice2
Copy link

fenice2 commented Mar 28, 2018

Hi Thomas

Thanks for that, it's moved me a bit further on. :)

First, it builds then runs and start without errors. The problem now seems to be that the create_db.py isn't populating the database with any tables. Obviously I've created the database and a valid user with all permissions for the database but when I login to the database and show tables, there aren't any. I can login to the DB server from the command line with the actual powerdnsadmin credentials without problems. Is there somewhere

Before I realised this was happening I created a user and tried to login and unsurprisingly it just returns me to the login screen. I then tried to create the same user after running the create_db again but it said the user already existed, are the user details stored somewhere else?

Regards

Bill

@fenice2
Copy link

fenice2 commented Mar 28, 2018

Ah, it seems that it wants to use an sqlite database although I've specified the IP address of a MySQL(Percona) DB server. If I comment out the sqlite entries in the config.py then run the creatdb again I see the following error: ImportError: cannot import name SQLALCHEMY_MIGRATE_REPO

Should the sqlite entries stay there or should the entries that point to my db server take precedence?

@thomasDOTwtf
Copy link
Owner

That should look like to following;
#MySQL
SQLALCHEMY_DATABASE_URI = 'mysql://'+SQLA_DB_USER+':'
+SQLA_DB_PASSWORD+'@'+SQLA_DB_HOST+'/'+SQLA_DB_NAME
#SQLite
#SQLALCHEMY_DATABASE_URI = 'sqlite:///pdns.db'
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = True

@fenice2
Copy link

fenice2 commented Mar 28, 2018

Thanks Thomas

That was it. :) I assumed it would select the MySQL db if that's what it was pointing to, silly assumption I know.

OK, that works and tables and users are created however, it still just passes me back to the login page even though the log files shows I've logged in successfully.

I'm also seeing this message "Warning: '@@tx_isolation' is deprecated" and I assume this is harmless for the moment.

@thomasDOTwtf
Copy link
Owner

You can safely ignore the warning. What about deleting the cookie of that website?
Or try it in a in private browser session.

@fenice2
Copy link

fenice2 commented Mar 28, 2018

Yet again, such a simple answer. many thanks Thomas and and I think Iclose this issue, all the problems are gone and I can manage the DNS server.

I'm looking forward to what comes later with the your work being incorporated with the other PDNS Admin project.

Thanks again.

Regards

Bill

JeroenBo pushed a commit to ProviderNL/PowerDNS-Admin that referenced this issue Jun 8, 2018
JeroenBo pushed a commit to ProviderNL/PowerDNS-Admin that referenced this issue Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants