If I have an app and some of its parts are illegal in some countries (e.g. due to different copyright laws in different countries). And the app is licensed under (L/A)GPL v3. Can I forbid using and distribution my app in certain countries? If no, are there any open-source licenses that allow this?

Thank you.

  • 2
    For export controls specifically (without general applicability to restricting users), see relevant GPL FAQ and Q&A on this site
    – apsillers
    Sep 3, 2020 at 2:56
  • What do you mean by "illegal due to different copyright law"? Do you mean that you want this restriction to protect yourself, because you as the author might have violated someone else's copyright making the app? Or that the users might violate the copyright law by using the app?
    – TooTea
    Sep 3, 2020 at 15:35
  • 6
    A real world example of this is PuTTY, distributed under the MIT licence. It has a warning on the home page citing legal restrictions on cryptography use on some countries and point out a binary without any crypto for such cases. Other than that warning, it's up to each user to do what they want.
    – Alejandro
    Sep 3, 2020 at 15:36
  • 5
    Also note that laws change. It would be very bad that in three years, people on country X would now be legally allowed to use your software, yet the license you had chosen a years back just due to that now-fixed issue prevented them from doing that.
    – Ángel
    Sep 4, 2020 at 1:06

3 Answers 3


A license either is an open-source license, or it restricts usage of the software to certain regions or types of usage. You cannot have both.

That said, it is not your responsibility as the software creator to forbid people the usage when the law already forbids the usage. That serves no purpose (law overrides license, always) and would impose an unnecessary restriction when the law changes. It's the responsibility of the users of software to obey the law and not use unlawful tools.

What you can do is to add to your README a section which explains the legal situation with an emphasis on countries where the usage of your software or its distribution to certain regions might expose a person to risk of prosecution.


No and No, and also you shouldn't


The requirement you propose is in contradiction with the official definition of open source, namely with criteria 1 and 5 (since I interpret inhabitants of a certain country as group of persons):

  1. Free Redistribution
    The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fee for such sale.
  1. No Discrimination Against Persons or Groups
    The license must not discriminate against any person or group of persons.

It is also in contradiction with the definition of free software, from which the official open source definition indirectly derived, and which is short enough to be printed in full:

A program is free software if the program's users have the four essential freedoms:

  • The freedom to run the program as you wish, for any purpose (freedom 0).
  • The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
  • The freedom to redistribute copies so you can help others (freedom 2).
  • The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

There is a common misconception about what "open source" means:

However, the obvious meaning for the expression “open source software”—and the one most people seem to think it means—is “You can look at the source code.” That criterion is much weaker than the free software definition, much weaker also than the official definition of open source. It includes many programs that are neither free nor open source.


planetmaker's answer already states that it is nor your responsibility to prevent people from using your software, which I agree with.
I want to go one step further though, and say that from an ethical standpoint, it is very much your responsibility to make your software as free as possible, to help people keep (or regain) the control over their own computing. What ever oppressive laws prohibit the use of free software in some country, it is not our job to support them in any way.


Background information

What is a "license"?

The answer: A "license" is the permission given by the author of a software (or other kind of copyright protected work) to do something with the software that requires the permission of the author according to the law.

If the law states that something is allowed or forbidden independently of the permission of the author, the license terms do not have any effect:

In a country where the law forbids the distribution of certain software, it does not matter that the GPL states that distribution is allowed: It's forbidden by the law, so a "license" cannot allow it.

On the other hand, in a country where the law allows using foreign source code in closed-source programs without the author's permission, it does not matter that the GPL forbids this: It's allowed by law, so a "license" cannot forbid it.

The same is true for the (L)GPL and for the MS EULA.

Your actual question

... some of its parts are illegal in some countries ...

If this is the only reason why you want to forbid using the software in some countries, this is no reason to forbid the use in those countries in the license:

As I wrote above, it does not matter what the license says if the law forbids using the program.

You may publish your program under (L)GPL and point out that the use or distribution of your program may be illegal according to the laws of certain countries.

  • As far as free software, "A program is free software if the program's users have the four essential freedoms...". Wouldn't it be the case that people who are not allowed to acquire/have/possess/use, or more generally, people who for whatever reason, don't use the program, are not "the program's users" ? =) Sep 4, 2020 at 1:58
  • 1
    Read "have" here as "are granted". If those freedoms are taken away by a third party, it's not the fault of the OSS developer, and shouldn't be considered to make the software un-free. Otherwise, the mere existence of a dictatorship in which nobody is allowed to, say, download software except from an official government site, would imply that the entirety of OSS is impossible in theory (since certain users of any given software would be forbidden by law from redistributing anything). Reductio ad absurdum. Sep 4, 2020 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.