abhishek-ram / django-pyas2

AS2 file transfer Server built on Python and Django.
https://django-pyas2.readthedocs.io
GNU General Public License v3.0
83 stars 31 forks source link

Possibility to alter receive URL path? #117

Open MightyGorilla opened 1 month ago

MightyGorilla commented 1 month ago

First of all, this is a great project & thanks for your work!

We have an existing AS2 system and I was investigating the possibility of just moving our keys and certs and then updating our DNS and not having to send a different endpoint URL out to partners. Is there a supported/reasonable way to alter the directory portion of the URL or is that a dumb idea?

For example changing: http://myserver.com:5080/pyas2/as2receive to something like http://myserver.com:5080/inbound

Thanks Travis-

chadgates commented 1 month ago

@MightyGorilla : just change the urls.py of the django project to something like this:

` from django.contrib import admin from django.urls import path, include from yourProjectName.views import Home from pyas2.views import ReceiveAs2Message from django.conf import settings

urlpatterns = [ path('whateveryoursiteaminlinkis/', admin.site.urls), path('pyas2/', include('pyas2.urls')), path('', Home.as_view(), name='home'), path('inbound/', ReceiveAs2Message.as_view(), name="as2-receive"),

Add the url again without slash for backwards compatibility

path('inbound', ReceiveAs2Message.as_view(), name="as2-receive"),
path('accounts/', include('django.contrib.auth.urls')),

] `

More about URLs is here: https://docs.djangoproject.com/en/4.1/topics/http/urls/ (I suggest to use django version < 4.2 - there are issues).

MightyGorilla commented 1 month ago

@chadgates Thanks! I didn't see a lot in the issues list, so concerning the suggestion of using v4.1 or less: Is that related to the cryptography lib dependency still needing to be patched, or something else? ....or several somethings else? ;)

chadgates commented 1 month ago

I get issues with Posix Path/Default Storage and Suspicious File Operations under 4.2 ... but it might be just my setup...

chadgates commented 1 month ago

@MightyGorilla : The Django >=4.2 thingy - I investigated and found following to be the case depending on if you set DATA_DIR or not:

I tried a PR #119 ... let's see ...

MightyGorilla commented 1 month ago

Thanks for the detail (and the fix)! I patched our install with your update- I still need to setup a another instance to send some traffic between the two to test.